diff --git a/.omo/evidence/first-place-overhaul-task5-gate-review.md b/.omo/evidence/first-place-overhaul-task5-gate-review.md new file mode 100644 index 0000000..fe50853 --- /dev/null +++ b/.omo/evidence/first-place-overhaul-task5-gate-review.md @@ -0,0 +1,120 @@ +# Gate Review - first-place-overhaul plan todo 5 (auto-seed Hollow demo fixture on empty Event Log) + +- **recommendation:** APPROVE +- **AdversarialVerify verdict:** confirmed +- **failure_class:** none +- **confidence:** 0.96 +- **reviewer:** omo-native-gate-reviewer (st_01a1faa4) +- **worktree:** /home/athapa/patriothacks-wt/first-place-overhaul-todo5 (branch first-place-overhaul-todo5) +- **commit under review:** f8b40fc + +## originalIntent +GAP-2 of the plan: a cold/empty Event Log shows "no balance yet" / "No allocation yet" everywhere until a resident manually visits `/admin`. A PatriotHacks judge who clicks the live link and lands on `/` must reach a working, seeded, populated app within 2 clicks (IS-1/IS-2) without ever finding `/admin`. + +## desiredOutcome +On a genuinely empty Event Log, mounting the shell at `/` auto-seeds the same clearly-labeled "Demo data" Hollow fixture the `/admin` panel loads, so the wallet shows a real non-zero balance and the mini-app grid is populated on first boot - and a reload (which under React dev StrictMode fires the boot effect twice) never duplicates any seeded event. + +## userOutcomeReview +The shipped artifact satisfies the user outcome. A cold first visit to `/` (never `/admin`) auto-seeds 34 signed events through the real `append()`/`appendEntry()` paths, resolves the wallet balance to 50, and populates the 13-tile grid - verified in a real Chromium browser by me. Idempotency holds across reload (34 entries / exactly 1 marker). The "Demo data" badge and the Assembly demo-fixture disclaimer are preserved verbatim, so the seeded data is still honestly labeled as demo configuration, never presented as live activity. + +## Checked artifact paths +- /home/athapa/patriothacks-wt/first-place-overhaul-todo5/src/admin/loadHollowDemo.ts +- /home/athapa/patriothacks-wt/first-place-overhaul-todo5/src/admin/AdminSeedPanel.tsx +- /home/athapa/patriothacks-wt/first-place-overhaul-todo5/src/shell/ShellLayout.tsx +- /home/athapa/patriothacks-wt/first-place-overhaul-todo5/src/shell/ShellLayout.test.tsx +- /home/athapa/patriothacks-wt/first-place-overhaul-todo5/src/lib/identity.ts (precedent for the in-flight-promise pattern) +- /home/athapa/patriothacks-wt/first-place-overhaul-todo5/src/main.tsx (StrictMode wrapper confirmed) +- /home/athapa/patriothacks-wt/first-place-overhaul-todo5/e2e/autoSeedColdLoad.e2e.mjs +- .omo/evidence/first-place-overhaul/task-5-first-place-overhaul.txt (executor evidence) +- .omo/evidence/first-place-overhaul/task-5-first-place-overhaul-browser-qa.json (executor e2e evidence) + +## Independent reproduction (my own runs, not pasted executor numbers) + +### Git state (step 2, 9) +``` +$ git log --oneline -3 +f8b40fc (HEAD -> first-place-overhaul-todo5, origin/first-place-overhaul-todo5) feat(shell): auto-seed the Hollow demo fixture on a genuinely empty Event Log +ae2f920 chore(ulw-execute): close todos 2-4, record gate-review evidence and ledger +32f27b1 (origin/first-place-overhaul-todo2) test(evidence): record plan todo 2 verification... +$ git status --short # clean +$ git rev-parse HEAD # f8b40fcad0338a1cec4df83f6aa4ba08d831e4cb +$ git ls-remote origin first-place-overhaul-todo5 # f8b40fcad0338a1cec4df83f6aa4ba08d831e4cb +``` +Clean tree, exactly 1 commit on top of master-lineage, local HEAD == pushed remote SHA. + +### Code inspection (step 3) +- (a) `loadHollowDemoFixture` / `loadHollowDemoFixtureUncached` contain **zero** React state calls - no `setDemoStatus`/`setDemoLoading`/`useState`. Confirmed by full read. All UI state stays in `AdminSeedPanel.handleLoadDemo`. +- (b) AdminSeedPanel is a thin wrapper: `handleLoadDemo` -> `await loadHollowDemoFixture(assemblyDbName)` then sets its own status. The `data-testid="demo-data-label"` "Demo data" badge and the `data-testid="assembly-demo-fixture-disclaimer"` paragraph are present verbatim, untouched. +- (c) ShellLayout gate is `if (existing.length === 0 && !alreadySeeded)` - requires a truly-empty (zero-entry) log AND marker-absent, not marker-only. +- (d) In-flight-promise-cache guard is a byte-faithful copy of `identity.ts`'s `init()` pattern: `if (!inFlight) { inFlight = uncached().finally(() => { inFlight = undefined; }); } return inFlight;`. Pattern matches the cited precedent exactly. + +### Targeted tests (steps 4, 5) +``` +$ npx vitest run src/admin/AdminSeedPanel.test.tsx -> Test Files 1 passed, Tests 11 passed (11) +$ npx vitest run src/shell/ShellLayout.test.tsx -> Test Files 1 passed, Tests 2 passed (2) +``` +ShellLayout tests are genuinely behavioral: the happy test asserts a real rendered non-"--", numeric, >0 wallet balance and a populated grid after a real mount creates real fake-indexeddb entries; the idempotent test asserts the real entry count is unchanged across unmount/remount with exactly 1 `seed.demo.loaded` marker. (They also carry supplementary mock-call-count assertions - see NOTE 1.) + +### Full suite + claimed regression-fix tests (step 6) +``` +$ npm run test -> Test Files 90 passed (90), Tests 796 passed (796) +$ npx vitest run ...coreLoopFoodIntegration.test.tsx ...coreLoopHonestyAnchor.test.tsx + -> Test Files 2 passed (2), Tests 4 passed (4) +``` +(The `ECONNREFUSED 127.0.0.1:3000` lines are AdminAggregatePanel's backend probe - expected noise; tests pass.) + +### Build (step 7) +``` +$ npm run build -> tsc -b passes, vite build "built in 515ms", PWA generated, BUILD_EXIT=0 +``` + +### Playwright StrictMode-race probe (step 8) - THE CRUX +Ran the real e2e against a real Vite dev server (React dev StrictMode active) in headless Chromium, cold IndexedDB context: +``` +$ node e2e/autoSeedColdLoad.e2e.mjs + initialBalance "--" -> autoSeededBalance 50 (non-zero number) + tileCount 13 + firstLoadEventLog: totalEntries 34, markerCount 1 + reloadEventLog: totalEntries 34, markerCount 1, sameTotalAsFirstLoad true + SUMMARY: PASS (E2E_EXIT=0) +``` +The **first** cold load is itself under StrictMode's double effect-invocation (main.tsx wraps `` in ``; Vite dev = development build), so first-load `34 entries / 1 marker` is the real concurrent-double-invoke result, not just a sequential single mount. + +**Negative control (my addition, to prove the e2e distinguishes a working guard from a broken one):** I temporarily replaced the in-flight-cache wrapper with a direct `return loadHollowDemoFixtureUncached(...)` and re-ran the identical e2e: +``` + firstLoadEventLog: totalEntries 68, markerCount 2 + error: "expected exactly 1 seed.demo.loaded marker after first load, got 2" +``` +Without the guard the first cold load under StrictMode duplicates the entire fixture (68/2). With the guard it is 34/1. This proves (i) the StrictMode race is real, (ii) the e2e genuinely detects it, (iii) the in-flight-promise guard actually prevents it. I then reverted the file (`git diff HEAD -- src/admin/loadHollowDemo.ts` is empty) and restored the two e2e-regenerated evidence artifacts via `git checkout`; final `git status --short` is clean. + +## remove-ai-slops overfit/slop pass (my own, over diff + tests + production code) +- Production extraction of `loadHollowDemoFixture` into a shared module is the task's explicit requirement (one function, two call sites), not unnecessary extraction. +- In-flight-promise cache is load-bearing, proven necessary by the negative control - not defensive slop. +- No deletion-only tests, no tests that merely verify a requested removal, no tautological tests, no prose-pinning tests, no unnecessary parsing/normalization in production code. +- `nextDemoLamportTs` helper and the single-field `LoadHollowDemoResult` interface are minimal and used. + +## programming-criteria findings +No maintenance-burden, false-confidence, or scope-drift finding rises to a blocker. Two NOTES below. + +## blockers +None. + +## NOTES (not tied to any stated success criterion - informational) +1. **ShellLayout.test.tsx Test 2 mixes mock-call-count pins with behavioral assertions.** It asserts `hasDemoFixtureBeenLoaded` was called exactly 2 then 3 times (implementation-mirroring). These are supplementary - the acceptance criterion ("second mount does not duplicate") is independently satisfied by the real `entries.toHaveLength(countAfterFirstMount)` + `markerEntries.toHaveLength(1)` assertions. The unit tests do not themselves run under StrictMode; the true concurrent-race coverage lives in the e2e (verified above). Evidence pointer: src/shell/ShellLayout.test.tsx:95-131. +2. **The `&& !alreadySeeded` term in ShellLayout's gate is logically redundant** when `existing.length === 0` (an empty log cannot contain the marker). It is harmless and the executor documented it intentionally as a belt-and-suspenders explicit guard; the real idempotency guarantee is the `hasDemoFixtureBeenLoaded` check inside `loadHollowDemoFixtureUncached`. Evidence pointer: src/shell/ShellLayout.tsx:42-46. + +## Evidence gaps +- No dedicated code-review report artifact exists for todo 5 (only the executor's own `task-5-first-place-overhaul.txt` evidence and `task-5-...-browser-qa.json`). The task asked me to confirm a code-review report shows the same skill-perspective/overfit coverage; that report was not produced for this todo. This is an evidence gap, not a criterion failure - the plan's todo-5 verification strategy is inspection + tests + Playwright (all independently reproduced above), and I ran the remove-ai-slops/overfit pass directly myself rather than relying on report coverage. + +## Criterion-by-criterion +| Criterion | Status | Evidence | +|---|---|---| +| Extracted shared `loadHollowDemoFixture`, no React state | PASS | read of loadHollowDemo.ts | +| AdminSeedPanel thin wrapper; Demo-data badge/disclaimer intact; 11/11 assertions pass | PASS | read + `npx vitest run AdminSeedPanel.test.tsx` 11/11 | +| ShellLayout gate = truly-empty log AND marker | PASS | ShellLayout.tsx:42-46 | +| StrictMode double-invoke race fixed via identity-style in-flight cache | PASS | pattern match + negative control (68/2 without, 34/1 with) | +| No regression in pre-existing integration tests | PASS | 796/796; coreLoopFood + coreLoopHonestyAnchor 4/4 | +| Cold `/` mount auto-seeds, balance non-zero, grid populated, no `/admin` | PASS | e2e: balance 50, 13 tiles, 34 entries | +| Reload idempotent, no duplicate seed events | PASS | e2e reload 34/1; unit idempotent test | +| build exit 0 | PASS | `npm run build` BUILD_EXIT=0 | +| One commit pushed to origin, clean tree | PASS | HEAD==remote==f8b40fc, clean status | diff --git a/.omo/plans/first-place-overhaul.md b/.omo/plans/first-place-overhaul.md index 373f1a4..23ea2b8 100644 --- a/.omo/plans/first-place-overhaul.md +++ b/.omo/plans/first-place-overhaul.md @@ -134,7 +134,7 @@ Your next move: approve, or ask for the high-accuracy review first (it runs auto Commit: Y | docs(edge-cases): correct the stale QV credit-forgery claim - verified already fixed Recommended task executor category: quick - single-sentence factual correction with the exact replacement text and citation already specified -- [ ] 5. Auto-seed the Hollow demo fixture on a genuinely empty Event Log at shell boot +- [x] 5. Auto-seed the Hollow demo fixture on a genuinely empty Event Log at shell boot What to do: extract the full body of AdminSeedPanel.tsx's `handleLoadDemo` (lines ~92-..., ends before the next function - read the whole function first) into a new exported async function (e.g. `loadHollowDemoFixture(assemblyDbName?: string): Promise` in a new src/admin/loadHollowDemo.ts, or inline in seedEvents.ts if that fits better - executor's call, but it must be a single shared function, not copy-pasted logic) that does NOT touch React state (no setDemoStatus/setDemoLoading calls - those stay in AdminSeedPanel's thin wrapper which now just calls the extracted function and sets its own UI state around it). Call this same function from src/shell/ShellLayout.tsx's existing useEffect (ShellLayout.tsx:27-33, which already runs trySyncWithBackend() once on mount) - BEFORE calling it, check `hasDemoFixtureBeenLoaded(await readAll())` (same idempotency marker /admin already uses) and only call the seeding function when the Event Log is genuinely empty of the marker; never call it unconditionally, never call it a second time, never present it as anything other than the same clearly-labeled "Demo data" the /admin panel already discloses (do NOT remove or weaken the "Demo data" badge/disclaimer anywhere in AdminSeedPanel.tsx). Must NOT change AdminSeedPanel's own UI/behavior/tests beyond calling the extracted function instead of inlining the logic - all of AdminSeedPanel.test.tsx's existing assertions must still pass unchanged. Closes: GAP-2 Parallelization: Wave 1 | Blocked by: 1 | Can parallelize with: 2,3,4,6(partially - see todo 6's own Blocked-by) diff --git a/.omo/ulw-execute/ledger.jsonl b/.omo/ulw-execute/ledger.jsonl index 929de57..288143f 100644 --- a/.omo/ulw-execute/ledger.jsonl +++ b/.omo/ulw-execute/ledger.jsonl @@ -222,3 +222,6 @@ {"event":"task-landed","plan":"first-place-overhaul","task":"7","commit_worktree":"6065a64","commit_master":"6065a64 (fast-forward)","ts":"2026-11-20T20:18:14.404Z"} {"event":"task-completed","plan":"first-place-overhaul","task":"7","checkpoint":"x","artifact":".omo/evidence/first-place-overhaul/task-7-first-place-overhaul.txt","ts":"2026-11-20T20:18:14.404Z"} {"event":"wave-complete","plan":"first-place-overhaul","wave":2,"note":"todos 7,8 landed and independently verified on master","ts":"2026-11-20T20:18:14.404Z"} +{"event":"verify-confirmed","plan":"first-place-overhaul","task":"5","verifier_id":"st_01a1faa4","verdict":"confirmed","confidence":0.96,"note":"verifier added a negative control (disabled the guard, confirmed duplication bug reproduces 68/2, restored, confirmed 34/1) - the StrictMode race fix is genuinely effective, not a false negative","ts":"2026-11-20T20:31:53.976Z"} +{"event":"task-landed","plan":"first-place-overhaul","task":"5","commit_worktree":"21319b3","commit_master":"21319b3 (fast-forward)","ts":"2026-11-20T20:31:53.976Z"} +{"event":"task-completed","plan":"first-place-overhaul","task":"5","checkpoint":"x","artifact":".omo/evidence/first-place-overhaul/task-5-first-place-overhaul.txt","ts":"2026-11-20T20:31:53.976Z"}