You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bridge AST-to-SSA name gap to reach 90% mapping accuracy (SC-003) #6
The quality.MapAssertionsToEffects() function traces SSA data flow to link test assertions to the side effects they verify. However, SSA register names (t0, t1, etc.) do not match AST variable names (got, err, etc.), so the mapping engine cannot bridge the gap between detected assertion sites and traced target values.
Current state: 0% mapping accuracy (0/42 assertions mapped across 6 test fixtures). Spec target: SC-003 requires >= 90% accuracy for standard Go test patterns.
Impact
Contract Coverage metrics report 0% coverage even for well-tested functions
gaze quality output shows all assertions as unmapped
GazeCRAP scores (once wired) would be inflated due to missing contract coverage data
Technical Context
The mapping pipeline works in three stages:
Assertion detection (AST-based) -- working correctly, finds 42+ assertion sites
Target value tracing (SSA-based) -- working correctly, traces return values and mutations
Linking -- broken: SSA values are identified by register names, AST assertions reference source-level variable names
The fix requires bridging AST positions to SSA values. Possible approaches:
Use go/types position info to correlate AST nodes with SSA instructions at the same source position
Build an AST-to-SSA map using ssautil.ValueForExpr() or similar
Use ssa.DebugRef instructions that link SSA values back to source-level names
PR #56 partially addresses this issue with helper parameter bridging:
Mapping accuracy: 78.8% (52/66) → 84.8% (56/66)
Added CallerArgs to AssertionSite and buildHelperBridge to mapping.go. When a test calls assertEqual(t, got, 12), the assertion inside the helper now resolves got (helper param) → got (test variable) → side effect ID at confidence 70.
The remaining 9/66 unmapped assertions are cross-target assertions (test exercises function A but asserts on function B's output), go-cmp patterns with stub type info, and helper-internal variables — all addressable via the AI fallback path. The 90% target for mechanical-only mapping is not achievable without CodeQL-level interprocedural data flow analysis, which was evaluated and deferred (see session notes on CodeQL feasibility).
Activity
chore: update TODO references from #5 to #6 (correct issue number)
fix: bridge AST-to-SSA name gap for assertion mapping (TODO unbound-f…
fix: bridge AST-to-SSA name gap for assertion mapping (TODO unbound-f…
Merge pull request #9 from jflowers/project-improvements
feat: bridge helper function parameters to caller arguments for asser…
feat: bridge helper function parameters to caller arguments for asser…
jflowers commentedon Mar 15, 2026
PR #56 partially addresses this issue with helper parameter bridging:
Mapping accuracy: 78.8% (52/66) → 84.8% (56/66)
Added
CallerArgstoAssertionSiteandbuildHelperBridgetomapping.go. When a test callsassertEqual(t, got, 12), the assertion inside the helper now resolvesgot(helper param) →got(test variable) → side effect ID at confidence 70.Remaining gap to 90% (10/66 unmapped):
if f() != x) — ~3-4Ratchet floor raised from 76.0% to 83.0%. Issue remains open for the remaining ~5% gap.
feat: add inline call matching for assertion mapping (86.4% accuracy)
feat: add inline call matching for assertion mapping (86.4% accuracy)
feat: AI-assisted assertion mapping with agent-level evaluation
feat: AI-assisted assertion mapping with agent-level evaluation
feat: AI-assisted assertion mapping with agent-level evaluation
jflowers commentedon Mar 16, 2026
Closing as substantially addressed across multiple PRs in this session:
Mechanical accuracy: 78.8% → 86.4%
CallerArgs+buildHelperBridge) — +4 mapped (confidence 70)matchInlineCall) — +1 mapped (confidence 60)AI fallback for the remaining ~14%:
AIMapperFunccallback as 5th mapping pass (confidence 50)BuildAIMapperPrompt/ParseAIMapperResponsepublic helpers for any AI backend/gazecommand executionRatchet floor: Raised from 76.0% to 85.0%
The remaining 9/66 unmapped assertions are cross-target assertions (test exercises function A but asserts on function B's output), go-cmp patterns with stub type info, and helper-internal variables — all addressable via the AI fallback path. The 90% target for mechanical-only mapping is not achievable without CodeQL-level interprocedural data flow analysis, which was evaluated and deferred (see session notes on CodeQL feasibility).
Follow-up issues for continued improvement:
fix: address PR unbound-force#211 review feedback
fix: address PR unbound-force#211 review feedback
fix: address PR #211 review feedback
fix: address PR unbound-force#211 review feedback