Record the architecture review unit (tier property, login clock) and its two-round finish audit as session logs, register both in docs/devlog/INDEX.md and the root AGENTS.md window, and carry the round-1 corrections into the review log (exports, diff counts, which tests use the fake clock).
6.6 KiB
6.6 KiB
Finish audit of the architecture-review unit: two rounds to a clean-or-docs-only round
Date: 2026-11-25 Type: generic Reference: procedure
/Users/alex/.pi/agent/prompts/finish_audit.md; audits the unit recorded in20261125-architecture-review-tier-property-and-login-clock_log.md
Goal
Run the finish-audit procedure over this session's uncommitted changes (catalog tier moved to a model property, login clock seam with six tests, docs and wiki): fresh-context reviewer fanout, synthesize the three reports, fix accepted findings, and repeat until one full clean-or-docs-only round follows the last code-change finding.
What Was Done
- Before each round: five patches re-materialized into
_code_review/by explicit path list (production / tests / docs / new devlog / agent-wikis), each verified by reverse-apply against the working tree;after/snapshots byte-identical; secret scan clean. The morning audit's stale patches were moved to_code_review/_rounds-1-5-stale/. Round 2 also materialized README, the ADR andtsconfig.jsonunderafter/, which round-1 reviewers had to skip. - Each round: three fresh-context, read-only reviewers (
ponytail-review,security-review,review) in ONEworkflow: truecall withruns.allandworktree: false; brief at_code_review/BRIEF.md; the cumulative "already fixed, do NOT re-report" ledger pasted into every task (17 items carried forward, then 22, then 24). Launched async, armedgoal_wait, resumed on the native completion wake. - Round 1 verdicts: ponytail code 2 / security CLEAN / general code 1, docs 1, tests 1. Deduplicated: two code-change findings, so round 2 was required.
- Round 1 fixes: dead
type ProviderStreamsimport deleted;toModelwritescatalogTier: tier,directly instead of a conditional spread; thedriveLoginfetch mock throws after 100 token polls; the devlog's export wording corrected. - Round 2 verdicts: ponytail CLEAN / security CLEAN / general code 0, docs 2, tests 0. Zero code-change findings in a full round after the last code-change round: stopping rule met, no round 3.
- Round 2 fixes (docs): the devlog
index.tsrow says +20 −36 and names the dropped import; "five tests on the fake clock, the sixth on the real clock" in the devlog andtests/AGENTS.md; the wiki's injected-clock recipe gained the poll cap, with its INDEX summary andlog.md. - Gates:
npm run checkafter each round:tscclean, 25/25. Wiki lint: 0 errors (its one warning is the unrelatedtea-api-output-flag.mdtaxonomy tag).
Decisions & Rationale
| Decision | Rationale |
|---|---|
| Accept the conditional-spread deletion (ponytail) | No reader distinguishes an absent key from undefined: tierOfModel returns undefined both ways and the JSON store drops the key. exactOptionalPropertyTypes stays at its default (tsconfig checked), and an explicit property in a literal typed TieredModel is better for tsc than a spread, where a misspelled key would not be an excess-property error. |
| Reproduce the hang before accepting the test finding | In a scratch copy under a 10 s watchdog, else throw error; to else {} left the non-retryable test with no result until killed; after the guard the same mutation fails in 273 ms. A plain Error from the mock bypasses the instanceof OAuthError filter in login, so it surfaces even when the loop swallows OAuth errors. |
| Stop after round 2 | It was a full round with zero code-change findings following the last code-change round, the procedure's Goodhart edge. Its two docs findings were counts and wording; fixing them does not reopen the loop. |
| Mutation checks in a scratch copy, not after a commit | The unit is uncommitted and the user has not asked for commits. A temp dir with node_modules symlinked exercises the same code with no git checkout, so the earlier "checkout discards the fix" trap cannot occur. |
| No commits | Outside the goal's scope and not requested. Both repos are left with uncommitted changes. |
Gotchas & Fixes
| Problem | Root Cause | Fix |
|---|---|---|
Round-1 reviewers had to skip README, the ADR and tsconfig.json |
Unchanged files were not materialized | Added under after/ for round 2; README and ADR confirmed free of header-carrier wording |
| A five-part exact-text edit of the devlog was rejected whole | One target read "a non-OK device-code response" where the file says "non-OK device-code response" | Re-applied the three affected lines by LINE:HASH anchor |
_code_review/ still held the morning audit's patches |
Scratch from the previous loop was never cleared | Moved to _rounds-1-5-stale/; the morning's ledger is carried forward in the brief |
goal_complete rejected the first completion summary |
Negated phrasing about an out-of-scope leftover ("NOT DONE: commits") is read as incompleteness | Same facts rephrased affirmatively; accepted |
Files Changed
| File | Change Summary |
|---|---|
index.ts |
ProviderStreams import removed; catalogTier: tier, written directly. Unit total: +20 −36 |
tests/index.test.mjs |
100-poll runaway guard in the driveLogin mock; the untiered assertion is .catalogTier === undefined |
tests/AGENTS.md |
Five-of-six wording; the 100-poll guard contract and why no test timeout can fire |
docs/devlog/20261125-architecture-review-tier-property-and-login-clock_log.md |
Export wording, diff counts, five-vs-six wording, decision row |
docs/devlog/20261125-finish-audit-architecture-review-unit_log.md, docs/devlog/INDEX.md, AGENTS.md |
This log, its index row, the refreshed session-log window |
agent-wikis: pi/gotchas/pi-device-code-login-dialog.md, pi/INDEX.md, pi/log.md |
Poll cap added to the injected-clock recipe; summary and action log |
_code_review/ (gitignored) |
Round briefs with the cumulative ledger (24 items), patches, snapshots |
Open Items & Next Steps
- Committed in the closeout:
cb5aecf(carrier move, with the audit's dead-import and explicit-property fixes) and544af1e(clock seam and tests, with the runaway guard), each gated on its own tree; this log and its index rows follow in adocs:commit.agent-wikis:27b6aa8(review, audit and distill learnings; that repo has no remote, so nothing to push there). - The six poll-loop mutations re-run against the final files after the
driveLoginguard (fresh scratch copy; each mutation asserted to apply exactly once): each fails exactly its own test (1 fail / 24 pass, baseline 25/25); the repo file was untouched. - Abort-during-sleep in
loginremains untested (security reviewer, both rounds; not introduced by this unit).
Log written by write-log skill