mirror of
https://github.com/ruvnet/RuView
synced 2026-07-20 17:03:24 +00:00
99bbd4eb9c
Iter 39. Defends the wire-format CRC contract from silent polynomial substitution. ADR-119 §2.4 specifies CRC-32/ISO-HDLC (same as Ethernet and zlib), NOT CRC-32C (Castagnoli) or any other variant. Two BFLD implementations that disagree on the polynomial treat every frame from the other as corrupt. Added (in tests/crc32_polynomial.rs): - 7 named tests using canonical CRC vectors from the reveng catalogue (https://reveng.sourceforge.io/crc-catalogue/all.htm): check_string_matches_canonical_iso_hdlc_value CRC-32/ISO-HDLC of the standard "123456789" check string is 0xCBF43926. This is THE canonical vector for the algorithm. empty_payload_yields_zero_crc init=0xFFFFFFFF, xorout=0xFFFFFFFF → empty payload CRC is 0. single_zero_byte_has_a_specific_value CRC-32/ISO-HDLC of [0x00] is 0xD202EF8D — well-known constant. flipping_a_single_payload_byte_changes_the_crc Sensitivity property: any one-bit flip MUST change the CRC. Catches a stuck CRC implementation. iso_hdlc_distinguishes_from_castagnoli_for_same_input CRC-32C/Castagnoli of "123456789" is 0xE3069283. Our value MUST differ. Documents the failure mode for a future reviewer who fires the test. known_short_inputs_have_documented_crcs Three additional vectors: "a", "abc", "hello world". Each pins a specific 32-bit value against the active polynomial. crc_is_deterministic_across_repeated_calls Sanity for pure-function correctness. These tests are no_std-compatible so they run in BOTH feature configs. The no_default count therefore jumps from 80 to 87. ADR-124 status (iter step 0 sibling check): - docs/adr/ADR-124-rvagent-mcp-ruvector-npm-integration.md unchanged at 431 lines. SENSE-BRIDGE scope remains orthogonal. ACs progressed: - ADR-119 §2.4 "CRC-32/ISO-HDLC" contract — the test surface now catches any future PR that swaps the polynomial. crc 4.x ships CRC_32_ISO_HDLC alongside half a dozen other CRC-32 variants; a typo in src/frame.rs::CRC32_ALG could otherwise silently flip the wire-format contract. Test config: - cargo test --no-default-features → 87 passed (80 + 7 no_std-compat) - cargo test → 262 passed (255 + 7) Out of scope (next iter target): - PR-readiness pivot: CHANGELOG, witness bundle, AC closeout table. External-resource-gated work (KIT BFId, Pi5/Nexmon) still skipped. Co-Authored-By: claude-flow <ruv@ruv.net>