[architecture] Repository-backed diagrams can show unreachable modules as live components
What happens
Archify verifies that each sources[].path exists at the pinned revision, which is great: it caught an uncommitted directory in one of my repos that my own checker missed.
It does not check whether a cited module is actually reached by the running program. A module that is complete, tested, and exported, but that no production code path ever imports, gets drawn as a live component with valid source evidence. The diagram then presents dead code as a capability.
Evidence
I ran a static import-reachability pass (Python only) over 6 of my repositories before rendering with Archify. After removing false positives, 7 modules were drawable with valid sources yet unreachable from any entry point. 6 of the 7 have their own tests, so they look healthy in every other respect:
| Repo | Module | Has tests | Imported by production code |
|---|---|---|---|
| A | orchestrator/scheduler.py |
yes | no |
| B | app/services/email_service.py |
yes | no |
| C | runtime/prioritizer.py |
yes | no |
| C | logging_config.py |
yes | no |
| C | platform/reports/formatter.py |
yes | no |
| C | evals/cases.py |
yes | no |
| D | auth/stripe_skeleton.py |
no | no |
False positives worth knowing about
A naive import graph overreports badly. These are the three cases that produced almost all the noise in my run:
- A repository whose root is itself a package (
__init__.pyat the root) is imported by its directory name. Without that prefix, 25 of 28 modules looked dead in one repo. - Importing
a.b.cexecutesa/__init__.pyanda/b/__init__.pyfirst, and whatever those import. Ignoring that made 17 of 18 flagged modules false in another repo. - Alembic and Django load migrations by file path, never by import.
Suggestion
An optional repository-evidence diagnostic, a warning rather than an error, when a component's only sources are modules unreachable from the repository's entry points. Even a Python-only first version would catch the case above. The entry-point heuristics I used: __main__.py, cli.py, main.py, app.py, any module with an if __name__ == "__main__" guard, and migration directories.
I have a small standalone implementation I can share if this direction fits the project.
Source: tt-a1i/archify