test(machine): settlement-watch.test.ts — 5 of 7 fail on a clean dev checkout #125

Open
opened 2026-10-10 20:28:58 +00:00 by padreug · 0 comments
Owner

Found while running the machine suite for #124; identical on an untouched dev worktree at 23bd547, so not introduced by that branch.

pnpm exec vitest run src/services/__tests__/settlement-watch.test.ts
 Tests  5 failed | 2 passed (7)

Failing: "replays a settlement that beat the consumer (the race that lost payments)", "delivers a push that arrives while the consumer is attached", "settles from the poll when no push ever arrives", "polls even when arming the subscription fails", plus one more. All the same shape — the settlement callback spy is never called:

AssertionError: expected "spy" to be called with arguments: [ 'VIA-POLL' ]   (×2)
                                                            [ 'VIA-PUSH' ]
                                                            [ 'PREIMAGE' ]
                                                            [ 'LATER' ]

The two that pass are the ones that don't wait on a timer, which points at fake-timer / await ordering in the test rather than at settlement-watch.ts — but this is the cash-out payment path (the race in ebb07ce "arm the cash-out settlement watch before the invoice is shown"), so it needs to be established which, not assumed. Last touched in ebb07ce. The live path works (sintra's 90 EUR withdraw on 2026-10-10 settled via push), which is consistent with a test-harness problem but is not proof.

Note pnpm test is red on dev until this is fixed, which hides new failures.

Found while running the machine suite for #124; identical on an untouched `dev` worktree at 23bd547, so not introduced by that branch. ``` pnpm exec vitest run src/services/__tests__/settlement-watch.test.ts Tests 5 failed | 2 passed (7) ``` Failing: "replays a settlement that beat the consumer (the race that lost payments)", "delivers a push that arrives while the consumer is attached", "settles from the poll when no push ever arrives", "polls even when arming the subscription fails", plus one more. All the same shape — the settlement callback spy is never called: ``` AssertionError: expected "spy" to be called with arguments: [ 'VIA-POLL' ] (×2) [ 'VIA-PUSH' ] [ 'PREIMAGE' ] [ 'LATER' ] ``` The two that pass are the ones that don't wait on a timer, which points at fake-timer / `await` ordering in the test rather than at `settlement-watch.ts` — but this is the cash-out payment path (the race in ebb07ce "arm the cash-out settlement watch before the invoice is shown"), so it needs to be established which, not assumed. Last touched in ebb07ce. The live path works (sintra's 90 EUR withdraw on 2026-10-10 settled via push), which is consistent with a test-harness problem but is not proof. Note `pnpm test` is red on `dev` until this is fixed, which hides new failures.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/bitspire#125
No description provided.