Repository navigation
feat(agent): enforce claim-source attribution integrity (#81) - #83
Merged
Merged
Conversation
Add a model_validator to DiagnosisReport that enforces referential integrity on the claim-source-mapping pattern, so nothing in a diagnosis is untraceable: - every sourced claim's source_id must reference a real SourceRecord (UNSOURCED claims are exempt, they explicitly have no backing source) - every conflict must reference two real claims - source_ids and claim_ids must be unique, so references are unambiguous This closes the "attribution lost" failure the pattern exists to prevent: a dangling source_id would leave a finding with no traceable origin. 5 new tests. Closes #81
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.
Adds a
DiagnosisReportmodel_validator that enforces referential integrity on the claim-source-mapping pattern:source_idmust reference a realSourceRecord(UNSOURCED claims exempt)source_id/claim_iduniqueness so references are unambiguousPrevents the "attribution lost" failure the pattern exists to stop (a dangling reference = an untraceable finding). 5 new tests; full suite 207 passing, ruff + format clean.
Closes #81