Skip to content

test: let the unbuilt schema fail in tsc instead of a pre-check - #466

Merged
Vivswan merged 1 commit into
mainfrom
test/drop-schema-precheck
Oct 5, 2026
Merged

Vivswan merged 1 commit into
mainfrom
test/drop-schema-precheck

Conversation

@Vivswan

@Vivswan Vivswan commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Before

Clean checkout, lib/ absent, after #456:

$ bun test test/docs/library-examples.test.ts
error: lib/settings.schema.json is not built; run `bun run build:schema`
 4 pass  1 fail
$ bun test test/published-schema.test.ts
error: lib/settings.schema.json is not built; run `bun run build:schema`

Three existsSync pre-checks fired before the tool ran.

After

Same checkout:

$ bun test test/docs/library-examples.test.ts
+   "docs/reference/library.md:117: TS2307: Cannot find module '.../lib/settings.schema.json' ...",
 3 pass  1 fail
$ bun test test/published-schema.test.ts
ENOENT: no such file or directory, open '.../lib/settings.schema.json'

The tools' own failures, fixed by bun run build:schema when they happen. With lib/ built: 79 pass across the four touched test files.

How

  • Owner's rule: no check or guard for something that fails on its own. A pre-check restating a failure the tool already produces is deleted.
  • Item 1 of test: name the schema build step before tsc runs and register a helper's kind argument as data #456 rolled back: compileExamples back to tsc alone, importsModule and schemaNotBuilt() gone.
  • Same class: readSettingsSchema() and refusalSources() lose their existsSync checks; readFileSync raises ENOENT naming the path. The gone-source control asserts it.
  • Every other existsSync under test/ and .github/scripts/ does real work and stays. Census below.

Proof

  • tsc -p ., biome check, knip: clean.
  • Clean-checkout controls: mv lib lib.bak, run, restore. Output above.
  • Codex rubber-duck, two rounds: approve.
Technical details

Line accounting (git diff --numstat origin/main...HEAD): +12 / -86

File + - Kind
test/docs/library-examples.test.ts 8 63 pre-check, import scan, schema-path parameter, and its test row removed
test/settings-schema.ts 2 14 schemaNotBuilt() mint and the existsSync check removed
test/sections/refusal-messages.test.ts 2 9 refusalSources() existsSync check removed, control asserts ENOENT, unused import dropped

Deleted (each restated the failure the next call produces on its own):

