Repository navigation
test: name the schema build step before tsc runs and register a helper's kind argument as data - #456
Merged
Merged
Conversation
Contributor
File size check0 over a hard cap (fails), 34 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 5 managed file(s) skipped; repo-platform owns them. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused test-infrastructure changes are internally consistent and cover the reported regressions.
Review effort: Balanced
Findings: None
What changed in this PR
Improves test diagnostics for missing generated schemas and prevents vocabulary literals from being mistaken for refusal messages.
Changes:
- Adds a shared missing-schema error helper.
- Detects schema imports before compiling documentation examples.
- Classifies literals using local function parameter types.
| File | Description |
|---|---|
test/settings-schema.ts |
Centralizes missing-schema errors. |
test/docs/library-examples.test.ts |
Adds schema preflight detection and coverage. |
test/sections/refusal-messages.test.ts |
Adds typed-parameter vocabulary classification and controls. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…r's kind argument as data The library-examples test rewrote the page's schema subpath import to lib/settings.schema.json, a built and ignored artifact, so a clean checkout failed with TS2307 against the page line, which reads as a docs defect. The generator only writes into the tree, so the test cannot build the schema elsewhere; compileExamples now checks, before tsc and only when the program imports the schema path, that the file exists, and rejects with the one line readSettingsSchema already uses: lib/settings.schema.json is not built; run bun run build:schema. The line is minted once in test/settings-schema.ts. Every other test reads the schema through readSettingsSchema and already failed closed. The refusal-messages scanner read a bare string argument of a local helper in a schema slice or shared helper as a message unless the DATA_ARGUMENTS registry named the position, so a kind tag such as "knobbed" passed to the minting helpers needed a line-end pin, and the kinds were carried in a table to avoid it. The registry now names the kind parameter of wrappedList and knobbedList, and takes over commitMessageFamily's two key names and githubName's noun from PIECE_ARGUMENTS, where their containment pins held wherever any test spelled the key or the word. The real census drops those six key-name and noun literals and nothing else. One planted row holds the control: knobbedList(entry, "knobbed", shape) reports "knobbed" on main and is silent here.
Vivswan
force-pushed
the
test/infra-prerequisites
branch
from
October 5, 2026 05:15
9314ba1 to
d68afbc
Compare
Vivswan
marked this pull request as ready for review
October 5, 2026 05:43
Vivswan
added a commit
that referenced
this pull request
Oct 5, 2026
The library-examples test gained, in #456, an existsSync check before tsc ran: when a fence imported the package's settings.schema.json subpath and lib/settings.schema.json was absent, compileExamples rejected with a line naming bun run build:schema, through a textual import scan (importsModule) and a shared mint (schemaNotBuilt) in test/settings-schema.ts. The owner's rule: do not write a check or guard for something that fails on its own. A missing build output, a missing package, a wrong toolchain surface as failures when they happen and are fixed then; a pre-check that restates a failure the tool already produces is deleted. tsc's own TS2307 against the page line is that failure, so both files return to their content before #456. The refusal-messages registry rows and planted row from #456 stay. The same rule removes two more pre-checks of the same class: readSettingsSchema's own existsSync check and not-built message (readFileSync's ENOENT names the path) and refusalSources' existsSync check and census message (read() raises the same ENOENT, and the gone-source control asserts it). Every other existsSync under test/ and .github/scripts/ chooses a path, skips an optional input, or is the test's own assertion, and stays.
Vivswan
added a commit
that referenced
this pull request
Oct 5, 2026
The library-examples test gained, in #456, an existsSync check before tsc ran: when a fence imported the package's settings.schema.json subpath and lib/settings.schema.json was absent, compileExamples rejected with a line naming bun run build:schema, through a textual import scan (importsModule) and a shared mint (schemaNotBuilt) in test/settings-schema.ts. The owner's rule: do not write a check or guard for something that fails on its own. A missing build output, a missing package, a wrong toolchain surface as failures when they happen and are fixed then; a pre-check that restates a failure the tool already produces is deleted. tsc's own TS2307 against the page line is that failure, so both files return to their content before #456. The refusal-messages registry rows and planted row from #456 stay. The same rule removes two more pre-checks of the same class: readSettingsSchema's own existsSync check and not-built message (readFileSync's ENOENT names the path) and refusalSources' existsSync check and census message (read() raises the same ENOENT, and the gone-source control asserts it). Every other existsSync under test/ and .github/scripts/ chooses a path, skips an optional input, or is the test's own assertion, and stays.
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.
Before
Clean checkout,
bun test test/docs/library-examples.test.ts:Scanner:
knobbedList(entry, "knobbed", shape)in a helper reported"knobbed"as an unpinned message.After
Same checkout,
lib/absent:After
bun run build:schema: 5 pass. Scanner: the planted call is silent, the message beside it still reports.How
compileExampleschecks the file before tsc, only when a fence imports the schema path.schemaNotBuilt()intest/settings-schema.ts, whichreadSettingsSchema()already used.DATA_ARGUMENTSnames the kind parameter ofwrappedListandknobbedList, and takescommitMessageFamily's key names andgithubName's noun fromPIECE_ARGUMENTS.Proof
tsc -p .,biome check,knip: clean.mv lib lib.bak, run, restore. Output above.Technical details
Line accounting (
git diff --numstat origin/main...HEAD): +116 / -48schemaNotBuilt()mintThe six dropped literals:
commitMessageFamily("squash_merge_commit_title", "squash_merge_commit_message"),commitMessageFamily("merge_commit_title", "merge_commit_message"),githubName("secret"),githubName("variable"). A key or noun that renders inside a message is data: a containment pin on it holds wherever a test spells the key.The earlier form of this PR carried a typed-parameter resolver (read the callee's parameter type to decide message or vocabulary). The lead gate blocked it on size: 114 lines for the same 255 / 88 census, and a guarantee resting on partial type interpretation. Deleted in favour of the audited registry.
Recorded, not built:
importsModulemisses an import with an inline comment betweenfromand the path, and accepts animport "..."inside a template literal. The page has neither.Files: test/settings-schema.ts, test/docs/library-examples.test.ts, test/sections/refusal-messages.test.ts