fix(wzdx): drop 'unknown' direction from subject + extract dedup mixin (v0.9.1)

Two v0.9.0 fast-follows. Production code; central-supervisor + central-gui
restart (adapter base change + template change). No migration, no new stream.

(a) Work-zone subject + detail no longer leak vehicle direction "unknown"
(common in AZ mcdot etc.) -- gated on direction not in (None, "unknown") in both
wzdx partials. Was "Work zone on MORELAND ST unknown".

(b) is_published/mark_published/sweep_old_ids extracted from per-adapter inline
copies onto the SourceAdapter base (beside bump_last_seen); a dedup_sweep_days
class attr parameterizes the retention window (NWIS=30, default=14). Inline
copies deleted from inciweb/nwis/wzdx; the other 10 adapters keep theirs as a
future cleanup. Net dedup code down ~52 lines.

Full suite: 744 passed, 1 skipped (central and unprivileged zvx, 3x each).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Johnson 2026-05-25 21:18:07 +00:00
commit 9cd2183cc3
9 changed files with 169 additions and 106 deletions

View file

@ -270,6 +270,19 @@ class implements the standard `published_ids` bump; adapters using that table
inherit it and need not override. It is a safe no-op when the adapter has no
`_db` handle.
**`def is_published(self, event_id: str) -> bool`** — Optional. Returns whether
`event_id` is already in the `published_ids` dedup table. The base class
implements the standard query; adapters using that table inherit it. Safe
(returns `False`) when the adapter has no `_db` handle.
**`def mark_published(self, event_id: str) -> None`** — Optional. Records
`event_id` as published (refreshing `last_seen` on re-publish). Base-class
default operates on `published_ids`; safe no-op without `_db`.
**`def sweep_old_ids(self) -> int`** — Optional. Purges dedup rows older than
`dedup_sweep_days` (default 14; NWIS overrides to 30) and returns the count
deleted. Base-class default; safe no-op (returns 0) without `_db`.
**`async def preview_for_settings(self, settings: BaseModel) -> list[dict] | None`** —
Optional. The settings-page preview hook. The default returns `None` (no
preview). See [§11](#11-settings-preview-hook) for the contract.