docs(architecture): document how the six packages connect - #72
Merged
Conversation
Each src/ package had a spec doc under docs/gate/ describing one hop; nobody owned the chain. docs/architecture.md now does: a mermaid flowchart LR with the governing contract on every edge, a package table (responsibility, entry point, contracts read/written, spec doc), an artifact table marking each produced file committed or gitignored, a real-vs-stubbed section linking a live issue per stub, and the invariants with the code that enforces them. Derived from the code at 6ad7151, not from sibling docs. Two findings the existing prose does not reflect, recorded as the diagram's dashed edges: - Nothing outside src/cache/ and tests/ imports the cache package, so the authoritative write-time boundary (writeCacheRow) is never called by the pipeline. The pool_eligible flag on a bundle row comes from the compiler's own pre-check instead. - The runner consumes CompiledProgram, a different shape from the compiler's CompiledTrajectoryBundle, and no adapter exists; gate:matrix loads a hand-written fixture. Both are issue #52. Where DEVELOPMENT.md and contracts/README.md disagree with the code on these two hops, the disagreement is recorded in Open questions rather than silently resolved or edited away. npm run lint:docs does not exist yet (#53), so the doc was checked with npm run ci, npm run test:canary, a path-existence sweep over every repo path it names, and a real mermaid 11 render of the diagram. Closes #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #55.
Adds
docs/architecture.md— the document that owns the chain between the sixsrc/packages. Thedocs/gate/*.mdspecs each describe one hop; this one describes what hands what to whom, under which contract, and where the chain is not connected yet.Derived from the code at
6ad7151, not from sibling docs.What's in it
flowchart LR— testbed → recorder →trajectory.json→ compiler → bundle → cache write (pool/tenant split) → runner replay → repair → metrics NDJSON → gate report, with the governing contract on every edge.experiments/gate-v1/).no_dataover invented rates, and the harness staying throwaway.The diagram draws these as dashed red edges rather than pretending the chain is whole:
src/cache/andtests/imports the cache package — sowriteCacheRow, the authoritative write-time privacy boundary, is never called by the pipeline. Thepool_eligibleflag on a bundle row comes from the compiler's own pre-check (src/compiler/pool.ts). Both fail closed and the compiler's doc honestly calls itself a pre-check — but today nothing calls the authority.CompiledProgram(src/runner/types.ts), a different shape fromCompiledTrajectoryBundle, and no adapter exists.npm run gate:matrixloads a hand-writtenexperiments/gate-v1/fixtures/compiled-program.jsoninstead.Both close with #52. Every hop is unit-tested; the seams between them are not.
Per the issue's constraint, I recorded rather than resolved the resulting doc conflicts — no sibling doc was edited:
DEVELOPMENT.md"The data flow" showscache write (fail-closed)as a step in the chain, and its layout table sayscache-row.schema.json — compiler + cache write, runner reads.contracts/README.mdlistscache-row.schema.jsonas read by "B4" (the runner) — true by shape, false by wiring.Whether those are describing intent or are stale is the owners' call, so both are in Open questions.
Stub → issue mapping
Every stub links a live issue:
StubRepairModelClient→ #27 ·cost_freshzeros → #39 ·run-matrix.tsexit-2 → #62 · placeholderversions.json→ #26 · cache read path/persistence → #63 · confidence updates → #64 · both unwired hops → #52 · missing cache hit-rate metric → #67.How this was verified
npm run lint:docsdoes not exist yet — it is #53, already flagged inDEVELOPMENT.md's own open questions. The issue's stated test could not be run, so I substituted stronger checks and noted this in the doc:npm run cinpm run test:canaryexperiments/gate-v1/out/*, which are gitignored generated output and correctly described as suchfile:linereferencesed -noutputRENDER_OK, 14 nodes / 14 edges, zero console errors, andlinkStyle 4/7confirmed to land on the two dashed edgesgate:matrix -- --dry-run+gate:reportand diffed the produced file list against the table; also confirmednpm run compileleaves the committed bundle byte-identicalno_dataon exactly the four with no denominatorFrontmatter matches the CONTRIBUTING standard (
doc_type: spec) and the doc ends with## Open questions / what I could not verify.docs/README.mdindex row added under Start here.The test the doc exists for
There is a Reading the diagram subsection directly under the mermaid block that answers exactly that question in one paragraph, naming the CLI that writes it, the default output path, and the single reader.
Follow-up (not in this PR)
npm run lint:docsagainst this doc and add it to the check table.DEVELOPMENT.md/contracts/README.mdconflicts above need an owner's adjudication — they are deliberately untouched here.🤖 Generated with Claude Code