Repository navigation
fix(diff): judge unused in full when a manifest changed - #248
Merged
Merged
Conversation
`unused` takes entries from manifests: what a package runs or exports and the files a framework it lists loads. A diff run that changed a manifest judged `unused` only by the change, so a file the edit left unreachable was dropped, its violation on an unchanged line. Now `unused` is judged in full too, and `diff.in_full` names it with the manifest, whether or not `manifests` and `packages` are on. ADR 0002 says so. Closes #217 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… for every manifest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
unusedtakes entries from manifests (what a package runs or exports, the files a framework it lists loads), so a manifest edit can leave a file unreachable without touching a line of it. A diff run now judgesunusedin full when a manifest changed andentryis set, and says so indiff.in_full.Diff::keeps(violation) changed line | config rule | policy delta | whole project | manifests in full && reads a manifest + | unused in full && violation.rule == unused"in_full": [ { "keys": ["manifests", "packages"], "reason": "package.json changed, …" }, // when manifests/packages on + { "keys": ["unused"], "reason": "package.json changed, so the `unused` rule was judged in full: it takes entries from manifests, so an edit to one can leave a file unreachable without touching it" } ]ADR 0002 now counts
unusedamong the rules that read a manifest; its Consequences no longer say it stays judged by the change.docs/adoption.mdanddocs/configuration.mdfollow.Evidence
check --diff mainafterpackage.jsondrops@sveltejs/kit→Passed; after it dropsmain,binandexports→Passed.After: both fail with
unusedon the files left unreachable (routes, hooks, params;lib.ts,cli.ts,x.ts),in_fullnamesunusedwithpackage.json, and an oldstorage -> webviolation on an unchanged line stays out.--diff(pinned by a new test).Merge Danger
Door: two-way
Blast Radius: diff-runs
A diff run that changes a manifest with
entryset now reports oldunusedviolations the baseline does not cover, andin_full.keyscan holdunused.Closes #217
🤖 Generated with Claude Code