Repository navigation
Service: accept station ids published as strings - #35
kevinelliott wants to merge 1 commit into
Conversation
The aggregation server serializes row ids as JSON strings, while station metadata synced from the API is keyed by number. Every production event therefore failed the station trust check as an unknown station (0 processed). Normalize station ids to numbers in the aircraft and marine parsers and in station sync, and drop events whose id is not a positive integer. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PS44Q7WRmAzMJLhi44dzdo
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Deploying airframes-coverage with
|
| Latest commit: |
de4aa87
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9bdd5bf9.airframes-coverage.pages.dev |
| Branch Preview URL: | https://claude-project-thread-xlxhmp.airframes-coverage.pages.dev |


Requested by Kevin · project thread
Problem
The coverage service went live on production (Dockhand stack
gh-coverage-v1on papp-euc-1) and is healthy, but it produces no coverage: in the first six minutes it parsed about 400 events per second and rejected every one of them (0 processed, about 140,000 rejected).The cause is an id type mismatch. The aggregation server's ORM models hold row ids as
String, so NATS payloads carry"station": {"id": "1234", ...}. The service keys its station metadata by the numericidreturned byapi.airframes.io/stations. AMap<number, …>lookup with a string key never matches, so every event fails the station trust check as an unknown station.Staging hid this because almost no aircraft messages were flowing there.
Fix
toStationId()helper that accepts a positive integer as a number or a digit string and returns a number, otherwisenull.id?: number | string.Tests
service/test/parsers.test.ts(new): id normalization, both aircraft parsers with a production-shaped payload (string ids), and an end-to-end check that such an event is ingested rather than rejected.npm test(19 passing),npm run typecheckandnpm run buildpass.Screenshots
None. This is a backend-only change with no UI.
After merge
CI publishes
coverage-service:sha-<commit>. A follow-up stack PR pins that tag inprod/coverage/compose.yml, then thegh-coverage-v1stack is redeployed through Dockhand.Generated by Claude Code
Note
Medium Risk
Touches core event parsing and station sync for a production outage fix; behavior change is narrowly scoped to id normalization with tests, but incorrect handling would still drop or mis-attribute coverage events.
Overview
Fixes production coverage ingestion where every NATS event was rejected because aggregation publishes
station.idas JSON strings while the service indexes metadata with numeric keys, soMaplookups never matched.Adds
toStationId()to coerce positive integer ids from numbers or digit-only strings (otherwisenull). Aircraft and marine parsers and station sync now use it so emittedCoverageEvent.stationIdand synced map keys stay numeric; unparseable ids still drop at parse/sync time. Payload types widen relevantidfields tonumber | string. Newparsers.test.tscovers normalization, production-shaped string ids, and end-to-end ingest acceptance.Reviewed by Cursor Bugbot for commit de4aa87. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit