Skip to content

HFDL: forensic round — LPDU emission parity, bench fixture (33 vs oracle 37)#100

Merged
kevinelliott merged 1 commit into
masterfrom
hfdl-lpdu-parity
Jun 12, 2026
Merged

HFDL: forensic round — LPDU emission parity, bench fixture (33 vs oracle 37)#100
kevinelliott merged 1 commit into
masterfrom
hfdl-lpdu-parity

Conversation

@kevinelliott

@kevinelliott kevinelliott commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What

The HFDL forensic round (task #36), VDL2 methodology — dumphfdl built from source, frame-exact diff on the 21931 kHz capture:

  • The 13 data LPDUs match the oracle one-for-one (every uplink/ack'd data frame xng decodes corresponds exactly).
  • The missing 4 are the weakest bursts (4.0–5.0 dB SNR at 300 bps) — a genuine deep-weak sensitivity tail, same class as AIS's, not a convention bug. The VDL2-style suspicion was checked and cleared.
  • Parser-policy fixes: CRC-valid LPDUs with unparsable HFNPDU contents now emit an unnumbered-data envelope (hex payload) instead of vanishing; LPDU 0x4F correctly labeled logon-resume.
  • Bench gate: hfdl_offair fixture (release asset) with floor 31 (actual 33) — the fourth fenced mode.

xng now stands at 33/37 (89 %) of dumphfdl with the gap precisely characterized.

Testing

Full workspace green; all four bench gates green (this PR's CI exercises the new fixture).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • HFDL parser now distinguishes logon request and logon resume events separately.
    • Parser ensures CRC-valid unnumbered-data LPDUs emit envelope events instead of being silently dropped.
  • New Features

    • Added HFDL off-air regression benchmark.
  • Documentation

    • Updated benchmark documentation with HFDL benchmark details and parser improvements.
  • Chores

    • Updated build infrastructure for benchmark asset downloads.
    • Updated benchmark baseline calibration data.

…cle 37)

VDL2-methodology oracle diff (dumphfdl built from source, frame-exact):
the 13 data LPDUs match one-for-one; the missing 4 are the weakest
bursts (4.0-5.0 dB SNR at 300 bps) - a sensitivity tail, NOT a
convention bug.

Parser-policy fixes from the round:
- no CRC-valid LPDU is silently dropped anymore: unparsable HFNPDU
  contents emit an 'unnumbered-data' envelope with payload hex
  (dumphfdl-equivalent behaviour)
- LPDU 0x4F correctly labeled logon-resume (was logon-request)

Bench: hfdl_offair fixture (release asset) + floor 31.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

HFDL parser now emits separate events for logon request (0x8F|0xBF) and logon resume (0x4F) variants, and prevents silent drops of CRC-valid unnumbered-data LPDUs by emitting envelope events when payloads are short or unparsable. A new benchmark fixture (hfdl_48k.cs16) with baseline floor (31 frames) validates the parser improvements via CI workflow and shell script integration, documented in the notes.

Changes

HFDL Parser and Benchmark Improvements

Layer / File(s) Summary
HFDL parser behavior improvements
crates/xng-mode-hfdl/src/pdu.rs
PduParser splits logon variants into separate logon-request (0x8F|0xBF) and logon-resume (0x4F) events. HFNPDU parsing now emits unnumbered-data envelope events containing payload hex when headers don't match 0xFF or ACARS parsing fails, instead of silently returning.
HFDL benchmark fixture and baseline setup
.github/workflows/bench.yml, .gitignore, bench/baselines.json, bench/run.sh
GitHub Actions workflow downloads hfdl_48k.cs16 fixture asset; .gitignore excludes it; baselines.json defines hfdl_offair minimum decode count (31); run.sh conditionally benchmarks frame counts against baseline, skipping if fixture is absent.
Benchmark documentation update
docs/notes/BENCHMARKS.md
Documents HFDL event counts vs dumphfdl, explains remaining event deficit as weak-burst sensitivity tail, and describes parser-policy changes (no silent CRC-valid drops, unnumbered-data envelopes, correct logon labeling) alongside fixture and baseline updates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit's benchmark hops with glee, ✨
Logons split true, both far and near,
No silent drops—each frame's a cheer,
From 0x4F to 0xBF's tree,
The HFDL envelope's crystal clear! 🐰📡

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references the main technical objective: achieving LPDU emission parity in HFDL parsing (33 decoded frames vs 37 oracle) with the bench fixture addition, which is precisely what the changeset accomplishes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hfdl-lpdu-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
crates/xng-mode-hfdl/src/pdu.rs (1)

198-229: ⚡ Quick win

Add focused unit tests for the new fallback/classification branches.

Please add parser tests that assert: (1) LPDU 0x4F emits logon-resume, and (2) CRC-valid but unparsable HFNPDU content emits unnumbered-data with stable data_hex. The bench decode-count gate validates totals, but not event-kind/detail correctness.

Proposed test scaffold
+    #[test]
+    fn lpdu_0x4f_emits_logon_resume() {
+        let lpdu = with_fcs(vec![0x4F, 0x12, 0x34, 0x56]);
+        let mpdu = build_mpdu_downlink(3, 0xC7, &[lpdu]);
+        let ev = PduParser::new().parse(&mpdu, 300);
+        assert_eq!(ev.len(), 1);
+        assert_eq!(ev[0].kind, "logon-resume");
+    }
+
+    #[test]
+    fn unparsable_hfnpdu_emits_unnumbered_data_envelope() {
+        let lpdu = build_lpdu_hfnpdu(&[0x01, 0x02]); // non-0xFF HFNPDU
+        let mpdu = build_mpdu_downlink(3, 0xC7, &[lpdu]);
+        let ev = PduParser::new().parse(&mpdu, 300);
+        assert_eq!(ev.len(), 1);
+        assert_eq!(ev[0].kind, "unnumbered-data");
+        assert_eq!(ev[0].details["data_hex"], "0102");
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/xng-mode-hfdl/src/pdu.rs` around lines 198 - 229, Add focused unit
tests for the HFDP/LPDU parser to cover the new fallback/classification
branches: create tests that feed a LPDU with first byte 0x4F and assert the
parser emits an HfdlEvent with kind "logon-resume" and appropriate details; and
feed a CRC-valid HFNPDU whose payload bytes are not parsable by
xng_acars::block::parse and assert the parser emits an HfdlEvent with kind
"unnumbered-data" whose details contain a stable data_hex exactly matching the
input bytes and raw equals the original payload. Locate the parsing entry (in
pdu.rs where the envelope closure, match on h[1], and xng_acars::block::parse
are defined) and add tests that call the public parse function/entrypoint used
by the crate, constructing minimal headers/CRC so the code path hits the 0x4F
and the CRC-valid but unparsable branches, and assert on HfdlEvent.kind,
details["data_hex"], and raw fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/xng-mode-hfdl/src/pdu.rs`:
- Around line 198-229: Add focused unit tests for the HFDP/LPDU parser to cover
the new fallback/classification branches: create tests that feed a LPDU with
first byte 0x4F and assert the parser emits an HfdlEvent with kind
"logon-resume" and appropriate details; and feed a CRC-valid HFNPDU whose
payload bytes are not parsable by xng_acars::block::parse and assert the parser
emits an HfdlEvent with kind "unnumbered-data" whose details contain a stable
data_hex exactly matching the input bytes and raw equals the original payload.
Locate the parsing entry (in pdu.rs where the envelope closure, match on h[1],
and xng_acars::block::parse are defined) and add tests that call the public
parse function/entrypoint used by the crate, constructing minimal headers/CRC so
the code path hits the 0x4F and the CRC-valid but unparsable branches, and
assert on HfdlEvent.kind, details["data_hex"], and raw fields.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f7b16ea5-cab0-4acc-b4e2-0e099756f0ea

📥 Commits

Reviewing files that changed from the base of the PR and between fe03312 and 5d7b4e8.

📒 Files selected for processing (6)
  • .github/workflows/bench.yml
  • .gitignore
  • bench/baselines.json
  • bench/run.sh
  • crates/xng-mode-hfdl/src/pdu.rs
  • docs/notes/BENCHMARKS.md

@kevinelliott kevinelliott merged commit 3cc2301 into master Jun 12, 2026
3 checks passed
@kevinelliott kevinelliott deleted the hfdl-lpdu-parity branch June 12, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant