-
Notifications
You must be signed in to change notification settings - Fork 39
chore(deadcode): fix dead-code ratchet — remove unused devDeps + rebaseline knip (#607) #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b317776
b42f0b9
d0eb13d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "count": 78, | ||
| "comment": "Dead-code ratchet baseline for issue #282 (cairn MVG gate #6). This is the knip issue count at the time the gate was introduced — pre-existing unused exports/types that are out of scope to remove in the gate PR. The ratchet (scripts/check-deadcode-ratchet.mjs) fails the build only if the count rises above this number. When dead code is removed and the count drops, lower this value in the same PR to lock in the gain. Per-category false positives belong in knip.json, not here." | ||
| "count": 85, | ||
| "comment": "Dead-code ratchet baseline for issue #282 (cairn MVG gate #6). The ratchet (scripts/check-deadcode-ratchet.mjs) reads only `count` and fails the build only if the current knip issue count rises above it; when dead code is removed and the count drops, lower this value in the same PR to lock in the gain. Suppress false positives in knip.json — via ignore/ignoreDependencies, or by declaring the workspace so its entry points are reachable — never absorb them into this baseline. The remaining 85 are pre-existing unused exports and types, tracked in #682." | ||
| } | ||
| Original file line number | Diff line number | Diff line change | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,7 +20,11 @@ | ||||||||||||||||
| "docs": { | |||||||||||||||||
| "entry": ["astro.config.mjs", "src/content.config.ts", "src/components/**/*.astro"], | |||||||||||||||||
| "project": ["src/**/*.{astro,ts,tsx}"], | |||||||||||||||||
| "ignoreDependencies": ["@astrojs/check", "remark-gfm", "@pagefind/default-ui", "jest"] | |||||||||||||||||
| "ignoreDependencies": ["@astrojs/check", "markdown-link-check", "remark-gfm", "@pagefind/default-ui", "jest"] | |||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
knip flags all three only because I verified the fix. Adding "ignore": [
".semgrep/**",
"scripts/**",
"integrations/**"
]drops the count from 88 to 85, with Worth doing rather than deferring: the baseline is the durable artifact every future dead-code PR ratchets against, so 3 phantom findings embedded now are 3 that can never be cleaned up, and they push the "driven to zero" flip-to-blocking milestone permanently out of reach.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done — but as a scoped knip workspace entry rather than a blanket Verified locally:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @theagenticguy Landed as the scoped workspace you flagged as arguably better (not a blanket
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @theagenticguy Landed as the scoped workspace you flagged as arguably better (not a blanket |
|||||||||||||||||
| }, | |||||||||||||||||
| "integrations/jira-forge-app": { | |||||||||||||||||
| "entry": ["src/index.js!", "test/**/*.test.js"], | |||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the right fix, and better than the blanket
That third row is the one that matters most: a hardcoded Two nits, neither blocking:
For the record, I also chased down (and refuted) a concern that this entry makes the count install-dependent, since this directory is npm-managed and absent from root
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @isadeks Both nits applied in 950a9ce. (1) |
|||||||||||||||||
| "project": ["src/**/*.js!", "test/**/*.js"] | |||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (non-blocking) — this is inert as shipped, and my prior nit that asked for it was wrong. Credit to you for applying it in good faith. I asked for The real cause is knip's Node.js plugin. Because That last glob makes everything under
So the glob only bites if the The only thing worth fixing is the rationale in the commit message and PR description — " For the record, the rest of this entry re-verified clean at |
|||||||||||||||||
| } | |||||||||||||||||
| } | |||||||||||||||||
| } | |||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,9 +49,13 @@ const baselinePath = join(repoRoot, 'knip-baseline.json'); | |
| // array-of-arrays (one inner array per duplicate group), so its `.length` | ||
| // counts groups, which is the unit we ratchet on. | ||
| // | ||
| // This is the complete set of countable keys for the installed knip (6.20.0, | ||
| // pinned exactly). There is no `nsExports`/`nsTypes`/`classMembers` in this | ||
| // schema — namespace/enum members surface as `namespaceMembers`/`enumMembers`. | ||
| // This is the complete set of countable keys for the installed knip (6.23.0, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verified: root Worth calling out what this comment protects, since it reads as boilerplate but isn't. I could not verify offline that 6.23.0 still surfaces namespace/enum members as
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @isadeks Corrected the stale pin in 950a9ce: the docstring now reads "installed knip (6.23.0, pinned exactly)" to match root
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (non-blocking, pre-existing — but inside the block you just edited). The version bump to The next sentence (line 53-54) does not, and it is now stated about 6.23.0 rather than 6.20.0:
They are not missing from the schema — they are default-excluded: Why this is only a nit: the ratchet invokes knip with no Why it is still worth a line: this comment's explicit job is to be re-derived on a knip bump, and it currently tells that reader those keys cannot exist. If anyone later enables them ( // `nsExports`/`nsTypes` also exist in this schema but are default-excluded by
// knip, so they never appear in our JSON; add them here if that ever changes.
// There is no `classMembers` — namespace/enum members surface as
// `namespaceMembers`/`enumMembers`.Separately, on the earlier thread: I can now confirm offline what I previously could not, from the installed 6.23.0 — |
||
| // pinned exactly). `nsExports`/`nsTypes` also exist in this schema but are | ||
| // default-excluded by knip, so they never appear in our JSON; add them here if | ||
| // that ever changes — otherwise the reporter would emit findings COUNTED_KEYS | ||
| // silently drops, an under-count in the one direction this gate exists to | ||
| // catch. There is no `classMembers` — namespace/enum members surface as | ||
| // `namespaceMembers`/`enumMembers`. | ||
| // If knip is bumped, re-derive this list from its JSON (the countIssues guard | ||
| // below will fail loud if the top-level shape changes). | ||
| const COUNTED_KEYS = [ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both durability nits confirmed FIXED. Reading the prose as shipped at
950a9ce9:(44)/(41)split is gone — it now reads "pre-existing unused exports and types, tracked in chore(deadcode): ratchet down the 85 pre-existing unused exports/types (follow-up to #607) #682", withcountas the only number. That was the point:check-deadcode-ratchet.mjs:117reads.countand nothing else, so any breakdown here is decoration that rots the moment chore(deadcode): ratchet down the 85 pre-existing unused exports/types (follow-up to #607) #682 removes one export. It also now agrees with chore(deadcode): ratchet down the 85 pre-existing unused exports/types (follow-up to #607) #682, whose title independently tracks 85.ignore/ignoreDependencies, or by declaring the workspace so its entry points are reachable" — which is what landed, and is the case the next person will hit.The "never absorb them into this baseline" phrasing is a genuine improvement on the original — it states the rule as a prohibition rather than a preference, which is the right register for the one file whose job is to stay durable.
I also re-confirmed @theagenticguy's second blocking ask stays fixed here: no "plus the local ambient declaration" clause, no "fixture files" mischaracterisation of live Forge source, and the underlying v1-decl-over-v2 runtime bug is filed as #683 (
bug/infra-cdk/security) rather than being documented as policy. Right disposition — that bug predates this PR and fixing it here would have been scope creep.And the number itself: I re-derived
85from scratch against the pinned knip 6.23.0 at this head rather than trusting my prior read, since the head moved. It reproduces, and CI athead_sha 950a9ce9…prints✅ Dead-code count holding at baseline (85).