Commit f8ec36f
committed
fix(tooling): docs-drift stops flagging docs for tests-only changes
`affected-docs.mjs` derived changed-package roots from every file under `packages/`,
including tests. A test observes behaviour rather than defining it, so it cannot make an
implementation-accuracy doc stale — yet every tests-only PR lit up its packages' whole
doc set. Three in a row did it: #4064 and #4078 each flagged 6 `packages/services` docs
for a diff containing no production code, and one before them the same way.
This is the one place the mapper's deliberate over-inclusion actively hurt. The script's
own header says over-inclusion is preferred to misses, and for real code that is right —
the periodic full audit is the backstop. But a category that is ALWAYS false is
different: a reader who learns the comment is noise stops reading it, and then it fails
on the PR where it is correct. Precision matters here for the same reason a flaky test
is worse than no test.
- Test files are dropped before the package roots are derived: `*.test.*` / `*.spec.*`
at any depth (so `.integration.test.ts` and `.conformance.test.ts` are covered) plus
anything under `__tests__` / `__mocks__` / `__fixtures__`.
- The narrowing is NOT silent. The excluded count rides the summary line and
`testFilesSkipped` in `--json` — a tool that quietly narrows its own scope reads as
"nothing to see here" when it means "I did not look".
- `--self-test` pins the matcher, following `check-error-code-casing` /
`check-route-envelope`, and the drift workflow runs it before computing the mapping so
a regression fails loudly instead of emptying the comment.
Verified against real history rather than by inspection:
- `46e86bad` (#4078, tests only) → 0 docs, was 6, reporting `1 test file(s) excluded`
- `4965bfac` (#4059, engine.ts + formula) → the same 11 docs as before, `1` skipped
- `--all` unchanged at 178 docs
The self-test earns its place too: swapping the anchored match for a naive
`path.includes('test')` fails 7 cases, among them `control-flow.zod.ts` and `latest.ts`
being swallowed as tests — the direction that would turn this optimisation into a miss.
Tooling only; empty changeset since nothing releases.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QoA8AV99Ss1RRkLLAYmDzq1 parent 2af1988 commit f8ec36f
4 files changed
Lines changed: 134 additions & 4 deletions
File tree
- .changeset
- .github/workflows
- scripts/docs-audit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
31 | 44 | | |
32 | 45 | | |
33 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
18 | 27 | | |
19 | 28 | | |
20 | 29 | | |
| |||
26 | 35 | | |
27 | 36 | | |
28 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
29 | 44 | | |
30 | 45 | | |
31 | 46 | | |
| |||
61 | 76 | | |
62 | 77 | | |
63 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
64 | 132 | | |
65 | 133 | | |
66 | | - | |
| 134 | + | |
| 135 | + | |
67 | 136 | | |
68 | 137 | | |
69 | 138 | | |
| |||
91 | 160 | | |
92 | 161 | | |
93 | 162 | | |
94 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
95 | 177 | | |
96 | | - | |
| 178 | + | |
97 | 179 | | |
98 | | - | |
| 180 | + | |
99 | 181 | | |
100 | 182 | | |
101 | 183 | | |
| |||
0 commit comments