Support adding TransformResult for ValueTask endpoints - #325
Conversation
📝 WalkthroughWalkthroughThe code fix now supports ChangesTransformResult code fix
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Coverage Report for CI Build 30317553066Coverage decreased (-0.001%) to 96.259%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/Immediate.Apis.CodeFixes/MissingTransformResultMethodCodeFixProvider.cs`:
- Around line 72-82: Restrict the code fix in the handler-generation flow around
the return-type switch to methods returning ValueTask or ValueTask<T>. Validate
handleMethodSymbol.ReturnType semantically before emitting TransformResult,
rejecting Task, Task<T>, and custom return types while preserving valid
ValueTask cases.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0703e699-db29-46a5-8f5a-2620627bcaef
📒 Files selected for processing (3)
src/Immediate.Apis.CodeFixes/MissingTransformResultMethodCodeFixProvider.cssrc/Immediate.Apis.Generators/ImmediateApisGenerator.Transform.cstests/Immediate.Apis.Tests/CodeFixTests/MissingTransformResultMethodCodeFixTests.cs
| var (valid, returnType) = handleMethodSyntax.ReturnType switch | ||
| { | ||
| GenericNameSyntax | ||
| { | ||
| TypeArgumentList.Arguments: [{ } returnType], | ||
| }) | ||
| TypeArgumentList.Arguments: [{ } rt], | ||
| } => (true, rt), | ||
|
|
||
| IdentifierNameSyntax => (true, null), | ||
|
|
||
| _ => (false, null), | ||
| }; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C4 'IAPI0007|GetValidHandleMethod|IsValueTask1|IsValueTask' src testsRepository: ImmediatePlatform/Immediate.Apis
Length of output: 16535
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== Code fix ==\n'
sed -n '1,220p' src/Immediate.Apis.CodeFixes/MissingTransformResultMethodCodeFixProvider.cs
printf '\n== Language version settings ==\n'
rg -n -C2 '<LangVersion>|TargetFramework|SupportedOSPlatformVersion|ImplicitUsings' -g '*.csproj' -g 'Directory.Build.*' -g 'global.json' .Repository: ImmediatePlatform/Immediate.Apis
Length of output: 14817
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== MissingTransformResultMethodAnalyzer ==\n'
sed -n '1,220p' src/Immediate.Apis.Analyzers/MissingTransformResultMethodAnalyzer.cs
printf '\n== GetValidHandleMethod / type helpers ==\n'
sed -n '1,220p' src/Common/ITypeSymbolExtensions.cs
printf '\n== Related tests ==\n'
sed -n '1,220p' tests/Immediate.Apis.Tests/AnalyzerTests/MissingTransformResultMethodAnalyzerTests.csRepository: ImmediatePlatform/Immediate.Apis
Length of output: 10834
Restrict the fix to ValueTask handlers. The diagnostic is raised for any class with a Handle/HandleAsync method, so Task, Task<T>, and custom return types can still reach this syntax-based switch and generate a mismatched TransformResult; use handleMethodSymbol.ReturnType (or mirror the analyzer’s semantic checks) before emitting the method.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/Immediate.Apis.CodeFixes/MissingTransformResultMethodCodeFixProvider.cs`
around lines 72 - 82, Restrict the code fix in the handler-generation flow
around the return-type switch to methods returning ValueTask or ValueTask<T>.
Validate handleMethodSymbol.ReturnType semantically before emitting
TransformResult, rejecting Task, Task<T>, and custom return types while
preserving valid ValueTask cases.
Summary by CodeRabbit
TransformResultmethods now use the appropriate result parameter when available, or create a new result when no type is specified.