feat: add operation-aware audit evidence model - #53
Merged
Conversation
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.
Summary
Implement the operation-aware
AuditEvidencemodel published bybasis-schemas v0.2.1.AuditEvidenceis the bounded kernel-side evidence record associated with one operation-aware authorization evaluation.This PR adds the model and contract validation only. It does not add assembly, persistence, enforcement, or gateway behavior.
Architecture
The model is implemented under:
The audit layer legally consumes:
The model reuses:
OperationAwareEvaluationStatusOperationAwareDecisionOutcomeOperationAwareFailureReasonReasonCodeIdentityEvidenceReferenceAdapterEvidenceReferenceThe audit package does not import:
A recursive import-boundary test now explicitly protects the
audit → evaluationprohibition.Model Responsibilities
AuditEvidencerecords bounded kernel evidence including:The model does not contain:
Evaluation-State Invariants
Completed evaluations require:
Failed evaluations require:
Contradictory states are rejected.
A failed evaluation is not converted into an authorization denial.
Recorded Timestamp
recorded_atis:The model introduces no time, UUID, randomness, filesystem, network, or process-state dependency.
Matched Rules
matched_rule_idsis validated according to the published contract.When supplied, it is:
The model does not calculate, sort, or derive rule identifiers.
Assembly remains later work.
Evidence References
Identity and adapter evidence use the existing typed reference models.
The audit record never embeds:
Unknown and out-of-contract fields are rejected.
Serialization
The model uses composable wrapped serialization so required-nullable contract keys remain present under:
Coverage includes:
Explicit caller exclusions remain authoritative and excluded fields are not reintroduced.
Contract Conformance
The model validates every published
AuditEvidenceexample in the vendoredbasis-schemas v0.2.1contract:All five canonical expected audit-evidence artifacts also construct successfully:
The invalid-policy-bundle artifact correctly uses:
No replacement reason code is invented.
Compatibility
This PR does not modify:
AuditEvent;AuditWriter;OperationAwareDecisionResponse;EvaluationTrace;OperationAwareEvaluationEngine;No persistence API, writer protocol, storage backend, or delivery mechanism is added.
Roadmap Boundary
This PR implements only the AuditEvidence model.
Remaining work stays separate:
Validation
221 passed6 passed20 passed5 passed3,540 passed, 86 skippedgit diff --check: passed