Repository navigation
fix(lint): close three gates that passed what they exist to refuse - #600
Conversation
arch-lint dropped the bare relative specifiers. Its filter kept only a specifier with a slash, so an import of "." or ".." (a directory's index, which tsc and bun both resolve) drew no edge, and a forbidden cross-layer import passed. The filter now keeps every relative specifier. The rule-gate plugin guarded .refine() and .superRefine(), which src/ does not write, and not .check(), which it does. zod skips a function written inline in .check() once a nested value failed, exactly as it skips a bare refinement, so the plugin now refuses that form with the message the existing patterns give. A check passed by name or built by a helper is not followed. build:check never saw a generated region that no generator registers. Each generator re-renders only the regions in its own registry, so a region dropped from one kept its markers and went stale with the gate green. Each "regions" row of the generated-output table now carries the region names its generator registers, read from the registry, and the runner refuses a BEGIN marker in a registered page that names none of them, naming the page and the region, before any generator runs. The check sits in the runner because docs/reference/inputs.md is written by two generators, and only the table sees both registries. The marker scan now returns the names it finds, so the table test and the runner read one scan. _typos.toml loses the allow entry for DELETEing, a word no tracked file holds, and its look-alikes comment no longer names a file that does not hold the word.
File size check0 over a hard cap (fails), 6 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. |
Member shape check1 finding(s).
Add the blank lines, make the comment one line directly above the item, comment every field or none, or list the path in 4 generated file(s) skipped. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the changes strengthening architecture, refinement, and generated-region validation.
No open issues 🎉
What changed in this PR
Strengthens three validation gates in GitHub Settings as Code, closing gaps in architecture checks, schema-refinement linting, and generated-region ownership checks.
Changes:
- Includes bare
.and..imports in architecture enforcement. - Flags inline functions passed directly to
.check()so refinements userule(). - Rejects unregistered generated regions before generators run, accounting for files shared by multiple generators.
| File | Description |
|---|---|
test/scripts/generated.test.ts |
Tests region-name discovery and early rejection of unregistered HTML and YAML regions. |
test/scripts/arch-lint.test.ts |
Adds regression cases for bare directory imports. |
test/lint/rule-gate.test.ts |
Covers inline check functions and permitted wrapped or named checks. |
lint/rule-gate.grit |
Detects inline arrow and function expressions passed to .check(). |
.github/scripts/lib/generated-regions.ts |
Returns discovered region names using the shared marker grammar. |
.github/scripts/generated.ts |
Collects registered region names across generators and checks ownership before generation. |
.github/scripts/arch-lint.ts |
Recognizes bare . and .. as relative imports. |
_typos.toml |
Removes an unused spelling allowance and corrects a fixture-location comment. |
Review effort: Balanced
Before
Three planted violations, each through the gate's own command on
main. All three pass.After
The same three plants on this branch.
How
lint:arch.and..included.check()undersrc/handed an inline functionbuild:checkBEGIN GENERATEDmarker, in a file the generators own, that no generator registersoxc-parser, and the plugin is biome's own GritQL.Proof
mainfirst.lint,lint:arch, andbuild:checkstay green on the tree itself, so nothing committed today is newly refused.Technical details
.check()by name or built by a helper is not followed.test/scripts/generated.test.ts.docs/reference/inputs.mdis written by two generators (inputs-table,outputs-list), so one generator's loop cannot tell the other's region from an unregistered one.regionsrow ofGENERATED_OUTPUTScarries the region names its generator registers, read from the registry.hasGeneratedRegion()becameregionNames(), which returns the names it finds, and its four assertions intest/scripts/generated.test.tsnow compare names.[a-z0-9-]+is not a marker to the scan, as before.git grep -n -E "from ['\"]\.\.?['\"]" -- srcandgit grep -n -E "(import|require)\(['\"]\.\.?['\"]\)" -- srcprint nothing.git grep -h -E "from ['\"]\.\.?/" -- src | wc -lprints 1011.git grep -n -F '.check(' -- srcprints 31 lines, 30 calls and one comment, and the tightened plugin flags none of them (bun run lintexits 0).git grep -n -E "\.(superRefine|refine)\b" -- srcprints one line,rule()itself in the exempt file.git grep -h -o -E "BEGIN GENERATED: [a-z0-9-]+" -- '*.md' '*.yml' ':(exclude)test' | wc -lprints 14, in 10 files.build:docs 6, build:action-docs 7, build:inputs-table 1._typos.tomlheld 21 allow entries, 15 words and 6 patterns.git grep -l -E -e <entry> -- . ':(exclude)_typos.toml'finds 20 of them in a tracked file andDELETEingin none, so that entry is removed.alikessits intest/scripts/generated-regions.test.tsalone, so the comment no longer namestest/docs/guides.test.ts.git archive <ref> | tar -xinto a scratch directory, committed there withgit init, planted as shown, and run with the command shown.mainatfaf72dab, After is this branch.--reporter=githubgives the plugin's diagnostic as one line.bun run lintfails the same plant with the same message and exit code 1.tsc -p .exits 0 on both bare forms, and bun resolves each to the directory'sindex.ts.main, arch-lint: the two bare-form rows oftest/scripts/arch-lint.test.tsreceive[].main, plugin:test/lint/rule-gate.test.tsmisses its three new diagnostics.bun test test/scripts/{arch-lint,generated,generated-regions,auto-fix-steps,nightly-steps,gen-docs,gen-action-docs,gen-inputs-table}.test.ts test/lint/rule-gate.test.ts test/docs/coverage.test.ts.main, runner: the new case oftest/scripts/generated.test.tsreceives status 0 and "14 generated files match their generators"..github/scripts/{arch-lint.ts,generated.ts,lib/generated-regions.ts},lint/rule-gate.grit,test/scripts/{arch-lint,generated}.test.ts,test/lint/rule-gate.test.ts,_typos.toml.