bds port

Documentation Community

Skill notes

Touchpoints

A full port spans six files and one frontend + one docs update: dotnet/src/FlightJar.Decoder/ModeS/CommB.cs — add IsBdsXX(payload) validator + DecodeBdsXX(payload) decoder + BdsXXData record. Extend the Candidates record and Infer() to include the new register.

Step 1 — Fetch the pyModeS reference

pyModeS lives at junzis/pyModeS on GitHub (default branch main). BDS decoders live under src/pyModeS/decoder/bds/bdsXX.py, helpers under _helpers.py. Fetch into /tmp/pymodes/ via the GitHub API (the raw CDN sometimes 404s; the contents API is reliable):

Step 2 — Port the validator + decoder

pyModeS operates on a 56-bit payload as a Python int with (payload >> (55 - i)) & mask indexing (MSB-first from payload bit 0). The C# port keeps identical bit indexing so the ported arithmetic reads one-to-one next to the Python. Add your new methods inside public static class CommB in CommB.cs. Use the existing helpers that are already in CommB.cs:

Step 3 — Wire into inference

CommB.Infer(payload) returns a Candidates record with one bool per heuristic register. MessageDecoder.InferCommB(msg) returns a decoded message only when exactly one candidate validates. This single-match discipline is intentional: multi-match payloads are ambiguous and dropped rather than risk polluting aircraft state with fields decoded

Step 4 — Extend state + snapshot

For every decoded field: Add a nullable property to Aircraft (e.g. public int? WindshearLevel { get; set; }). Add an identically-named property to SnapshotCommB. In ApplyCommB, add a case "X,Y": that assigns from the DecodedMessage; do not touch fields from other registers

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Documentation
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
94 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@MrSuttonmann · GPL-3.0
Token usage
Lean
Setup complexity
Guided setup
External API key
Not required
Operating systems
macOS · Linux · Windows
Runtime requirements
Node.js · Python
Detected file/system behavior
  • Read-only
  • Write / modify
  • Env read
Network behavior
External requests
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

01
Step 1 — Fetch the pyModeS reference

pyModeS lives at `junzis/pyModeS` on GitHub (default branch `main`). BDS decoders live under `src/pyModeS/decoder/bds/bdsXX.py`, helpers under `_helpers.py`. Fetch into `/tmp/pymodes/` via the GitHub API (the raw CDN sometimes 404s; the contents API is reliable):

02
Step 2 — Port the validator + decoder

pyModeS operates on a 56-bit payload as a Python int with `(payload >> (55 - i)) & mask` indexing (MSB-first from payload bit 0). The C# port keeps identical bit indexing so the ported arithmetic reads one-to-one next to the Python. Add your new methods inside `public static class CommB` in `CommB.cs`. Use the existing helpers that are already in `CommB.cs`:

03
Step 3 — Wire into inference

`CommB.Infer(payload)` returns a `Candidates` record with one bool per heuristic register. `MessageDecoder.InferCommB(msg)` returns a decoded message only when exactly one candidate validates. This single-match discipline is intentional: multi-match payloads are ambiguous and dropped rather than risk polluting aircraft state with fields decoded

04
Step 4 — Extend state + snapshot

For every decoded field: Add a nullable property to `Aircraft` (e.g. `public int? WindshearLevel { get; set; }`). Add an identically-named property to `SnapshotCommB`. In `ApplyCommB`, add a `case "X,Y":` that assigns from the `DecodedMessage`; do not touch fields from other registers

05
Step 5 — Extend the frontend panel

The Enhanced Mode S panel is driven entirely by `a.comm_b` in the snapshot. In `detail_panel.js`: Add placeholder tile markup inside `.panel-met-grid` in `buildPopupContent` — same shape as existing tiles (`<div class="metric pop-met-xxx" hidden><div class="label">…</div><div class="val"></div></div>`).

06
Step 6 — Tests

`CommBTests.cs` follows two patterns; use both for the new register: Validator acceptance + rejection: pick a golden-vector hex from pyModeS's `test_bds_commb.py`, assert `IsBdsXX` accepts it, then construct synthetic payloads that should be rejected (all zeros, out-of-range values, status-bit / value-bit inconsistency)

07
Step 7 — Add an integration test

`dotnet/tests/FlightJar.Core.Tests/State/AircraftRegistryTests.cs` + `FakeDecoder.cs` use fake hex keys (`BD44` → pre-built `DecodedMessage`) to exercise `ApplyCommB` + `BuildCommBSnapshot` without real wire bytes. Add a `BDxx` fixture and a test proving the new field lands in the snapshot and ages out correctly past `CommBMaxAge`.

08
Step 8 — Playwright smoke (optional)

The `detail panel renders Enhanced Mode S section when comm_b is present` test in `tests/e2e/layout.spec.js` injects a fake snapshot with a full `comm_b` block. If the new register adds a user-visible tile, extend the fixture and assert the new label appears.

09
Step 9 — Verify

All five must pass before the port is done. Formatter drift and Playwright regressions are the two most common surprises.

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.