fix: factory pattern should check all conditional reassignments#24
Merged
fix: factory pattern should check all conditional reassignments#24
Conversation
The factory.go had a bug where BlockReturnsContextUsingFunc was short-circuiting when it found ANY nested func literal that uses context, even if that func wasn't actually returned. Fixed by: - Removing the short-circuit and only checking what's actually returned - Adding recursive context-checking for nested factories - Creating funcLitAssignmentsAllUseOrReturnContext to check ALL assignments from last unconditional onwards Also added FuncLitAssignment type and related methods to assignment.go to track conditional vs unconditional assignments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
==========================================
+ Coverage 84.18% 84.25% +0.06%
==========================================
Files 24 24
Lines 1834 1842 +8
==========================================
+ Hits 1544 1552 +8
Misses 173 173
Partials 117 117
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mpyw
added a commit
that referenced
this pull request
Dec 26, 2025
Resolved conflict in internal/probe/assignment.go: - Kept FuncLitsAssignedTo from main - Removed duplicate FuncLitAssignmentsOfIdent (already added in main via PR #24)
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
BlockReturnsContextUsingFuncto only check what's actually returned, not short-circuit on any nested func literalfuncLitAssignmentsAllUseOrReturnContextto verify ALL assignments from last unconditional onwardsFuncLitAssignmenttype and related methods toassignment.gofor tracking conditional vs unconditional assignmentsTest plan
./test_all.sh)🤖 Generated with Claude Code