T1: canary_diff.py + hosted-CI pytest suite#74
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
tx_scaling_table_jaguarindex, updated byPowerTracking8812a(and the kernel's phydm watchdog) from the thermal-meter sample. Other bits of 0xc1c (AGC table select, static base bits) ARE diffed.--channel > 14; the same divergence at 2.4G is reported as real.--strictdisables all masking.--show-cleanprints a CLEAN summary line even when there's nothing to report.Exit codes
0— no real init-drift divergence1— divergences found in non-ephemeral registers2— file parse error / register-set mismatchTest plan
python3 -m pytest tests/test_canary_diff.py -v— 13 / 13 passing locallyCanary diff unit testsjob