Skip to content

Commit 27d92d7

Browse files
committed
Make the records true again, and hand the gate to its judge
Work item V9 of the M3 plan, and the last of it. Every fact below was read from the tree rather than recalled, because a stale record is a bug and this file is what a fresh session trusts. PROJECT-STATE is rewritten. It had the app at "placeholder page only" with no src/server, no components, no e2e, and Playwright browsers not installed, all of which stopped being true days of work ago. It now records what exists: 27 route handlers, 9 screens, eight migrations, the settings catalogue, the two environment variables, the screens by path, and what is deliberately not built. The execution order's progress table is corrected the same way, with the partly-done items marked partly done rather than either. The FG-2 checklist is new, and its job is to keep two questions apart. Whether the machinery works is answered, for free, and captured: eight of eight planted defects found, nothing reported in the two files that are deliberately correct, nothing discarded by the quotation check. Whether the findings are worth reading is not answered and cannot be without spending real usage on a real model, so the checklist says what to look at, in what order, and what each verdict means. Gate G1 is recorded as AWAITING VERDICT, not passed. The real-model smoke has deliberately not been run: it spends the maintainer's usage and starting it is theirs to do. Nothing in this repository marks a gate passed, and a run of the fake cannot, which is the whole point of having a gate.
1 parent 39625b5 commit 27d92d7

7 files changed

Lines changed: 204 additions & 65 deletions

File tree

docs/DECISIONS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,3 +812,8 @@ verified evidence, in writing, here.
812812
before it was right. Chromium reports these colours as `lab()`, where the
813813
first channel is lightness on a 0 to 100 scale; summing the channels read
814814
98.8 as "dark". The helper now normalises lab, oklch and rgb to one scale.
815+
- 2026-07-31 DECIDED (V9): gate G1 is recorded as AWAITING VERDICT rather than
816+
passed. The fake-engine half is complete and its evidence is captured, but
817+
the half that decides whether findings are worth reading needs a real model
818+
and the maintainer's usage. Nothing in this repository marks a gate passed,
819+
which is the point of a gate.

docs/GATES.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ IS executing the plan. Update this file in the same session anything moves.
77
| Gate | What must be true to pass | Status | Evidence | Date |
88
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
99
| G0: Brief and plan | App brief received; scope, stack, and plan written to `docs/` and ratified by the maintainer; later gates defined. | PASSED | Brief (`00-BRIEF.md`), feasibility confirmed on the live account, decisions logged (`DECISIONS.md`), specs 01-05 and `plans/BUILD-PLAN.md` written, G1-G3 defined. Ratified by the maintainer 2026-07-30 ("you can get started on this"). | 2026-07-30 |
10-
| G1: Working pipeline | M2 of `plans/BUILD-PLAN.md`: fake-engine review runs end to end; real-engine smoke on the seeded fixture; the maintainer verdict on pipeline and prompts. | ACTIVE | Build started 2026-07-30 at WP-A. | 2026-07-30 |
10+
| G1: Working pipeline | M2 of `plans/BUILD-PLAN.md`: fake-engine review runs end to end; real-engine smoke on the seeded fixture; the maintainer verdict on pipeline and prompts. | AWAITING VERDICT | Fake-engine evidence complete and captured in `review/2026-07-31-fg2/`: 8 of 8 planted defects found, no findings in the two files that are deliberately correct, nothing discarded by the quotation check. 566 unit tests and 15 browser tests green under `./verify.sh --build --e2e`. The real-model smoke has deliberately NOT been run: it spends the maintainer's usage and is theirs to start. What to judge and how: `plans/FG2-CHECKLIST.md`. | 2026-07-31 |
1111
| G2: Usable app | M3: the maintainer drives a real review of their own branch with the imported protocol; verdict on findings quality and confirmation flow. | PENDING | - | - |
1212
| G3: Ship v1 | M4: design judgment per 04 section 5; engine quality gate evidence accepted; full e2e green. | PENDING | - | - |
1313

1414
Notes:
1515

