What a static reader gets wrong about a modern codebase

I had a tool that reported no false findings on requests, flask, express, cobra and ripgrep. Then I pointed it at four repositories people actually work in, and it told me 970 of immich's files were dead. Sixteen are.

This is the whole list of what it got wrong, with the line of real code that caused each one. It is not a list of bugs in those four projects. It is a list of things a static reader has to understand before it has earned the right to tell you anything.

The repositories

Five tidy ones — requests, flask, express, cobra, ripgrep — and four that have everything a real codebase has: a monorepo layout, TypeScript path aliases, a filesystem router, a Python subproject, 250-package manifests.

netbox (1,140 source files, Django + TypeScript), immich (1,263; TypeScript, Svelte, Python, Dart, Rust), outline (2,098; TypeScript throughout), documenso (2,168; a Remix monorepo).

FindingBeforeAfterOf those, real
Undeclared production imports, all four repos~801515
immich: files nothing reaches9701616
immich: modules a test reaches5%71%—
documenso: files nothing reaches2044141
Five tidy repos: false findings00—

The five tidy repositories never moved, which is exactly the problem: they could not have caught any of what follows.

1. The word "import" at the end of a string

Outline has this line:

analyticsName: "Navigate to import",

The pattern for an import statement allowed anything between import and the quoted module path, and "anything" includes newlines. So the match began at that lowercase import, took the closing quote as the opening one, and read the next hundred characters of JSX as a module name. The missing-dependency list contained entries like , section: NavigationSection, icon: <ImportIcon .

A dozen findings on outline were fragments of its own source code. Nothing erodes trust in a tool faster: you do not check the other findings, you close the tab.

The rule: an import or export ... from declaration begins a statement. It may only follow the start of a line, or ; } >. The > matters more than it looks — Svelte and Vue write <script>import X from "./X.svelte" on one line, and anchoring to the line start alone missed every import in those files. import(...) and require(...) need no anchor, because the parenthesis is unambiguous.

2. A scope is part of an npm package's name

The dependency is @tanstack/react-table. The tool reduced it to tanstack, looked for that in package.json, did not find it, and reported it missing — from the manifest that declares it.

Every scoped package in a modern TypeScript repository was a false finding. requests, flask and express have almost none, which is why this survived so long.

3. A dot-directory claimed a real package's name

Outline keeps a lint helper at .oxlint/sequelize.mjs. The tool indexed every file by the names it could be imported as, including its bare filename — so sequelize pointed at that helper. Every import ... from "sequelize" in the repository then resolved to it.

This one is worth sitting with, because it fails twice in opposite directions. It invented 107 import edges to a file nothing imports, and put that lint helper in the reading path as a thing the application depends on. And because a resolved import is never reported as external, it hid the real npm dependency from the manifest check. A single bad index entry produced both a false positive and a false negative.

The rule: a dot-directory is tool configuration, not a package. Its files keep their full path as a name, so a genuine relative import still resolves, but they never answer to a bare module name.

4. A repository imports its own code through three different alias systems

This is the one that caused the 970.

Immich's web application writes #lib/components/AdminCard.svelte, 1,516 times. That is a Node subpath import, declared in web/package.json:

"imports": { "#lib": "./src/lib/index.js", "#lib/*": "./src/lib/*" }

Outline writes @shared/utils/browser and ~/components/Button, which come from compilerOptions.paths in tsconfig.json. Documenso uses both.

Resolve none of these and the import graph is not wrong in detail — it does not exist. Immich's web application came apart into unconnected files, so every file was dead code and test reach collapsed to 5%. The tool was not lying about immich. It was describing a graph it had failed to build, with total confidence.

The subtlety: these maps are declared per project, not at the top. Immich's lives in web/package.json. Reading only the repository root finds nothing. A monorepo is the normal case now, not the exception.

5. The extension is part of the specifier

import Card from "./Card.svelte". The file index was keyed without extensions, so this never resolved. Sixty-one of immich's components — each one sitting in the same folder as the route that imports it, imported on a line directly above — were reported as dead code.

The same applies to ESM-style TypeScript, where ./util.js means ./util.ts.

