Skip to content

T1: canary_diff.py + hosted-CI pytest suite#74

Merged
josephnef merged 1 commit into
masterfrom
t1-canary-diff-ci
Jun 2, 2026
Merged

T1: canary_diff.py + hosted-CI pytest suite#74
josephnef merged 1 commit into
masterfrom
t1-canary-diff-ci

Conversation

@josephnef
Copy link
Copy Markdown
Collaborator

Summary

Adds the host-side half of the T1 canary cross-validation oracle: a Python differ (tests/canary_diff.py) that compares kernel and devourer canary dumps with runtime-ephemeral register masking, plus a 13-test pytest suite covering the parser, mask logic, channel-aware capture-state filter, and exit-code contract.

A dedicated path-scoped GitHub Actions workflow runs the pytest suite on every PR that touches the differ or its tests — no libusb, no VM, runs in about a second.

Masking rules

Without masking, every diff drowns in genuine drift sources that aren't init bugs:

  • MAC 0x040 / 0x550 / 0x560 — per-queue / TBTT / beacon-window counters that increment continuously.
  • RF[A|B] 0x42 — thermal-meter sample register; reads vary with chip temperature.
  • BB 0xc1c / 0xe1c bits 31:21 — TX BB-swing tx_scaling_table_jaguar index, updated by PowerTracking8812a (and the kernel's phydm watchdog) from the thermal-meter sample. Other bits of 0xc1c (AGC table select, static base bits) ARE diffed.
  • BB 0xc20 / 0xe20 at 5G only — CCK regs that the long-lived kernel iface retains from prior 2.4G activity, while devourer captures from a fresh process per run. Suppressed only when --channel > 14; the same divergence at 2.4G is reported as real.

--strict disables all masking. --show-clean prints a CLEAN summary line even when there's nothing to report.

Exit codes

  • 0 — no real init-drift divergence
  • 1 — divergences found in non-ephemeral registers
  • 2 — file parse error / register-set mismatch

Test plan

  • python3 -m pytest tests/test_canary_diff.py -v — 13 / 13 passing locally
  • Smoke-tested against real 8814 ch6 captures — surfaced 21 real divergences cleanly, masked counters / thermal noise without false positives
  • Hosted CI green on the new Canary diff unit tests job

Adds the host-side half of the canary cross-validation oracle:
a Python differ that compares kernel/devourer canary dumps with
runtime-ephemeral register masking, plus 13 unit tests exercising
the parser, mask logic, channel-aware capture-state filter, and
exit-code contract.

Masking rules baked in:
  - MAC 0x040 / 0x550 / 0x560 — counters that tick continuously
  - RF[A|B] 0x42 — thermal-meter sample
  - BB 0xc1c / 0xe1c bits 31:21 — phydm TX-swing thermal index
  - BB 0xc20 / 0xe20 at 5G — CCK regs that the long-lived kernel
    iface retains from prior 2.4G activity, while devourer captures
    from a fresh process; suppressed only when --channel > 14

Exit codes: 0 clean / 1 real divergences / 2 parse error or
register-set mismatch.

A dedicated path-scoped workflow runs the pytest suite on every PR
that touches the differ or its tests — no libusb, no VM, ~1 s.
Hardware-side canary capture stays in regress.py / the self-hosted
rig.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@josephnef josephnef merged commit ba66c0a into master Jun 2, 2026
6 checks passed
@josephnef josephnef deleted the t1-canary-diff-ci branch June 2, 2026 18:52
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