fix(core): harden the dead-code cache key against version and input-list drift#1056
Merged
Merged
Conversation
…ist drift Addresses the two review findings on #1053: the fingerprint's extension and manifest lists are now imported from a new dependency-free deslop-js/analyzed-inputs subpath (single source of truth with the analyzer's own readers — the hand-copies were already missing ng-package.json and pnpm-workspace.yml), and the core package version joins the key so an upgrade invalidates post-processed cached diagnostics. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
commit: |
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.
Why
Follow-up to #1053, addressing both review findings:
ng-package.json, whoselib.entryFilefeeds Angular entry discovery, andpnpm-workspace.yml).checkDeadCode's post-processing (message text, toolchain-dependency filtering), so upgrading react-doctor with an unchanged tree could replay stale-shaped findings.What changed
deslop-js/analyzed-inputssubpath:DEFAULT_EXTENSIONS(already the single source its walk uses) andANALYZED_MANIFEST_FILENAMES(assembled from constants its own readers now consume — the workspace/lockfile/monorepo-marker lists were consolidated intoconstants.tsso the export can't drift from usage either). A dedicated entry matters: deslop's root export top-level-importstypescript/oxc-parser/oxc-resolver, which the in-process cache module must never load (verified: 162-byte entry, stays external in core's and the CLI's bundles).knip.json, read core-side for entry/ignore patterns;deno.lockas an extra installed-metadata proxy).CORE_PACKAGE_VERSION(build-time-injected from core's package.json, mirroring the CLI'sVERSIONmechanism; verified inlined as0.6.3in both dists) joins the cache key.DEAD_CODE_CACHE_SCHEMA_VERSIONdeliberately not bumped — it stays reserved for cache-format changes; both drift classes are now closed structurally.Test plan
packages/core: 1162 passed (baseline 1158; +4 — core-version key sensitivity, per-extension and per-manifest fingerprint loops over the imported lists, and a reviewed-set snapshot so a widened deslop list lands as a conscious choice). deslop-js suite (node --import tsx --test): 489 passed, before and after. Root typecheck + lint + vp fmt clean.unused-filefinding exactly.🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to cache key composition and a dependency-free deslop subpath export; behavior on cache miss is unchanged and tests cover invalidation paths.
Overview
Hardens whole-project dead-code cache invalidation so stale diagnostics are not replayed after react-doctor or deslop upgrades, or when analyzer input coverage grows.
The cache key now includes
CORE_PACKAGE_VERSION(inlined at core build time), because stored entries reflect core post-processing (messages, toolchain filtering), not raw deslop output.DEAD_CODE_CACHE_SCHEMA_VERSIONis unchanged — reserved for on-disk format changes only.Fingerprint extension and manifest name sets are no longer duplicated in core: they come from a new lightweight
deslop-js/analyzed-inputsexport (DEFAULT_EXTENSIONS,ANALYZED_MANIFEST_FILENAMES), built from the sameconstants.tslists deslop readers use. Core still fingerprintsknip.jsonanddeno.lockon its side. In deslop-js, workspace/lockfile/monorepo marker lists were centralized inconstants.ts(closing prior gaps such asng-package.jsonandpnpm-workspace.ymlin the old copy).Tests add core-version key sensitivity, loops over imported extension/manifest sets, and snapshot assertions so widening deslop inputs is an explicit review step.
Reviewed by Cursor Bugbot for commit 00e045f. Bugbot is set up for automated code reviews on this repo. Configure here.