Add expected_text contract on screenshot evidence; wrapper enforces equality #172
No reviewers
Labels
No labels
4-29
bug
documentation
duplicate
enhancement
flow improvement
good first issue
help wanted
invalid
investigating
issue-agent
issue-agent-blocked
issue-agent-complete
issue-agent-pr-open
issue-agent-runner-nelsonlaptop
issue-agent-runner-nelsonpc
issue-agent-runner-nelsonpc-user
issue-agent-running
needs-verification
next to do
question
queue
recon
relics-stats-onboarding
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/spirelens!172
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/expected-text-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes items 2 and 3 of the PR #170 failure-chain triage. (Item 1 — agent misread the screenshot — landed in PR #171.)
Why
PR #170 verification passed and shipped a screenshot showing
vigor gained: 88for an Akabeko start-of-combat trigger that should have produced exactly 8. Two structural gaps after the agent's misread:must_showwas loose: "non-zero count, at minimum 8 after first combat-start trigger" accepts ≥ 8, so a literal-reading wrapper would pass88even with a perfectly-honest agent.Apply-VerificationEvidenceGuardhad no field to compare: it checkstext_visible:trueand non-emptyobserved_text, but never compares observed against any expected value the test plan declared.What this PR does
Schema: screenshot
required_evidenceitems withtext_visible_required:truemust now also carry a literalexpected_textfield. The wrapper does a case-insensitive, word-boundary-aware substring match betweenobserved_textandexpected_textand aborts withclaimed_result_not_observedon mismatch.Word-boundary matching matters: a naive
.Contains()letsvigor gained: 8matchvigor gained: 88as a prefix. Pattern is(?:^|[^A-Za-z0-9]) + escape(needle) + (?:[^A-Za-z0-9]|$)so the needle must sit between non-alphanumerics or string ends — a trailing digit can't extend without breaking the boundary rule.Test-plan prompt now forbids loose phrasings ("non-zero", "at minimum N", "≥ N", "N or cumulative") and requires
expected_textderived fromscenario_setup × validation_plan, e.g.vigor gained: 8for one combat-start of Akabeko. If the test plan can't pin a specific expected value because the implementation behavior is genuinely ambiguous, the rule is to abort withvalidation_plan_impossiblerather than ship a loose contract.Verification prompt now requires copying literal screenshot characters into
observed_text— not paraphrased, not "cleaned up". If the agent can't read the value confidently, abort withtarget_evidence_missingrather than guess what the contract said it should show.Tests
EvidenceGuard.Tests.ps1exercises the comparison logic — including the specific PR #170 failure (8must not match88), digit-extension cases (8must not match80or800), full-string equality, start-anchor, end-anchor, missing-text, empty-observed, and case-insensitivity. Suite is 53/53.Doc
docs/issue-agent.md: new "Expected-Value Contract on Required Evidence" section describing the rule, the derivation principle (compute from scenario × validation plan), and the forbidden loose phrasings.What's still deferred
The Akabeko 11×-per-combat fire is a real implementation bug in PR #170. Worth a follow-up issue against that PR — but that's the bug this contract would have caught at verification time, not this PR's scope.