fix(maritime): AIS relay delivers zero military candidates and zero tanker reports — the AIS vessel layer is dark in production
Problem
The AIS relay is healthy and processing traffic, but it delivers zero per-vessel military candidates and zero tanker reports to browsers. candidateReports is the only per-vessel AIS input the client has, so the entire AIS-derived military vessel layer is dark: every "military vessel" the dashboard shows is a USNI roster ship.
Found while validating the #8611 classifier fix in production — the reason that mislabel was never observable is that no AIS-only contact reaches the browser at all.
Evidence
Two probes of https://api.worldmonitor.app/api/maritime/v1/get-vessel-snapshot, ~5.5 minutes apart on 2026-09-24:
| probe 1 | probe 2 | |
|---|---|---|
sequence |
1047 | 1161 |
status.connected |
true | true |
status.vessels |
20000 | 20000 |
status.messages |
328,954 | 365,929 |
densityZones |
200 | 200 |
candidateReports |
0 | 0 |
tankerReports |
0 | 0 |
Snapshot age at probe 2 was 6 seconds, so this is fresh data, not a stale cache. Across 114 republished sequences and ~37,000 further AIS messages, not one candidate was emitted.
The relay's own aggregate path works — densityZones is fully populated — so this is specific to the per-vessel report maps, not to ingestion.
Why zero is implausible
isLikelyMilitaryCandidate (scripts/ais-relay.cjs:9074) admits a vessel on any of:
shipType === 35 || shipType === 55 || (shipType >= 50 && shipType <= 59)— this range is Pilot Vessel, SAR, Tug, Port Tender, Anti-Pollution, Law Enforcement, Local Vessel, Medical Transport. Tugs and pilot vessels are ubiquitous in coastal AIS.- a naval name prefix (
NAVAL_PREFIX_RE) - MMSI suffix starting
00or99
Retention is 2 hours (CANDIDATE_RETENTION_MS, ais-relay.cjs:8968). Getting exactly zero matches from 20,000 tracked vessels over a 2-hour window is not a quiet period.
Impact
- The military vessel map layer, its clusters, and dark-ship detection show only USNI roster ships. In the observed session all 34 vessels were USNI-derived (amphibious 6, carrier 3, destroyer 23, frigate 1, auxiliary 1), every one hull-numbered.
StrategicPosturePaneltheater counts are USNI-only, so they reflect a periodic fleet report rather than live positions.- Dark Ship detection cannot fire at all — it needs AIS gaps on tracked contacts.
- The tanker layer is empty for the same reason.
Suggested starting points
- Whether
candidateReports.set(...)(ais-relay.cjs:9358) is reached at all — the call sits after the density-grid update inside the position handler, so instrument the branch rather than the handler. - Whether
effectiveShipTypeis resolving. The predicate's comment says PositionReport callers rely on thevesselMetacache forshipType; if that cache is cold or its lookup regressed, the type-based arm never fires and only the name/MMSI arms remain. - Whether the maps are populated but dropped on serialization into the snapshot payload.
- Whether the prune/evict pass (
ais-relay.cjs:9449) is clearing them on every cycle.
Relationship to #8611
#8611 / #8624 fixes a real classifier defect (AIS type 35 mapped to destroyer). That fix is correct and worth keeping, but this issue is why it had no observable user impact. The two are independent: fixing this one is what would make the classifier path run in production at all.
Source: koala73/worldmonitor