The referral and hazard resolve reconstructions now join on the intrinsic referralId/reportId, not the local Event Log id; the doc comments said otherwise.
Identical bug to the healthpost referral one: tunnelsafety.hazard.resolve joined on StoredEventLogEntry.id (a per-device Dexie autoincrement), and hazards sync cross-device - so a hazard resolved on one device showed 'active' forever on every other device and stayed falsely corroborated, and routing kept avoiding a cleared segment. Each hazard report now carries an intrinsic reportId (UUID) in its signed payload; resolveHazard + computeHazardReports join on it. Verified by a cross-device test (resolve matches despite differing entry ids). The convergence review confirmed this was the last such join bug - theclimb/fairdraw/governance/fairshare/assembly all already use intrinsic ids.
trySyncWithBackend fires a best-effort fetch('/api/sync') on many component mounts; in happy-dom it resolves to the dead localhost:3000 origin and the undici socket error could race teardown and flip the run's exit code to 1 even though all 791 tests passed. The global test setup now intercepts only that relay endpoint and rejects instantly with no socket, so best-effort sync still exercises its caught-error path. Verified: WalletCard's sync mount shows 0 ECONNREFUSED and 9/9 full-suite runs exit 0.
decisionFor derived `enacted` from mere membership in the enacted set, so a forged or peer-synced governance.proposal.enacted for a proposal that did NOT pass would render as Enacted. Now enacted requires the proposal to actually pass (isProposalPassed over the signed ballots, the ground truth), so a forged enactment of a failing proposal is ignored. Also relabeled the badge's tally 'Current tally' (it is the live replay-derived tally, not a frozen snapshot) to stop implying the numbers are recorded. New test: a forged enactment of a failing proposal shows no Enacted badge.
healthpost.referral.resolve joined on StoredEventLogEntry.id (a device-local Dexie autoincrement). Once referrals sync cross-device, the same referral has a different local id on each device, so a resolution never matched - a handled case stayed 'open' on every other device, breaking the cross-device clinician loop the referral sync was meant to enable. Each referral now carries an intrinsic UUID (ReferralPayload.referralId) in its signed payload, and the resolve + extractReferrals join on that stable id. Verified by a test asserting a resolve matches its referral despite differing entry ids.
The Health Post -> Fair Share water-floor interop needs >=3 DISTINCT diarrhea reporters (anti-inflation), so it was not demonstrable on a single fresh device. The hollow-demo-v3 seed now appends 5 foreign-signed diarrhea symptom reports from 3 distinct resident identities, so loading the demo shows an elevated dispatch priority + the one-click Raise Fair Share water floor action with no manual multi-device setup. Verified cold on the real surface (banner present, diarrhea count 5, dispatch elevated). Fixture bumped v2->v3.
Governance had no teeth: a passed QV tally produced no recorded consequence. A proposal with Yes weight strictly greater than No can now be Enacted by any enrolled resident, appending a signed governance.proposal.enacted event; the proposal then shows an Enacted badge with the frozen tally and honest copy (the Assembly records a binding decision, it cannot force anyone - there is no server underground). Derived purely by replay (extractEnactedProposalIds), idempotent, and allowlisted so the decision syncs cross-device like ballots. Verified on the real surface (self-enroll -> Enact -> badge replaces button). 47 governance/assembly tests + the sync allowlist test; full gate 790 tests + build green.
The waterborne->water-floor interop fired on a single resident tapping Report diarrhea 5x (count>=5), letting one person raise everyone's water ration - contradicting Tunnel Safety's distinct-reporter corroboration standard. Added countDistinctSymptomReporters (distinct authorPubkeys) and gated the action on >=3 DISTINCT residents. Relabeled the tally 'Symptom tally (this device)' since symptom reports stay local (not synced). Follow-up: seed a demo outbreak (foreign-signed diarrhea reports) so it is cold-demoable single-device.
The default-deny push allowlist was too coarse: it excluded entire families whose own code comments promise cross-device delivery, silently breaking real features. Most critically healthpost.referral(.resolve) - a resident's consent-bearing handoff of their own case to a clinician - never reached a second device, so the 'reaches real care' half of Health Post was dead cross-device (the passive healthpost.symptomReport stays local). Also allowlisted mentor.skillReview/mentor.match (community apprentice-mentor matching), theclimb.tiebreak (the audit trail must travel with its plan), and fairdraw (public-by-design verifiable lottery).
The demo seed predated the recent fixes: Assembly tally showed 0.00 (dead castVote path removed), Housing never rotated fairness-debt (identity-matrix prefs), Tunnel never corroborated (one signer), Mentor had no reachable match. Now: founding residents are enrolled with putResidentCredit + cast real signed QV ballots (yes 6.00); the demo identity and a neighbour contest one single-capacity slot so debt accrues then flips; a genuinely foreign-signed corroborating hazard (appendEntry, re-verified) makes seg-market-bypass Confirmed by 2; the local identity is a still-learning apprentice and a foreign-signed mentor Good review yields one real match. Fixture bumped to hollow-demo-v2.
npm run build (tsc -b) enforces noUnusedLocals, which tsc --noEmit did not surface, so two leftovers from the wave-1 lanes were silently failing the production build: findfamily.ts hashNameToPoint (orphaned by the AEAD-seal rewrite) and an unused test import. Removed both; npm run build is green again.
First cross-mini-app interop for breadth: when the community symptom tally shows a diarrhea cluster (dispatch priority elevated/urgent, a waterborne-outbreak signal), the clinician gets a one-click action to raise the Fair Share water floor (postFairshareFloor water) so every resident is guaranteed enough water for oral rehydration. Real clinician decision, shared key = the water resource, no fabricated data; links Health Post + Fair Share + the water theme.
runSync pushed every local event type to the pubkey-stamped relay, letting a puller correlate healthpost/sky.morale/wallet under one identity. Push is now a default-deny allowlist (health/mood/lightclock/mentor/fairdraw/testimony stay strictly local; only merge-needing types sync). Default WebRTC signaling is now self-hostable (VITE_SIGNALING_URL -> ws://localhost:4444), public host opt-in only; DEPLOY.md documents self-hosting.
Criticality used raw direct in-degree, so a deep/leaf prerequisite the whole settlement transitively rests on could slip under the at-risk threshold. Added computeTransitiveDependentsCounts (DAG closure, GAP-15 edge normalization + cycle guard); kept the direct count for mentorMatching. A deep leaf prerequisite now flags at-risk.
RevealDraw claimed a re-roll after a published commit is auditable+rejected, but validateReveal had zero production callers. The reveal flow now replays the signed log and renders a Draw integrity: valid/rejected badge; a duplicate or pre-commit reveal flips it to rejected.
computeQvTally weighed votes by the unsigned WebRTC-synced CRDT residentCredits, so a peer could set credits to 1e6 and dominate any tally. extractQvBallots now carries the signed tamper-evident credits and the tally weighs sqrt(min(ballot.credits, DEFAULT_QV_CREDITS)); residentCredits is used only as the enrolled-membership set. Also collapsed the inert direct-vote widget into the one signed QV ballot and moved delegation to a single global card with a Revoke button.
The Climb held its plan in useState (wiped on reload, never collective) and its Fair Draw tie-break used Math.random with commit+reveal+verify in one call (self-theater, non-reproducible). The plan is now theclimb.plan.propose/commit signed events replayed on mount (survives reload, identical on a second identity); the tie-break seed is derived deterministically from signed log content, the commit is appended before the reveal, and verifyClimbTieBreakAudit re-checks it from the log. Plus inline input validation.
Housing minted a wallet.issue to every assigned resident on every cycle run (button-spam inflation), and the resident-run cycle used a flat score of 1 so shortfall was always 0 and the fairness-debt ledger never moved. Credit now fires only when a resident's slot actually changes (idempotent one-time settlement grant), and a signed housing.preference event + ranked fit-scores make debt genuinely rotate (loser cycle 0 wins the contested slot cycle 1).
The trend-hide filter (only render a trend for resources with cycle history) broke waterwatch/coreLoopHonestyAnchor which asserts fairshare-trend-water renders after a water re-solve. A 'No trend yet' card is an honest empty state, not fake, so render all four unconditionally; the resident need form stays.
Fair Share was a read-only dashboard: fairshare.need was admin-only, so a resident could not report a need, and all four trend cards showed a permanent 'No trend yet' (power/cooling have no allocation-cycle writer at all). Adds postFairshareNeed (resident write path, agent = caller) + a Report your need form so the CEEI allocation re-solves live from a resident's own reported need, and renders a trend card only for resources that actually have allocation-cycle history.
Commons Credit could only ever be minted (welcome grant, housing, fair draw) with no spend, no sink, and no send UI, so the ledger's transfer + credit-limit + double-spend machinery was exercised only by tests. Adds postWalletTransfer (a signed wallet.transfer where the signer is the sender) and a Send credits form in WalletCard (recipient id + amount) that pre-validates amount <= balance, blocks self-send, and surfaces the ledger's over-spend rejection. This activates the dormant economy into a real contribution-exchange time-bank (see ECONOMY.md).
Presence joined one fixed PUBLIC WebRTC room, counting internet strangers as residents under this sky and broadcasting raw account ids. The room is now derived per cohort code (like Assembly) with an ephemeral handle, so cohorts are isolated and no account id leaks. The morale aggregate is windowed to the current cycle instead of counting every pulse ever.
The device-motion path showed the model's seed constant (always Strong/0.820) as a computed result and mapped movement to 250 lux daylight in a sunless world. Re-scoped the signal as actigraphy (rest/activity, an explicitly-labeled model-input inference, never measured light), gated the UI on a full-circadian-window guard (honest need-more-data instead of the seed constant), and persist timestamped samples as signed lightclock.actigraphy events so a multi-day log accumulates across reloads.
A febrile child with no other sign was shown a green Home care badge (the engine omitted fever), a false reassurance contradicting the fever symptom tally. Added the WHO-IMCI fever assessment and a neutral Not fully assessed state so a febrile child is never home_care. Added a signed healthpost.referral.resolve event + Mark handled so the clinician queue can close cases.
respondToSearch returned every entry's cleartext id (name-bearing) to any query, breaking the PSI privacy premise. Each id is now sealed with AES-256-GCM under HKDF(H(name)); only a genuine matcher can derive the key and decrypt the single matching id; the response is shuffled + padded to hide roster size. Seed ids are opaque handles.
The Sensor-corroborated badge fed a binary 0/250 lux proxy in as accelerometer data and RMS-thresholded it, so any movement corroborated and a handheld phone can't sense a flooded corridor anyway. Removed it; a hazard segment is now Confirmed by N residents only when >=2 distinct signer pubkeys report the same unresolved segment, replay-derived from the signed log.
Farms->Fair Share credited food via seed.resource.food (latest-wins), so the demo's 20kg forecast OVERWROTE the 410 baseline (food 410->20, the farm starved the settlement). Farms now appends a signed fairshare.contribution that Fair Share SUMS onto the baseline per-contributor-latest, so growing food only raises the pool and multiple growers sum. Also wires the advertised-but-inert grow-light power budget into FarmsScreen + shows energy vs budget in ForecastPanel.
A mounted mini-app's fire-and-forget window.commons append/getPublicKey could
still be in flight after beforeEach wiped the DB, throwing an unhandled
IdentityMissingError that flipped the suite exit code ~1 in 3 runs despite all
tests passing. Seeding an identity makes that late signed call resolve against
the fresh DB. 8/8 runs green.
The event relay was an in-memory array that started empty on every process, so
synced history vanished on every API-server restart. Persist it to a gitignored
.data/events.sqlite3 via node:sqlite like the blob store (EVENT_DB_PATH override;
seq rowid pull cursor; UNIQUE(authorPubkey,signature) push idempotency), keeping
the exact exported API. Synced history now survives restarts and keeps growing,
and a fresh device pulls the whole lived-in history on load; ShellLayout adds a
light 6s poll for live cross-device reflection. Adds a dev:all script, isolates
the two integration tests to a temp EVENT_DB_PATH, documents EVENT_DB_PATH.
trySyncWithBackend's pulled-entry dedup is a non-atomic read-modify-write (read
the existing (authorPubkey,signature) set, then appendEntry in a loop). Several
mini-app mounts plus the shell poll can fire it at once; two overlapping runs
both saw a remote entry as absent and ingested it twice, duplicating it locally
and corrupting the replayed ledger (a real-browser pull of 26 relay events
produced 156 = 6x local rows). Chain all calls on one promise so only one runs
at a time, making the dedup atomic. Adds a 4-concurrent-sync regression test.
An exhaustive adversarial stress-test pass (6 parallel domain adversaries +
in-kernel engine probing + a real-browser adversary) tried to BREAK every
feature. 24 genuine breaks were found and fixed at root cause, each with a
regression test; the dominant class (15/24) was a NaN/Infinity slipping past
a typeof/isNaN-only guard at a trust boundary and poisoning a derived value.
- Water Watch: blank value stored as fabricated 0; a single NaN reading
permanently killed a channel baseline (and survived replay). Reject
non-finite at the form, the gate, and the replay matcher.
- Fair Share: a floor consuming the pool emitted an Infinity clearing price;
Infinity need/supply/trend -> NaN. Finiteness guards + residual-only CEEI
sub-market.
- Housing: NaN/Infinity score/capacity signed a NaN fairness-debt that
poisoned all future cycles. Validate finiteness at the input boundary.
- Tunnel Safety: A* returned suboptimal routes when coord scale != weight
scale (inadmissible heuristic). Scale the heuristic to be provably
consistent; verified vs brute-force Dijkstra.
- Assembly QV: duplicate P2P-synced credit rows double-counted a resident.
Collapse per (proposal,resident) before tallying.
- Fair Draw: empty participants committed a draw it could never resolve
(stuck). Refuse empty draws.
- Light Clock: negative/huge/NaN lux -> NaN circadian output; non-finite
hours -> unbounded RK4 loop (hang/OOM). Finite light-drive + step bound.
- Farms: NaN baseTemp/crop fields -> NaN GDD/yield (NaN-leak into Fair
Share's signed ledger); overflow temps -> Infinity GDD. Finiteness +
overflow-safe mean.
- The Climb: Infinity capacities -> self-contradictory schedule; non-integer
readyPeriod -> silent 0-delivered. Finiteness + integer guards.
- Upload/manifest: an extra unknown field leaked into the stored manifest and
onto the share wire; duplicate permissions and 200k names accepted. Reject
unknown keys and return a reconstructed manifest; dedupe + length caps.
Combined gate green: 689 tests pass (+21 regression over 668 baseline),
tsc build exit 0, oxlint exit 0. No test skipped or weakened.
Found by actually uploading and opening a mini-app end-to-end in a real
browser: the whole 'upload a mini-app and it runs with SDK access' feature
was silently broken for real users. mountMiniapp parsed the HTML with
DOMParser and carried each node over with document.importNode - but a
<script> produced by a parser keeps the 'already started' flag, so
appending it to the live document does NOT execute it in a real browser.
The code comment even asserted the opposite. happy-dom DOES run such
scripts, so the existing test suite passed while the feature was dead in
Chromium - a false-confidence gap.
Also surfaced a second, latent parse bug: the bundled 'Hollow Welcome'
sample (installed for everyone via 'Load Hollow demo') had a bare '&&' in
its inline script, which the strict application/xhtml+xml mount parser
rejects with xmlParseEntityRef - so even once scripts executed, that
sample failed to parse. Both the demo sample and anyone copying it would
hit this.
Fixes:
- mountMiniapp now re-creates every parsed <script> as a fresh
document.createElement('script') with attributes + text copied over. A
freshly-created script has no 'already started' flag and executes on
insertion, exactly as a real page's inline script does. Verified in a
real Chromium browser: the sample's balance now resolves (50), the
greeting count increments 0->1 on click, and persists across reload
through the real signed Event Log.
- Escaped the bare '&&' in the Hollow Welcome sample to '&&' so it
parses under the strict XHTML mount parser.
- Made both the shipped sample and the test fixture guard their async SDK
callbacks (element-exists + window.commons-present checks). This is the
correct robust pattern for an unsandboxed mini-app: a real browser would
otherwise throw an unhandled error if the user navigates away while an
SDK call is in flight. It also makes the tests deterministic (the newly-
executing async callbacks no longer land on a torn-down DOM).
Verified: all 668 tests pass with zero unhandled errors (previously the
newly-running scripts caused 3 unhandled rejections and a non-zero exit),
build passes, lint clean. Confirmed end-to-end in a real browser with both
the bundled sample and a freshly-uploaded custom mini-app.
The prior commit seeded two hardcoded sensorId strings ("kiosk-1",
"kiosk-2") reporting through the real corroboration gate - technically
real engine logic, but the sensorId label implies a hardware sensor
network that doesn't exist anywhere in this project. Water Watch has no
actual device integration; its real design is a resident typing a reading
into ReportReadingForm, and corroboration specifically requires a second,
genuinely independent report - something an admin seed step cannot
honestly produce without inventing a second reporter.
Removes the seeded readings entirely. Water Watch now starts at its
honest "No sensor readings yet" empty state, same as it would with zero
fabricated starting data. The real corroboration mechanism is meant to be
demonstrated by actually using the form, not by injected fixture data
standing in for equipment that was never built.
Tunnel Safety's hazard report, Farms' planting forecast, Assembly's votes,
and Mentor's skill review are unaffected - each represents an action a
real person could take through the app's own real form, with no claim
about external hardware, consistent with this fix's standard.
"Load Hollow demo" already populated Fair Share, Housing, Mentor's at-risk
list, the wallet, and Assembly's roster - but Water Watch, Tunnel Safety,
Farms, Assembly's votes, and Mentor's review history stayed completely
empty, so a cold visitor saw several apps with nothing to look at.
Extends the same one-click load to drive real outcomes through each app's
actual engine - never a fabricated or hand-set state:
- Water Watch: two independent sensors (kiosk-1/kiosk-2) each report a
baseline reading, then both report the same contaminated value - run
through the real createCorroborationGate()/reportWaterReading() the live
resident form uses. The exact sequence was verified by executing the
real gate directly before writing this: readings 1-2 establish each
sensor's baseline, reading 3 flags "corroborating", reading 4 (the
second independent sensor agreeing) genuinely reaches "alert" - the
gate's own state machine decides this, not a hardcoded status.
- Tunnel Safety: one real hazard report (reportHazard()) closes a segment
so the map shows a genuine closure and rerouted path.
- Farms: a real, provably-feasible temperature/plot/crop input reaches an
"optimal" solve via solveFarmsPlantingOptimizer() + settleFarmsForecast(),
which also feeds Fair Share's food resource through the same real edge a
live grower's forecast would use.
- Assembly: the two founding residents cast real votes (castVote()) on the
seeded proposal, so the tally is non-zero instead of "No vote cast yet".
- Mentor: one real skill review (postSkillReview()) on well-repair (already
seeded as at-risk) gives it a genuine next-due-date instead of no history.
AdminSeedPanel.test.tsx's hardcoded expected Event Log count is updated to
account for the 10 new real entries (4 water readings + 2 water settlement
+ 1 hazard report + 2 farms settlement + 1 mentor review), with the same
itemized-comment style the existing formula already used.
Verified: the exact corroboration sequence was run against the real gate
in isolation to confirm it reaches "alert" before relying on it here;
npm run build passes; all 668 tests pass (including the exact
AdminSeedPanel integration test that clicks the button and inspects the
resulting Event Log); lint is clean with zero new warnings.
Node labels were placed at a fixed y-offset regardless of local edge
geometry, so hub nodes with multiple fanning segments (Market Junction,
South Gate) had connector lines running straight through the label glyphs.
Added a white stroke halo behind the text (the standard SVG technique for
legibility over crossing graph edges) - works regardless of exact layout
geometry, independent of how many lines converge on a given node.
Found via a real-browser visual audit (Playwright + a real vite dev server,
real seeded demo data) across all 13 mini-apps plus the home grid, admin
panel, and upload-mini-app flow at mobile and desktop widths - the only
genuine defect found. Confirmed fixed via before/after screenshots and
independently reproduced (including a zoomed A/B comparison) by a fresh
gate reviewer. Build, test (668/668), and lint all stay green.
Adds optional energyBudgetKwh to SolveFarmsPlantingInput and required kWhPerM2 to CropMaturityWindow. The solve loop adds a single energy<=budget constraint and an energy coefficient per variable when a budget is set, guarded by the existing assertFiniteNumber. totalEnergyKwh is summed in the existing schedule-building varMeta loop. PlantingInputForm.tsx and its two test files are updated only as a direct consequence of kWhPerM2 becoming a required field (new form input + existing crop literals/test flows updated); objective function, GDD eligibility filter, and downstream consumers are untouched.