Find dead code, prove it is dead, and see it on a map.
Most dead-code tools print a list and walk away. deadcode-map does three things they don't:
- Confidence + evidence, not a boolean. Every finding is graded
SAFE/REVIEW/KEEPand carries its evidence: 0 importers, 0 callers, last git touch, test coverage, string mentions. - The map is the product.
deadcode-map --mapwrites a single self-contained HTML file (no CDN, no server — open it by double-clicking). Dead nodes are red, review is amber, live is green. Click a node for why it was flagged, who doesn't call it, its git age, coverage, and the exact delete diff. - Prove, don't just list.
deadcode-map --provedeletes SAFE candidates in an isolated git worktree, runs your test suite once per file-cluster, and reportsproven/breaks/skipped. It bisects only if a cluster fails.
JS / TypeScript and Python in v1, one command, one mental model. Java (private-only) is supported too — see "Java scope" below.
A scan of umami (1,511 files, 5,184 imports) rendered with
deadcode-map <umami> --map umami-map.html: 36 SAFE, 71 REVIEW, 529 KEEP. Red nodes are SAFE —
provably dead; amber nodes are REVIEW — a human should look; grey nodes are
files. Drag to pan, scroll to zoom, click a node for its evidence and the
exact delete diff. The map is one self-contained HTML file: no CDN, no server,
open it by double-clicking.
npm install -g deadcode-map
# or, without installing:
npx deadcode-map [path]Requires Node.js 18+. The target repo needs no runtime: source is parsed with tree-sitter, never executed.
deadcode-mapRun it in your project directory. It prints every dead-code finding it found,
graded SAFE / REVIEW / KEEP.
To scan a different directory:
deadcode-map ./my-appdeadcode-map ./my-app --map deadcode-map.html # open the visual map in a browser
deadcode-map ./my-app --json report.json # machine-readable report
deadcode-map ./my-app --fix # delete SAFE findings only
deadcode-map ./my-app --prove # prove SAFE deletions with your tests
deadcode-map ./my-app --prove --test-command "pytest -q"
deadcode-map ./my-app --fail-on safe # CI: exit 1 on new SAFE dead code
deadcode-map ./my-app --baseline # hide grandfathered findings
deadcode-map ./my-app --update-baseline # record current findings as baseline
deadcode-map ./my-app --include-fixtures # also scan fixtures/ test-data dirs (excluded by default)
deadcode-map ./my-app --cache # cache per-file parses; repeat scans are several times faster
deadcode-map ./my-app --cache --cache-stats # show cache hit rate after the scan
deadcode-map ./my-app --cache --timing # show per-phase scan timings on stderr
deadcode-map ./my-app --no-cache # force a full scan, ignore the cache
deadcode-map mcp # start the MCP server on stdio (for AI tools)deadcode-map ships an MCP server (stdio) so AI coding tools can scan, explain, and safely clean up dead code in your repo. It exposes six tools — scan_repo, explain_finding, prove_safe, fix_safe, get_map, status — plus a cleanup-dead-code prompt and a deadcode://map/{path} resource serving the visual HTML map. fix_safe deletes SAFE findings only and refuses unless you pass confirm: true; it never touches REVIEW or KEEP. Requires Node.js 18+.
/plugin marketplace add ashudhanda/deadcode-map
/plugin install deadcode-map@deadcode-mapThis installs the MCP server, the deadcode-map skill, and the /deadcode-map slash command. For local development without installing:
claude --plugin-dir ./deadcode-mapOr wire the MCP server by hand in .mcp.json (project) or ~/.claude.json (global):
{
"mcpServers": {
"deadcode-map": {
"type": "stdio",
"command": "npx",
"args": ["-y", "deadcode-map", "mcp"]
}
}
}Add to claude_desktop_config.json (~/Library/Application Support/Claude/ on macOS, %APPDATA%/Claude/ on Windows, ~/.config/Claude/ on Linux), then restart Claude Desktop:
{
"mcpServers": {
"deadcode-map": {
"command": "npx",
"args": ["-y", "deadcode-map", "mcp"]
}
}
}In ~/.codex/config.toml:
[mcp_servers.deadcode-map]
command = "npx"
args = ["-y", "deadcode-map", "mcp"]Or add it from the command line (note: env does no ${VAR} expansion in Codex — use env_vars to forward host variables):
codex mcp add deadcode-map -- npx -y deadcode-map mcpIn .cursor/mcp.json (project) or ~/.cursor/mcp.json (global). Cursor requires "type": "stdio" on stdio entries:
{
"mcpServers": {
"deadcode-map": {
"type": "stdio",
"command": "npx",
"args": ["-y", "deadcode-map", "mcp"]
}
}
}Open the MCP config from inside Windsurf (Settings → MCP Servers) and add:
{
"mcpServers": {
"deadcode-map": {
"command": "npx",
"args": ["-y", "deadcode-map", "mcp"]
}
}
}The config file lives at ~/.config/devin/mcp_config.json (current; older installs used ~/.codeium/windsurf/mcp_config.json).
In ~/.copilot/mcp-config.json (global) or a workspace .mcp.json:
{
"mcpServers": {
"deadcode-map": {
"type": "stdio",
"command": "npx",
"args": ["-y", "deadcode-map", "mcp"]
}
}
}(Deprecated: .vscode/mcp.json with top-level servers — use the format above instead.)
In ~/.gemini/settings.json or a project .gemini/settings.json (env vars expand as $VAR / ${VAR}). Verify with /mcp list:
{
"mcpServers": {
"deadcode-map": {
"command": "npx",
"args": ["-y", "deadcode-map", "mcp"]
}
}
}In opencode.json. Note the v2 shape: mcp.servers, type: "local", command is one array, env vars go under environment:
{
"mcp": {
"servers": {
"deadcode-map": {
"type": "local",
"command": ["npx", "-y", "deadcode-map", "mcp"],
"environment": {},
"disabled": false
}
}
}
}Any agent that can run shell commands can use the CLI directly — no MCP setup needed:
deadcode-map [path] --json - # full JSON report on stdout (pure JSON, no terminal summary)
deadcode-map [path] --json report.json # or write it to a file
deadcode-map [path] --map deadcode-map.html
deadcode-map [path] --fail-on safe # CI: exit 1 on new SAFE dead code
deadcode-map [path] --baseline # hide findings already in .deadcode-map.json
deadcode-map [path] --update-baseline # record current findings as the baseline
deadcode-map [path] --prove # prove SAFE deletions with your tests first
deadcode-map [path] --fix # delete SAFE findings only
deadcode-map [path] --coverage report.xml # test-coverage evidence (Cobertura XML or lcov); auto-detected when present
deadcode-map [path] --coverage coverage-dir/ # merge every report in a directory (union of covered lines)
deadcode-map [path] --no-coverage # ignore coverage files entirelyCoverage is a one-way safety net: a symbol whose body lines ran under tests is demoted from would-be SAFE to REVIEW, never the other way round — coverage never promotes a REVIEW to SAFE, and a file with covered lines is never a SAFE dead file. Only the symbol's body lines count (the def line runs on import, so it is excluded). When the report also names the function itself — lcov FN:/FNDA: records or Cobertura <method> elements — that record is the exact signal: it demotes a one-line definition, which has no body lines for the range check, and it is authoritative when present, so a nested definition's lines can no longer demote its outer function (a Cobertura method's hits count only its own lines, not a nested method's). A function record of 0 hits never demotes. The other direction is corroboration, not promotion: a SAFE finding whose body never ran in the covered runs carries coverageCorroborated: true in its evidence (and a note in its reason) — a second, independent "nobody runs this" observation next to the static 0-references evidence, so triage and --prove can rank corroborated SAFEs first. The grade never changes on it: stale or partial coverage can show 0% for live code, so an uncorroborated SAFE is no weaker for it. A 0-hit function record corroborates even a one-line definition; without a record the body lines must be reported in the file's line set and none covered — lines the report never mentions are no signal at all. A dead file with 0% of its lines covered is corroborated the same way, and a one-line field never is (its range is only its definition line, which executes at class load). When no coverage file is given, the tool auto-detects coverage.xml, coverage/coverage.xml, lcov.info, and coverage/lcov.info in the scanned repo and merges every report it finds — a unit run's coverage.xml plus an e2e run's lcov.info both count, the same union merge as an explicit directory or list (a line counts as covered when any run covered it, so merging can only demote findings, never promote them); a lone auto-discovered report keeps its own source. Pass --coverage <file> to point at a specific report, or --coverage <directory> to merge every report in the directory. A single file input behaves exactly as before.
A --json report or --map file written inside the scanned repo is excluded from the scan itself, so repeat runs report identical findings — the tool's own output never counts as a reference to the symbols it lists. Only the exact output path is excluded; any other file, including one with the same name in another directory, is still scanned.
Exit codes: 0 ok, 1 --fail-on triggered, 2 usage error / no such directory. A repo guide for agents lives in AGENTS.md.
Example output:
deadcode-map /home/ashu/my-app
34 findings — 2 SAFE · 25 REVIEW · 7 KEEP (hidden)
SAFE dead code: ~74 bytes across 2 findings
by category: file 5, function 22, import 1, unreachable 1, class 1, method 4
SAFE src/used.js:1 unusedImport
imported "unusedImport" from "./helper" but never referenced in this file
SAFE src/used.js (unreachable)
code after return/throw/break/continue
Paste a public GitHub repo link at https://ashudhanda.github.io/deadcode-map/ and check dead code in the browser: summary counts, per-file findings, and a visual map. Your repo is fetched straight from GitHub in your browser — nothing is uploaded anywhere. An optional GitHub token raises the API rate limit from 60 to 5,000 requests/hour; it is kept only in memory and never stored.
Honest limit: the web checker is a lightweight regex-based analyzer, not the full
tree-sitter CLI. It covers JS/TS and Python, caps at 500 files / 5 MB, and handles public
repos only. For full accuracy, --prove, and --fix, use the CLI above.
| Category | Definition |
|---|---|
| Dead file | No importer, not an entry point, not referenced by name anywhere |
| Dead export / function / class | Defined/exported, 0 importers/callers in the repo |
| Dead import / variable | Imported/declared, never referenced in its scope |
| Unreachable code | Code after return / throw / break / continue, if (false) branches |
| Dead dependency (JS) | In package.json, never imported/required, named in a script, or referenced by a code/config string — README prose does not count |
- Entry points:
package.jsonmain/bin/exports,src/index/src/main,if __name__ == "__main__"scripts, shebang CLI scripts, framework routes (pages/,app/), tests, stories, config, migrations.package.jsonscripts also name entry points: a bare path token (node server.js) and a--flag=pathvalue (knex --knexfile=./knexfile.js,node --config=./config/app.js) both count, and so does a space-separated flag value (node --input ./seed.js); a--flagwith no=and no following path names nothing, and a token naming a file that does not exist is ignored, never an entry. Apackage.json#importssubpath target ("#utils": "./src/utils.js") is an entry point only when the#nameis actually imported somewhere in the repo — an unimported target grades normally. - Framework magic: route handlers (
@app.route, Next.jsgetServerSideProps), decorators, dunder / protocol methods (__init__,__str__), module dunder variables (__version__,__author__,__all__— read by the import system / packaging tooling),__init__.pyre-exports. Framework rules live inframeworks/*.jsonand are loaded by default. Pydantic / dataclass / TypedDict model fields,@overloadgroups,@model_validator/@field_validator,declare moduleaugmentation, and decorated methods (@contextmanager,@property) are framework-invoked — KEEP, never SAFE. - Re-exports are uses:
import X as X,export { X },# noqa: F401imports, and compat-shim modules (compat.py,_compat/) are public API — their contents are REVIEW at most, never SAFE. Atsconfig/jsconfigpathsalias (@/*) resolves like a relative import. A#namesubpath import (import { fn } from '#utils') resolves through the nearestpackage.jsonimportsmap (exact keys,#utils/*wildcards, conditional objects, dynamicimport()too), so the imported export is live like a relative import. - Test code and intentional dead code: files under
tests//test//__tests__/and files literally namedtest.ts/test.tsxare KEEP at most, never SAFE — and so is unreachable code marked# pragma: no coveror/* istanbul ignore next */. - Dynamic use: anything in a file that uses dynamic
import(),require(variable),importlib, orgetattris REVIEW at most — never SAFE. - Public API of a published library: exported symbols are REVIEW, never SAFE, never auto-deleted.
- Methods: a method with 0 in-repo callers is REVIEW at most — it could be called via an object or a framework.
- Same-file use is alive: a symbol called or referenced in its own file is never flagged — it is used, even if nothing else in the repo imports it.
- Fixture / test-data directories are not scanned by default:
fixtures/,__fixtures__/at any depth (test/fixtures,tests/fixtures, …) are excluded — planted dead code in test data is not real dead code. Use--include-fixtures(CLI) or the checkbox in the web checker to scan them.
- A real import/call graph built from entry points — no flat name-matching.
- A string-reference pass: the symbol name is searched across the whole repo (code, config, templates) before flagging. Only code-like mentions count — the name as a whole string (
'named',{"handler": "wired"}) or delimited by code characters ('handlers.named','./named'). Words inside sentences ('a named export is nice', a docstring, README prose) do not count, and.md/.txtfiles never count. For FILE findings the rule is stricter (batch 31): a string mentions a file only when it names the file by path — a path suffix (components/svg/Link, with or without the extension, after an alias or root prefix), a relative path (./Link,../svg/Link) resolving to the file, or the bare filename with its extension (Link.tsx). A bare stem token ('Link','react') is not a file reference: it kept genuinely dead files at REVIEW (umami'ssvg/Link.tsxshared its stem with the livecommon/Linkimport, UI labels, and translation keys;lib/react.tsshared its stem with thereactpackage name). A static import specifier is consumed by the import graph, never a free string mention — but a dynamic import (await import('pkg')) still counts as a real import for dependency liveness. Bare symbol names still count for SYMBOL findings: a config naming a handler by bare name keeps the handler's file at REVIEW. - Coverage evidence demotes would-be SAFE to REVIEW: a symbol whose body lines ran under tests is REVIEW, never SAFE, even with no callers — coverage never promotes. Same-file liveness is reachability over per-definition reference scopes, so a helper used only by another dead symbol in the same live file is caught (methods are conduits only when their enclosing class is live — a helper called only from a method of a dead class is SAFE).
- Dynamic-import / reflection detection downgrades to REVIEW.
- Framework rule packs as data files (
frameworks/next.json,frameworks/fastapi.json, …). - Confidence grading +
--min-confidence;--fix/--proveact on SAFE only. - Baseline (
.deadcode-map.json) + inline ignore (// deadcode-map-ignore-next,# deadcode-map: ignore— planned, see Roadmap). proveas the final arbiter: if the tests pass without it, it is dead.- JSX-pragma imports: in a file that contains JSX, an imported
React,createElement,h,Fragment,jsx,jsxs, orjsxDEVcounts as used by the JSX transform — the factory is chosen at build level (tsconfigjsx/jsxFactory, babel preset,@jsxcomment), which a per-file parser cannot see, so treating pragma bindings as transform-used is the only false-positive-safe rule. In a file with no JSX the same import is still flaggable.memo,Component,Suspense,lazyare not pragma names and stay flaggable. --fix(and the MCPfix_safetool, which shares the same code) never writes outside the scanned root: every target path is checked with a separator-aware containment test (path.relative—..or..+ separator is refused) before any delete or edit, so a finding path that somehow escaped the root is refused and reported instead of acted on. A file literally named..evilinside the root still fixes — the check is on the resolved path, not the name. This is defence in depth against the workspace-traversal class behind Knip CVE-2026-120325 (a malicious repo'sworkspacesfield making--fixdelete files outside the repo); deadcode-map never reads aworkspacesfield and never follows symlinks, so the guard should never fire — it exists so a future feature cannot silently break that.
Fixtures live in fixtures/ with planted dead items and known live items. Run them with npm test (135 CLI tests passing, 1 skipped) and node --test test/web-analyzer.test.js test/web-prototype-names.test.js (84 web tests). New fixtures in batch 3: js-same-file-cascade, py-same-file-cascade, js-file-stringrefs — every live symbol in them is never flagged SAFE, every planted dead item is found at SAFE or REVIEW.
| Fixture | Files | SAFE found | SAFE false positives | SAFE FP rate |
|---|---|---|---|---|
js-basic (JS, CommonJS + ESM) |
9 | 4 | 0 | 0% |
py-basic (Python, Flask + pytest) |
6 | 2 | 0 | 0% |
py-relative (Python, relative imports) |
7 | 1 | 0 | 0% |
py-imports (Python, dotted imports + module dunders) |
4 | 1 | 0 | 0% |
py-multiline (Python, parenthesized + backslash imports) |
2 | 3 | 0 | 0% |
js-string (JS, prose vs code-like string mentions) |
6 | 3 | 0 | 0% |
py-string (Python, docstring prose vs code-like mentions) |
4 | 1 | 0 | 0% |
js-deps (JS, dead dependencies: README prose vs real imports) |
5 | 0 | 0 | 0% |
js-framework (Next.js pages/) |
1 | 0 | 0 | 0% |
py-class-attrs (Python, config classes / external-base overrides / chained aliases / documented attrs) |
5 | 6 | 0 | 0% |
Measured 2026-11-23 with the current tool (batch 3 —
re-measure with node ~/workspace/bench-repos/bench-run.js). Before =
the tool at the start of batch 1 (corpus scan B / diagnosis numbers);
after = now. SAFE precision is hand-sampled per repo, not asserted
from the count.
| Repo | Files | SAFE before | SAFE after | Sampled SAFE precision after |
|---|---|---|---|---|
| express | 142 | 0 | 0 | — |
| commander | 159 | 3 | 0 | — |
| zustand | 49 | 5 | 0 | — |
| preact | 239 | 33 | 20 | 16/20 verified true (unused demo imports); 4 are JSX-pragma imports (createElement, React, h, memo, Fragment) the web counts as live — CLI gap, see limitations |
| date-fns | 1776 | 100 | 2 | 2/2 true (1 unused variable; 1 one-off jscodeshift codemod with no importer or script — true by the tool's model, manually-run tools are a known edge) |
| next-blog | 22 | 11 | 11 | 100% (unused React imports) |
| flask | 83 | 17 | 0 | — |
| fastapi | 1237 | 71 | 0 | — |
| requests | 37 | 33 | 2 | 100% (2 unused type aliases) |
| click | 91 | 2 | 0 | — |
| axios | 261 | 90 | 0 | — |
| typer | 645 | 43 | 5 | 5/5 true (re-sampled in batch 3; the 2 new ones are never-read TyperGroup class attributes) |
| umami | 1520 | 1044 | 38 | 38/38 true (re-sampled in batch 3; the 6 new ones are 5 dead helpers in src/lib/react.ts and 1 dead component file, SettingsButton.tsx) |
| Total | 3836 + 2426 | 1452 | 78 | 74 of 78 verified true; 4 preact JSX-pragma imports are a known CLI gap |
What fixed the bulk of it, in order: re-exports counted as uses
(import X as X, export { X }, # noqa: F401, compat shims);
framework-invoked declarations kept live (Pydantic/dataclass/TypedDict
model fields, @overload groups, @model_validator, declare module
augmentation, decorated methods); type-position references (TS type
annotations, Python string annotations, TypeAlias values, __all__);
tsconfig paths aliases (@/* — umami's dominant family, 196 → 32);
.js → .ts import resolution; monorepo-private packages treated as
libraries; test files (tests/, test.ts) and intentional-unreachable
markers (# pragma: no cover, /* istanbul ignore next */) kept.
Batch 2 closed the last 6 corpus SAFE false positives — framework-
consumed class attributes (Pygments theme classes, external-base
overrides like Werkzeug's default_mimetype, chained-assignment
aliases, Sphinx-documented flags) — and ported the inverted string
index to the web checker, so web-only SAFE is now 0.
Batch 3 added same-file cascade (per-definition reference scopes;
methods are conduits), coverage demotion (Cobertura/lcov, one-way),
a fix for the 32 KiB parse limit (tree-sitter's node binding throws
past 32,768 bytes, so large files were silently treated as live —
55 of 6,278 corpus files, including fastapi's routing.py), Python
re-export comments (# re-export / # backwards-compat keep one
name, including span-wide # noqa: F401 on multi-line imports),
and a fix for locals inflating file findings (a local named url
kept umami's SettingsButton.tsx at REVIEW by matching 116 files —
locals no longer count as file-level string references). The 9 new
SAFEs in batch 3 are all verified true: 5 dead helpers in umami's
src/lib/react.ts, the dead SettingsButton.tsx file, 2 never-read
TyperGroup class attributes, and date-fns' one-off codemod.
Batch 5 expanded the corpus with five more repos (Vue, SvelteKit,
Django, NestJS, Pydantic). Batch 6 cut their CLI SAFE from 176 to 47;
batch 7 cut it to 26 — hand-judged one by one, 26/26 verified true
(100% SAFE precision). Re-measure with node ~/workspace/bench-repos/bench-run.js (old corpus) and the batch-6
after JSONs under ~/workspace/bench-repos/bench7-verify/ (expansion
repos); web numbers via node ~/workspace/bench-repos/web-bench5.js.
| Repo | Files | CLI SAFE batch 5 | CLI SAFE batch 6 | CLI SAFE batch 7 | SAFE precision batch 7 |
|---|---|---|---|---|---|
| vuejs-core | 522 | 9 | 9 | 0 | — |
| sveltejs-kit | 1579 | 6 | 0 | 0 | — |
| django-django | 3054 | 112 | 13 | 2 | 2/2 true (globalThreshold, handles_files) |
| nestjs-nest | 2284 | 49 | 25 | 24 | 24/24 true (9 dead test.dto.ts files, 4 unimported entity files, 2 unregistered logging.plugin.ts files, audio.module.ts, 8 unused imports) |
| pydantic-pydantic | 3168 | 0 | 0 | 0 | — |
| Total | 10,607 | 176 | 47 | 26 | 26/26 true |
What fixed it in batch 7: type-test files (*.test-d.ts(x), run by
test-dts-only) are entry points; workspace self-references (vue /
@vue/* imported from inside vuejs-core) count as uses; classic
(non-module) script globals resolve repo-wide (quickElement et al. in
Django's admin JS); module-level defs under grouping statements
(if / try / with) are visible, so TYPE_CHECKING-guarded
TypeAliases are correctly exported public API (REVIEW, never SAFE);
__unittest is KEEP; per-definition liveness fixed the NestJS
missingFile bug (a shared name merged a live const with a dead
method). The web checker got the same ports for case-insensitive
# NOQA, *.e2e-spec.ts test files, and try/except probe imports:
web SAFE 26 → 15 (django 16 → 7, nestjs 10 → 8, rest 0, maxDup 1×).
Web-only SAFE is now 6, all django, all known false positives whose
CLI fixes are not yet ported to the web: the 4 admin-core.js globals
(quickElement, removeChildren, findPosX, findPosY), the
__unittest variable, and the replace import. Web SAFE precision
is 9/15 (the other 9 overlap CLI SAFE and are verified true). The
batch-2 claim above that web-only SAFE is 0 is superseded by this
measurement.
Java precision is fixed. Batch 8 measured gson 0/64 SAFE true and
junit5 1/589 — 0.3% overall — and batch 9 gated Java SAFE off by
default and fixed the liveness bugs (FJ-7 same-file callers, FJ-9
field reads, FJ-1 Javadoc links, FJ-8 package-info annotations).
Batch 10 finished the job: a parser bug that counted // comments
as call arguments (junit5's validateDelimiter/3 recorded as /7),
enum-constant constructor invocations (gson FJ-6), and the three
judgment families — FJ-2 utility-class private constructors are
KEEP (instantiation guards, never dead), FJ-3 load-bearing unused
locals are REVIEW (their initializer calls a method or creates an
object), FJ-4 serialization callbacks are KEEP by (name, arity).
Measured with --java-safe on the same clones:
| Repo | SAFE batch 8 | SAFE batch 9 | SAFE batch 10 | SAFE precision batch 10 |
|---|---|---|---|---|
| google/gson | 64 | 40 | 0 | — (zero false positives) |
| junit-team/junit5 | 589 | 3 | 1 | 1/1 true (SETTINGS_GRADLE) |
| Combined | 653 | 43 | 1 | 100% on remaining SAFE |
The default gate stays: Java SAFE is still off unless --java-safe
is passed, so --fix can never delete Java code on a default scan.
The gate is now a safety default, not a precision workaround — but
it stays until more Java repos are measured, since two repos are not
proof of generality.
JS-side, batch 10 cut vue2 CLI SAFE 4 → 1 (JSDoc {@link} imports
are live; new X() rescues classic-script globals) — the one
remaining SAFE (Data in types/v3-define-component.d.ts) is
verified true. Web-only SAFE stays 0.
Java also landed in the web checker (batch 10): docs/parse-java-web.js
ports src/parse-java.js (same traversal, diffed against the CLI
parser in the test suite) and parses .java files with vendored
tree-sitter WASM — web-tree-sitter 0.22.5 and tree-sitter-java
0.23.5 under docs/vendor/ (~662 KB, lazy-loaded only when a
.java file is present; load failure skips Java with a warning,
never regex-parses). The web is the opted-in surface, so it grades
Java exactly like the CLI with --java-safe: gson 7,517 findings
(0 SAFE) and junit5 23,796 findings (1 SAFE) are identical to the
CLI output, finding-for-finding, web-only SAFE 0. Two gaps the
integration closed along the way also fixed pre-existing web gaps
for all languages: framework-pack keeps (@Service / @Entity
classes) and the manual-script rule (scripts/ / tools/ files
are entries).
Corpus re-verified at batch 10 (bench10-latest/, default settings):
gson 0, junit5 0, vue2 1, flask-sqlalchemy 0, axios 0, typer 4,
umami 36 — 41 SAFE total, all previously hand-judged TRUE. Full
suite: 278 tests (277 pass, 1 skipped — the javac test, javac not
installed here). Dogfood 0 findings; --include-fixtures 380
findings, 0 in src/.
Three items, all measured. Field analog of FJ-3: an unused
private field whose initializer calls a method or creates an object
is REVIEW, never SAFE — the call runs when the class loads / an
instance is created, so deleting the declaration would remove it.
This demoted the last remaining Java SAFE: junit5's
SETTINGS_GRADLE (ROOT.resolve("settings.gradle.kts")) is now
REVIEW. Measured with --java-safe: gson 0, junit5 0, petclinic 0
SAFE — zero SAFE on all three Java repos measured to date. The gate
stays gated: only one new repo shape was measured this batch (below).
Same-file gate recall gap: a dead local named after a called
method was swallowed by the name-keyed same-file flag (obj.foo()
kept a dead local foo alive — the member name is not a read of
the local). Parsers now record bare references (bare identifier
reads only, never a member name or call base); locals grade on
those, and a non-exported variable local gets no cross-file credit
under a same-named top-level symbol. Fixes the guard forced along
the way: Java switch-case locals now get bindings (gson's
JsonReader.pathIndex, read 3×, was a false SAFE); JS getters are
credited on property access (ctx.slots runs get slots());
modifiersOf now reads the modifier keyword nodes themselves (a
comment between two modifiers, public /* private */ static, no
longer flips the flags, and neither does a word inside an
annotation's string argument); forClass records the outermost
constructed class (new TypeToken<List<Tweet>>() was Tweet, now
TypeToken); and the dead ::new branch was revived (new is an
anonymous child, so the old test never fired — TypeToken::new
recorded a phantom method call, Outer.Inner::new nothing), with
the class name recorded as a reference so LinkedHashMap::new no
longer leaves the import looking unused. Known gap left open:
JS/Python locals in the web analyzer are not ported (its regex
parsers have no bare-reference tracking); the Java gate in the web
analyzer is ported.
Java measurement: one new repo measured — spring-petclinic
(Spring Boot app, 50 Java files, 387 findings, 0 SAFE in both
modes; its 68 REVIEWs are correctly held back, e.g. Spring Data
derived-query methods OwnerRepository.findByLastNameStartingWith
/ findById, invoked at runtime). Three more clones — Android
library (leakcanary), Maven plugin (maven-dependency-plugin),
Gradle library (okhttp) — were blocked by a runtime security
notice prohibiting further cloning; they stay unmeasured, and the
gate stays gated until those shapes are measured.
Corpus re-verified at batch 11 (bench11-latest/, default
settings): gson 0, junit5 0, vue2 1, flask-sqlalchemy 0, axios 0,
typer 4, umami 36 — 41 SAFE total, finding-for-finding identical
to batch 10 (zero SAFE lost, zero gained). With --java-safe:
gson 0, junit5 0, petclinic 0 SAFE. Recall improved with no new
SAFE: total findings rose (gson 7,517 → 8,328, junit5 23,796 →
24,947, vue2 895 → 1,185, typer 2,127 → 2,155, petclinic 387 →
396) — every new finding is REVIEW or KEEP (test-file locals /
fields and framework-dispatched members the gate fix now finds).
Web/CLI Java parity re-verified on the full clones
(web-bench11): gson, junit5 and petclinic identical
finding-for-finding, web-only SAFE 0. Full suite: 306 tests (305
pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures 413 findings, 0 in src/.
Batch 11 left one known gap: the bare-reference local rule lived in the
CLI only — the web analyzer graded JS/Python locals on the flat
references set, so a dead local named after a called method (obj.foo()
kept a dead local foo alive) was missed by the web. Batch 12 ports the
rule: parseJs/parsePy in docs/analyzer.js now record bareReferences
(bare identifier reads only — never a member/property name or a property
definition site) and bareCalls, and the grading loop grades non-Java
locals on bare-name use only, with no cross-file credit for non-exported
variable locals. Function/method locals keep cross-file credit (they can
escape). Two corrections rode along: the class-method branch no longer
excludes methods named get/set/async; Python isMethod now requires
the innermost scope to be the class (a function nested in a method is a
function, not a method), and function-local variables are recorded as
definitions. Java is untouched. Fixtures js/py-batch12-bare + 34 tests;
the web matches the CLI on both fixtures finding-for-finding.
Corpus re-verified at batch 12 (bench12-latest/, default settings):
gson 0, junit5 0, vue2 1, flask-sqlalchemy 0, axios 0, typer 4, umami 36
— 41 SAFE total, finding-for-finding identical to batch 11 on all 10
scans (zero SAFE lost, zero gained, zero grade changes). That is the
expected result, not a missed measurement: batch 12 changed only
docs/analyzer.js, the CLI is untouched. With --java-safe: gson 0,
junit5 0, petclinic 0 SAFE. The expansion repos were re-measured
separately (never blended into the 41): vuejs-core 0, sveltejs-kit 0,
django 2, nestjs 24, pydantic 0 — 26 SAFE, the same 26 hand-judged TRUE
at batch 7.
Web/CLI parity re-verified on the full 13-repo set (web-bench12.js,
against the batch-12 CLI output; a batch-11 analyzer baseline was run
first so batch-12 changes can be told apart from pre-existing web gaps).
Java is exact: gson 8,328, junit5 24,947, petclinic 396 findings —
identical to the CLI finding-for-finding, web-only SAFE 0. On
JS/Python the web reports 27 SAFE against the CLI's 67, and 12 of the
web's SAFE are web-only false positives — but every one of them already
existed at batch 11, and batch 12 introduced zero new web-only SAFE:
axios 4 (named function-expression callbacks — _resolve/_reject
passed to settle(), onAdapterResolution/onAdapterRejection passed
to .then() — the names are never referenced because they are the
callbacks themselves, so the web flags live code SAFE); typer 7 (six
imports used only inside string annotations — Context, CompletionItem,
TyperCommand, TyperGroup, Typer — which the web's regex references
pass misses, plus the GrpType TypeVar, which the CLI deliberately
holds at REVIEW as a type-level declaration); umami 1 (an unreachable
flag on a chained-call continuation line in WorldMap.tsx, part of the
return expression, not dead code). One more web-only SAFE id is not a
false positive at all: vue2's Data is the same item as the CLI SAFE
(the genuinely unused import in types/v3-define-component.d.ts,
verified true at batch 10) — the web reports every import finding at
line 1, so the id differs by line only. The web still misses 53 CLI SAFE
ids (umami 33 dead files/functions, nestjs 16 dead files, typer 2,
django 1, vue2 1 line artifact) — the known recall gap, in the
conservative direction: the web under-flags, it does not over-flag
beyond the 12 above. Against its own batch-11 baseline the web gained
101 findings and lost 23 (net 79,418 → 79,496), all REVIEW or KEEP,
zero new SAFE, zero grade changes: 80 of the 101 new findings match CLI
findings exactly (locals and get/set methods the port now finds),
22 of the 23 lost ids reappeared under a corrected category (methods
nested in a method are functions now), and the one true disappearance
is django's __getattribute__ test-helper method, which the CLI never
reported. Full suite: 340 tests (339 pass, 1 skipped — the javac test).
Dogfood 0 findings; --include-fixtures 420 findings, 0 in src/.
Batch 12 ended with 12 named web-only SAFE false positives on the live
surface — the web checker flagged live code SAFE on three real repos.
Batch 13 fixes all 12, and web-only SAFE is now 0 on every repo in the
13-repo set. Axios: the web regex recorded any line starting with
function name( as a declaration, including named function expressions
passed as callbacks (settle(function _resolve…, .then(function onAdapterResolution…)). A named expression's name is visible only
inside itself, so it can never be referenced — the CLI's tree-sitter
parser records function_declaration nodes only, never
function_expression, and the web now gates the definition push the
same way (bracket-stack top ( / [, or a previous raw line ending
in an expression-continuing token). Umami: a [ line after a return
is a chained-call continuation, not a new statement, so the
unreachable flag on WorldMap.tsx:50 is part of the return
expression. Typer: the web now runs an annotation-span pass in
parsePy that joins multi-line def signatures and reads annotated
assignments, counting string literals only inside the annotation span —
so ctx: Union["Context", None], cls: type["TyperCommand"] and
list["CompletionItem"] count as uses, while default string values,
docstrings, error messages, and Doc(...) prose do not. GrpType
is held at REVIEW as a TypeVar, mirroring the CLI's treatment.
Finally, web import findings now carry their real line: import records
carry a range (the finding code already read it, but no web import
ever set one), so vue2's Data reports line 19 like the CLI instead
of line 1 — the last line-artifact id is gone. Fixtures
js-batch13-named-callback, js-batch13-chain-call,
py-batch13-string-annotation, py-batch13-typevar,
js/py-import-lines + 27 tests; the web matches the CLI on every new
fixture finding-for-finding.
Corpus re-verified at batch 13 (bench13-latest/): the CLI is
finding-for-finding identical to batch 12 on all 15 scans (0 lost, 0
gained, 0 grade changes — expected, batch 13 changed only
docs/analyzer.js): 41 SAFE total, --java-safe gson 0, junit5 0,
petclinic 0. Web/CLI parity (web-bench13.js): Java exact — gson
8,328, junit5 24,947, petclinic 396, identical finding-for-finding.
Web SAFE 27 → 15 (the 12 false positives are gone; every remaining
web SAFE is also a CLI SAFE), web findings 79,496 → 79,472, missed CLI
SAFE 53 → 52 (vue2 Data now matches by id), grade diffs 319 → 318
(typer GrpType now agrees). The remaining web gap is recall, in the
conservative direction: the web still misses 52 CLI SAFE (umami 33
dead files/functions, nestjs 16 dead files, typer 2, django 1) because
it has no dead-file detection for JS/TS. Full suite: 367 tests (366
pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures 443 findings (31 SAFE / 346 REVIEW / 66 KEEP),
0 in src/.
Old corpus (10 repos + 3 diagnosis repos) re-measured at batch 7:
SAFE 45 → 42, with zero findings lost and zero new SAFE. The 3
changes are all SAFE → REVIEW demotions of exported TypeAlias /
TypeVar declarations (CookiesType, ProxiesType in requests,
GrpType in typer) — the conditional-def fix above. Four
*.test-d.ts(x) file findings disappeared (type tests are now entry
points) and 5 new REVIEW findings appeared (conditional-def variables
such as fastapi's ujson and click's BEFORE_BAR / AFTER_BAR) —
improved recall, same conservative grading. Remaining old-corpus SAFE:
preact 1 (memo in demo/suspense.jsx — the known JSX-pragma CLI
gap), date-fns 1 (the one-off expectify.js codemod), typer 4,
umami 36, everything else 0.
Batch 13 ended with the web checker missing 52 CLI SAFE findings —
the web had no dead-file detection for JS/TS, so dead files and the
symbols inside them graded REVIEW while the CLI graded them SAFE
(umami 33, nestjs 16, typer 2, django 1). Batch 14 ports dead-file
detection to the web analyzer: grading repeats to a fixpoint (at most
6 passes), ignoring usage from files already graded SAFE-dead — dead
importers, dead string mentions, and dead callers do not keep a file
or a symbol alive — with cascade evidence ({ iteration, via }) on
findings that appear only in a later pass. The same port brings
per-file library/app kind (the kind comes from the nearest manifest
above the file, not a repo-global flag, so an exported-but-uncalled
symbol in an app repo is SAFE while in a library it stays REVIEW),
workspace self-references (a monorepo package imported by its own
name resolves to its own source), .test-d. files as test files and
entry points, the @/* alias empty-suffix fix, case-insensitive entry
basenames, hidden-directory skipping, and Next.js instrumentation.ts
as a keep file. It also ports the same-file live-root BFS (a symbol
counts as same-file-live only through live code — uses from dead
files never seed liveness) and the Python class-body assignment
recording with the CLI's FP-6 guardrails (override, cross-file
attribute read, Sphinx docs, external base, config class, chained
alias), which recovers typer's command_class / group_class and
Django's handles_files.
Web/CLI parity (web-bench14.js, 13 repos): missed CLI SAFE 52 →
0, web-only SAFE stays 0 — CLI SAFE 67, web SAFE 67, the same
67 ids (umami 36, nestjs 24, typer 4, django 2, vue2 1; gson, junit5,
petclinic 0 under --java-safe). The 139 remaining grade diffs are
all between REVIEW and KEEP (126 web REVIEW vs CLI KEEP, 13 web KEEP
vs CLI REVIEW) — no SAFE-grade disagreement anywhere. The CLI is
unchanged (no src/ changes), re-verified identical to batch 13 on
the spot-checked repos (umami 36 SAFE / 636 findings, nestjs 24 /
2,682, typer 4 / 2,155). Fixtures js-batch14-deadfile,
js-batch14-parity, js-same-file-bfs, js-alias,
py-batch14-class-attrs + 36 tests; full suite: 402 tests (401
pass, 1 skipped — the javac test). Dogfood 0 findings. The next gap
is grade parity, not recall: Django's 131 diffs are mostly
framework-invoked names the CLI keeps (migration classes,
templatetag functions, management-command methods) that the web
grades REVIEW.
Closes the last batch-15 research item: Django's templatetag render
functions (search_form, admin_actions, prepopulated_fields_js
in django/contrib/admin/templatetags/) graded REVIEW with "0
callers" — they are invoked by the template engine through the
@register.tag parser, which builds an inclusion node with
func=<render fn>. Measuring first showed the func= reference WAS
tracked (the parser records it in the tag function's uses) — the gap
was the same-file cascade deleting kept definitions from the live
set: the render functions are exported public names, so they counted
as kept conduits and were removed from liveness before grading.
Rather than redesign the exported-REVIEW policy, batch 18 adds a
targeted framework rule: the parsers record the tag names registered
by @register.tag("name") decorators in each file (tagNames, CLI +
web), and a same-file module-level function of that name is KEEP as
the tag's render function. The rule is same-file only (the same name
in another file stays REVIEW) and module-level functions only (a
local sharing a tag name is never KEEP); a render function that IS
called or imported keeps its no-finding behaviour, since the rule
sits after the live checks. Verified on the django clone: CLI 39,695
findings unchanged in total, SAFE still 2, REVIEW 4,100 → 4,097,
KEEP 35,593 → 35,596 — exactly the three render functions moving
grade; web unchanged (29,018 findings, SAFE 2, grade diffs 0,
web-only SAFE 0 — the web's file-level same-file rule already sees
the func= reference, so it never flagged them). New fixture
py-django-tags (4 render shapes: func=, string-registered,
multi-line decorator, lambda/no-render) + 3 tests; cache
FORMAT_VERSION 4 → 5 (tagNames round-trips; cold/warm scans
identical). Full suite: 433 tests (432 pass, 1 skipped — the javac
test). Dogfood 0 findings.
First whole-corpus re-measurement since batch 14
(bench19-latest/, node ~/workspace/bench-repos/bench14-run.js bench19-latest for the CLI, web-bench19.js for the web — the
batch-16 note asked for this before any push claiming whole-corpus
numbers). The headline is stability: CLI SAFE is identical to
batch 14 on every repo — core corpus 41 (gson 0, junit5 0, vue2 1,
flask-sqlalchemy 0, axios 0, typer 4, umami 36), expansion 26
(vuejs-core 0, sveltejs-kit 0, django 2, nestjs 24, pydantic 0), and
--java-safe gson 0, junit5 0, petclinic 0. Django matches batch 18
exactly (39,695 findings, SAFE 2, REVIEW 4,097, KEEP 35,596).
One total moved: sveltejs-kit 1,928 → 1,823 findings. All 105 gone
are KEEP except 1 REVIEW — 0 SAFE, 0 grade changes, 0 gained.
Bisected by phase: 99 come from Phase 1, 6 from Phase 2, and both
are genuine improvements, not regressions. The 99 are SvelteKit's
public.d.ts / internal.d.ts types: packages/kit/tsconfig.json
carries its paths map with a // internal use only comment inside
the JSON, so pre-Phase-1 JSON.parse dropped the whole map and
@sveltejs/kit/* / $app/* aliases never resolved — the exported
types had no importers and surfaced as KEEP "in a config file"
findings. Phase 1's JSONC parsing loads the map, the aliases resolve
to the real files, and the types are live. Verified file-by-file:
every lost file maps to a paths entry (@sveltejs/kit/hooks →
exports/hooks/public.d.ts, $app/navigation →
runtime/app/navigation/public.d.ts, types →
src/types/internal.d.ts, and so on). The 6 are service-worker.js
test-app files, now *-worker.js entry points under the Phase 2
worker-entry rule.
Web/CLI parity is now complete on grades as well as SAFE:
grade diffs 0 on all 13 repos (was 139 at batch 14 — django 131,
nestjs 4, flask-sqlalchemy 3, typer 1 — closed by the batch-15 grade
parity port, the batch-16 Django verification, and the batch-18
render-function rule). Web-only SAFE 0 and missed CLI SAFE 0
everywhere; CLI SAFE 67, web SAFE 67, the same 67 ids. Java is exact:
gson 8,328, junit5 24,947, petclinic 396 findings, identical to the
CLI finding-for-finding, javaSkipped false. The web still reports
fewer findings overall than the CLI on symbol-dense repos (vue2 158
vs 1,185, pydantic 14,819 vs 21,401) — a recall gap on REVIEW/KEEP
grades, in the conservative direction; every SAFE the CLI finds, the
web finds too. Full suite: 433 tests (432 pass, 1 skipped — the
javac test). Dogfood 0 findings.
Root-containment guard for --fix (backlog item 1 from the 1 Dec
Knip 6.46.0 / CVE-2026-120325 research). deadcode-map was verified
NOT exposed to the CVE's vector — it never reads the workspaces
field, never follows symlinks, and findings' paths derive from walked
files only — but src/fix.js had no explicit containment assertion,
so safety rested entirely on construction. applyFix now refuses
(separator-aware, path.relative-based, the same pattern already in
src/index.js:104) any target resolving outside the scanned root,
before touching the filesystem, and reports the refusal as an error
entry the CLI prints. The guard covers the --fix unlink branch and
in-place edits, --fix --cascade (which shares applyFix), and the
MCP fix_safe tool. Tests in test/fix.test.js (3 tests): a
../victim.js file finding is refused and the file outside the root
survives (bite-checked — the test fails with the guard removed), and
a file named ..evil.js inside the root still fixes (its dead
helper is deleted, the live one kept). Full suite: 436 tests (435
pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures 537 (31 SAFE / 403 REVIEW / 103 KEEP), 0 in
src/, unchanged from batch 18.
Knip 6.46.0 recall items 2–3 from the 1 Dec research (backlog):
subpath-import targets and --flag=path script tokens.
- Subpath imports are entries only when imported.
packageJsonEntriesused to mark everypackage.json#importstarget as an entry point, so a file that was only a subpath-import target nobody imports was KEEP, never flagged. Nowdiscover.jscollects the targets with their#name(subpathEntries) andgraph.jspromotes a target to an entry only when the parsers' own import records show the#nameactually imported (static, side-effect,require()and dynamicimport()alike; an exact-name match —#utils/helpersdoes not count for#utils). An unimported target grades normally: in the probe it surfaces as a REVIEW file finding (theimportsdeclaration itself is a string mention inpackage.json, so the file holds at REVIEW rather than SAFE — the fix surfaces it, it does not claim the declaration is not a mention). Fixturefixtures/js-subpath-imports/+ 1 test (bite-checked: fails without the fix). - Scripts
--flag=pathtokens are entries.scriptEntriessplit on whitespace/quotes and required the token to exist on disk, so--knexfile=./knexfile.js/--config=./x.jswere missed (the token as written never exists). The--<flag>=prefix is now stripped before the extension / exists check; a--flagwith no=carries no path and its space-separated value is still caught as a bare token. Fixturefixtures/js-script-entries/+ 1 test (bite-checked). The scripts parser's evidence and boundaries are documented under "What is never flagged SAFE" below. - Known follow-up (not this batch): the graph still does not
resolve
#specifiers to import edges, so a symbol imported only via#name(e.g.usedFnimported through#used) still grades SAFE — a pre-existing false SAFE, unchanged by this batch. Resolving#imports ingraph.js(nearest-manifestimportsmap, wildcard patterns) is the next item; the web checker never marked subpath targets as entries and never parsed script entries, so there is no web parity work for these two items. - Full suite: 474 tests (473 pass, 1 skipped — the javac test).
Dogfood 0 findings;
--include-fixtures542 (31 SAFE / 407 REVIEW / 104 KEEP), 0 insrc/. Real-repo check: umami re-scanned before/after on the same clone — 655 findings, 45 SAFE, 0 lost, 0 gained, 0 grade changes (umami has noimportsmap and no--flag=script token naming a code file; no bench clone has animportsmap, and the--flag=tokens in bench scripts —--compare=,--filter=,--input-type=,--npm-tag=— name no code file, so the corpus is unaffected).
The batch-25 follow-up: # subpath imports now resolve to real
import edges.
- Subpath imports are import edges. A
#namespecifier resolves through the nearestpackage.jsonimportsmap — the manifest closest to the importing file wins, so a nested package's map shadows the root's (same nearest-wins rule astsconfigpathsaliases). Exact keys win over wildcard patterns ("#utils/*": "./src/utils/*.js"); a value may be a string, an array of fallbacks, or a conditional object ({"browser": ..., "default": ...}) — conditions are runtime facts the scanner cannot know, so every string value is tried in order and the first one that exists on disk wins. Static imports,require()and dynamicimport()all resolve. Before this batch a symbol imported only via#namegraded SAFE (a false SAFE:usedFnimported through#usedwas reported dead). Fixturefixtures/js-subpath-imports/extended with all five shapes + 1 test (bite-checked: fails without the fix —usedFnSAFE). No cache version bump: no parse shape changed, resolution is recomputed from fresh parses each scan. - Known gap (web only): the web checker does not resolve
#specifiers — it treats them as external dependencies, so all five fixture symbols grade SAFE there (a web-only false SAFE, pinned intest/web-batch14.test.js). Web work is deprioritized; port the resolution when web focus resumes. - Full suite: 475 tests (474 pass, 1 skipped — the javac test).
Dogfood 0 findings;
--include-fixtures542 (31 SAFE / 407 REVIEW / 104 KEEP), 0 insrc/, unchanged. Real-repo check: umami re-scanned before/after on the same clone (HEAD aad2c4c) — 655 findings, 45 SAFE, 0 lost, 0 gained, 0 grade changes (umami has noimportsmap; no bench clone has one, so the corpus is unaffected).
Re-derived confidence-batch items B1 and B4 from the code with fresh probes (their audit reports are not on disk — only the item names survive in the backlog).
- Java coverage demotion (B1). The generic symbol path demotes a
would-be SAFE to REVIEW when coverage reports covered body lines,
but the Java branch emitted private-method / private-field /
private-constructor SAFE without ever consulting coverage. The Java
branch now applies the same
coverageForSymbolBodydemotion: a covered private method, field, or constructor is REVIEW, never SAFE. One-line definitions have no body lines and stay SAFE. Unreachable findings and dead imports get no coverage check — no coverage signal can exist for code that never runs or for an import line. Fixturefixtures/java-batch27-coverage/(Covered.java + lcov.info) + tests (bite-checked). - Definition-aware arity liveness (B4).
javaArityIsLivecollected calls from every definition whose NAME was in the live set, so a dead private overload sharing a live method's name contributed its own calls — its callee looked live through a method that never runs. Liveness is now tracked per definition: only genuinely live definitions contribute calls. A genuine cross-overload call still rescues the private overload (the batch-9 identity-based self-call exclusion). Fixturefixtures/java-batch27-arity/+ tests (bite-checked). Same-arity constructor overloads (e.g. two privateFoo(int)/Foo(String)) still share one arity key — telling them apart needs a type resolver, out of scope; documented, not built. - Known gaps (web only): the web's
javaArityIsLiveis still name-based, and the web checker takes no coverage input, so both gaps reproduce there — pinned intest/web-batch14.test.js. Web work is deprioritized; port when web focus resumes.
The rest of batch 27 re-derived the CLI cascade batch and the remaining confidence items the same way — every item probed from the code first, fixed only where a probe proved a wrong filter:
- Cascade filtering (CLI, "most dangerous"). Four real bugs,
all in the dead-file fixpoint (
src/confidence.js): (1) the loop capped at 6 iterations, so a dead chain longer than 6 files stopped half-way — the cap is nowfiles.size + 1(loop-to-fixpoint; the loop already breaks on no progress). (2) A dead import cycle (a <-> b, or a file importing itself) had no live importer, so the fixpoint had no seed — 0 findings. Seedable strongly connected components are now added todeadFileswhen the fixpoint stalls (every member must grade SAFE as a file except for the importer check, no live importer or string mention from outside the component), and seeded files get their symbols graded once in the iteration right after seeding. A self-import also used to add the file to its own symbol'simportedBy, so the function was a live root in the very iteration its file died and never reported after that —graph.jsnow skips the self-add for real imports only (the member-use channel is untouched: a member call in the defining file is a real use of a same-named method — cutting it hid Django's wholeas_oraclefamily on the real-repo check). (3) A namespace re-export (export * as ns from './lib.js') in a barrel nobody imports pinned its target at REVIEW ("exported via a package re-export"); the pin now holds only while a re-exporter is alive (hasLiveReExportergates both the REVIEW rule and thebaseKeepDefconduit clause). (4) On a same-grade re-add, the stored finding'sstringRefsevidence went stale (it cited a file that had since died) — the re-add now refreshes them. Fixturesfixtures/js-cascade-chain/,fixtures/js-cascade-evidence/,fixtures/js-dead-cycle/,fixtures/js-dead-barrel/,fixtures/js-live-barrel/+ tests (bite-checked). The other cascade shapes probed correct: dead-file symbol cascade, exported-unused chains, string-ref REVIEW-to-SAFE flips, grade-change evidence replacement, SAFE never flipping to REVIEW. Two minor observations, not bugs: a file whose only user was a same-file symbol carries no cascade marker, and top-level code in a dead file seeds live roots, so its symbols get no findings (the file finding itself is still SAFE). - Spread order (B2) — not reproducible. Object-spread source,
rest destructuring, array rest, rest params, JSX spread, spread
inside a dead function only, Python
*/**, nested rest, and spread cascades all grade correctly. No fix. - Dep script prefix (B3). The dependency check matched script
names with
\bleft-pad\b, and\bfires at hyphen boundaries — a script naming onlyleft-pad-xkeptleft-padalive. A newdepMentionRegExptreats-as a name character (subpathleft-pad/xand versionedleft-pad@1.0.0still count as uses;$deliberately does not end a name, soleft-pad$SUFFIXis a shell use). Used in the two dep paths only;mentionRegExpis untouched for symbol matching. Fixturefixtures/js-dep-prefix/- tests (bite-checked).
- File string loop (B5). The dead-file string-refs loop skipped
locals (batch 3) but still counted class members: a method or
class-body attribute name matching a string elsewhere kept its
dead file at REVIEW. The loop now skips methods and any
definition carrying a
className(JS methods, Python class-body variables, Java members); type aliases and interfaces stay. Fixturesfixtures/js-file-methods/,fixtures/py-file-methods/- tests (bite-checked).
- Import locals (B6). The import-locals skip was name-based, so
it swallowed every same-named definition — a module-level
assignment shadowing a Python import, a nested function, a
shadowing local, a re-exported local. A definition is now the
binding only when its source range OVERLAPS the import
statement's range for the same local (overlap, not containment —
the two range shapes differ by form). The same predicate also
guards the dead-import section's
topLevelDefNamescheck, which fixes the multi-line destructured-require 0-findings case. Twoparse-js.jsfixes ride along: re-export entries (export { foo } from './x') no longer mark a local definition exported, and the export-specifier reference rule skips re-exports. Fixturesfixtures/py-import-shadow/,fixtures/py-import-nested/,fixtures/js-import-shadow/,fixtures/js-import-reexport/,fixtures/js-import-multiline/+ tests (bite-checked). - Finding-ID collision (B7). Two distinct findings sharing one
id (same file + symbol + category, different lines) collapsed in
the findings map — the second overwrote the first.
add()now disambiguates with a#rangeStartsuffix whenever therangeStartdiffers, even when the grades differ (same-line siblings with different grades used to lose one). Fixturefixtures/js-findid-coverage/+ tests (bite-checked). No missing-:0-startLine shape was found across JS/TS/Python/Java parser dumps — that vector needs no fix. - Known gaps (web only): the web reproduces the B3, B5, B6,
and cycle gaps — pinned in
test/web-batch14.test.js. Web work is deprioritized; port when web focus resumes. - Full suite: 502 tests (501 pass, 1 skipped — the javac test).
Dogfood 0 findings;
--include-fixtures611 (46 SAFE / 461 REVIEW / 104 KEEP), 0 insrc/. Real-repo check (baseline0cddf8fvs this batch): umami 655, typer 2,174, gson--java-safe8,328 — all byte-identical, 0 gained, 0 lost, 0 grade changes. Django 41,325 → 41,443 (+118 gained, 0 lost, 0 grade changes, 0 new SAFE): 39 are B7 un-collapsed same-line siblings (#rangeStartids), 79 are B6 (definitions that shared a name with an import — e.g. test-backendauthenticatemethods hidden by the importedauthenticate— now graded, all KEEP). JUnit5--java-safe24,947 → 25,226 (+279 gained, 0 lost, 0 grade changes, 0 new SAFE): all B6, parameters named like a static import (Arguments.argumentsvs a parameterarguments), now graded like every sibling parameter (KEEP in a test file). One near-miss caught by this check: the first version of the self-import fix excluded the file itself fromimportedByinconfidence.js, which also cut the same-file member-use channel and surfaced Django's wholeas_oraclefamily as "0 callers" REVIEW (+28 more) — the fix moved tograph.js(real imports only), and the family is back to 0 gained.
Step 5 of the 4 Dec research entry (Java recall is zero on real repos): the reflective lookup with a computed name — a class that calls getDeclaredMethod / getMethod / getDeclaredField with a non-literal first argument ("by" + "NameOnly", a variable, a computed expression) may invoke ANY of its private members by name at runtime, and the name is not in source as a literal, so no string mention protects the member: the probe's ReflectConcat.byNameOnly graded SAFE on batch-44 HEAD. The parsers (src/parse-java.js, mirrored in docs/parse-java-web.js) now record the enclosing class of such a call — a literal first argument does not flag the class, since it names exactly one member and that member is already REVIEW via its own string mention; a parenthesized literal is still a literal — and flag every private member of a flagged class with reflectiveLookup. The confidence engine (src/confidence.js, mirrored in docs/analyzer.js) demotes a flagged private member to REVIEW, never SAFE. The rule sits after the write / load-bearing / coverage / PMD-6.50 checks for fields and after the arity check for methods, so it only fires for a member that would otherwise grade SAFE, and a member of a reflective class that live code also calls gets no finding at all (batch 41's placement trap). The flag is per class, not per file: a plain class in the same file keeps its dead members SAFE. The check is name-based on purpose — a user-defined method with the same name over-demotes in the safe direction (REVIEW, never a false SAFE). Cache FORMAT_VERSION 11 → 12 (new per-definition flag).
Measured effect (same clones, before → after, finding-ID diffs). All 12 bench repos byte-identical (id|grade|reason) to the batch-44 after-sets: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,768 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328 — no bench repo has a private member in a class with a computed reflective lookup that was SAFE, not even junit5 itself. The probe flips exactly one finding (hidden_files/java-probe-2026-12-04/ReflectConcat.java: byNameOnly SAFE → REVIEW; probe total 6 SAFE → 5). Bench evidence in ~/workspace/bench-repos/batch45-work/ (compare script + per-repo after-sets). Pinned by 7 new tests in test/java-reflection.test.js (bite-checked: all 7 fail with src/ stashed) + 1 in test/web-analyzer.test.js for the web mirror.
- Full suite: 572 tests (571 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures648 (47 SAFE / 497 REVIEW / 104 KEEP), 0 insrc/.
Step 4 of the 4 Dec research entry (Java recall is zero on real repos): the CDI observer — a private method with a parameter annotated @Observes is invoked by the CDI container when the event fires, and the runtime resolves it by parameter type, so no call exists in source and the observer graded SAFE (the Sonar S1144 CDI shape: even full semantic analysis misses the implicit reference). The parsers (src/parse-java.js, mirrored in docs/parse-java-web.js) now scan each method's formal parameters for an @Observes annotation and flag the method with observesParameter; the confidence engine (src/confidence.js, mirrored in docs/analyzer.js) grades a flagged method KEEP, like the serialization callbacks and the @MethodSource provider. The rule sits after the arity check on purpose, so an observer live code also calls gets no finding at all (batch 41's placement trap). The rule is targeted: only @Observes counts — a parameter annotated @NonNull or anything else does not keep the method, since Sonar warns against blanket-keeping methods with any annotated parameter, and an annotation on the method itself is the separate framework-invoked rule, not this flag. @Observes may carry arguments (@Observes(notifyObserver = Reception.IF_EXISTS)), unlike @MethodSource where arguments change the meaning, and a fully qualified @jakarta.enterprise.event.Observes (or javax.*) counts via the simple name. Cache FORMAT_VERSION 10 → 11 (new per-definition field).
Measured effect (same clones, before → after, finding-ID diffs). All 12 bench repos byte-identical (id|grade|reason) to the batch-43 after-sets: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,768 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328 — no bench repo has an @Observes observer that was SAFE, not even junit5 itself. The probe flips exactly one finding (hidden_files/java-probe-2026-12-04/CdiObserver.java: onStart SAFE → KEEP; probe total 7 SAFE → 6). Bench evidence in ~/workspace/bench-repos/batch44-work/ (compare script + per-repo after-sets). Pinned by 7 new tests in test/java-observes.test.js (bite-checked: 6 fail with src/ stashed; the 7th pins the pre-existing live-called behaviour) + 1 in test/web-analyzer.test.js for the web mirror.
- Full suite: 564 tests (563 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures648 (47 SAFE / 497 REVIEW / 104 KEEP), 0 insrc/.
Step 3 of the 4 Dec research entry (Java recall is zero on real repos): the implicit JUnit 5 @MethodSource provider — a @ParameterizedTest method with a bare @MethodSource (no value) is fed at runtime by a static method of the same name in the same class, and JUnit resolves the provider by name, so no call exists in source and the provider graded SAFE (the Sonar S1144 shape: even full semantic analysis misses the implicit reference). The parser (src/parse-java.js, mirrored in docs/parse-java-web.js) now records the triple when a method carries both @ParameterizedTest and a bare @MethodSource — a marker annotation, or one with an empty argument list (@MethodSource(), which JUnit treats the same as bare) — and flags the same-class, same-name method that is not the test method itself with implicitMethodSource. The confidence engine (src/confidence.js, mirrored in docs/analyzer.js) grades a flagged provider KEEP, like the serialization callbacks: the runtime invokes it by reflection. The rule sits after the arity check on purpose, so a provider live code also calls gets no finding at all (batch 41's placement trap). An explicit @MethodSource("name") is not bare — its string already keeps the named provider at REVIEW — and a @MethodSource without @ParameterizedTest invokes nothing, so both stay out; a same-named method in another class is not the provider either. Cache FORMAT_VERSION 9 → 10 (new per-definition field).
Measured effect (same clones, before → after, finding-ID diffs). All 12 bench repos byte-identical (id|grade|reason) to the batch-42 after-sets: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,768 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328 — no bench repo has a bare-@MethodSource provider that was SAFE, not even junit5 itself. The probe flips exactly one finding (hidden_files/java-probe-2026-12-04/MethodSource.java: testColor SAFE → KEEP; probe total 8 SAFE → 7). Bench evidence in ~/workspace/bench-repos/batch43-work/ (compare script + per-repo after-sets). Pinned by 6 new tests in test/java-method-source.test.js (bite-checked: 5 fail with src/ stashed; the 6th pins the pre-existing live-called behaviour) + 1 in test/web-analyzer.test.js for the web mirror.
- Full suite: 556 tests (555 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures648 (47 SAFE / 497 REVIEW / 104 KEEP), 0 insrc/.
Step 2 of the 4 Dec research entry (Java recall is zero on real repos): PMD's 6.50 rule for Java fields — a private field in a class carrying ANY annotation, or with any annotation itself, is REVIEW at most, never SAFE. Annotations often enable a framework (dependency injection, mocking, Lombok) that uses the field by reflection or other means static analysis cannot see, and a denylist cannot cover unknown frameworks: a @CustomBean class's unused field graded SAFE on batch-41 HEAD. The confidence engine (src/confidence.js, field branch) now demotes a private field whose enclosing class carries any annotation outside the known-framework set to REVIEW, with the annotation named in the reason. The field's own annotation needs no new code — any annotated private member is already KEEP ("framework-invoked") before the field branch is reached, which is stronger than the REVIEW the rule asks for; that half is pinned by a test rather than re-built. The check sits after the write / load-bearing / coverage checks, so it only fires for a field that would otherwise grade SAFE, and the more specific REVIEW reasons keep their wording. A known-framework class keeps its framework reason (that check fires first), and a written-but-never-read field in an annotated class keeps the write reason.
The blanket is field-specific on purpose and is NOT extended to methods: a @Service class's dead private helper is the most common real Java dead code, and an annotated method is already base-kept when the annotation is on the method itself — a dead private method in an annotated class still grades SAFE, pinned by a test. No parse change, so no cache FORMAT_VERSION bump and no web mirror: the sync web analyzer skips Java files entirely, and the async web parser's shape is unchanged (the full suite passing confirms no parity guard tripped).
Measured effect (same clones, before → after, finding-ID diffs). Measured first, as the research entry required: under --java-safe, junit5 has 0 SAFE and gson has 0 SAFE, so the rule costs 0 SAFE on the bench repos — its cost is future recall, not current findings. The isolated probe (UnknownAnnField / UnknownAnnMethod / NoAnnField) flips exactly one finding: UnknownAnnField.unused SAFE → REVIEW with the PMD 6.50 reason; the NoAnnField control stays SAFE and the UnknownAnnMethod.helper method stays SAFE. The full probe directory is unchanged (8 SAFE). All 12 bench repos byte-identical (id|grade|reason) to the batch-41 after-sets: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,768 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328. Bench evidence in ~/workspace/bench-repos/batch42-work/ (compare script + per-repo after-sets). Pinned by 5 new tests in test/java-annotated-field.test.js (bite-checked: the class-annotation test fails with src/confidence.js stashed; the other 4 pin pre-existing behavior).
- Full suite: 549 tests (548 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures648 (47 SAFE / 497 REVIEW / 104 KEEP), 0 insrc/.
Step 1 of the 4 Dec research entry (Java recall is zero on real repos): a private Java method or field named only by a Javadoc {@link #member} / {@linkplain #member} / @see #member was graded SAFE — a false SAFE, because deleting the member breaks the Javadoc reference (the member analog of FJ-1, which keeps doc-only imports live). The parsers (src/parse-java.js, mirrored in docs/parse-java-web.js) now extract the member name after # from those three tags into a per-definition javadocMention flag, and the confidence engine (src/confidence.js, mirrored in docs/analyzer.js) demotes a flagged private member to REVIEW, never SAFE: the link is a documentation reference, not a runtime call, so a human decides whether the member or the doc goes. Plain prose mentions and {@code} tokens do not demote (the parser records only tag targets), and a malformed target (#123, #bad-name, bare #) names nothing. The member name deliberately never joins references — FJ-1 pins that a #member link adds no reference — so it cannot rescue an import or make the member a live root. Cache FORMAT_VERSION 8 → 9 (new per-definition flag).
One placement trap, caught by the bench re-run before committing: the first version of the check sat before the arity-liveness check, so it also fired for Javadoc-linked methods that live code actually calls — junit5 gained 7 net-new REVIEWs (e.g. AnnotationUtils.findAnnotation, called by the public overloads and @see-linked in their docs) and gson 1. A Javadoc-linked method that live code calls is live and gets no finding, so the demotion is guarded by the arity test for methods (!javaArityIsLive(def)); fields need no guard, since they only reach the branch when unread from live code. Pinned by a dedicated test (a linked method called from a public method has no finding; bite-checked: it fails with the guard removed).
Measured effect (same clones, before → after, finding-ID diffs). All 12 bench repos byte-identical (id|grade|reason) to the batch-40 after-sets: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,768 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328 — exactly as the research entry required (no grade changes on gson/junit5; no petclinic clone exists locally to re-run). Bench evidence in ~/workspace/bench-repos/batch41-work/ (compare script + per-repo after-sets). The probe file from the research run (hidden_files/java-probe-2026-12-04/JavadocLink.java) flips linkedOnly from SAFE to REVIEW. Pinned by 6 new tests in test/java-javadoc-link.test.js (all 6 fail with src/ stashed) and 1 new test in test/web-analyzer.test.js (web grades the same shapes REVIEW, and a linked live-called method has no finding there either).
- Full suite: 544 tests (543 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures648 (47 SAFE / 497 REVIEW / 104 KEEP), 0 insrc/.
Shallow-clone git age is no longer reported as evidence (umami issue 3 / NestJS issue 3 from the 1 Dec training entries). Every finding used to carry gitAgeDays / gitCommits from git log, but on a shallow single-commit clone every file shows the same commit — gitCommits: 1 and an identical age on all findings — which looks like real corroboration and says nothing. gitInfo (src/git.js) now counts history depth with git rev-list --count HEAD first, and when the depth is 1 it returns no per-file info, so the evidence fields are null (shown as "no git" in the map, omitted in the terminal). A genuinely single-commit repo is the same case — one commit touches every file there too — and a two-commit repo keeps real per-file ages, so the boundary is exactly depth 1. Git evidence is evidence-only (it never feeds a grade), so no grade changes anywhere.
While verifying the fixture counts for this batch, the --json - output turned out to be truncated mid-string when piped (deterministically at 65,470 bytes, ~600 KiB report). The first suspect — process.exit() racing an async process.stdout.write() — was wrong: the real cause is that creating a worker_threads Worker flips stdout (fd 1) to non-blocking mode, and the flag stays set after the workers terminate, so a plain fs.writeSync loop throws EAGAIN after one 64 KiB pipe buffer (verified with a probe: before a worker the write blocks and completes, after it throws EAGAIN after exactly 65,536 bytes). The fix is the async path done properly: --json - now awaits the process.stdout.write callback before anything below it can exit (src/cli.js), which drains correctly on a non-blocking pipe. The --fail-on exit-1 path is covered by the same await.
Measured effect (same clones, before → after, finding-ID diffs). All 12 bench repos byte-identical (id|grade|reason) to the batch-39 after-sets: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,768 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328. All 12 clones are shallow single-commit checkouts (verified with git rev-list --count HEAD), so every finding in every repo — about 110,000 in total — now carries null git evidence instead of the bogus single-commit age. Bench evidence in ~/workspace/bench-repos/batch40-work/ (compare script + per-repo after-sets). Pinned by 5 new tests in test/git.test.js (bite-checked: the 2 depth-1 tests fail with src/git.js stashed) and 1 new test in test/cli.test.js for the large piped report (bite-checked: fails with src/cli.js stashed — the old code truncates the ~600 KiB report at 65,470 bytes).
- Full suite: 537 tests (536 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures648 (47 SAFE / 497 REVIEW / 104 KEEP), 0 insrc/.
Knip 6.51.0 #2480 probe (step 6 of the 3 Dec research entry: coverage/runtime signals) — the namespace-member shape does not reproduce, but the probe found a sibling gap in the same area and that is what got fixed. Knip fixed namespace member access through dynamic imports; deadcode-map already credited ns.member via the graph's member-use channel (any member access in a file with an import edge to the module credits the export, and dynamic-import edges count). Verified with a six-shape probe: top-level await ns.x(), .then(ns => ns.x()), a dynamic import inside a function, and the static import * as ns control all credit the member, and the never-referenced controls grade REVIEW. But a name destructured straight out of the awaited import — const { called } = await import('./mod'), exactly Knip's fixture shape, which destructures Helpers out of await import('./dynamic-only') — graded REVIEW "exported but never imported", and so did destructuring the namespace object (const ns = await import('./mod'); const { called } = ns;), while the CJS equivalent (const { called } = require('./mod')) was already credited. The parser (src/parse-js.js, mirroring the require walk) now records destructured names from an awaited dynamic import as import names, and a namespace binding (const ns = await import(...)) lets a later const { a } = ns record the same; a bare identifier binding is the module namespace, not the default export, and gets no entry (member access on it is already credited), and an unawaited import() binds nothing (it is a promise). Cache FORMAT_VERSION 7 → 8.
Measured effect (same clones, before → after, finding-ID diffs). 11 of 12 bench repos byte-identical; nestjs 2,770 → 2,768, gained 0, lost exactly 2 — both lost REVIEWs are the fix working on real code, hand-verified: RequestLazyModule and TransientLazyModule in nestjs's own lazy-loading example (integration/lazy-modules/src/lazy.controller.ts, the documented LazyModuleLoader pattern) are destructured from await import(...) and passed to load(). All other counts unchanged: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328. Bench evidence in ~/workspace/bench-repos/batch39-work/ (compare script + per-repo after-sets). The new behaviour is pinned by fixture fixtures/js-dynamic-import-destructure/ + 1 test in test/fixtures.test.js (bite-checked: without the fix the destructured names grade SAFE in the app-repo fixture). The web gap is pinned in test/web-batch14.test.js (the web grades all 8 live dynamic-import exports SAFE there — it credits neither the destructuring nor the member access, and does not count a dynamic import as a file importer), not ported.
- Full suite: 535 tests (534 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures648 (47 SAFE / 497 REVIEW / 104 KEEP), 0 insrc/— exactly +8 REVIEW vs batch 38, the planted dead exports in the new fixture (the whole-repo scan keeps them REVIEW via the test file's string mentions, the known effect from batches 33/38).
Knip 6.49.0 #2460 probe (step 4 of the 3 Dec research entry: coverage/runtime signals) — does not reproduce, so no fix. Knip fixed enum members iterated with for...in being reported as unused; deadcode-map never had that shape. The probe (an exported enum iterated with for...in from the entry, an exported enum read via Object.keys, a non-exported enum iterated inside a live function, two never-referenced enums as controls) shows the iterated enums have no finding at all — the for...in right-hand side is a bare read of the enum, and enum members are not definitions (only the enum itself, kind type, in src/parse-js.js), so the member-level false SAFE Knip fixed cannot occur. The two controls grade SAFE, correctly. Pinned as fixture fixtures/ts-enum-forin/ + 1 test in test/fixtures.test.js (bite-checked: with the for...in / Object.keys uses removed from a scratch copy, all three iterated enums flip to SAFE). The version record is also updated (step 5 of the same entry): the comparison table now reads Knip v6.51.0 (3 Dec 2026) and Skylos v5.9.0 (1 Dec 2026), verified via the GitHub API this run. Knip 6.51.0's one accuracy-relevant item — namespace member access through dynamic imports (#2480) — is recorded as an open probe in the backlog, not built in this run.
- Full suite: 534 tests (533 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures640 (47 SAFE / 489 REVIEW / 104 KEEP), 0 insrc/.
Auto-discovery now merges every coverage report it finds (step 3 of the 3 Dec research entry: coverage/runtime signals). parseCoverage used to take the first file found in priority order — a repo whose unit tests write coverage.xml and whose e2e tests write lcov.info silently used only the XML run. Now all four standard locations (coverage.xml, coverage/coverage.xml, lcov.info, coverage/lcov.info) are parsed and merged with the same union code as explicit inputs (mergeCoverage in src/coverage.js): a line counts as covered when any run covered it, function hits take the max, and a lone auto-discovered report keeps its own source instead of becoming merged. Per-file sources stay per-file — a file covered by only one run keeps that run's source in its evidence. The change is one-way safe like every other coverage merge: it can only demote a would-be SAFE to REVIEW, never promote one.
Measured effect (same clones, before → after, finding-ID diffs). None of the 12 bench repos carries a coverage file, so all 12 are byte-identical to the batch-36 after-sets: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,770 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328. Bench evidence in ~/workspace/bench-repos/batch37-work/ (compare script + per-repo after-sets). The new behaviour is pinned by 3 new tests in test/coverage.test.js (bite-checked: all 3 fail with src/coverage.js stashed — the updated first-wins test now asserts the merge, plus a four-location merge test, a lone-report source test, and an end-to-end scan with no --coverage flag where the XML run rescues one dead symbol and the lcov run the other): a probe repo with coverage.xml covering _dead_a and lcov.info covering _dead_b went from _dead_a REVIEW / _dead_b SAFE to both REVIEW.
- Full suite: 533 tests (532 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures638 (47 SAFE / 487 REVIEW / 104 KEEP), 0 insrc/.
0%-coverage corroboration on SAFE findings (step 2 of the 3 Dec research entry: coverage/runtime signals). Coverage used to only ever weaken a finding — a symbol whose body ran under tests demotes SAFE to REVIEW. Now the other direction is recorded too, as evidence only: a SAFE finding whose body never ran in the covered runs carries coverageCorroborated: true in its evidence plus a note in its reason ("coverage corroborates: 0% of its body ran in the covered runs"), so triage and --prove can rank corroborated SAFEs first. The grade never changes on it — stale or partial coverage can show 0% for live code, so an uncorroborated SAFE is no weaker for it, and this is the missing half of advance criterion #3 (confidence backed by more than name matching). The signal is the demotion signal read the other way round (coverageCorroboratesDead in src/coverage.js): a 0-hit function record corroborates even a one-line definition and is authoritative when present (an outer function is corroborated even when its nested definition's lines ran); without a record the body lines must be reported in the file's line set and none covered — lines the report never mentions are no signal, so a partially instrumented file cannot corroborate by absence. The definition line itself never counts (it executes on import / class load), so a one-line field is never corroborated. Wired at all four SAFE sites (src/confidence.js: generic symbol, Java private method, Java private field, dead file — a dead file with 0% of its lines covered is corroborated the same way), and only when the final grade is SAFE (the Java SAFE gate demotes to REVIEW first, and a gated finding carries no flag). The flag also flows to SARIF properties and the MCP findingSummary evidence; JSON output carries it automatically, and terminal + map show it through the reason suffix.
Measured effect (same clones, before → after, finding-ID diffs). None of the 12 bench repos carries a coverage file, so all 12 are byte-identical to the batch-35 after-sets: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,770 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328. Bench evidence in ~/workspace/bench-repos/batch36-work/ (compare script + per-repo after-sets). The new behaviour is pinned by 5 new tests in test/coverage.test.js (bite-checked: all 5 fail with src/ stashed): a planted dead function stays SAFE with coverageCorroborated: true under lcov and Cobertura with and without function records, stays unflagged with no coverage, with a covered body (REVIEW), and when the report never mentions its body lines; a dead file with 0% coverage is corroborated; a Java multi-line field and a one-line method with a 0-hit record are corroborated, a one-line field is not, and gated (REVIEW) Java findings carry no flag.
- Full suite: 530 tests (529 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures638 (47 SAFE / 487 REVIEW / 104 KEEP), 0 insrc/.
Coverage now carries per-function records (top open item from the 3 Dec research entry: coverage/runtime signals). The parsers used to throw away lcov FN:/FNDA: and Cobertura <method> records and demote only on body-line ranges, which left two holes: a one-line definition has no body lines and could never be demoted, and a nested definition sharing the range could demote its outer function. Now src/coverage.js parses both record shapes into a per-file functions map keyed <line>:<name> — lcov pairs FN/FNDA in order per name, so same-name functions keep separate counts (an FNDA with no matching FN, or an FN with no FNDA, is dropped, never a hit count of 0 by fiat); Cobertura takes the method's line attribute when present (JaCoCo), else its first reported line, and counts only the method's own lines, so a nested method's lines belong to the nested method. coverageForFunction matches by (name, definition line), with a bounded unique-name fallback for producers that number the first body line instead of the definition line. The generic path and the Java private-method path use it through one helper (coverageDemotionReason in src/confidence.js): when the report names the function, its hit count is authoritative — hits > 0 demotes to REVIEW, 0 hits never demotes even when the range shows covered lines; without a record the body-line check applies exactly as before. Fields keep the body-line check inline — they have no function record. Merging runs takes the max hits per function, like the union of covered lines. One thing the parsers also fixed in passing: real Cobertura output lists each line twice (once inside its method, once at class level), so method blocks are stripped before the class-level line count — linesTotal no longer double-counts when methods are present (a producer that lists lines only inside its methods still falls back to counting those).
Measured effect (same clones, before → after, finding-ID diffs). None of the 12 bench repos carries a coverage file, so all 12 are byte-identical to the batch-34 baselines: django 41,444 (SAFE 1), typer 2,174 (SAFE 2), fastapi 7,492 (SAFE 1), pydantic 21,920, click 1,134, flask 1,214, requests 632, umami 661 (SAFE 53), nestjs 2,770 (SAFE 43), date-fns 1,013 (SAFE 1), junit5 --java-safe 25,226, gson --java-safe 8,328. Bench evidence in ~/workspace/bench-repos/batch35-work/ (compare script + per-repo after-sets). The new behaviour is pinned by 8 new tests in test/coverage.test.js (bite-checked: all 8 fail with src/coverage.js + src/confidence.js stashed): a planted one-line function flips SAFE → REVIEW with FNDA 3 / a Cobertura method record of 2 hits (Python and a one-line Java private method), stays SAFE with 0 hits or no coverage, and an outer function whose nested definition's lines are covered stays SAFE when its own record says 0 hits.
- Full suite: 525 tests (524 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures638 (47 SAFE / 487 REVIEW / 104 KEEP), 0 insrc/.
Class attributes of a live class are public surface now (training issue: public-API blindness — the top open item from the 1 Dec NestJS training entry). A class attribute of a live class grades REVIEW, never SAFE: any code holding the class, an instance, or a subclass can read it by attribute lookup, including downstream code outside this repo, which the in-repo graph cannot see. The same reason methods are REVIEW at most. A class attribute of a dead class keeps its normal grade — nothing can reach the class, so the attribute is dead with it. The rule is Python-only: a Java field is provable in-file when private, and JS class fields are not recorded as definitions at all. It sits after the more specific class-attribute rules (override family, cross-file attribute read, Sphinx docs, external base), so those keep their better reasons. The liveness set it reads (liveClassNames, from the same-file cascade) is now hoisted out of the if (scopes) block so the grading loop can use it; on a stale parse cache it stays empty and the rule never fires — fail-open, never a new SAFE.
Measured effect (same clones, before → after, finding-ID diffs). Exactly four grade changes, all SAFE → REVIEW, zero gained, zero lost, zero other grade changes. Django 41,444 findings, SAFE 2 → 1 — handles_files (django/contrib/staticfiles/handlers.py:22, StaticFilesHandlerMixin, documented "May be used to differentiate between handler types"); globalThreshold stays SAFE. Typer 2,174, SAFE 4 → 2 — command_class / group_class (typer/core.py:1102-1103, public attributes of the exported TyperGroup); _AnyCallable and _click_patched stay SAFE. FastAPI 7,492, SAFE 2 → 1 — bearerFormat (fastapi/openapi/models.py:352, a Pydantic field on the live HTTPBearer model, populated from OpenAPI documents). Pydantic 21,920, Click 1,134, Flask 1,214, Requests 632, Umami 661 (SAFE 53), NestJS 2,770 (SAFE 43), JUnit5 --java-safe 25,226, Gson --java-safe 8,328 — byte-identical. New fixture fixtures/py-class-attr-dead/ pins the boundary (a dead class in a dead module, and a nested class of a dead factory, both stay SAFE); the py-batch14-class-attrs, py-class-attrs, and py-attr-overrides tests now assert the live-class attributes REVIEW. New tests are bite-checked (the three updated tests fail with src/confidence.js stashed; the boundary test passes without the fix, as it should).
Known gaps (web only): the web analyzer has no public-surface rule, so the three planted attributes are still SAFE there while the CLI grades them REVIEW — test/web-batch14.test.js pins the divergence instead of asserting agreement (batch-33 gap on both the batch-14 and the older class-attrs fixtures). Web work is deprioritized; port the rule when web focus resumes.
- Full suite: 516 tests (515 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures638 (47 SAFE / 487 REVIEW / 104 KEEP), 0 insrc/.
export default <identifier>; is now a named default export (training follow-up from the umami svg/Link.tsx case). The parser used to record the export as a phantom name default and count the statement as a use of the identifier, so the definition was neither exported nor used anywhere else — it got no finding at all. Now pass 1 records { name: 'default', local: <identifier>, isDefault: true }, the definition is marked exported + isDefault, and pass 2 does not count the statement as a use — exactly like export { SvgLink }. Two guards keep the neighbouring shapes correct: any other default value (export default foo(), export default foo.bar, export default 42) keeps the old shape and its identifiers are genuine uses; re-exporting an import (import foo from './x'; export default foo;) still counts as a use of the imported binding, mirroring the export { } rule.
Measured effect (same clones, before → after, finding-ID diffs). Umami 655 → 661 findings, SAFE 47 → 53 — exactly the six orphan svg components (SvgCalendar, SvgClock, SvgGlobe, SvgLink, SvgMoon, SvgSun), 0 lost, 0 grade changes; each file is const SvgX = (...) => ...; export default SvgX; with no importer anywhere in the repo (hand-verified by grep — the files were already confirmed dead on 1 Dec, the symbols were the invisible half). Django 41,443 → 41,444, SAFE 2 = 2 — exactly one gain, rootConst in tests/staticfiles_tests/project/documents/absolute_root.js, graded KEEP ("in a test file": the only references are URL imports in a cached test fixture and byte-string expectations in test_storage.py). NestJS 2,770, Typer 2,174, JUnit5 --java-safe 25,226, Gson --java-safe 8,328 — byte-identical, 0 gained, 0 lost, 0 grade changes. The js-file-pathrefs fixture's Link.js is back to the named default export form, and the SvgLink symbol now grades REVIEW there. New tests are bite-checked (all 3 fail with src/parse-js.js stashed).
Known gaps (web only): the web analyzer still counts export default SvgLink; as a use and hides the symbol entirely, so test/web-batch14.test.js pins it as a sixth pathrefs gap. Web work is deprioritized; port the named-default-export rule when web focus resumes.
- Full suite: 514 tests (513 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures631 (47 SAFE / 480 REVIEW / 104 KEEP), 0 insrc/.
File findings now use path/import-based string references only (training issues umami-1 and NestJS-2, same root cause). A string mentions a file only when it names the file by path — a path suffix (components/svg/Link, with or without the extension, after an alias or root prefix), a relative path (./Link, ../svg/Link) resolving to the file, or the bare filename with its extension (Link.tsx). A bare stem token is not a file reference, and a static import specifier is consumed by the import graph, never a free string mention. The symbol loop is unchanged: bare symbol names still keep a file alive (a config naming a handler keeps it at REVIEW).
Why. Umami's src/components/svg/Link.tsx was REVIEW while its five sibling svgs were SAFE: 35 of its 48 string refs were the import specifier '@/components/common/Link' (a different file), 12 were intl translation labels, 1 was a title: 'Link' UI string. src/lib/react.ts had 480 refs, mostly 'react' / 'react-dom' / '@tanstack/react-query' import specifiers and package.json/tsconfig strings. NestJS had the same shape: same-named files in other samples kept each other at REVIEW (date.scalar.ts, http-exception.filter.ts, timeout.interceptor.ts, logging.interceptor.ts, generate-typings.ts — import specifiers of a same-named sibling, or a bare word in another sample's spec).
Measured effect (same clones, before → after). Umami 655 findings, SAFE 45 → 47 — exactly the two targets flipped (svg/Link.tsx, lib/react.ts), no other grade change. NestJS 2,766 → 2,770 findings, SAFE 32 → 43: the 9 same-name flips above, plus 2 cascade services (defaults.service.ts, core.service.ts — their only importer, defaults.module.ts, went SAFE, so they die in iterations 2–3 with cascade evidence) and 2 new REVIEW class findings for those services. Every flip was hand-verified against the referring strings. Django 41,443, Typer 2,174, JUnit5 --java-safe 25,226, Gson --java-safe 8,328 — all byte-identical, 0 gained, 0 lost, 0 grade changes. New fixture fixtures/js-file-pathrefs/ pins every shape (relative path, bare filename, alias suffix, template reference, script-command word, import-specifier exclusion, config-handler safety net); the js-deps fixture gains a dynamic-import dependency case. All new tests bite-checked.
Two regressions the real-repo check caught, both fixed in this batch. (1) Dynamic-import dependencies: await import('is-docker') / await import('node-fetch') in umami's scripts/telemetry.js were the deps' only signal, and it travelled through the string index — excluding import sources from the index surfaced both as REVIEW dependency findings. The dependency check now counts dynamicImports as real imports alongside static ones. (2) Django template nested quotes: {% static "admin/js/theme.js" %} pairs the outer quotes in a naive quoted-string scan and drops the inner path, so theme.js and popup_response.js briefly graded SAFE (false SAFEs). Raw-text extraction now also matches path tokens and bare filenames as tokens (a / is deliberately not a token prefix, so a shorter suffix inside a longer path cannot mis-attribute; a bare filename token must follow a quote, so a command word like ts-node generate-typings.ts in another sample's script is not a reference). Both fixes are pinned by fixture tests.
Known gaps (web only): the web still uses the old bare-stem rule, so test/web-batch14.test.js now records the divergence instead of asserting agreement: stringKept.js is REVIEW on the web but SAFE on the CLI, deadString.js carries iteration-3 cascade evidence on the web but none on the CLI (SAFE in pass 1), and the new js-file-pathrefs pin test records five web-REVIEW / CLI-SAFE items. Web work is deprioritized; port the path-mention rule when web focus resumes.
- Full suite: 512 tests (511 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures630 (47 SAFE / 479 REVIEW / 104 KEEP), 0 insrc/.
The warm-run floor is now profiled (backlog item 3, closed) — with a
--timing flag to keep it measurable, and three safe speedups that
cut warm scans by about a fifth on this VM.
Profile (warm, 100% cache hits, this VM). A CPU profile of a warm
fastapi run put path.relative / resolve / normalizeString at
~23% of warm CPU — most of it inside grading, where the evidence
builder called path.relative once per string referrer per finding
(7,492 findings on fastapi), and the walk called it once per
.gitignore rule per walked entry (fastapi's root .gitignore has
28 rules). The cache save was another ~8%: every warm run rewrote
the whole multi-MB cache file (fastapi 13 MB) even when nothing had
changed. Phase breakdown from --timing (medians, warm): fastapi
prepare ~0.48 s, parse ~0.05 s, graph ~0.22 s, git ~0.07–0.11 s,
grade ~1.13 s (string index ~0.06 s of it), cache save ~0.17 s;
date-fns prepare ~0.35 s, grade ~0.64 s, cache save ~0.15 s. Grading
— not parsing, not the string index — is the warm floor: it re-grades
every file once per fixpoint iteration, and the per-finding evidence
work is where the time goes. The string index itself is only ~60 ms.
Warm times are noisy on this shared VM (the grade phase occasionally
spikes to ~3 s and the parse phase once to ~0.6 s, in runs before this
batch too — scheduling/GC, not the tool), so the numbers below are
medians of clean runs, first-run outliers excluded.
The three fixes. (1) Grading now looks relative paths up in a
map built once per scan (relByFile, from the graph's per-file rel
plus one path.relative per text file) instead of calling
path.relative per referrer per finding, and coverage lookups are
resolved once per file per scan instead of once per file per fixpoint
iteration (covByFile); every call site keeps a path.relative /
coverage.get fallback for paths outside the map. (2) The cache
save is skipped when nothing changed — no miss stored, no entry
dropped, neither measured value moved — so a pure warm run leaves
the cache file's bytes and mtime untouched; stats() reports
saved: false for the skipped write (true when it writes, null when
save() never ran). A changed or deleted file still saves. (3) The
.gitignore check groups rules by base directory and computes the
relative path once per directory instead of once per rule, preserving
rule order (later rules still override earlier ones).
Measured effect (medians, same clones, findings identical).
fastapi warm 2.17 s → 1.65 s (prepare 0.48 s → 0.29 s, grade 1.13 s
→ 0.95 s, cache save 0.17 s → ~0.001 s); date-fns warm 1.53 s →
1.26 s (prepare 0.35 s → 0.25 s, cache save ~0.15 s → ~0.001 s).
Cold still writes the cache (fastapi cold 42.4 s on this run,
7,492 findings, identical to warm). Real-repo check: umami 655
(45 SAFE), typer 2,174 (4 SAFE), django 41,443 (2 SAFE) — finding
IDs identical to the batch-27 baselines (django matches the
corrected 41,443 end state; the 28 IDs in the mid-batch
final-django.json that this run "loses" are the batch-27 Bug-2
misfire set — the as_oracle family — that batch 27 itself removed).
5 new tests (3 skip-save cases, API timings shape, CLI --timing
stderr/JSON purity — all bite-checked); full suite 510 tests
(509 pass, 1 skipped — the javac test). Dogfood 0 findings;
--include-fixtures 611 (46 SAFE / 461 REVIEW / 104 KEEP), 0 in
src/, identical to the clean tree — one near-miss caught by that
check: the first version of the changed-file test used the literal
'f1.js', whose f1 token kept the js-cascade-chain/f1.js
fixture alive at REVIEW and hid the whole f2–f8 chain; the test now
asserts the entry count instead.
Decision recorded for the next speedup. A --diff-style
changed-files mode is NOT the next step: it would need the same
invalidation proof as caching edges, and the remaining warm floor
is grading, which a changed-files mode does not shrink for a full
report. A cached string-ref index is also not the next step: the
index build is only ~60 ms — caching it would buy almost nothing
and would add a second cache to invalidate. The next step is the
grade phase itself (per-finding evidence work, frameworkKeepSymbol
per symbol, the fixpoint re-grading every file every iteration) —
profiled, not yet attempted.
--cache-stats overstated the parse time saved by more than 2× on every
warm run. The estimate summed per-file parse CPU times, but parses run in a
parallel worker pool — fastapi reported ~60 s saved for ~25 s of wall-clock
saving, date-fns ~29 s for ~13 s. The estimate is now a wall-clock one: the
cache file stores the parse phase's effective parallelism (CPU parse time /
parse-phase wall time, measured on fully cold runs and kept across warm runs
like the average parse cost), and a warm run reports (files × average parse
cost / parallelism) minus its own parse-phase cost (cache lookups,
deserialisation). A warm run on a cache written before any run measured the
parallelism falls back to the worker count a cold run would use, which errs
low. Verified on the bench clones: fastapi cold 36.6 s → warm 5.8 s, reported
~29.4 s saved vs ~30.8 s actually saved (within 5%); date-fns cold 17.4 s →
warm 3.5 s, reported ~14.2 s vs ~13.9 s actually saved (within 2%). Findings
identical cold vs warm on both (fastapi 7,492, date-fns 1,012). The README
cache claim is re-based to these measured ranges — the old "8–10×" (fastapi
13.0 s → 1.3 s) was measured on a faster machine and no longer holds on this
VM. 3 new tests in test/cache.test.js (stored-parallelism division,
worker-count fallback, cold-run measurement); full suite 505 tests (504 pass,
1 skipped — the javac test). Dogfood 0 findings; --include-fixtures 611
(46 SAFE / 461 REVIEW / 104 KEEP), 0 in src/. The warm-run floor itself
was profiled and cut in batch 29 (see above).
Java landed in the CLI in batch 6 (private-only SAFE:
tree-sitter-java, calls grouped by name + arity, field read-vs-write
tracking, fail-open on parse errors; exact-16 fixture SAFE set, 0
false SAFE). Batch 7 added framework packs as data —
frameworks/spring.json (61 keep-decorators, 20 class annotations)
and frameworks/jackson-jpa.json (59 + 9) — and a fix for imports
used only by annotations (@JsonProperty) wrongly graded SAFE. Web
checker Java support was deliberately not shipped: a regex port
cannot meet the "never a SAFE the CLI would not" bar (no scopes, no
arity channel, field read-vs-write needs binding resolution); it
needs a real scanner, not regex.
Java SAFE is disabled by default (batch 9 gate, still in place).
Batch 8 measured the CLI on two real Java repos and the precision
collapsed: google/gson 0/64 SAFE true, junit-team/junit5 1/589 —
0.3% overall. The Java call graph had no cross-file resolution and
its same-file live roots were effectively empty, so same-file callers,
Javadoc-only imports, package-info annotations, and same-file field
reads were all missed. Batch 9 repaired the call graph (FJ-7/FJ-9
live roots, FJ-1 Javadoc links, FJ-8 package-info) and gated Java
SAFE off by default so --fix and --prove could never delete Java
code on a default scan; batch 10 finished the repair (arity
comment-counting bug, enum-constant constructor invocations, FJ-2
utility-class / FJ-3 load-bearing-local / FJ-4 serialization policies)
and re-measured gson 0 SAFE and junit5 1 SAFE, the 1 TRUE item —
100% precision on remaining SAFE, zero false positives (see "Batch
10 update" above). The gate stays as a safety default until more
Java repos are measured, since two repos are not proof of generality.
Opt in to the old grading only while measuring, with --java-safe
(or javaSafe: true via the API). The per-family evidence is in
bench8-new/ (junit5-589-judged.md, gson-64-judged.md).
Scan times (same machine): umami 1520 files 15.6 s (~97 files/s),
fastapi 1237 files 12.9 s, date-fns 1776 files 8.6 s — the O(symbols ×
files) string pass is now an inverted index and git is one git log
per repo instead of two processes per file (umami was 173.9 s before).
Repeat scans with --cache are several times faster (content-hash parse
cache, warm findings identical to cold): measured on this VM, fastapi cold
~28–37 s → warm ~1.5–2.2 s and date-fns cold ~13–17 s → warm ~1.2–1.9 s
(100% hit rate) — batch 29 cut the warm floor by about a fifth with a
rel-path lookup map in grading, a gitignore rule grouping, and skipping
the cache rewrite when nothing changed. The warm floor is now the graph
rebuild and grading, not parsing, so the ratio varies by repo and machine
load; --timing prints the per-phase breakdown (prepare / parse / graph /
git / coverage / grade / cache save / total) to stderr for any scan.
--cache-stats reports the wall-clock parse time saved: the summed per-file
parse cost divided by the parse parallelism a cold run measures (fastapi
~2.6, date-fns ~2.5 on this VM, against 3 pool workers), minus the warm run's
own parse-phase cost (cache lookups, deserialisation). A warm run on a cache
written before any run measured the parallelism falls back to the worker
count a cold run would use, which errs low. The cache is
off by default; --no-cache forces a full scan.
Determinism note: a single CLI run is not ground truth on Python repos unless the tool version is pinned — an earlier measurement gap (flask 39 vs 17 SAFE across runs) turned out to be a tool-version change mid-measurement, not nondeterminism: the current tool is byte-identical across 3 repeat runs on flask/requests/click.
The web checker (docs/analyzer.js, regex-based for JS/Python) reproduces the same SAFE findings on every fixture above — verified by the web test suite (96 tests). Java is tree-sitter-parsed, not regex-based (see "Java scope" below). On the 10-repo corpus it no longer crashes on any repo, emits no duplicate finding IDs, and every web SAFE is also a CLI SAFE (web-only SAFE: 0). Batch 4 fixed web multi-line import/require/re-export handling (continuation lines no longer leak into the references pass) and decided the JSX-pragma rule (see "False-positive defences" above); measured on the same clones, web SAFE is 2 vs CLI SAFE 4, at full parity on preact (1 = 1) and next-blog (0 = 0) — the only remaining gap is requests, where the web checker misses 2 CLI SAFE variables in src/requests/_types.py. It is also now faster than the CLI on large repos — the inverted string index was ported to it (fastapi 0.8 s web vs 12.6 s CLI; whole 10-repo corpus ~3 s web). The CLI is still the reference for the few shapes the web misses (see limitations).
Dogfood — deadcode-map run on itself: 0 findings. The repo scans clean: fixture/test-data directories are excluded by default, same-file use counts as alive, and the one genuinely dead helper (named in src/parse-js.js) was deleted. With --include-fixtures the planted fixture data still reports (640 findings, 47 SAFE / 489 REVIEW / 104 KEEP, 0 in src/), which is the point of the fixtures.
A real-repo check on a Python project (a Raspberry Pi / Arduino gateway script) first flagged the runnable __main__ script as a dead file — that false positive is now a regression test (run.py in py-basic), and the same repo now reports 0 SAFE.
Known limitations, stated honestly:
- Java scope (private-only, SAFE off by default — batch 9): Java SAFE is disabled by default (batch 11 re-measured gson 0, junit5 0 and petclinic 0 SAFE with
--java-safe— zero SAFE on all three Java repos measured to date; see "Batch 11 update" above); use--java-safeonly while measuring. When opted in, SAFE applies only to private methods (includingprivate static), private fields, private constructors, unused imports (never on-demandimport foo.*), and unused locals of private methods. Unused parameters are REVIEW, never SAFE: deleting one changes the method's arity, so every call site would break, and--fixonly deletes the declaration. Everything else in Java — public, protected, and package-private members, whole classes — is REVIEW at most, never SAFE, and Java files are never dead-file candidates (there is no Java import resolution yet, so a file cannot be proven unimported). Overloads are told apart by (name, arity) only: same-name, same-arity overloads (process(int)vsprocess(String)) are one unit — a call to one keeps both alive. A varargs method matches any call with arity >= its fixed arity. Any annotation on a private member keeps it (@PostConstruct,@JsonProperty,@Autowired, ...), as does a framework stereotype on its enclosing class (Spring, JPA, Lombok),native, andserialVersionUID. Utility-class constructors (FJ-2, batch 10) are KEEP, never SAFE: a private constructor of a class whose direct members are all static (a utility class —GsonTypes,Primitives,Streams, ...) is an instantiation guard, not dead code. Its purpose is precisely to be uncallable: it prevents instantiation and subclassing, and deleting it would expose a public default constructor and change the class's API (and trip Error Prone'sPrivateConstructorForUtilityClasscheck, which treats the constructor as required). Members of nested or anonymous classes do not count toward the check — a utility class full of anonymousTypeAdapterimplementations is still a utility class. A private constructor of a class with instance members stays SAFE when uncalled: the guard reasoning does not apply there. Private enum constructors are KEEP when no constant invokes them: an enum's constants invoke the constructor at class-load time and the call graph records that (batch 10), so an invoked constructor is live and gets no finding; a constructor no constant invokes is still KEEP, never SAFE — the constructor is the wrong deletion unit for an enum; delete the constant, or the enum, instead. Java serialization callbacks (FJ-4, batch 10) are KEEP: privatereadObject/writeObject(arity 1),readObjectNoData/readResolve/writeReplace(arity 0) are invoked by the serialization runtime via reflection, never by in-repo code — the (name, arity) pair is the contract, and a same-named method with another arity grades normally. The list is hardcoded insrc/confidence.jsnext toserialVersionUID(not a framework pack: packs are not language-gated, and akeepNamesentry would also keep a same-named JS/Python function). Load-bearing unused locals (FJ-3, batch 10) are REVIEW, never SAFE: a local that is never read is still not dead when its initializer calls a method or creates an object — the call may advance a reader (JsonToken unused = reader.peek()), validate input (new SimpleDateFormat(pattern)throws on a bad pattern), or run the measured work of a benchmark (gson.fromJson(...)). Deleting the declaration would remove that call. A truly dead pure local (int x = 1;, never read) stays SAFE. Load-bearing unused fields (batch 11, the field analog of FJ-3) are REVIEW, never SAFE: a private field that is never read is still not dead when its initializer calls a method or creates an object — the call runs when the class loads / an instance is created, so deleting the declaration would remove that call. A truly dead pure field (private int x = 1;, never read) stays SAFE. The Spring and Jackson/JPA annotation lists live as data inframeworks/spring.jsonandframeworks/jackson-jpa.json(a pack-only stereotype such as@ControllerAdviceor@JsonIgnorePropertieskeeps members at REVIEW too). An import used only by an annotation (@JsonProperty) is live — deleting it would break compilation. A name mentioned in any string — Java source, Spring/MyBatis XML,application.properties, YAML — downgrades to REVIEW; names built by string concatenation ("by" + "NameOnly") are undetectable and remain a documented caveat. Test sources (src/test/java,*Test.java) are KEEP at most, never SAFE.--proverunsmvn -q test/./gradlew test(15-minute timeout) when Maven/Gradle is installed. The web checker supports Java too (batch 10):docs/parse-java-web.jsportssrc/parse-java.js(same traversal, diffed against the CLI parser in the test suite so the two cannot drift silently) and parses.javafiles with tree-sitter WASM — web-tree-sitter 0.22.5 (docs/vendor/tree-sitter.js+tree-sitter.wasm) and tree-sitter-java 0.23.5 (docs/vendor/tree-sitter-java.wasm), vendored underdocs/vendor/and lazy-loaded only when a.javafile is present; if the WASM fails to load, Java files are skipped with a warning, never regex-parsed. The web IS the opted-in surface, so it grades Java exactly like the CLI with--java-safe: on the fixtures it matches the CLI finding-for-finding (java-basic 65: 16 SAFE / 36 REVIEW / 13 KEEP; java-batch10-arity 13: 2 / 11 / 0; java-batch10-policy 35: 7 / 20 / 8; java-batch11-fields 8: 2 / 6 / 0), and on the real repos gson (8,328 findings, 0 SAFE) and junit5 (24,947 findings, 0 SAFE — batch 11: the former sole SAFE,SETTINGS_GRADLE, is now REVIEW, its initializer callsPath.resolve; batch 12 re-verified both identical to the CLI finding-for-finding) it reproduces the CLI's--java-safeoutput exactly — web-only SAFE 0. Fixtures are validated with tree-sitter (0 ERROR nodes), notjavac. - Web/CLI parity: the web checker is regex-based, so it misses some things the CLI catches. Measured on the 13-repo corpus at batch 19 (
node ~/workspace/bench-repos/web-bench19.jsagainstbench19-latest/): web SAFE 67 = CLI SAFE 67, the same 67 ids — web-only SAFE 0, missed CLI SAFE 0, grade diffs 0. The remaining gap is recall on REVIEW/KEEP grades: the web reports fewer findings overall on symbol-dense repos (vue2 158 vs the CLI's 1,185, pydantic 14,819 vs 21,401), in the conservative direction. Java (batch 10) is at full parity, not regex-based: the web parses Java with the same tree-sitter traversal as the CLI (see "Java scope" above) — measured on the same clones withnode ~/workspace/bench-repos/b10-java-web/web-bench.js, gson 8,328 findings (0 SAFE) and junit5 24,947 findings (0 SAFE) are identical to the CLI's--java-safeoutput, finding-for-finding, web-only SAFE 0 (batch 11: junit5 is now 0 SAFE —SETTINGS_GRADLEmoved to REVIEW under the field rule, and the web agrees on that file; batch 12 re-verified both at the same counts; batch 19 re-verified all three Java repos identical finding-for-finding). Same-id duplicate findings: 0 on every repo (verified) — the remaining "max per key" counts are repeated definitions of one name in a test file, mostly KEEP. The CLI is the reference; the web checker is a convenience. - A name that appears as a whole string or a code-delimited string still counts as a reference, even when the string is not a real dynamic lookup — for example a test file asserting on the symbol by name (
bySymbol(f, 'src/index.js', 'render')). Those findings land in REVIEW, never SAFE, so the cost is noise, not a false deletion. The same shape applies to the dead-dependency check: a dependency named in a config value (e.g."theme": "chalk") counts as used, and a dependency name that is a prefix of a longer hyphenated name (left-padinsideleft-pad-x) can also count — both are REVIEW noise, never a false deletion.
discover → parse (tree-sitter) → import/call graph → confidence + evidence
↑ git age / churn ↑ string-reference pass
↑ coverage.xml (if present) ↑ framework packs
└─→ CLI / JSON / --fail-on / baseline ─→ HTML map ─→ --fix ─→ --prove
src/discover.js— file walk + entry-point detection.src/parse-js.js,src/parse-py.js,src/parse-java.js— tree-sitter parsers (imports, exports, definitions, calls, dynamic imports, unreachable code, decorators).src/graph.js— import resolution (relative, ESM, CommonJSrequire, dynamicimport(), Python sibling modules), reachability from entry points, per-symbol usage.src/confidence.js— SAFE / REVIEW / KEEP grading with evidence.src/git.js,src/coverage.js— git age/churn and Cobertura coverage evidence.src/map.js— single-file offline HTML map (canvas force graph, no CDN).src/fix.js— SAFE-only deletion, one file at a time.src/prove.js— isolated git worktree + test run, batched by file cluster, bisect on failure.src/baseline.js—.deadcode-map.jsongrandfathering for CI.
- v0.1.0 (shipped): MCP server + Claude Code plugin + AI-tool configs (see "Use with AI tools").
- v1.1: Java (private-only SAFE — private methods/fields/constructors, unused imports, unused locals on private methods; parameters are REVIEW — removing one needs call-site updates; public Java is REVIEW-only — it cannot be proven statically).
- Framework packs: Django, Angular, Spring, pytest (more), Vue, Svelte.
--diff/--sincefor PRs: "what did this PR leave dead?"- Inline ignore comments (
// deadcode-map-ignore-next). - Interactive approve / reject / keep-with-reason in the map.
Knip (~13k stars) is the JS/TS incumbent and Vulture (~5k) is the Python standard, but both are terminal lists with well-documented false positives on dynamic imports, lazy loading, and framework code — and neither proves a deletion is safe or shows you a map. deadcode-map wins on prove + map + multi-language + false-positive-first trust. If v1 were just a terminal list, it would not ship.
MIT. See LICENSE.

