Repository navigation
feat: bridge helper function parameters to caller arguments for assertion mapping - #56
Merged
Merged
Conversation
…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
This was referenced Mar 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
Problem
When a test calls a helper function like
assertEqual(t, got, 12), the assertion detection recurses into the helper and finds the comparisonif got != want. But thegotinside the helper is a differenttypes.Object(the helper's parameter) than thegotin the test body (the test's local variable). Without bridging these, the assertion can't be linked to any traced side effect.Solution
CallerArgs []ast.ExpronAssertionSite: WhendetectHelperAssertionsrecurses into a helper, it attaches the call-site argument expressions from the test body.buildHelperBridge: Maps helper parametertypes.Objectto caller argumenttypes.Objectby zipping the helper's parameter declarations with the caller's argument expressions.Extended Pass 1: After checking
objToEffectIDdirectly, also checks the helper bridge. Matches at confidence 70 (between direct match 75 and indirect root resolution 65).Before/After
Remaining gap to 90%
10/66 assertions remain unmapped after this change:
if f() != x) -- ~3-4Issue #6 remains open for these remaining gaps.
Partially addresses #6