Skip to content

get_authoring_meta scans past an invalid authoring item - #258

Open
thedavidmeister wants to merge 1 commit into
mainfrom
2026-08-25-issue-176
Open

get_authoring_meta scans past an invalid authoring item#258
thedavidmeister wants to merge 1 commit into
mainfrom
2026-08-25-issue-176

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Closes #176

DeployerResponse::get_authoring_meta returned None for the whole document as
soon as it hit an AuthoringMetaV1-tagged item that unpacked but failed
abi_decode_validate, so a valid authoring meta later in the same document was
unreachable. [AuthoringMetaV1(garbage), AuthoringMetaV1(valid)] yielded None
while the reverse order yielded Some(..) — the result depended on item order
rather than on document content.

The scan now skips a failed decode and keeps looking, which is the treatment the
loop already gave an item whose unpack() failed. The issue names that asymmetry
and offers Err(_) => continue as the alternative to a doc note; "find the
authoring meta" is what the doc comment states, so the scan is what is fixed.

A document whose only authoring item is invalid still yields None, so
test_get_authoring_meta_invalid_returns_none is unchanged and still passes.

QA

  • Discriminating tests: test_get_authoring_meta_skips_invalid_item — fails on
    base (reverted the source hunk to the pre-fix Err(_) => return None and ran
    cargo test -p rain-metadata --lib get_authoring_meta: left: None,
    right: Some(AuthoringMeta([...])) at mod.rs:391), passes after. It is the
    issue's own repro: a RainMetaDocumentV1 document
    [AuthoringMetaV1(fails validate), AuthoringMetaV1(valid)].
  • Mutations applied:
    • if let Ok(am) = abi_decode_validate(&v) { return Some(am) } -> pre-fix
      match { Ok(am) => return Some(am), Err(_) => return None } (the defect
      itself) -> killed by test_get_authoring_meta_skips_invalid_item alone; the
      other six get_authoring_meta tests still pass under it.
    • return Some(am) -> return None -> killed by
      test_get_authoring_meta_found, _deflate_unpack, _scans_beyond_first_item,
      _skips_unpack_failure, _skips_invalid_item.
    • meta_map.magic == KnownMagic::AuthoringMetaV1 -> != -> killed by the same
      five.
  • Oracle: the doc comment ("get authoring meta bytes of this deployer meta") and
    the issue's stated property that a document may carry multiple items and the
    authoring meta contained in it should be found. The expected value is the
    authoring_meta() fixture the test itself encodes into the document, not
    anything read back through get_authoring_meta; the invalid item is asserted
    invalid directly via abi_decode_validate(..).is_err() before the document is
    built, so the test cannot silently degrade into a document of two valid items.
  • Category check: the issue asks one thing — an order-dependent result from a
    scan that aborts on the first invalid authoring item; covered. Its other branch
    (document a "first authoring item is authoritative" contract instead) is the
    alternative it explicitly offers, not a second requirement.

🤖 Generated with Claude Code

An AuthoringMetaV1 item that unpacked but failed abi_decode_validate
returned None for the whole document, so a valid authoring meta later in
the same document was unreachable and the result depended on item order.
Skipping it matches the existing unpack-failure path.

Closes #176

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 8 minutes.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5f823821-ac8b-48ae-9f2a-5d9321641750

📥 Commits

Reviewing files that changed from the base of the PR and between 45ca96c and 98dd7bf.

📒 Files selected for processing (1)
  • crates/cli/src/meta/query/mod.rs

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.

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.

DeployerResponse::get_authoring_meta returns None for a document whose valid authoring meta follows an invalid one (order-dependent result)

1 participant