demo(04-breaking-api-change): 04 — Breaking change to public PaymentClient signature#153
demo(04-breaking-api-change): 04 — Breaking change to public PaymentClient signature#153
Conversation
…lient signature See scenarios/04-breaking-api-change/README.md for the expected verdict.
| } | ||
|
|
||
| public Task<PaymentResult> ChargeAsync(PaymentRequest request, CancellationToken ct = default) | ||
| public Task<PaymentResult> ChargeAsync(PaymentRequest request) |
There was a problem hiding this comment.
GCI0003 — Behavioral Change Detection
Method signature changed: 'ChargeAsync' in src/OrderService/Payments/PaymentClient.cs
Evidence:
- public Task<PaymentResult> ChargeAsync(PaymentRequest request, CancellationToken ct = default)
+ public Task<PaymentResult> ChargeAsync(PaymentRequest request)💡 Suggested action: Verify all callers are updated and consider adding an overload for backward compatibility.
Confidence: Medium | Severity: Block
| } | ||
|
|
||
| public Task<PaymentResult> ChargeAsync(PaymentRequest request, CancellationToken ct = default) | ||
| public Task<PaymentResult> ChargeAsync(PaymentRequest request) |
There was a problem hiding this comment.
GCI0004 — Breaking Change Risk
Public API signature changed: 'ChargeAsync' in src/OrderService/Payments/PaymentClient.cs
Evidence:
- public Task<PaymentResult> ChargeAsync(PaymentRequest request, CancellationToken ct = default)
+ public Task<PaymentResult> ChargeAsync(PaymentRequest request)💡 Suggested action: Provide a backward-compatible overload or bump the major version.
Confidence: Medium | Severity: Block
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88077c36c2
ℹ️ 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".
| public interface IPaymentClient | ||
| { | ||
| Task<PaymentResult> ChargeAsync(PaymentRequest request, CancellationToken ct = default); | ||
| Task<PaymentResult> ChargeAsync(PaymentRequest request); |
There was a problem hiding this comment.
Preserve CancellationToken in public payment interface
IPaymentClient is a public contract, and removing the CancellationToken parameter from ChargeAsync is a source/binary breaking API change for downstream consumers. Any external implementation or call site compiled against the previous signature will fail to compile after upgrade, even though this repo’s internal call sites were updated, so this should remain backward-compatible (or be released only as an explicit major-version break).
Useful? React with 👍 / 👎.
| var result = await _payments.ChargeAsync( | ||
| new PaymentRequest(order.Id, priced.Total, order.Customer.Email), | ||
| ct).ConfigureAwait(false); | ||
| new PaymentRequest(order.Id, priced.Total, order.Customer.Email)) | ||
| .ConfigureAwait(false); |
There was a problem hiding this comment.
Propagate operation cancellation into payment charging
ProcessAsync still accepts a CancellationToken, but this call no longer passes it into payment execution, so request/job cancellation can stop repository calls while the charge path keeps running to completion. In cancellation scenarios (HTTP disconnects, worker shutdown), this can still create authorizations after the caller has abandoned the operation.
Useful? React with 👍 / 👎.
04 — Breaking change to public PaymentClient signature
Expected verdict: ❌ Fails — GauntletCI should fire GCI0004 (breaking public API change).
What changed
IPaymentClient.ChargeAsynclost itsCancellationToken ct = defaultparameter — purportedly because nobody was passing one through. Five files
were updated to compile against the new signature:
src/OrderService/Payments/IPaymentClient.cs— interface definitionsrc/OrderService/Payments/PaymentClient.cs— implementationsrc/OrderService/Processing/OrderProcessor.cs— call sitesrc/OrderService/Controllers/PaymentsController.cs— call sitetests/OrderService.Tests/Fakes/FakePaymentClient.cs— test fakeWhy this is risky
IPaymentClientis apublic interface— any downstream packageimplementing it (a custom adapter, a mock) will fail to compile after
upgrading.
caller uses it.
What GauntletCI catches
GCI0004 Breaking public API change— a public/protected member'ssignature changed in a non-additive way (parameter removed).