Skip to content

fix(accounts): heal accounts left without cash wallets after an IBEX failure (#90) - #522

Closed
nul-quill wants to merge 1 commit into
lnflash:mainfrom
nul-quill:heal-ibex-account-90
Closed

nul-quill wants to merge 1 commit into
lnflash:mainfrom
nul-quill:heal-ibex-account-90

Conversation

@nul-quill

Copy link
Copy Markdown

Recover accounts whose IBEX cash wallets were never created.

  • new ensure-account-wallets.ts fills only missing currencies (reuses an existing Checking wallet per currency) and repairs defaultWalletId`n- required-currency failures are returned, optional ones logged so one IBEX hiccup no longer blocks the account
  • createAccountWithPhoneIdentifier delegates provisioning to the same helper
  • getAccountFromUserId heals an account with no defaultWalletId on the next read

Tests: jest test/flash/unit/app test/flash/unit/graphql -> 118 suites / 1431 tests pass; sc --noEmit shows only the two pre-existing Express/Application errors.

…failure (lnflash#90)

Account creation could persist the Account record and then fail while the
IBEX cash wallets were being provisioned, leaving an account with no
defaultWalletId and no way to recover: every later read kept returning the
same half-built account.

- add src/app/accounts/ensure-account-wallets.ts with createMissingCashWallets()
  which fills only the missing currencies (reusing an existing Checking wallet
  per currency) and ensureCashWallets() which re-runs that gap fill, repairs
  defaultWalletId and persists the account
- required-currency failures are returned, optional ones are logged and the
  loop continues, so a single IBEX hiccup no longer blocks the whole account
- create-account.ts now delegates provisioning to the same helper so both
  paths share one routine
- getAccountFromUserId() calls ensureCashWallets() when defaultWalletId is
  unset, so an affected account heals on the next read instead of failing
- add unit coverage for the gap fill, reuse, error propagation, idempotent
  repair and the missing-wallet CouldNotFindError path
@nul-quill

Copy link
Copy Markdown
Author

Handle: nul-quill. Payout wallets: Solana USDC BdznDjc4xwt5Y6WJT5UnrFQzDptka8YnC9oqmmkKpwkd, TRC20 TNEHCVwR2aPMrj5AKfWCQ2rFL3bEDQmsg7. Shipped in #522: ensureCashWallets() gap-fills missing cash wallets and repairs defaultWalletId, so an account left half-built by an IBEX createAccount failure heals on the next read instead of failing forever. Mocked IBEX failure plus second-attempt success covered in test/flash/unit/app/accounts/ensure-account-wallets.spec.ts; happy-path creation still asserted by create-account.spec.ts. 118 suites / 1431 tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants