mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
chore(central-ripout 2a): remove the budget shim + dead work_zone renderer (#161)
* chore: remove central.budget re-export shim The shim's implementation lived at notifications.formatters._budget from the start; central.budget was only a 9-line re-export kept around for import-path compatibility. Point every importer directly at the real module and delete the shim: - notifications/renderers/composer.py: lazy import inside a function - central/wfigs_handler.py, central/satpass_handler.py: import line only - tests/test_fire_refactor.py, test_nws_refactor.py, test_firms_refactor.py: import line only, no behavior change test_budget_shim.py existed solely to assert identity-equality between the shim and the real module; with the shim gone there is nothing left for it to test, so it is deleted too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: delete dead renderers/work_zone.py format_work_zone_mesh() had exactly one production caller, the central/consumer.py NATS bridge deleted in the prior Central-excision pass. Its live replacement, formatters.incident._render_work_zone() (registered for category "work_zone" in formatters/__init__.py), is an already-shipped byte-identical replica per that module's own docstring. All remaining references to renderers.work_zone were prose/comments describing the replica relationship, not imports. Test fallout: - tests/test_work_zone_renderer.py tested only the dead renderer in isolation (17 cases). Deleted — the live path has its own coverage (test_adapter_wzdx.py's formatter-integration tests, plus TestCrossSourceIdentity::test_work_zone_category_uses_wz_renderer and TestWorkZoneGolden in test_incident_refactor.py). - tests/test_itd_511_work_zone.py::test_itd_511_work_zone_renderer_produces_wire only smoke-tested the dead renderer's wire output for itd_511 data; redundant with TestWorkZoneGolden's byte-identical fixture coverage for the same adapter. Deleted. - tests/test_incident_refactor.py::TestWorkZoneGolden compared the live formatters.incident.format() output against a golden computed by calling the dead renderer live on two real fixtures. Mirroring the precedent already in test_nws_refactor.py for this exact situation (golden generator deleted out from under a parity test), the two golden strings were captured by running format_work_zone_mesh() against these fixtures immediately before deletion and are now pinned as literals — same coverage, no live dependency on the dead module. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Matt Johnson <mj@k7zvx.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b7fa0aad02
commit
ff127bee18
12 changed files with 34 additions and 485 deletions
|
|
@ -18,10 +18,13 @@ Original diffs are preserved in git history. This is a real production gap
|
|||
flagged for Matt: TomTom road-incident ingestion in particular has no
|
||||
native replacement.
|
||||
|
||||
Work-zone parity is unaffected — `meshai.central_normalizer` (a top-level,
|
||||
non-Central-NATS module; note the name is legacy) and
|
||||
`meshai.notifications.renderers.work_zone` were never part of the deleted
|
||||
consumer path and remain live.
|
||||
Work-zone parity: `meshai.central_normalizer` (a top-level, non-Central-NATS
|
||||
module; note the name is legacy) was never part of the deleted consumer path
|
||||
and remains live. `meshai.notifications.renderers.work_zone` was ALSO never
|
||||
part of the deleted consumer path, but was itself dead code (zero production
|
||||
callers) once formatters.incident absorbed it as `_render_work_zone()`; it
|
||||
was removed in a later ripout pass. See TestWorkZoneGolden below for how its
|
||||
golden-parity coverage was preserved as pinned literals.
|
||||
|
||||
Groups
|
||||
------
|
||||
|
|
@ -143,16 +146,30 @@ class TestWorkZoneGolden:
|
|||
"""traffic_last/0002 (itd_511 work_zone) and traffic_last/0003 (wzdx)
|
||||
must produce byte-identical output from the new formatter.
|
||||
|
||||
Golden is computed via normalize() → format_work_zone_mesh() (old path).
|
||||
New path: normalize() → canonical data → formatters.incident.format().
|
||||
Originally the golden was computed live via normalize() →
|
||||
format_work_zone_mesh() (old renderers.work_zone path) and compared
|
||||
against normalize() → canonical data → formatters.incident.format()
|
||||
(new path). renderers.work_zone.py has since been deleted (dead code,
|
||||
zero production callers post-Central-excision; formatters.incident's
|
||||
_render_work_zone() is its byte-identical live replacement — see that
|
||||
module's docstring). Mirroring the approach in test_nws_refactor.py for
|
||||
the same situation: the golden strings below were captured by running
|
||||
format_work_zone_mesh() against these exact fixtures immediately before
|
||||
its deletion (confirmed byte-identical to the new formatter's output at
|
||||
that time) and are now pinned as literals, so this test exercises the
|
||||
LIVE formatters.incident.format() path only.
|
||||
|
||||
now is pinned to captured_epoch (1783206522) for both paths so the
|
||||
ends-at segment is deterministic.
|
||||
"""
|
||||
|
||||
_GOLDEN = {
|
||||
"0002.json": "🚧 US-91, near Chubbuck: southbound, road construction, ends Aug 17",
|
||||
"0003.json": "🚧 US-95, near Wilder: southbound, ends Jul 19",
|
||||
}
|
||||
|
||||
def _run_wz(self, fixture_name: str, adapter_expected: str):
|
||||
from meshai.central_normalizer import normalize
|
||||
from meshai.notifications.renderers.work_zone import format_work_zone_mesh
|
||||
from meshai.notifications.formatters.incident import format as fmt
|
||||
|
||||
# Find the fixture by name
|
||||
|
|
@ -167,12 +184,10 @@ class TestWorkZoneGolden:
|
|||
|
||||
envelope = fx["envelope"]
|
||||
now_epoch = float(fx.get("captured_epoch", time.time()))
|
||||
now_dt = datetime.fromtimestamp(now_epoch)
|
||||
|
||||
# Old renderer golden
|
||||
n = normalize(envelope)
|
||||
assert n is not None, f"normalize() returned None for {fixture_name!r}"
|
||||
golden = format_work_zone_mesh(n, now=now_dt)
|
||||
golden = self._GOLDEN[fixture_name]
|
||||
|
||||
# New formatter
|
||||
canonical = _n_to_canonical_workzone(n)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue