Repository navigation
chore(test): one generator registry behind build:check, one Io capture fake, one ROOT, conventions stated - #200
Conversation
File size check0 over a hard cap (fails), 7 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 4 managed file(s) skipped; repo-platform owns them. |
There was a problem hiding this comment.
🟢 Approval recommended
The generator gate and mechanical test-helper migrations are internally consistent and retain the existing assertions.
Pull request overview
Centralizes generated-output validation and shared test infrastructure while documenting repository conventions.
Changes:
- Adds a generator registry powering
build:check, including upstream-gap output. - Consolidates test I/O capture, temporary directories, and repository-root resolution.
- Updates conventions and migrates affected tests.
File summaries
| File | Description |
|---|---|
.github/scripts/generated.ts |
Adds the generated-output registry and drift gate. |
.github/scripts/gen-docs.ts |
Exports the coverage output path. |
.github/scripts/gen-gaps-index.ts |
Exports the gaps index path. |
package.json |
Routes build:check through the registry. |
AGENTS.md |
Updates generated-artifact guidance. |
CONTRIBUTING.md |
Documents code and test conventions. |
test/temp-dir.ts |
Adds shared temporary-directory helpers. |
test/root.ts |
Adds the shared repository root. |
test/io/capture.ts |
Adds the shared I/O capture fake. |
test/scripts/generated.test.ts |
Verifies registry completeness and wiring. |
test/scripts/gen-docs.test.ts |
Delegates page-set coverage to the registry test. |
test/scripts/gen-action-docs.test.ts |
Uses shared ROOT. |
test/scripts/graduate-upstream-gaps.test.ts |
Uses shared ROOT. |
test/scripts/release-pipeline.test.ts |
Uses shared ROOT. |
test/scripts/check-compat-markers.test.ts |
Adopts shared temp directories and ROOT. |
test/scripts/changed-sections.test.ts |
Adopts shared temp directories and ROOT. |
test/sections/graphql-queries.test.ts |
Uses shared ROOT. |
test/sections/docs-registry.test.ts |
Uses shared ROOT. |
test/report/delivery.test.ts |
Uses shared I/O capture. |
test/published-schema.test.ts |
Uses shared ROOT. |
test/library/public-surface.test.ts |
Uses shared ROOT. |
test/io/mask-pair.test.ts |
Uses shared I/O capture. |
test/flows/snapshot.test.ts |
Moves temp-directory lifetime into test bodies. |
test/flows/redact.test.ts |
Uses the unified ordered I/O event format. |
test/flows/multi.test.ts |
Uses shared I/O and temp-directory helpers. |
test/flows/merge.test.ts |
Uses per-test temporary directories. |
test/flows/layers.test.ts |
Uses per-test temporary directories. |
test/flows/execute.test.ts |
Uses shared ROOT and temp directories. |
test/flows/deliver.test.ts |
Uses the unified I/O event format. |
test/engine/snapshot.test.ts |
Uses shared I/O capture. |
test/engine/secrets.test.ts |
Uses shared I/O and silent fakes. |
test/engine/orchestrate.test.ts |
Uses shared I/O capture and mask hooks. |
test/e2e/schema.ts |
Uses shared ROOT for section scenarios. |
test/e2e/runner.ts |
Uses shared ROOT. |
test/e2e/openapi/validate.test.ts |
Uses the idiomatic null matcher. |
test/e2e/foundation.test.ts |
Uses shared ROOT for source scanning. |
test/docs/version-pins.ts |
Uses shared ROOT. |
test/docs/semantics.test.ts |
Uses shared ROOT. |
test/docs/readme.test.ts |
Uses shared ROOT. |
test/docs/post-green-workflow.test.ts |
Uses shared ROOT. |
test/docs/permissions.test.ts |
Uses shared ROOT. |
test/docs/npm-publish-workflows.test.ts |
Uses shared ROOT. |
test/docs/library-examples.test.ts |
Uses shared ROOT. |
test/docs/issue-templates.test.ts |
Uses shared ROOT. |
test/docs/guides.test.ts |
Uses shared ROOT. |
test/docs/e2e-nightly-workflow.test.ts |
Uses shared ROOT. |
test/docs/diagrams.test.ts |
Uses shared ROOT. |
test/docs/coverage.test.ts |
Uses shared ROOT. |
test/docs/ci-workflow.test.ts |
Uses shared ROOT. |
test/docs/checks-workflow.test.ts |
Uses shared ROOT. |
test/docs/checks-sections-gate.test.ts |
Uses shared ROOT. |
test/docs/biome-schema.test.ts |
Uses shared ROOT. |
test/cli/program.test.ts |
Adopts shared temp directories and ROOT. |
test/cli/io.test.ts |
Moves temporary working directories into test bodies. |
test/cli/init.test.ts |
Adopts shared temporary-directory helpers. |
test/cli/execution.test.ts |
Scopes action and CLI fixtures with withTempDir. |
test/architecture/architecture.test.ts |
Uses shared ROOT. |
test/action/run.test.ts |
Migrates merge and snapshot fixtures to shared helpers. |
test/action/io.test.ts |
Uses shared temp directories and ROOT. |
test/action/action-yml.test.ts |
Uses shared ROOT. |
src/sections/branches/branches.test.ts |
Uses shared I/O capture. |
src/sections/actions_secrets/actions_secrets.test.ts |
Uses shared I/O capture and mask timing. |
Review details
- Files reviewed: 62/62 changed files
- Comments generated: 0
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
The centralized helpers preserve existing assertions, and the new registry is comprehensively guarded against missing outputs and drift.
Review details
- Files reviewed: 63/63 changed files
- Comments generated: 0 new
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
5d7ae08 to
07b918c
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The centralized tooling preserves existing behavior and includes targeted drift and regression coverage.
Review details
- Files reviewed: 63/63 changed files
- Comments generated: 0 new
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
There was a problem hiding this comment.
🟢 Approval recommended
The registry runner and mechanical test-helper migrations are coherent, covered by focused controls, and introduce no unresolved defects.
Review details
- Files reviewed: 63/63 changed files
- Comments generated: 0 new
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
Before: package.json's build:check spelled ten generated paths by hand and never checked src/upstream-gaps/index.ts. After: .github/scripts/generated.ts derives GENERATED_OUTPUTS (path, generator, kind) from the generators' own registries; build:check runs every generator in the table and diffs every registered path, the gaps index included. - test/scripts/generated.test.ts pins the table against the tree: every tracked .md/.yml file carrying a BEGIN GENERATED marker is registered and vice versa, the two whole-file outputs are tracked with one writer each. - The hand-typed page list in gen-docs.test.ts goes; the tree scan is the pin.
Before: seven local captureIo/recordingIo/eventIo copies and six inline
`const io: Io = {...}` literals, each recording a different subset of the
port in its own format.
After: captureIo() records every channel into its own list and into one
ordered event log; the copies and literals are deleted, every assertion
kept (the event strings move to the one format: "annotate <level>: ...",
"log: ...", "mask: ...").
Before: twelve test files created temp directories in beforeEach or a scratch list and removed them in afterEach/afterAll hooks. After: test/temp-dir.ts exports withTempDir() (try/finally, removed on every exit path) and tempDirTest() (a test handed its own dir); the hooks are gone, and the helpers that read a shared `dir` take it as a parameter. CONTRIBUTING.md states the rule in one line.
Before: CONTRIBUTING.md called lib/settings.schema.json "the one committed generated artifact" and stated no line caps, test placement, or file-header rule. After: the committed generated output is the table in .github/scripts/generated.ts; a Code conventions section states the line caps (100 for code, 256 elsewhere, 10-line comment blocks), the one-line-per-paragraph markdown rule, the colocated-test rule, and the file-header convention; the Tests section names the shared fakes.
Before: 26 verbatim `const ROOT = join(import.meta.dir, "..", "..")` copies, a REPO_ROOT, a depth-one copy, and eight inline `join(import.meta.dir, "..", "..", ...)` spellings across test/. After: test/root.ts exports ROOT once; every repository-relative path in a test resolves from it. A file beside its test still resolves from import.meta.dir. On the way: toBe(null) -> toBeNull() in test/e2e/openapi/validate.test.ts.
…mp-dir rule as it holds Before: "comments, YAML, and prose stay under the fleet's 256-character cap"; "no afterEach or afterAll hook cleans up" a temp dir. After: the 256-character width cap is check-file-size's, over source, test, workflow, and shell lines; markdown prose has no width cap. Every temp dir is removed on every exit path, through the shared helpers or a try/finally of its own; the one suite-scoped fixture cleans in afterAll.
…dir), as its two siblings do
…r, and control the drift runner Before: the tree scan matched a line-anchored BEGIN marker; the grammar also admits an inline HTML marker (inputs.md's outputs-list), so an inline-only page could leave the table unnoticed. The runner's negative control was manual. After: generated-regions.ts exports hasGeneratedRegion(), the scan reads it, and unit controls pin the inline, non-comment, and block-scalar cases. A test clones HEAD to a temp dir: the clean clone passes the runner, and a staged stale byte in docs/reference/sections.md and in src/upstream-gaps/index.ts makes it exit 1 naming both.
…ot HEAD's Before: the temp clone ran HEAD's .github/scripts/generated.ts, so an uncommitted edit that broke the runner still passed the control. After: the working tree's .github/scripts is copied over the clone before each run; the postconditions exclude that copy and the node_modules link.
…ipeline fixture in the temp-dir rule
Before: tests +140 net; tempTest("long title", async (dir) => {...}) wrapped to three header lines because biome applies test-call formatting only to test/it; generated.test.ts carried shape checks the pin implies.
After: tests +0 net. One temp-dir shape, test("title", () => withTempDir(prefix, async (dir) => {...})); tempDirTest() deleted. generated.test.ts is the tree-scan pin and the two controls; generated.ts is the table and the runner; capture.ts builds its lists once.
…ries capture Before: the runner re-listed drifted paths in its own modified:/untracked: format; captureIo kept a summaries list no test read. After: git diff --exit-code --stat prints the drifted paths, ls-files prints an untracked one, and one error line follows; a failing ls-files fails the check. captureIo's summary channel lands in events only.
8f064a5 to
29c96a0
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The registry, drift controls, helper migrations, and documentation are internally consistent and adequately tested.
Review details
- Files reviewed: 62/62 changed files
- Comments generated: 0 new
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
Before / After
What changed
One registry of generated output drives
build:check, and the test suite shares one Io capture fake, one temp-dir shape, and oneROOTinstead of per-file copies.build:checknow gatessrc/upstream-gaps/index.tswith the schema, the docs regions, andaction.yml; on drift,git diff --statlists the stale files and the check exits 1.BEGIN GENERATEDmarker must be in the table, and vice versa; the test scans the tree through the shared marker grammar.Proof
bun run checkgreen (3426 tests); the drift runner has a negative control (a clean clone passes, staged stale bytes in a region file and a whole file exit 1 naming both);bun run build:lib && bun .github/scripts/package-smoke.tsok.Technical details
Per item
.github/scripts/generated.ts(75 lines) derivesGENERATED_OUTPUTS(path, generator, kind) fromPAGE_REGIONS,GENERATED_REGIONS, and the gapsINDEX_PATH; the runner runs every generator, thengit diff --exit-code --statandgit ls-files --othersover the registered paths (git's own output names the files; a failingls-filesfails the check).test/scripts/generated.test.ts(117) is one tree-scan pin plus two controls (marker grammar, clone drift runner)test/io/capture.ts(57)captureIo(onMask?): annotations, logs, outputs, masks, and one ordered event log (annotate <level>: ...,log: ...,summary: <first line>,output <name>=<value>,mask: <value>)const io: Io = {...}literals deleted; 10 importerstest("...", () => withTempDir("prefix-", async (dir) => {...}))fromtest/temp-dir.ts(20); helpers reading a shareddirtake it as a parametertest/root.ts(5)join(import.meta.dir, "..", "..", ...)spellings replaced; #199'sworkflow-loader.tscopy swept tooLine accounting (62 files, +2380 / -2276)
capture.ts57,temp-dir.ts20,root.ts5) andgenerated.test.ts(117) are paid for by the deleted fakes, literals, hooks, andROOTcopies;snapshot.test.ts+31 andrun.test.ts+20 are onewithTempDirline per temp-dir test (20 and 14) plus helpers returning the path they computegenerated.tsreplaces the 700-characterbuild:checkone-liner;generated-regions.ts+6 exportshasGeneratedRegion()Conventions stated: biome's 100 for code; the fleet's check-file-size 256 cap over source, test, workflow, and shell lines (markdown prose has no width cap); 10-line comment blocks; markdown one source line per item; section tests in
src/sections/<key>/, the rest undertest/mirroringsrc/; every temp dir removed on every exit path (withTempDir()or a try/finally; the release-pipeline fixture in afterAll and the e2e bundle on process exit are the suite-scoped exceptions).Small fixes on the way:
toBe(null)->toBeNull()and the onenew URL(...)sibling read ->join(import.meta.dir, ...)intest/e2e/openapi/validate.test.ts.Rebases: onto #201 (033a9c6), #204 (f1f938e), #199 (798fc42); each a pure replay except the hunks main's edits overlapped (deliver.test.ts and redact.test.ts event lists, the temp-dir files, the ROOT declarations), redone against main's text.
Codex rubber-duck review, 12 rounds: the branch (2), the gate-fix delta (3), each rebase's resolutions (3, all clean), the two trims (4; the last found the runner discarding
git ls-files' exit status, fixed). Every finding fixed in its round.Recorded, not built
src/and.github/scripts/(the rule is stated; the sweep is its own change).test/action/run.test.ts's module-leveltestIoliteral (40+ assertions read its mixed-format array).mkdtempSync+ try/finally sites towithTempDir().build:checkline, per-path single writer, inputs.md row count) are not implied by the pin.toHaveLength(0)vstoEqual([]).