9.5 KiB
DEMO
A judge's or first-time visitor's guide to THE COMMONS: what it is, how it works, how to run it, and how to put it through its paces live. For the full architecture, the 15-problem mapping, and build/scope boundaries, see README.md; this file is the hands-on companion.
What this is
THE COMMONS is a mobile-first super-app for a fictional underground settlement ("the Hollow") that has lost every normal civic institution at once: no power grid dashboard, no water-safety office, no housing authority, no way to vote on anything as a group. Instead of building 13 disconnected point-solutions for 13 disconnected problems, this is one app, one login, one wallet, with 13 mini-apps mounted under a single Alipay/WeChat-style launcher, all reading and writing the same record of what happened. A resident reports a bad water reading once; that report can change their water ration the same session, through the same identity, without ever touching a second system. There's no backend and no server-held state: every mini-app is a window onto the same local data, computed fresh every time it's viewed.
How it works
Everything starts with one Ed25519 keypair generated on the device and never leaving it; that's the resident's identity. Every action a resident takes, reporting a reading, casting a vote, requesting a resource, posting a testimony, gets written as one signed entry in a single append-only event log (nothing is ever edited or deleted, only added to). The wallet balance isn't a stored number anywhere; it's recomputed by replaying that log's wallet.issue/wallet.transfer entries from scratch every time it's shown, the same way every other derived value in the app works (a CEEI resource allocation, a vote tally, a trend line). All 13 mini-apps sit on top of this shared log and shared identity: a Water Watch reading can feed Fair Share's allocation, a Fair Draw commit-reveal result can resolve a tie in The Climb, because they're all just different reducers over the one log, not separate silos.
How to run it yourself
Check the README's "Live demo" section first for the current state of the deployed preview URL: it's a temporary Vercel preview that expires roughly an hour after its last deploy, so it may already be dead by the time you read this (an accepted tradeoff, not an oversight). The reliable path is local:
npm install
npm run dev # Vite dev server at http://localhost:5173
Important: load the demo seed before you look at anything, or the app will look empty and broken. A fresh install has zero residents, zero resource pools, zero history, every balance reads "no balance yet" and every Fair Share tile reads "No allocation yet." That's correct, honest behavior for a cold install, not a bug, but it makes a terrible first impression. Fix it in one click:
- Open
http://localhost:5173/admin. - Under the "Load Hollow demo" heading (marked with a gray Demo data badge), click the Load Hollow demo button.
- Wait for the status line under the button to read "Demo data loaded into the Event Log." (clicking it again is safe; a second click reports "Demo data already loaded - no new events appended." instead of duplicating anything).
- Navigate to
http://localhost:5173/(the home grid). The wallet card and the 13 mini-app tiles are now populated with real signedseed.*events, not placeholders.
How to demonstrate it
The two walkthroughs below are the mandatory beats from the project's own recorded demo (see "Fallback: the recorded video" below if you can't run a live demo). Every button name, field label, and route path here was checked against the actual component source, not guessed.
1. The honesty-anchor chain (Water Watch -> corroboration -> Fair Share re-solve)
This is the single proof that a real, typed civic action moves a real number elsewhere in the app, with zero mocked steps.
- From the home grid, tap the Water Watch tile (
/miniapp/water-watch). - In the Report a water reading form at the top, leave Channel on its default (pH), type
sensor-Ainto Device / sensor ID, type7into Reading value, and click Submit reading. This is a baseline reading from sensor A; the status line below the form will read "Recorded - awaiting a second corroborating report." - Still with
sensor-A, submit a spike: typesensor-Aagain, type50into Reading value, click Submit reading. Watch the pH channel card's status light turn to Corroborating (it cannot go further on one sensor alone; a resident resubmitting under the same device ID can never self-corroborate their own alert). - Switch the sensor ID: type
sensor-B, type7, submit (sensor B's own baseline). - Submit sensor B's spike: type
sensor-B, type55, submit. The status light should now flip to Alert - this is the real multi-sensor corroboration gate firing, not a cosmetic color change. - Navigate back to the home grid and open the Fair Share tile (
/miniapp/fair-share). Point out the Water resource tile's bar and allocation figure: it has been re-solved by the real CEEI allocator because the corroborated alert fed a new water number into the engine, with no page refresh or manual trigger needed.
2. The Assembly partition-and-heal demo (two devices, genuine network split, converge on reconnect)
This proves the Assembly mini-app's CRDT sync survives a real network partition rather than faking a pause. It runs through a small browser harness at demo/assembly-sync.html, the same harness the project's own automated partition test drives; the shipped Assembly mini-app tile itself only syncs locally (via IndexedDB) in production, so the live cross-device transport is specifically this harness, not the mini-app route.
Setup (two terminals, in addition to npm run dev already running):
node node_modules/y-webrtc/bin/server.js # local signaling server, defaults to ws://localhost:4444
Then open two separate browser windows, both at http://localhost:5173/demo/assembly-sync.html, and open the DevTools console in each.
- In both windows' consoles, run the same command (same room name in both, pointed at the local signaling server you just started):
window.commons.init({ room: "demo-room", signaling: ["ws://localhost:4444"] }) - Wait for the page's own
#statusline in both windows to showpeers=1(or check manually withwindow.commons.peerCount()) - this proves the two windows found each other over real WebRTC. - Prove the live link works before claiming anything about a partition: in window A's console, run
window.commons.vote("prop", "warmup-voter", "yes"). Confirm window B's#tallytext (orwindow.commons.voteCount()) now shows that vote arrived. - Partition both sides for real. In each window's console, run
window.commons.setConnected(false). (This is what actually tears the established WebRTC data channel; toggling the browser's network-offline throttle alone does not, on loopback, since the project's own partition test found host candidates bypass that emulation.) Confirmwindow.commons.peerCount()reads0in both windows. - With both sides genuinely cut off, cast one independent vote on each: in window A,
window.commons.vote("prop", "bob", "yes"); in window B,window.commons.vote("prop", "carol", "no"). Show the audience thatwindow.commons.tally("prop")differs between the two windows right now - that's the proof the partition is real, not cosmetic. - Heal the connection: run
window.commons.setConnected(true)in both windows' consoles. - Watch
window.commons.tally("prop")(or the page's own#tallytext) converge to the identical value in both windows within a few seconds:{"yes":2,"no":1,"abstain":0,"total":3}(the warm-up vote plus bob's and carol's independent votes, merged by the CRDT with no data lost and no crash).
3. A quick tour of the rest (breadth, ~30 seconds each)
To show the remaining mini-apps are real, built screens and not "coming soon" placeholders, pick two or three more tiles from the home grid, for example:
- Fair Draw (
/miniapp/fair-draw) - run a real commit-reveal draw and point out the "verified" badge only ever appears after a genuineverify()call returns true. - Tunnel Safety (
/miniapp/tunnel-safety) - crowd-sourced hazard reports with routing around closed segments. - Assembly (
/miniapp/assembly, the shipped tile, separate from the partition-heal harness above) - the normal-operation proposal list, voting, and signed testimony board.
Fallback: the recorded video
If a live demo isn't possible, .omo/evidence/the-commons-hollow/task-60-the-commons-hollow.mp4 is a mechanically recorded (Playwright-driven, not hand-edited) walkthrough, 32.76 seconds total, covering both beats above plus a tour of every other mini-app. Real timestamps from the recording, in case you want to cue straight to a beat:
- 0:00 - home grid (wallet card + 13 tiles on the live deployed build)
- 0:02.1 - admin seed ("Load Hollow demo" clicked, real signed
seed.*events appended) - ~0:16 - 0:28 - honesty-anchor chain (sensor readings typed through Water Watch, corroboration gate fires, Fair Share's water tile re-solves and updates by 0:06.99 into that beat)
- 0:31.07 - Assembly partition-heal converges (both devices' tallies match:
{"proposalId":"prop","yes":2,"no":1,"abstain":0,"total":3}) - Total runtime 32.76s, scene A (live build) runs 27.72s, scene B (partition-heal harness) runs 5.04s.