Skip to content

fix(diff): judge unused in full when a manifest changed - #248

Merged
mokevnin merged 2 commits into
mainfrom
fix/diff-unused-in-full
Nov 19, 2026
Merged

mokevnin merged 2 commits into
mainfrom
fix/diff-unused-in-full

Conversation

@mokevnin

Copy link
Copy Markdown
Owner

Summary

unused takes 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 judges unused in full when a manifest changed and entry is set, and says so in diff.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 unused among the rules that read a manifest; its Consequences no longer say it stays judged by the change. docs/adoption.md and docs/configuration.md follow.

Evidence

  • Before: check --diff main after package.json drops @sveltejs/kit → Passed; after it drops main, bin and exports → Passed.
    After: both fail with unused on the files left unreachable (routes, hooks, params; lib.ts, cli.ts, x.ts), in_full names unused with package.json, and an old storage -> web violation on an unchanged line stays out.
  • A file left dead by removing its last import is still not reported under --diff (pinned by a new test).

Merge Danger

Door: two-way

Blast Radius: diff-runs

A diff run that changes a manifest with entry set now reports old unused violations the baseline does not cover, and in_full.keys can hold unused.

Closes #217

🤖 Generated with Claude Code

mokevnin and others added 2 commits November 18, 2026 23:02
`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>
@mokevnin
mokevnin merged commit 0c65ec0 into main Nov 19, 2026
12 checks passed
@mokevnin
mokevnin deleted the fix/diff-unused-in-full branch November 19, 2026 12:55
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.

--diff judges unused in full when a manifest changed

1 participant