fix(sync): register inbound sources before evidence in gated apply#540
fix(sync): register inbound sources before evidence in gated apply#540tryeverything24 wants to merge 1 commit into
Conversation
the as-proposals pass registered substrate in one sorted path walk, and evidence/... sorts ahead of sources/..., so put_evidence raised "cites unknown source" for any inbound evidence whose source arrived in the same sync -- the standard shape for a peer sharing receipt-backed claims. the whole gated apply crashed partway, after sync check had called the same input ok, and with no audit event for anything already registered. import_as_proposals (bundle.py) already registers sources before evidence for exactly this reason; the sync path now uses the same two-sub-pass order. regression test: a peer kb with source + evidence + claim-citing-the- evidence, all new to the receiving kb, fails on the previous code at storage.put_evidence and passes now.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Walkthrough
ChangesAs-proposals sync ordering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
what
vouch sync --as-proposals(the gated federation receive path from #536) crashes with an unhandledValueErrorwhenever the inbound KB carries a receipt-backed claim whose evidence and source are both new to the receiving KB — which is the standard shape for a peer sharing quoted/receipted knowledge._sync_apply_as_proposalsregisters pass-1 substrate in a single walk oversorted(check.new_files).evidence/...sorts ahead ofsources/..., sostore.put_evidenceruns before the evidence's own source has been registered and raisesevidence <id> cites unknown source <sha>. the exception is not caught (pass 2 only catchesProposalError), so the whole apply aborts partway:vouch sync checkhas just called the same input ok (_check_graph_integritydeliberately accepts references that arrive in the same sync),vouch import-proposalsaccepts the identical knowledge as a bundle (bundle.import_as_proposalsregisters all sources before any evidence, exactly to satisfyput_evidence's source-exists guard),sync.apply_proposalsis only logged at the end.fix
split pass 1 into two sub-passes — sources first, then evidence — matching the pass-1 order
import_as_proposalsalready uses. no surface, on-disk, or audit-shape changes.repro (fails on
test, passes on this branch):validation
test_sync_apply_as_proposals_registers_sources_before_evidence— confirmed it fails on the previous code (raises atstorage.put_evidence) and passes with the fix (verified viagit stash)python -m pytest tests/ -q --ignore=tests/embeddings— greenpython -m mypy src— no issues in 102 filespython -m ruff check src tests— all checks passedchangelog entry added under
## [Unreleased]→### Fixed.Summary by CodeRabbit
Bug Fixes
vouch sync --as-proposalswhen newly imported evidence references a newly imported source.Tests
Documentation