16+
- G1 is AWAITING VERDICT, not passed. The fake-engine half is done and its
17+
evidence is recorded; the half that judges whether findings are worth
18+
reading needs a real model, which costs the maintainer's usage. Nothing in
19+
this repository will mark this gate passed, and a run of the fake cannot.
20+
1621
- The two external AI plans have not been received. When they arrive they are
1722
reviewed against the specs and folded in as spec amendments; they do not
1823
block the build (the maintainer's 2026-07-30 go-ahead).

docs/PROJECT-STATE.md

Lines changed: 88 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,95 +3,126 @@
33
The live cache. Current facts only; if a change makes a line here wrong,
44
fixing it is part of that change. Dates are absolute (YYYY-MM-DD).
55

6-
Last verified: 2026-07-30
6+
Last verified: 2026-07-31
77

88
## Status
99

1010
- Gate G0 (brief and plan) PASSED 2026-07-30. Gate G1 (working pipeline) is
11-
ACTIVE. Build order: `plans/BUILD-PLAN.md`.
12-
- WP-A (scaffold and gates) complete and verified 2026-07-30, not yet
13-
committed (commits happen only when the maintainer asks).
14-
- WP-F is part built: the review pipeline runs end to end against a scripted
15-
stage runner, with sweeps, reconciliation, the quotation check and the
16-
coverage audit all enforced and mutation-tested.
17-
- All remaining work is planned in detail as `docs/plans/EXECUTION-ORDER.md`
18-
(items T1-T19, three founder gates, decisions D-1..D-20 pre-resolved). The
19-
driver works it top to bottom without asking between gates.
20-
- T1 to T7 are DONE. The engine spine is complete and the quality gate is in
21-
place: a correct review of the seeded fixture carries through the pipeline
22-
intact, a misquoted finding is discarded, and the clean files stay clean.
23-
The gate is mutation-proven and runs in verify.sh.
24-
- T8, T9 and the FG-2 demo are planned to commit level in
25-
`docs/plans/M2-FINISH-PLAN.md` (work items W1-W8): resume via checkpointed
26-
stage outputs, the job manager and SSE, and the demo script. Next: W1.
27-
- The two external AI plans have not arrived. They fold in as spec
28-
amendments when they do; they do not block the build.
29-
30-
## Stack (installed and proven 2026-07-30)
11+
ACTIVE and its evidence is ready: see `plans/FG2-CHECKLIST.md`. The verdict
12+
is the maintainer's, and nothing in this repository marks it passed.
13+
- The app is usable end to end. A person can add a project from a git URL, see
14+
its branches, set up a review with a pre-flight estimate, watch it run,
15+
decide every finding, complete it, and export a report.
16+
- Milestone M2 is finished: `plans/M2-FINISH-PLAN.md` items W1-W8 are DONE,
17+
including checkpointed resume, the job manager, SSE, and the demo script.
18+
- Milestone M3 is finished apart from these records:
19+
`plans/M3-FINISH-PLAN.md` items V1-V8 are DONE. V9 is this file and the
20+
FG-2 checklist.
21+
- The two external AI plans never arrived. They fold in as spec amendments if
22+
they do; they did not block the build.
23+
24+
## Stack (installed and proven 2026-07-31)
3125

3226
Node 22.22.1, npm 11.17.0, git 2.43.0, Claude Code 2.1.71 on Linux.
3327

3428
next ^16.2.12, react ^19.2.8, typescript ^6.0.3, drizzle-orm ^0.45.2,
35-
drizzle-kit ^0.31.10, better-sqlite3 ^13.0.2 (native binding verified
36-
working), zod ^4.4.3, tailwindcss ^4.3.3, vitest ^4.1.10,
37-
@playwright/test ^1.62.0 (browsers NOT yet installed), eslint ^9.39.5,
29+
drizzle-kit ^0.31.10, better-sqlite3 ^13.0.2, zod ^4.4.3, tailwindcss ^4.3.3,
30+
vitest ^4.1.10, @playwright/test ^1.62.0 (chromium installed), eslint ^9.39.5,
3831
prettier ^3.9.6, ulid ^3.0.2.
3932

4033
TypeScript runs strict plus `noUncheckedIndexedAccess`,
4134
`noImplicitOverride`, `noFallthroughCasesInSwitch`.
4235

4336
## Commands
4437

45-
See `CLAUDE.md` section 3. `./verify.sh` is the single gate and passes as of
46-
2026-07-30, including `--build`. Its failure branches are proven, not
47-
assumed: non-zero exit, error marker printed while exiting 0, step timeout,
48-
and house-style violations (em dash and emoji) each fail the gate; a clean
49-
tree passes. `--e2e` has never run: there are no e2e specs yet and no
50-
Playwright browsers installed.
38+
See `CLAUDE.md` section 3. `./verify.sh` is the single gate. As of 2026-07-31
39+
it passes with `--build --e2e`: 566 unit tests passing and 6 skipped across 38
40+
files, plus 15 browser tests. CI runs `./verify.sh --build --e2e`; the local
41+
default leaves both off so it stays fast.
42+
43+
`npm run demo:fixture -- --fake` reviews the seeded fixture end to end with no
44+
model and no money, scoring the result against the fixture's manifest.
45+
46+
## Environment
47+
48+
- `TRYSQUARE_DATA` - the data root, default `~/.local/share/trysquare`. Holds
49+
`db.sqlite`, `projects/`, `runs/` and `exports/`.
50+
- `TRYSQUARE_CLAUDE_PATH` - the binary reviews run through, default `claude`
51+
on PATH. Every run records which one it used as a run note.
52+
53+
## Settings
54+
55+
Stored in the `settings` table, edited on the settings screen. Only these keys
56+
are accepted; anything else is refused by name.
57+
58+
- `maxConcurrentReviews` (default 1). Two reviews share one usage limit.
59+
- `stageTimeoutMinutes` (default 20).
60+
- `stageMaxBudgetUsd` (default 15). A ceiling on any single model call; zero
61+
removes the ceiling.
5162

5263
## Structure
5364

5465
- `CLAUDE.md` - charter. `docs/` - specs, ledgers, plans.
55-
- `src/lib/` - pure domain logic: `paths.ts`, `ids.ts`, `domain/enums.ts`,
56-
`domain/state-machines.ts` (review and finding state machines).
57-
- `src/server/db/` - schema (14 tables), client, migrations, and
58-
repositories for projects, reviews, ledger, findings, models, settings.
59-
- `src/lib/git/` - pure git logic: diff parsing, URL validation, changed
60-
exported symbols.
61-
- `src/server/gitops/` - the only code that spawns git: clone, fetch, refs,
62-
worktrees, bundle builder.
63-
- `src/lib/engine/` - CLI event schemas and command construction (pure).
64-
- `src/server/engine/` - the only code that spawns claude: stage runner,
65-
stream decoding, model probing, auth status.
66-
- `src/lib/rulesets/` - protocol import with a fidelity gate, markdown
67-
export, prompt composition, and rule/file batch planning.
68-
- `src/lib/review/` - mechanical sweeps, the quotation check, stage output
69-
schemas, and stage reconciliation.
70-
- `src/server/review/` - the pipeline orchestrator.
66+
- `src/lib/` - pure and I/O free: paths, ids, domain enums and state machines,
67+
git diff and URL parsing, changed exported symbols, mechanical sweeps, the
68+
quotation check, stage schemas, budget arithmetic, ruleset import with a
69+
fidelity gate, prompt composition, batch planning, and the report renderer.
70+
- `src/server/db/` - schema (14 tables), client, migrations 0000 to 0007, and
71+
repositories for projects, reviews, ledger, findings, models, rulesets,
72+
settings and stage executions.
73+
- `src/server/gitops/` - the only code that spawns git.
74+
- `src/server/engine/` - the only code that spawns claude.
75+
- `src/server/review/` - the pipeline, the engine runner, the checkpointing
76+
runner that makes a resumed stage free, the service that runs a review from
77+
a row, merged detection, and the report assembler.
78+
- `src/server/jobs/` - the event bus, the job manager, and the SSE stream.
79+
- `src/server/api/` - one response shape for every route.
80+
- `src/app/api/` - 27 route handlers. `src/app/` - 9 screens.
81+
- `src/components/` - the shared UI vocabulary, the left rail, and the
82+
confirmation queue.
83+
- `scripts/` - the house-style gate, the leak gate, the nothing-hidden gate,
84+
and the fixture demo.
7185
- `tests/fixtures/example-protocol.md` - the public sample protocol the
7286
fidelity gate runs against.
73-
- `tests/fixtures/fake-claude.mjs` - stand-in CLI so engine tests are
74-
hermetic and cost nothing.
75-
- `drizzle/` - the committed initial migration.
76-
- `src/app/` - Next App Router (placeholder page only).
77-
- `src/server/`, `src/components/` - not created yet.
78-
- `scripts/check-style.mjs` - house-style gate.
79-
- `tests/` - unit tests. `e2e/` - not created yet.
87+
- `tests/fixtures/fake-claude.mjs` - stand-in CLI, so tests are hermetic and
88+
cost nothing.
89+
- `tests/` - unit and integration tests. `e2e/` - the browser journey and the
90+
theme pass. `drizzle/` - eight committed migrations.
8091
- `verify.sh` - the gate.
8192

82-
Runtime layout the app will create on disk is specced in
83-
`01-ARCHITECTURE.md` section 5 and implemented by `src/lib/paths.ts`.
93+
Runtime layout on disk is specced in `01-ARCHITECTURE.md` section 5 and
94+
implemented by `src/lib/paths.ts`.
95+
96+
## Screens
97+
98+
`/projects`, `/projects/[id]`, `/reviews`, `/reviews/new`, `/reviews/[id]`,
99+
`/rulesets`, `/rulesets/[id]`, `/settings`. The root redirects to projects.
84100

85101
## Known issues
86102

103+
- One Turbopack build warning remains, traced to the engine's per-review log
104+
paths, which cannot be static. It affects only the standalone output
105+
manifest, which this app does not use. Adopting `output: "standalone"`
106+
voids that acceptance; the re-check trigger is in `DECISIONS.md`.
87107
- 9 high npm advisories remain, all the same `brace-expansion` DoS reached
88108
through minimatch 3.x inside eslint and eslint-config-next's plugins. No
89109
compatible patched version exists; forcing the patched 5.0.8 breaks eslint
90-
(verified). Lint-time dev dependency only. Reasoning and re-check trigger
91-
in `DECISIONS.md` (2026-07-30 ACCEPTED RISK).
110+
(verified). Lint-time dev dependency only. Reasoning and re-check trigger in
111+
`DECISIONS.md` (2026-07-30 ACCEPTED RISK).
92112
- Next's build rewrites `tsconfig.json` (sets `jsx: react-jsx`, adds
93113
`.next/dev/types`). Run prettier on it after a build or the format gate
94114
fails on the next run.
115+
- An interrupted Playwright run can leave its server holding port 3100, and
116+
the next `--e2e` then fails saying the port is in use. Reusing an existing
117+
server is deliberately not allowed, because it would run the journey
118+
against a server started without the fake engine.
119+
120+
## Not built
121+
122+
- More than one dependency per review: the model and the screens take a
123+
single linked project.
124+
- Emailing a report (`plans/idea-inbox.md`).
125+
- Any authentication. This is a local, single-user tool by design.
95126

