The town: a fake community across the pasture, checked for coherence
tools/pasture/town/ (run through tools/pasture/town.sh) seeds a fake community across every running peer and checks that all of them, and PrivaPub, agree on what happened: - drivers per platform on four dialect bases (Mastodon API, Misskey API, Lemmy API, PrivaPub with /clientapi), each with a selftest against its own server; what a server holds is read from its database, never by making it fetch; - a deterministic generator (specs/village.json: 23 accounts on seven servers, roots with several personas, circles and communities, a cross-server follow graph, posts of every kind and visibility, reply rounds, likes, boosts, reactions, votes, edits, deletes, blocks, mutes and a report) and a seeder that keeps a ledger of what happened; - a sweep that expects delivery and confinement per server, what each account sees, counts, threads, edits, deletes, follows and privacy rows (sibling keys, published days, canary root credentials in every peer's database, located posts that never leave), with what the peers do on purpose modelled (Misskey drops orphan replies, Lemmy keeps only community content, edits go to the post's own audience); - known gaps (gaps.json) turn failures into xfail and passes into xpass; a self-contained report.html, and docs/INTEROP-BACKLOG.md. The pasture moves to a public-looking subnet (peers with no private address switch can join), takes PASTURE_PORT when 6971 is in use, adds peers to a running pasture (run.sh add, Caddy recreated with its CA kept), removes its volumes on down, writes every scenario check to out/scenarios.jsonl, serves decePub as decepub.test for its e2e tests, lifts GoToSocial's and Lemmy's own rate limits, trusts Caddy in Mastodon (TRUSTED_PROXY_IP) and gains Hollo (Fedify), whose one login owning several accounts is the nearest peer to PrivaPub's personas. The first village found the four PrivaPub bugs fixed in the commits before this one; the second run, on the fixed server, passes 2319 checks with 11 failures left, all between peers or from Lemmy's send worker, which the seeder now warms up first. ROADMAP records the owner's decisions of 2026-10-04 (the town, and P9 back from the cut list). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
d6131af289
commit
2873344690
46 files changed
+4400
-24
No files matched your search
@@ -0,0 +1,62 @@
|
||||
"""The town's command line. Run through tools/pasture/town.sh.
|
||||
|
||||
selftest <peer>... each driver against its own server: accounts, posts, likes, replies, polls, edits,
|
||||
deletes, and that its database view agrees with its API
|
||||
drive <peer> <user> <verb> '<json>' one action as one town account, printed as JSON
|
||||
stored <peer> <uri>... what a peer holds of each object (from its database, never fetching)
|
||||
seen <peer> <user> <uri>... what one account can see of each object
|
||||
plan <spec> the deterministic plan of a spec, printed as JSON lines
|
||||
seed <spec> replays a spec's plan against the pasture, writing out/<run>/ledger.jsonl
|
||||
check [run] sweeps every peer for what the ledger expects
|
||||
report [run] out/<run>/report.html
|
||||
backlog [run] [--write] docs/INTEROP-BACKLOG.md from the latest results
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.insert(0, HERE)
|
||||
|
||||
from dialects import DRIVERS, driver # noqa: E402
|
||||
from dialects.base import Account, PostSpec # noqa: E402
|
||||
import state # noqa: E402
|
||||
|
||||
|
||||
def main(argv):
|
||||
if not argv or argv[0] in ("-h", "--help", "help"):
|
||||
print(__doc__)
|
||||
return 0
|
||||
cmd, args = argv[0], argv[1:]
|
||||
if cmd == "selftest":
|
||||
import selftest
|
||||
return selftest.run(args or [p for p in DRIVERS])
|
||||
if cmd == "drive":
|
||||
peer, user, verb = args[0], args[1], args[2]
|
||||
params = json.loads(args[3]) if len(args) > 3 else {}
|
||||
s = state.session(peer, user)
|
||||
d = driver(peer)
|
||||
if verb == "post":
|
||||
made = d.post(s, PostSpec(**params))
|
||||
print(json.dumps(made.__dict__))
|
||||
else:
|
||||
result = getattr(d, verb)(s, **params)
|
||||
print(json.dumps(result if not hasattr(result, "__dict__") else result.__dict__, default=str))
|
||||
return 0
|
||||
if cmd == "stored":
|
||||
rows = driver(args[0]).stored(args[1:])
|
||||
print(json.dumps({u: {k: v for k, v in r.__dict__.items() if k != "raw"} for u, r in rows.items()}, default=str))
|
||||
return 0
|
||||
if cmd == "seen":
|
||||
s = state.session(args[0], args[1])
|
||||
print(json.dumps(driver(args[0]).seen(s, args[2:])))
|
||||
return 0
|
||||
if cmd in ("plan", "seed", "check", "report", "backlog", "gaps", "expect", "load"):
|
||||
module = __import__(cmd if cmd not in ("plan",) else "gen")
|
||||
return module.main(args)
|
||||
print(f"unknown command {cmd}", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv[1:]) or 0)
|
||||
Reference in new issue
Block a user