get_authoring_meta scans past an invalid authoring item - #258
Open
thedavidmeister wants to merge 1 commit into
Open
get_authoring_meta scans past an invalid authoring item#258thedavidmeister wants to merge 1 commit into
thedavidmeister wants to merge 1 commit into
Conversation
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>
|
Warning Review limit reachedNext included review available in 8 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 (1)
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 |
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.
Closes #176
DeployerResponse::get_authoring_metareturnedNonefor the whole document assoon as it hit an
AuthoringMetaV1-tagged item that unpacked but failedabi_decode_validate, so a valid authoring meta later in the same document wasunreachable.
[AuthoringMetaV1(garbage), AuthoringMetaV1(valid)]yieldedNonewhile the reverse order yielded
Some(..)— the result depended on item orderrather 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 asymmetryand offers
Err(_) => continueas the alternative to a doc note; "find theauthoring 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, sotest_get_authoring_meta_invalid_returns_noneis unchanged and still passes.QA
test_get_authoring_meta_skips_invalid_item— fails onbase (reverted the source hunk to the pre-fix
Err(_) => return Noneand rancargo test -p rain-metadata --lib get_authoring_meta:left: None,right: Some(AuthoringMeta([...]))at mod.rs:391), passes after. It is theissue's own repro: a
RainMetaDocumentV1document[AuthoringMetaV1(fails validate), AuthoringMetaV1(valid)].if let Ok(am) = abi_decode_validate(&v) { return Some(am) }-> pre-fixmatch { Ok(am) => return Some(am), Err(_) => return None }(the defectitself) -> killed by
test_get_authoring_meta_skips_invalid_itemalone; theother six
get_authoring_metatests still pass under it.return Some(am)->return None-> killed bytest_get_authoring_meta_found,_deflate_unpack,_scans_beyond_first_item,_skips_unpack_failure,_skips_invalid_item.meta_map.magic == KnownMagic::AuthoringMetaV1->!=-> killed by the samefive.
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, notanything read back through
get_authoring_meta; the invalid item is assertedinvalid directly via
abi_decode_validate(..).is_err()before the document isbuilt, so the test cannot silently degrade into a document of two valid items.
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