feat: project ContextProvenance explicitly - #34
Merged
Conversation
Projects core fields into `ContextProvenance` and stores remaining source-specific fields in `ContextItem::metadata`, satisfying the downstream half of rig-compose's Context packing stabilization.
There was a problem hiding this comment.
Pull request overview
Refactors all rig-resources projections to populate rig_compose::ContextProvenance directly via with_context_provenance, moving canonical fields (source_uri, principal, scope, recorded_at_millis, confidence, projection_state, version_key, reason, source_frame_id) out of the free-form provenance JSON blob and into the typed provenance struct, while domain-specific fields (finding_id, severity, signals, seed, etc.) move to with_metadata. Tests are updated accordingly.
Changes:
src/projection.rs: switchBehaviorPattern,EntityBaseline,memory_hit_to_context_item,subgraph_to_context_item, andevidence_to_context_itemto typedContextProvenance+metadatasplit; drop localSTATE_CANDIDATE/STATE_EXPANDEDconstants.src/security/finding.rs: same split forsecurity_finding_to_context_item; update doctest and unit tests; dropSTATE_CANDIDATE.tests/projection_provenance.rs: integration tests updated to read provenance viacontext_provenance()and domain fields viametadata.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/projection.rs |
Project canonical fields into ContextProvenance via builder; move domain fields to metadata. |
src/security/finding.rs |
Same split for security findings; doctest and unit tests updated. |
tests/projection_provenance.rs |
Helper and assertions rewritten to use context_provenance() and metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What
Modifies all projections (
subgraph_to_context_item,memory_hit_to_context_item,evidence_to_context_item,security_finding_to_context_item, etc.) to pack their overlapping canonical fields intorig_compose::ContextProvenancedirectly viawith_context_provenance, shifting non-canonical/domain-specific values (like internal ids, graphs, detail payloads) towith_metadata.Why
This realizes the first half of the cross-crate coordination step Context & Provenance Wiring for
rig-resources, aligning downstream projections cleanly into the stabilizedContextItemmodel.