fix(mapping): generator-aware side_effect_type mapping in infer_side_effect_type - #15
Conversation
…13) - Insert GeneratorYield/AsyncGeneratorYield checks in the value-type assertion chain after the P0 scan and before the ReturnValue fallback - Generator functions's test assertions now correctly map to their yield effect type instead of falling through to ReturnValue (0% coverage) - Add 7 regression and precedence tests covering all spec scenarios - Add OpenSpec change artifacts (proposal, design, spec, tasks) Assisted-by: claude-opus Generated with AI assistance (claude-opus)
2d1f7f6 to
8990bf1
Compare
jflowers
left a comment
There was a problem hiding this comment.
Council Verdict: APPROVE
Note: Could not post as APPROVE due to GitHub's self-review prohibition (PR author cannot approve their own PR). Posted as COMMENT instead. Original verdict: APPROVE.
Reviewers: Adversary, Architect, Guard, Tester, Operator, Curator, Envoy, Herald, Scribe
Iterations: 1
Adversary (APPROVE)
No findings.
Architect (APPROVE)
Alignment Score: 9/10. 1 LOW finding omitted.
Guard (APPROVE)
No findings.
Tester (APPROVE)
No findings.
Operator (APPROVE)
No findings.
Curator (APPROVE)
No findings.
Envoy (APPROVE)
No findings.
Herald (APPROVE)
3 LOW findings omitted.
Scribe (APPROVE)
- [MEDIUM] Dense context paragraph in
design.md(FT-004) - [MEDIUM] Missing H1 heading in delta spec
spec.md(FT-006) - [MEDIUM] Minor terminology variation in test docstrings (VB-003)
- 2 LOW findings omitted.
Linked Issues
- #13: fix: generator-aware side_effect_type mapping in infer_side_effect_type
This review was generated by /review-council (AI-assisted).
PR Cost Report: #15Session: Propose change with artifactsID:
Timeline: 2026-09-01 15:36:08 — 2026-09-01 16:43:54 Child sessions: 12 — additional cost: $8.26 Child session breakdown
Session: Code and spec review councilID:
Timeline: 2026-09-01 16:49:20 — 2026-09-01 17:25:09 Child sessions: 10 — additional cost: $9.41 Child session breakdown
Grand Total: $31.67 across 2 session tree(s) (24 sessions) |
Summary
Fixes the generator-aware side_effect_type mapping bug in
infer_side_effect_type(issue #13).The value-type assertion fallback chain (
equality,comparison,identity,membership) previously mapped toReturnValue → first P0 effect → ReturnValue (fallback). Generator functions produceGeneratorYield(P1 tier) as their primary effect, notReturnValue(P0 tier). Since the chain only checked P0 effects, generator functions fell through to theReturnValuefallback — a type not present in their effect list. This caused Gaze'sfindSideEffectIDto find no match, sending all test assertions toUnmappedAssertionswith 0% contract coverage.The fix inserts
GeneratorYieldandAsyncGeneratorYieldchecks after the P0 scan and before theReturnValuefallback, producing the expanded chain:ReturnValue → first P0 → GeneratorYield → AsyncGeneratorYield → ReturnValue (fallback).Closes #13
Note: This branch is rebased on
opsx/test-mapping(issue #6) which introducesquality/mapping.py. The diff frommainincludes both the test-mapping base and this fix.How to Test
Verification scenarios from the spec:
GeneratorYieldeffect → maps toGeneratorYield(wasReturnValue)AsyncGeneratorYieldeffect → maps toAsyncGeneratorYield(wasReturnValue)ReturnValuestill takes precedence when bothReturnValueandGeneratorYieldare presentGeneratorYieldReturnValueHow to Demo
# Show the 7 new tests passing uv run pytest tests/test_test_mapping_method.py::TestEffectTypeInference -vThe key tests
test_value_generator_yield_onlyandtest_value_async_generator_yield_onlydemonstrate the fix — on unfixed code these returnReturnValue, on fixed code they returnGeneratorYield/AsyncGeneratorYield.Key Files Changed
Source (fix):
src/snake_eyes/quality/mapping.py— Added generator-yield check (7 lines) to the value-type fallback chain ininfer_side_effect_type; updated docstringTests:
tests/test_test_mapping_method.py— Added 7 new tests: 2 regression tests (GeneratorYield, AsyncGeneratorYield), 3 precedence tests (ReturnValue beats generator, P0 beats generator, GeneratorYield beats AsyncGeneratorYield), 1 fallback guard, 1 generic chain regression guardSpec artifacts:
openspec/changes/generator-aware-effect-mapping/— proposal, design (3 decisions), spec (6 scenarios), tasks (12 items, all complete)This PR was generated by /uf.finale (AI-assisted).