fix(http-server-csharp): align controller argument order - #11903
Merged
Merged
Conversation
commit: |
Contributor
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
sophia-ramsey
force-pushed
the
sramsey/csharp-parameter-ordering
branch
from
September 15, 2026 02:05
c8d3b68 to
bed42b1
Compare
sophia-ramsey
marked this pull request as ready for review
September 15, 2026 02:05
sophia-ramsey
requested review from
catalinaperalta,
iscai-msft,
Laurent Mazuel (lmazuel),
Mark Cowlishaw (markcowl) and
Timothee Guerin (timotheeguerin)
as code owners
September 15, 2026 02:05
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate findings remain involving test modeling and missing emitter-level regression coverage.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes generated C# controller argument ordering by mapping canonical HTTP operations back to their source operations.
Changes:
- Tracks canonical-to-source operation mappings.
- Generates calls using business-interface parameter order.
- Adds resolution, component, emitter, and changelog tests.
File summaries
| File | Summary |
|---|---|
packages/http-server-csharp/src/service-resolution.ts |
Builds source-operation mappings. |
packages/http-server-csharp/src/service-resolution.test.ts |
Tests mapping behavior. |
packages/http-server-csharp/src/emitter.tsx |
Provides mappings through emitter context. |
packages/http-server-csharp/src/context/operation-source-context.ts |
Defines operation-source context. |
packages/http-server-csharp/src/components/controllers/controllers.tsx |
Passes source operations to actions. |
packages/http-server-csharp/src/components/controllers/controllers.test.tsx |
Moderate finding: the test does not correctly model source-operation mapping and expects an invalid call order. |
packages/http-server-csharp/src/components/controller-action/controller-action.tsx |
Orders generated business calls by source parameters. |
packages/http-server-csharp/src/components/controller-action/controller-action.test.tsx |
Tests reordered arguments. |
.chronus/changes/http-server-csharp-controller-parameter-ordering-2026-9-8.md |
Records the bug fix. |
Review details
Suppressed comments (1)
packages/http-server-csharp/src/components/controllers/controllers.test.tsx:111
- This test maps
canonOptobusinessGetPet, butBusinessLogicInterfacestill rendersGetPetAsyncfromgetPet(the expected signature ispetId, feature, apiVersion). The expected controller call reverses those first two arguments, so the generated C# would not compile and the test does not model the source-operation mapping used byresolveServiceTypes; use one operation with a deliberately different declaration order or validate the full emitter output.
<OperationSources.Provider value={new Map([[canonOp, businessGetPet]])}>
<BusinessLogicInterface type={PetStore} canonicalOps={[canonOp]} />
{"\n"}
<Controller type={PetStore} operations={[canonOp]} />
</OperationSources.Provider>
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
sophia-ramsey
enabled auto-merge
September 15, 2026 02:19
Timothee Guerin (timotheeguerin)
approved these changes
Sep 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.
This pull request addresses the ordering of controller call arguments in the generated C# code for the HTTP server emitter, ensuring that positional arguments match the order defined in the business interface. It introduces a mapping from canonicalized HTTP operations back to their original source operations, updates the controller and action rendering logic to use this mapping, and adds comprehensive tests to verify the new behavior.
Controller argument ordering and operation source mapping:
OperationSourcescontext and acanonicalOperationSourceMapin service resolution, which tracks the original source operation for each canonicalized HTTP operation. This mapping is provided throughout the emitter to ensure correct argument ordering. (packages/http-server-csharp/src/context/operation-source-context.ts [1] packages/http-server-csharp/src/service-resolution.ts [2]ControllerActionandControllercomponents to use the source operation fromOperationSourceswhen rendering method call arguments, ensuring correct positional mapping. (packages/http-server-csharp/src/components/controller-action/controller-action.tsx [1] [2] [3] [4] [5]; packages/http-server-csharp/src/components/controllers/controllers.tsx Ff671f60L9R9, [6] [7]Testing and validation:
Emitter integration:
OperationSourcescontext into the emitter so that all components have access to the canonical operation source mapping during code generation. (packages/http-server-csharp/src/emitter.tsx [1] [2]These changes together ensure that the generated C# controllers call business logic methods with arguments in the correct order, improving correctness and maintainability of the generated code.