feat: add RunContract evidence criteria#110
Merged
Merged
Conversation
Owner
Author
kapi-agent reviewVerdict: APPROVE Final approval summaryReview journey
Evidence
Notes
DecisionApproved for merge into |
There was a problem hiding this comment.
kapi-agent review
Verdict: REQUEST_CHANGES
Blocking issues
src/domain/run-contract.ts: required artifact expectations are labeled as “Required artifact is tracked”, but the evaluator only satisfies them when someValidationEvidencerecord references that artifact viaevidence.artifactRefs.- This makes the RunContract contract internally inconsistent:
state.artifactscan clearly contain the required artifact, whilecompletion.results[].missingExpectationIdsstill reportsartifact:<name>as missing with the reason “Required artifact is tracked: ”. - Either change the satisfaction logic so artifact expectations are satisfied by the required artifact being present in
state.artifacts, or change the expectation summary/criteria semantics to explicitly require validation evidence for each required artifact. - Please add a direct test for the intended behavior with required artifacts present and evidence present but not referencing the artifact.
- This makes the RunContract contract internally inconsistent:
Warnings / risks
test/run-contract.test.ts: the “complete” test only reaches completion by replacingartifacts: [], so it does not verify the normal case where workflows have required artifacts. This leaves the main new criteria path under-tested.src/domain/run-contract.ts:artifactRefscurrently means two things: expected artifact existence and evidence-reference matching. That ambiguity is likely to confuse future contract consumers.
Suggestions
- Consider renaming the field or splitting the model if both concepts are needed:
requiredArtifactRefs/requiredTrackedArtifactsevidenceArtifactRefs
- Consider making missing reasons more explicit, e.g. “No validation evidence references required artifact: verify.md” if evidence linkage is the intended rule.
Looks good
- The new RunContract fields are additive and stay within the domain layer.
- Existing evidence projection still avoids aliasing mutable arrays.
- The completion status now exposes a useful
needs-evidencestate instead of treating completion as purely lifecycle-derived.
Verification notes
- Verifier gate status: PASS —
npm ci && npm run verifyexited 0. - Size gate status: PASS — 95 changed lines, under the 200-line limit.
- Revision-explanation status: not required for this opened PR; found in PR body.
- I inspected
src/domain/run-contract.tsandtest/run-contract.test.ts. The blocking issue is semantic/contract correctness, not CI failure.
Engine: pi
This was referenced May 15, 2026
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
EvidenceExpectationandCompletionCriteriaprimitives to the RunContract domain view.ValidationEvidenceand required artifacts.Issue
Closes #99
Implementation notes
RunContractViewnow includesexpectations,completionCriteria, andcompletion.results.evidence:anyand required artifact expectations derived from existing workflow artifacts.evaluateCompletionCriteria()reportssatisfiedExpectationIds,missingExpectationIds, and clear missing-evidence reasons.needs-evidencewhen required generic expectations are missing.Verification
npm test -- test/run-contract.test.tsnpm run verifygit diff --checkgrep -RniE 'github|pullRequest|issueNumber|kapiAgent|discord|ragna' src/domain/run-contract.ts test/run-contract.test.tsreturned no matchesNotes
npm run verifystill reports the existing non-failing quality budget warning:code_smells=44, target<=20, statuswarn.