6. Nothing imports a route. The router finds it on disk.

A SvelteKit +page.svelte, a Remix routes/dashboard.tsx, a Next.js app/settings/page.tsx — no file imports any of them. 198 of the remaining "dead" files across immich and documenso were route modules doing exactly what they are supposed to.

The tempting fix is to ignore every routes/ directory. That is also wrong: outline keeps ordinary, imported Koa handlers in server/routes/, and a tool that excludes them can never again tell you about a route nobody calls. So the exclusion applies only where the repository actually declares a filesystem router, and it tests a path segment rather than a substring. app/ gets a narrower rule than routes/, because app/ is just as often an ordinary source folder.

7. The manifest has more sections than it used to

Immich's machine-learning subproject declares pytest and locust in [dependency-groups] — PEP 735, which is where uv-managed projects now put test and lint dependencies. Unparsed, the tool reported them missing from the file that declares them nine lines further down.

8. In Python, the import name is usually not the package name

You install djangorestframework and import rest_framework. You install django-filter and import django_filters — note the s. Netbox declares every one of these, and fourteen of them were reported as missing.

There is no algorithm for this. It is a table, and a tool that does not carry one will be wrong about every Django repository it ever reads.

9. Some modules do not exist until build time

$app/navigation is synthesised by SvelteKit. virtual: is Vite, astro:content is Astro. There is no package to install and no file to find, so no manifest will ever declare them, so they can never stop being findings. Pure noise, forever.

10. A test file is not a production requirement

server/queues/tasks/ExportJSONTask.test.ts is a test. The tool was guessing from directory names — looking for a tests/ folder — and there isn't one, so what it imported was reported as something that breaks your production install.

The repository already knew that file was a test. The fix was to ask it instead of guessing. The same applied to build configuration: what vite.config.ts imports is needed to build the project, not to run it.

11. The same question, asked twice, got two different answers

This one I found by accident, and it is the worst of them.

The in-degree table was built by iterating sets. Python randomises set iteration order per process, so the insertion order changed every run — and with it every tie in a sort that had no second key. One run reported adapters.py (748 lines) as requests' most-imported module; the next reported hooks.py (48 lines).

Both answers were defensible. Both were ties. But a tool that answers differently each time it is asked cannot be checked, and a finding nobody can check is worth nothing at all. There are now explicit tie-breaks in every ranking, and a test that runs the analysis under three different hash seeds and demands one identical report.

What was left

Fifteen undeclared production imports across 8,700 source files, and I checked every one by hand against the manifest that was supposed to declare it. All fifteen are real: things like outline importing koa-compose and express without declaring either, and netbox importing prometheus_client while declaring only django-prometheus, which happens to depend on it. They work today and break the day a transitive dependency changes.

My favourite finding is netbox's. The tool reported an undeclared import called netbox_missing_dependency, and filed it as development-only. The file is netbox/netbox/tests/dummy_plugin/broken_import.py, and its entire contents are a docstring reading "Fixture module whose import fails, for _load_resource error propagation tests." followed by import netbox_missing_dependency.

A deliberately broken import, in a test fixture, correctly identified as both — found, and kept off the list of things that will break your deploy.

The point

Each of these eleven was a confident, specific, checkable claim about real code. Each was wrong. And the five tidy repositories that this tool was originally measured against could not have caught a single one, because they do not use path aliases, or a filesystem router, or scoped packages, or a monorepo layout, or [dependency-groups].

If you are evaluating any tool that tells you what is dead or what is missing, this is the test worth running: point it at something with a tsconfig.json full of paths, and see whether it says your entire application is dead code. Then check three of its findings by hand. If all three are fine, you have learned what the tool is worth.

There are now 53 tests in this one, and most of them are an item on this list.

See the reports these came from

Repo X-Ray reads a codebase you do not know and writes one HTML page: what to read first, what is load-bearing, where the risk is, what your tests cannot see, what breaks in CI. It never imports, installs, runs or uploads anything. Measurements taken 5 December 2026 against the repositories named above, at the commits checked out that day.

More measured notes on coding agents: alexenabled.github.io