Add KnownMagic::WebDataV1 for the spec's 0xff5dcce9b571ba42 - #268
Add KnownMagic::WebDataV1 for the spec's 0xff5dcce9b571ba42#268thedavidmeister wants to merge 2 commits into
Conversation
Closes #187 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 15 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
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. Comment |
test_unpack_into_whitelist asserts its two lists cover every KnownMagic variant, so the new one has to be named in the unsupported list. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
CI on the first head caught one test my local run missed: Fixed in QA addendum for that commit:
|
Closes #187
The metadata-v1 spec magic number table lists
0xff5dcce9b571ba42 | Web data v1among the numbers "that the tooling maintained by the authors of this document are already handling". Every other row of that fifteen-row table has aKnownMagicvariant; this one did not, soKnownMagic::try_from(0xff5dcce9b571ba42u64)returnedErr(UnknownMagic).The issue's triage question was whether the table is instead stale for this crate. It is not: the row is in the spec as published today, and
crates/cli/tests/cli.rsalready documents this crate'smagic lsoutput as "derived from the magic number table of the rain metadata-v1 spec". So the table is this crate's stated oracle, and one row of it was unrepresented.What changed
KnownMagic::WebDataV1 = 0xff5dcce9b571ba42, declared where the spec table places it (after the rain-specific numbers, before the OffchainAsset block), plus itsTryFrom<u64>arm.test_web_data_v1pins the prefix bytes; the enum-wide pinstest_all_discriminants_pinnedandtest_strum_kebab_case_parse_displaygo from 19 to 20 entries; themagic lsexact-output pins incrates/cli/tests/cli.rsandcrates/cli/tests/magic_cli.rsand the line count incrates/cli/tests/cli_dispatch.rsfollow the new declaration order.Deliberately not changed:
KnownMetaandunpack_into. A Web data v1 item now decodes with a recognised magic, but unpacking it still returnsUnsupportedMeta— the spec defines no payload shape for it, nothing in this repo produces or consumes one, and that is exactly the position the OffchainAsset magics are already in.Overlap with in-flight work
#186, #188, #190, #191 and #203 all concern
cbor_decode/ unknown-magic handling incrates/cli/src/meta/mod.rs. This PR does not touch that file: it makes one more magic known, it does not change what happens to a magic that stays unknown, so it is orthogonal to all of them and composes with whichever lands first. #267 (issue #188) is the only one of those open right now and shares no file with this diff. The one textual conflict risk is the sharedmagic lsexpectation lists if another PR adds or reorders a variant; those are plain list edits and rebase cleanly.QA
test_web_data_v1,test_all_discriminants_pinned,test_strum_kebab_case_parse_display— each fails on base by not compiling (checkedorigin/mainout in a worktree, copied this branch'smagic.rsover it and deleted only the two source lines:error[E0599]: no variant or associated item named 'WebDataV1' found for enum 'meta::magic::KnownMagic'at the three test sites).magic_ls_prints_all_known_magic_numbers(tests/cli.rs),test_magic_ls_exact_output(tests/magic_cli.rs) andtest_dispatch_magic_ls(tests/cli_dispatch.rs) do compile on base and were run there with this branch's expectations: all three FAILED on base, all three pass here.WebDataV1 = 0xff5dcce9b571ba42→0xff5dcce9b571ba43→ killed bytest_web_data_v1,test_all_discriminants_pinned,magic_ls_prints_all_known_magic_numbers,test_magic_ls_exact_output(test_dispatch_magic_lssurvives by design — it pins only the line count and the 0xff prefix). Delete thev if v == KnownMagic::WebDataV1 as u64 => Ok(KnownMagic::WebDataV1)arm → killed bytest_try_from_u64_roundtrip_all. Move the variant to the end of the enum (declaration order) → killed bymagic_ls_prints_all_known_magic_numbersandtest_magic_ls_exact_output, unit tests unaffected as expected since they pin values, not order.| 0xff5dcce9b571ba42 | Web data v1 |. The hex literal and theweb-data-v1kebab name in every expectation come from that row, not from the implementation. The table was checked against the enum row by row: all fourteen other rows already had variants, this was the only gap.WebDataV1variant, or declare the spec table stale. Answered by adding the variant, with the reason for not taking the stale branch stated above. No other category in the issue.Verification
Ran the magic-related tests only (~70 agents are building on this machine, so no full local suite):
cargo test --lib --test cli --test magic_cli --test cli_dispatch magic— 41 passed, 0 failed.cargo fmt --all -- --checkclean.rainix-rs / static / rs-staticfails repo-wide on an unrelated rainix hook bug.🤖 Generated with Claude Code