Skip to content

fix(withdrawal): surface backend failures instead of returning mock data - #682

Open
woahwhattheheck wants to merge 7 commits into
Protocol-Guild:mainfrom
woahwhattheheck:sol56/payd457-withdrawal-errors-quotaforge-20261004
Open

woahwhattheheck wants to merge 7 commits into
Protocol-Guild:mainfrom
woahwhattheheck:sol56/payd457-withdrawal-errors-quotaforge-20261004

Conversation

@woahwhattheheck

Copy link
Copy Markdown

Closes #457.

What

Removes the blanket catch-and-mock-fallback behavior from all four methods in frontend/src/services/withdrawal.ts (getAvailableAnchors, initiateWithdrawal, getTransactionStatus, cancelWithdrawal). Real axios errors now propagate to the caller, so the existing useWithdrawal hook surfaces them through its error state and failed step instead of displaying fabricated anchors/transaction data.

Tests

Adds frontend/src/services/__tests__/withdrawal.test.ts covering rejection propagation for each of the four methods — a simulated network/500 failure reaches the caller rather than producing a fake success.

Validation

Fork CI Build Project and Run Tests (eslint typechecked rules, prettier, unit tests) passes on the head commit. The Playwright sidebar-navigation spec (getByRole('link', { name: 'Employees' }) strict-mode violation) fails on main independently of this change.

Use vi.spyOn(axios, 'get') so the mock is registered without an unbound method reference; fixes the @typescript-eslint/unbound-method error from the typechecked lint config.
Extend the vitest suite to assert rejection propagation for initiateWithdrawal, getTransactionStatus and cancelWithdrawal as well, matching the issue's error-path coverage criterion.
Keep the status-propagation assertion under the 100-character print width so the format check passes.
Rewrite the test file with LF line endings so the prettier --check step passes.
The existing error-propagating service reaches useWithdrawal, but WithdrawalFlow then reads its pre-await render state and calls onSuccess even after a validation or request failure. Return an explicit boolean from initiation and notify the caller only on success. Preserve current errors, form/processing states, polling and the existing successful-initiation account-refresh timing; this does not claim settlement.

This source residual was identified in Lantern's earlier PayD457 intake and remains present on the existing PR682 carrier. Only the hook and component change; backend/service and prior contributor work stay intact.

Static source inspection of service, hook, component and actual EmployeePortal callback only. No tests, fixtures, build, browser, wallet/backend or runtime execution was performed. The prior fork CI receipt remains historical on c6f73d8; native validation and maintainer acceptance of this continuation are pending.
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.

withdrawal.ts swallows all backend errors and silently falls back to fabricated mock data

1 participant