Skip to content

SPA: audit the other load-more/filter screens for the async races hardened in #467 #469

Description

@mforce

PR #467 (stock lot paging/filter) went through 11 codex review rounds, every finding a real interleaving of optimistic inputs, offset paging, and unticketed async settles. The stock panel now follows an intent-ordering discipline: a monotonic ticket per load claimed at user-intent time, checked after EVERY await (success and catch paths), ownership rules for shared loading flags, an applied-snapshot for optimistic inputs (commit on land, rollback on failure), write-result reconciliation against pre-mutation reads, and invalidation at every wholesale-replace or collapse.

The pattern #467 started from — HistoryPage, AuditPage, and the other limit/offset + from/to screens — predates that discipline: their loads are unticketed, so the same stale-settle/mixed-window/late-failure races exist there (e.g. two quick filter changes racing, a late rejection painting an error over a healthy view, load-more mid-filter mixing windows).

Sweep those screens against the checklist above; StockPage.tsx and its 56-test suite in StockPage.test.tsx are the reference implementation. Vitest can reproduce each race with deferred-promise mocks (see the 'codex round N' tests).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions