Skip to content

fix: History: stop a finished top-up's claim from landing on the next one - #77

Open
piggydoughnut wants to merge 7 commits into
mainfrom
fix/claim-cross-write
Open

piggydoughnut wants to merge 7 commits into
mainfrom
fix/claim-cross-write

Conversation

@piggydoughnut

Copy link
Copy Markdown
Contributor

What this changes

Stops a finished top-up's claim from being recorded onto the next top-up's record, so each history row keeps its own amount.

Note

Records already corrupted on paseo stay as they are (claimed is immutable by design; no migration)

Why

Two different top-ups (50 and 20) showed the same 50 amount in history. When a top-up settles,
the surface polls the worker's claim every 2s for up to 200s — and disposing the session never
stopped that loop. When the claim finally landed, onClaimProgress recorded it against the
mutable foregroundRef, i.e. whatever request the buyer had started since, and the record's
claimed slot is first-write-wins, so the wrong amount stuck permanently.

  • app/stores/session.ts: claim progress is pinned to the request the world was built for
    (claimRef), never the current foreground.
  • lib/coinage.ts: the session's existing stop flag is threaded into createCoinageHandoff;
    dispose() now ends the settle wait instead of leaving a zombie poll.

How it was tested

  • New regression test in tests/claim-handoff.test.ts: a settle disposed mid-wait ends without
    recording a claim or reporting "crediting".
  • Full suite (1070 tests), pnpm typecheck, pnpm typecheck:packages, pnpm format:check,
    pnpm build all pass.
  • Not reproducible in the local mock world (the bug lives in the hosted path only); end-to-end
    check on getcash.paseo after deploy: start a second top-up with a different amount while the
    first is still claiming — history must show both amounts. Records corrupted before the fix
    stay as they are (claimed is immutable by design; no migration), so judge only by new
    top-ups.

Checklist

  • pnpm typecheck and pnpm typecheck:packages pass
  • pnpm test passes
  • pnpm format:check passes (run pnpm format to fix)
  • pnpm build succeeds (and pnpm build:worker if the worker changed)
  • Scope is one concern, and unrelated changes are not bundled in
  • Docs/comments updated where the change touches behaviour, config, or an endpoint shape
  • No Co-Authored-By: trailers in commits (they fail the paritytech CLA check)
  • No secrets, seeds, or private keys added to the repo

Related

Closes #62

@piggydoughnut piggydoughnut changed the title History: stop a finished top-up's claim from landing on the next one Bug: History: stop a finished top-up's claim from landing on the next one Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

pr77-getcash.paseo · logs

https://pr77-getcash.paseo.li

@piggydoughnut piggydoughnut changed the title Bug: History: stop a finished top-up's claim from landing on the next one fix: History: stop a finished top-up's claim from landing on the next one Oct 1, 2026
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.

[Bug]: History is showing the same amount in different topups

3 participants