Repository navigation
test(ngn): prove the idempotency claims, and correct the ones that do not hold (W090) - #249
Open
Glorious21 wants to merge 2 commits into
Open
Glorious21 wants to merge 2 commits into
Glorious21 wants to merge 2 commits into
Conversation
… not hold (W090) Adds a fake Linq provider that records each provider assumption as a labelled BELIEF, plus client-level and route-level suites covering a duplicate request and three kinds of dropped response. Corrects comments that overclaimed: onramp and bill creation are retried without an idempotency key, provisionCustomer is keyed on customerRef alone, and the webhook is idempotent per event but not order-safe. docs/idempotency.md records each route's guarantee and the key's scope and lifetime. Closes Miracle656#247 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Glorious21 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Keeps both doc comments on provisionCustomer: the reused-reference note from main and the caveats about what idempotent provisioning does not promise.
This branch has not been deployed
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
Proves (or corrects) every idempotency claim on the naira rails.
src/__tests__/fakes/linqProvider.ts): replacesglobal.fetchwith no way through to the network; each provider assumption is markedBELIEF:. W089's fake doesn't exist yet, so this one is kept small for W089 to extend. No KYC endpoint, so it never sees a NIN.linq/idempotency.test.ts(client functions) androutes/idempotency.test.ts(HTTP routes, with an in-memory DB that enforces the schema's unique indexes). They cover a plain duplicate and three kinds of dropped response: the client never got our answer; Linq's answer never reached us; Linq created the order but our DB write failed.docs/idempotency.md: per-route guarantees, the key's scope and lifetime, and what is proven versus believed.Claims corrected
retryOnProviderFailuresaid every retry carries an idempotencyKey. Onramp and bills send none, so a retry after a lost answer creates a second (unpaid) order. Now documented and pinned in tests; behaviour unchanged.provisionCustomer: keyed oncustomerRefalone, so a repeat with new details keeps the old ones, andcreatedcan befalsefor a customer the same call created.recordNgnOrder: "a double-submit updates the row" was wrong. A double-submit is two orders.For W079
Before retrying KYC, ask Linq what a second submission of the same NIN for the same
customerRefreturns. If it isnin_already_used, a retry after a dropped response turns a success into a refusal.Related issue
Closes #247
Type of change
Checklist
npx tsc --noEmitpassesnpm run buildpassesnpm test: 719 passed, 2 failed, both inopenapiCoverage(W082, red onmainalready). Checked that the tests aren't empty: switching off the fake's offramp dedupe fails 6, and bypassing the route's own key check fails 2.🤖 Generated with Claude Code