96127
## External services
97128

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ then `GATES.md`, then only what the active gate needs.
3030
| [plans/BUILD-PLAN.md](plans/BUILD-PLAN.md) | Work packages WP-A..L, milestones, founder gates, standing rails. |
3131
| [plans/EXECUTION-ORDER.md](plans/EXECUTION-ORDER.md) | STANDING EXECUTION ORDER: remaining work T1-T19, dependencies, founder gates, pre-resolved decisions D-1..D-20. |
3232
| [plans/M2-FINISH-PLAN.md](plans/M2-FINISH-PLAN.md) | Implementation plan for T8, T9 and the FG-2 demo: commit map W1-W8, the resume design, decisions D-21..D-26. |
33+
| [plans/FG2-CHECKLIST.md](plans/FG2-CHECKLIST.md) | What the maintainer judges at founder gate FG-2, where the evidence lives, and what each verdict means. |
3334
| [plans/M3-FINISH-PLAN.md](plans/M3-FINISH-PLAN.md) | Implementation plan for the usable app (T10-T17 remainder plus W8 leftovers): commit map V1-V9, spend-safety and confirmation-loop design, decisions D-30..D-44. |
3435
| [plans/PLAN-TEMPLATE.md](plans/PLAN-TEMPLATE.md) | Template for multi-step plan docs (work packages, decision gates, done tracking). |
3536
| [plans/idea-inbox.md](plans/idea-inbox.md) | One-line dated idea capture. Ideas are not expanded until the active gate passes. |