Site Next call Its own failure
test/docs/library-examples.test.ts compileExamples (#456) tsc TS2307: Cannot find module .../lib/settings.schema.json at the page line
test/settings-schema.ts readSettingsSchema() readFileSync ENOENT ... open '.../lib/settings.schema.json'
test/sections/refusal-messages.test.ts refusalSources() readFileSync in read() ENOENT ... open '.../src/sections/<dir>/index.ts'

Kept (git grep -n existsSync test .github/scripts), with the reason:

Site Reason
.github/scripts/arch-lint.ts:219 chooses among candidate resolutions (.ts, index.ts); the throw after the loop names importer, specifier, and candidates
.github/scripts/release-pipeline.ts:286 selects which packaged paths exist to git add -f; an absent one is the carry check's finding by design
test/scripts/release-pipeline-fixture.ts:603 no pushes.log means no push attempted: optional input, returns []
test/e2e/runner.ts:332 optional snapshot file input
test/sections/docs-registry.test.ts:58, :61 resolves a relative import (directory to index.ts), then names the importer and specifier of a broken one; the later read in another iteration could not
test/docs/diagrams.test.ts:98; guides.test.ts:425 accumulates a missing-target diagnostic and continues the scan, where the readFileSync behind exportsSymbol() (diagrams.test.ts:27) or slugsOf() (guides.test.ts:402) would abort at the first ENOENT
test/docs/diagrams.test.ts:174; guides.test.ts:380; coverage.test.ts:31; sections/scenario-set.test.ts:50; schema-corpus.test.ts:47; scripts/graduate-upstream-gaps.test.ts:245 the test's own assertion or filter (a link or citation target exists, a scenario file is missing); no following call reads the path
test/flows/render.test.ts:174; flows/snapshot.test.ts:453, :919 case-insensitivity probes of the filesystem
test/docs/post-green-workflow.test.ts:695 and every expect(existsSync(...)) observed values and assertions

Files: test/docs/library-examples.test.ts, test/settings-schema.ts, test/sections/refusal-messages.test.ts

Copilot AI balanced review requested due to automatic review settings October 5, 2026 06:45
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

File size check

0 over a hard cap (fails), 34 warning(s).

File Size Tier Cap
.github/actions/setup/action.yml:7 169 chars warn 150
.github/scripts/gen-inputs-table.ts:54 11 comment lines warn 10
.github/scripts/generated.ts:28 191 chars warn 150
.github/scripts/release-pipeline.ts:7 156 chars warn 150
.github/scripts/release-pipeline.ts:456 151 chars warn 150
.github/scripts/release-pipeline.ts:1250 153 chars warn 150
.github/scripts/release-pipeline.ts:1 33 comment lines (header) warn 25
.github/scripts/release-pipeline.ts:452 14 comment lines warn 10
.github/workflows/post-green.yml:29 153 chars warn 150
.github/workflows/update-release-pr.yml:110 14 comment lines warn 10
docs/upgrading/v2-to-v3.md 1292 lines warn 1040
src/engine/layers.ts:75 157 chars warn 150
src/engine/layers.ts:95 167 chars warn 150
src/flows/settings-write.ts:137 159 chars warn 150
src/github/api-error.ts:104 159 chars warn 150
src/github/secret-scan.ts:45 11 comment lines warn 10
src/schema.ts:188 153 chars warn 150
src/schema.ts:199 176 chars warn 150
src/sections/contract/errors.ts:13 14 comment lines warn 10
src/sections/secret_scanning_custom_patterns/compilable-form.ts:382 161 chars warn 150
src/sections/shared/roles.ts:43 13 comment lines warn 10
src/sections/shared/schema-helpers.ts:15 153 chars warn 150
src/types.ts:16 156 chars warn 150
test/docs/guides.test.ts:451 155 chars warn 150
test/docs/nightly-workflows.test.ts:206 160 chars warn 150
test/e2e/constants.ts:9 197 chars warn 150
test/e2e/generators.ts 2634 lines warn 2560
test/e2e/generators.ts:1704 166 chars warn 150
test/e2e/generators.ts:1858 161 chars warn 150
test/e2e/generators.ts:1667 12 comment lines warn 10
test/engine/execute.test.ts:617 152 chars warn 150
test/flows/merge-parity.test.ts:63 164 chars warn 150
test/scripts/auto-fix-allowlist.test.ts:12 12 comment lines warn 10
test/sections/refusal-messages.test.ts:61 19 comment lines warn 10

Split the file, wrap the line, shorten or exempt the comment, or list the path in .file-size-allow.local with a # reason.

5 managed file(s) skipped; repo-platform owns them.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused rollback consistently removes the redundant pre-check without affecting built-schema behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Removes the redundant schema pre-check so TypeScript reports missing build output directly.

Changes:

  • Removes schema import detection and its dedicated test.
  • Simplifies schema error construction.
File Description
test/​docs/​library-examples.test.ts Lets tsc report a missing built schema.
test/​settings-schema.ts Removes the shared schema error helper.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 06:57
@Vivswan
Vivswan force-pushed the test/drop-schema-precheck branch from 2cf5045 to 1c2c5be Compare October 5, 2026 06:57
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
Vivswan force-pushed the test/drop-schema-precheck branch from 1c2c5be to c87025f Compare October 5, 2026 07:07
@Vivswan Vivswan changed the title test(docs): let the unbuilt schema fail in tsc instead of a pre-check test: let the unbuilt schema fail in tsc instead of a pre-check Oct 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused cleanup preserves failure visibility while removing redundant checks and obsolete tests.

Review effort: Balanced
Findings: None

@Vivswan
Vivswan marked this pull request as ready for review October 5, 2026 07:46
@Vivswan
Vivswan merged commit b0e61ba into main Oct 5, 2026
27 checks passed
@Vivswan
Vivswan deleted the test/drop-schema-precheck branch October 5, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants