Skip to content

feat: bridge helper function parameters to caller arguments for assertion mapping - #56

Merged
jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:explore-ast-ssa-bridge
Mar 15, 2026
Merged

jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:explore-ast-ssa-bridge

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

  • Bridge helper function parameters back to caller arguments for assertion mapping
  • Mapping accuracy: 78.8% (52/66) -> 84.8% (56/66)
  • Ratchet floor raised: 76.0% -> 83.0%
  • Part of Phase 3: Mapping Accuracy in the Gaze Roadmap

Problem

When a test calls a helper function like assertEqual(t, got, 12), the assertion detection recurses into the helper and finds the comparison if got != want. But the got inside the helper is a different types.Object (the helper's parameter) than the got in the test body (the test's local variable). Without bridging these, the assertion can't be linked to any traced side effect.

Solution

  1. CallerArgs []ast.Expr on AssertionSite: When detectHelperAssertions recurses into a helper, it attaches the call-site argument expressions from the test body.

  2. buildHelperBridge: Maps helper parameter types.Object to caller argument types.Object by zipping the helper's parameter declarations with the caller's argument expressions.

  3. Extended Pass 1: After checking objToEffectID directly, also checks the helper bridge. Matches at confidence 70 (between direct match 75 and indirect root resolution 65).

Before/After

Fixture Before (unmapped) After (unmapped) Change
helpers 4 (all helper_param) 0 -4 mapped via bridge

Remaining gap to 90%

10/66 assertions remain unmapped after this change:

  • Inline call returns (if f() != x) -- ~3-4
  • Complex helper patterns (multi-level, variadic) -- ~3
  • Cross-target assertions -- ~3

Issue #6 remains open for these remaining gaps.

Partially addresses #6

…tion mapping

Add CallerArgs to AssertionSite and buildHelperBridge to resolve
helper function parameter objects back to the caller's argument
variables. When a test calls assertEqual(t, got, 12), the assertion
inside assertEqual now maps got (helper param) to got (test variable)
to side effect ID at confidence 70.

Mapping accuracy: 78.8% (52/66) -> 84.8% (56/66).
Ratchet floor raised: 76.0% -> 83.0%.

Partially addresses unbound-force#6
@jflowers jflowers added this to the v1.4.0 milestone Mar 15, 2026
@jflowers
jflowers merged commit 6f7442f into unbound-force:main Mar 15, 2026
5 checks passed
@jflowers
jflowers deleted the explore-ast-ssa-bridge branch November 15, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant