From 77adc9a60c3396e0797c1664ed6418b0c014c435 Mon Sep 17 00:00:00 2001 From: Jakob Heuser Date: Wed, 2 Sep 2026 12:41:21 -0700 Subject: [PATCH] test: match generated/ at any depth in the deprecated-path guard `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. --- .changeset/generated-at-any-depth.md | 11 +++++++++++ packages/cli/test/api-deprecated-paths.test.ts | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .changeset/generated-at-any-depth.md diff --git a/.changeset/generated-at-any-depth.md b/.changeset/generated-at-any-depth.md new file mode 100644 index 00000000..0440245c --- /dev/null +++ b/.changeset/generated-at-any-depth.md @@ -0,0 +1,11 @@ +--- +"@taskless/cli": patch +--- + +The deprecated-path guard now skips `generated/` at any depth. + +`typeScriptSources` excluded only a top-level `src/generated`, so a nested +generated directory would have had every deprecated path in its transcript +reported as a call site. The exclusion exists because a generated directory is +the schema's own transcript rather than a call site, and that reasoning does not +depend on how deep it sits. diff --git a/packages/cli/test/api-deprecated-paths.test.ts b/packages/cli/test/api-deprecated-paths.test.ts index 61fcffa0..be97e040 100644 --- a/packages/cli/test/api-deprecated-paths.test.ts +++ b/packages/cli/test/api-deprecated-paths.test.ts @@ -58,8 +58,12 @@ async function typeScriptSources(directory: string): Promise { .map((entry) => join(entry.parentPath, entry.name)) .filter( // `generated/` is the schema's own transcript: it necessarily names every - // path, deprecated ones included, and is not a call site. - (file) => !relative(directory, file).startsWith(`generated${sep}`) + // path, deprecated ones included, and is not a call site. Matched at any + // depth, because that reasoning is about what a generated directory IS + // and does not depend on where it sits. `startsWith` reached only a + // top-level `src/generated`, which is a no-op today and would have + // reported a nested one as a wall of false offenders. + (file) => !relative(directory, file).split(sep).includes("generated") ); }