docs/plans/EXECUTION-ORDER.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,19 +434,26 @@ T19 last. FG-2 after T9; FG-3 after T15; FG-4 after T18.
434434
| T8 | T5 | DONE |
435435
| T9 | T8 | DONE |
436436
| FG-2 | T9 (+T7) | GATE |
437-
| T10 | T9 | TODO |
438-
| T11 | T8 | TODO |
439-
| T12 | T10 | TODO |
440-
| T13 | T12 | TODO |
437+
| T10 | T9 | DONE |
438+
| T11 | T8 | DONE |
439+
| T12 | T10 | DONE |
440+
| T13 | T12 | DONE |
441441
| T14 | T13, T11 | TODO |
442-
| T15 | T10 (T9 for Mode B) | TODO |
442+
| T15 | T10 (T9 for Mode B) | PART |
443443
| FG-3 | T15 | GATE |
444-
| T16 | T14, T15 | TODO |
444+
| T16 | T14, T15 | PART |
445445
| T17 | T13-T16 | TODO |
446446
| T18 | T7, T9 | TODO |
447447
| T19 | T17, T18 | TODO |
448448
| FG-4 | T18, T19 | GATE |
449449

450+
Status as of 2026-07-31. T10 to T13 are done. T11's report renderer and export
451+
are done; T14 (the report screen's polish) is folded into the review page.
452+
T15 is partly done: rulesets can be imported, listed, inspected, exported, and
453+
individual rules switched on or off; the fuller manager is not built. T16 is
454+
partly done: the browser journey and both-theme screenshots exist and CI runs
455+
them, and the remaining hardening is unstarted. T17 to T19 are unstarted.
456+
450457
T10 and T12 are partially built (routes for projects, branches, reviews,
451458
rulesets, models, events; screens for projects, new review, live review,
452459
reviews list, rulesets import, settings). The remainder of T10-T17, the FG-2

0 commit comments

Comments
 (0)