feat: HCR060 withholds using-declaration fix when the response escapes scope - #218
georgepwall1991 wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b28c355c08
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| AssignmentExpressionSyntax assignment when assignment.Left is not IdentifierNameSyntax => | ||
| assignment.Right.DescendantNodesAndSelf() | ||
| .OfType<IdentifierNameSyntax>() | ||
| .Any(identifier => identifier.Identifier.ValueText == variableName), |
There was a problem hiding this comment.
Restrict escape matching to transfers of the response itself
When code merely copies data from the response into a member, such as this.lastStatusCode = response.StatusCode, this descendant-name search treats the response as escaping and suppresses the using-declaration fix. The response object remains local and still needs disposal, so the newly added guard removes a valid fix for a common pattern; match an ownership-transferring expression rather than any occurrence of the identifier within the right-hand side.
Useful? React with 👍 / 👎.
…s scope If the response local is returned or stored into a member/container, disposing at block end would break callers, so no automatic fix is offered. Guards all three fix paths (direct, block-merge, top-level).
b28c355 to
5e2513b
Compare
Iteration 21. Guards all three HCR060 fix paths (direct, block-merge, top-level) with VariableEscapesScope: no using-declaration fix when the response is returned or stored into a member/container. Tests: member-store offers no fix; returned response reports no diagnostic. Local gates: dotnet format clean, 953/953 tests pass. Review gate: codex CLI (attempted 2026-09-07, usage-limited until Sep 12; see PR comments for gate transcript).