Skip to content

test: match generated/ at any depth in the deprecated-path guard - #250

Merged
thecodedrift merged 1 commit into
mainfrom
fix/245-generated-at-any-depth
Sep 2, 2026
Merged

test: match generated/ at any depth in the deprecated-path guard#250
thecodedrift merged 1 commit into
mainfrom
fix/245-generated-at-any-depth

Conversation

@thecodedrift

Copy link
Copy Markdown
Member

typeScriptSources in packages/cli/test/api-deprecated-paths.test.ts excluded only a top-level src/generated:

(file) => !relative(directory, file).startsWith(`generated${sep}`)   // before
(file) => !relative(directory, file).split(sep).includes("generated") // after

The hand-rolled recursion this replaced (in #243) skipped a generated directory at any depth. The narrowing was incidental to that cleanup, not intended, and the exclusion's own rationale — a generated directory is the schema's transcript, not a call site — is about what such a directory is, which does not depend on where it sits.

Verified in three states, not two

A no-op today, since exactly one generated directory exists. So the interesting question is whether the change does what it claims and whether it costs the guard anything. With a planted packages/cli/src/rules/generated/probe.ts naming /cli/api/rule/{ruleId}/restore:

State Result
before the fix, nested generated/ present failsrules/generated/probe.ts references /cli/api/rule
after the fix, nested generated/ present passes
after the fix, probe moved OUTSIDE generated/ fails — still caught

The third row is the one worth running. Widening an exclusion is how a guard quietly stops guarding, and a change that only demonstrates the new silence has not shown it kept the noise it needs.

Probes removed; the only file changed is the test.

Checks

pnpm typecheck, pnpm lint, and the full suite (1180 passed) all clean.

Fixes #245

`typeScriptSources` excluded a top-level `src/generated` only. The hand-rolled
recursion it replaced skipped a `generated` directory at any depth, and the
narrowing was incidental to that cleanup rather than intended.

A no-op today, since one such directory exists. The failure direction was safe
but useless: a nested generated directory would have reported every deprecated
path in its transcript as a false offender, which is loud and wrong rather than
quiet and wrong.

Proved in three states rather than reasoned about. With a nested
`src/rules/generated/probe.ts` naming a deprecated path: before the change the
guard reports it as an offender, after the change it does not, and a probe
placed OUTSIDE a generated directory is still caught. That third state is the
one worth running, since widening an exclusion is how a guard goes blind.
@thecodedrift thecodedrift reopened this Sep 2, 2026
@thecodedrift
thecodedrift merged commit 0a9c8b9 into main Sep 2, 2026
14 of 15 checks passed
@thecodedrift
thecodedrift deleted the fix/245-generated-at-any-depth branch September 2, 2026 19:56
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.

test: match generated/ at any depth in api-deprecated-paths

1 participant