Repository navigation
Delete the modules, endpoints and aliases nothing calls - #437
Merged
Merged
Conversation
Seven pieces of the backend had no callers left. Each was verified by
enumerating references across every repo under the workspace, on all
branches, rather than by reading the code that defines them:
- services/background.py, a re-export shim whose docstring says it
exists so main.py and tests keep importing the old path. No test
imported it and services/tasks/__init__.py already exported the
same sixteen names, so main.py now imports the package directly.
- core/types.py, four TypedDicts with zero importers, justified in
the vulture whitelist as "used as type annotations" when they are
not. NodeState also shadowed an unrelated NodeState in
routes/node_schemas.py.
- scripts/smoke_parquet_archive.py, whose two behaviours are covered
by test_parquet_writer.py and test_storage.py.
- /api/test/anomalies, superseded by /api/radar/anomalies, which the
dashboard actually calls. The test version dumped anomaly_log raw
and unauthenticated where the radar one redacts, so this also
closes a small disclosure.
- the two _get_stale_tasks aliases, left behind when the duplicated
rule was collapsed into core/task_registry.
- /api/radar/load-file and pipeline.passive_radar's batch __main__,
the two entry points to the offline .detection path. Neither is
reachable from a runbook, justfile recipe, deploy script or CI
step. load-file was also the codebase's only path-traversal check,
security surface maintained for no traffic.
Deleting those last two orphaned PassiveRadarPipeline.process_file,
their only caller, so it goes with them and the batch .detection path
leaves the tree entirely. The live geolocation path is _run_geolocation
driven by the frame loop, which is untouched and well covered.
generate_aircraft_json stays: its tar1090 batch schema is superseded by
the flush task's, but test_pipeline.py still pins it.
core/types.py's descriptions were worth keeping, but not verbatim:
checked against the code, two of the four had drifted. AircraftPosition
listed callsign, seen, squawk and rssi, where tcp_handler builds flight,
last_seen_ms, recv_ms and world, and omitted last_seen_ms altogether —
the field adsb_store orders writes on and feed_gc evicts on. NodeState
gave status as "active" | "disconnected", but _handle_heartbeat assigns
msg.get("status") straight from the wire, so it is not a closed set.
connected_nodes and adsb_aircraft therefore carry corrected comments
rather than copies, and the adsb one names its writer instead of
restating a field list that had already drifted once. TaskHealth was
already stated verbatim beside task_last_success and task_error_counts,
and GeoAircraft describes a payload one readable function builds, so
neither was carried across.
Nothing branches on either description today, so this fixes no live
fault; it stops the file's claims being re-inherited as fact.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Claude finished @Babissimo's task in 2m 7s —— View job Review complete
Looked at the full diff ( Findings: none. This is a well-executed dead-code removal:
Nice attention to detail overall — deleting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the first tranche-2 item of the consolidation survey: 123zgec37j1.
267 lines net, all of it removal. Each item was verified caller-free by enumerating references across every repo under the workspace, on all branches and including gitignored directories, rather than by reading the code that defines it.
Deleted outright
services/background.pyservices/tasks/__init__.pyalready exports the same sixteen names, and no test imported the old path.main.pynow imports the package.core/types.pyNodeStatealso shadowed an unrelatedNodeStateinroutes/node_schemas.py.scripts/smoke_parquet_archive.pytest_parquet_writer.pyandtest_storage.py./api/test/anomalies/api/radar/anomalies, which is what the dashboard calls. The test version dumpedanomaly_lograw and unauthenticated where the radar one redacts, and read bothanomaly_logandanomaly_hexeswithout takingstate.anomaly_lock, which the radar one does._get_stale_tasksaliasescore/task_registry.Deleted after confirming with the ticket owner
/api/radar/load-fileandpipeline.passive_radar's batch__main__were the two entry points to the offline.detectionpath. Nothing under the workspace reaches either: no runbook, justfile recipe, deploy script, compose command or CI step.load-filewas also the only path-traversal-validating file reader in the tree, so it was security surface being maintained for no traffic.Those two were the only callers of
PassiveRadarPipeline.process_file, so it goes with them and the batch.detectionpath leaves the codebase entirely. The live geolocation path is_run_geolocationdriven by the frame loop, untouched and well covered.generate_aircraft_jsonstays, still pinned bytest_pipeline.py, though it now has no production caller: its tar1090 batch schema was already superseded by the flush task's, as the deleted handler's own comment described.What was kept, and what turned out to be wrong
core/types.py's descriptions outlived the file, but checking them against the code before rehoming them showed two of the four had drifted. Both were about to be copied intocore/state.py, where sitting beside the store they describe would make them far more likely to be believed than they were in a module nothing imported:AircraftPositionlistedcallsign,seen,squawk,rssiandnode_id.services/tcp_handler.py:611actually buildsflight,last_seen_ms,recv_msandworld, then extends the record viaadsb_derived_fields. The TypedDict omittedlast_seen_msentirely — the fieldfeed_helpers.adsb_storeorders writes on andfeed_gcevicts on.NodeStategavestatusas"active" | "disconnected"._handle_heartbeatdoeshb_status = msg.get("status", "active")and assigns it verbatim, so any string a node reports lands there;routes/node_schemas.py:109defines six more that nodes plausibly send.So
connected_nodesandadsb_aircraftcarry corrected comments rather than copies, and theadsb_aircraftone names its writer instead of restating a field list that had already drifted once. Nothing branches on either description today, so no live fault is fixed here.TaskHealthwas already stated verbatim besidetask_last_successandtask_error_counts, andGeoAircraftdescribes a payload one readable function builds, so neither was carried across.Verification
pre-commit run --all-filesclean, vulture included: removing the whitelist block forcore/types.pyleft nothing newly flagged.test_mlat_history.pydeselected locally for its runtime; CI runs it).python -m scripts.generate_openapi --checkreports the node contract current, as expected since neither removed route sits under/v1/nodes.Dependsandrequire_adminunused inroutes/radar.py, confirming it was that module's only admin-gated route.Also confirmed stale and closeable: 86cb7v7hd asks for
backend/scripts/retnode_poller.py, deleted byde65050aand merged in #344.🤖 Generated with Claude Code