perf(web): optimistic tentative decisions — per-card busy gates, background refresh, no full-refetch wait #820

Merged
chris merged 1 commit from fix/decision-perf-web into main 2026-09-22 21:54:59 +02:00
Owner

Problem

Accepting/rejecting a tentative suggestion felt slow: the busy gate held ALL cards until the POST and three heavy refetches (tentative list + instance stats + timeline) completed; the carousel's single global busyId serialized every card; the parent grid refetched the domain instances twice per decision.

Changes

  • DiscoveryInstanceDetail: busy gate released right after the POST; accepted/rejected cards removed optimistically (suppressedCandidateIds); the 3 refetches now run fire-and-forget with a 300ms trailing coalescer; loadTentativeCandidates filters stale payloads through the suppression set so a late response can never resurrect a decided card; suppression + timer reset on load/unmount. Batch paths follow the same pattern (batch reject now refreshes at all).
  • DomainSuggestionsCarousel: per-card busy set replaces the global busyId (7 decision fns + ~40 controls); merge-suggestion card keeps its own flag; removed a duplicate parent-refetch trigger in afterDecision.
  • DiscoveryDomainInstances: refetchInstances coalesces in-flight+trailing; stashed listing runs in parallel instead of sequentially.

Tests

  • discovery-instance-tentative.spec.ts: global-gate test replaced by per-card busy isolation + stale-refetch-cannot-resurrect tests; stale-guard proven by mutation (test fails at the resurrection without the suppression filter).
  • 30 passed (spec alone), 42 with embedding-map suite, 126 carousel regression trio — all --retries=0; svelte-check 0 errors; build ok.

Backend companion PR (set-based overlap + batched confirm + index) follows separately.

## Problem Accepting/rejecting a tentative suggestion felt slow: the busy gate held ALL cards until the POST *and* three heavy refetches (tentative list + instance stats + timeline) completed; the carousel's single global busyId serialized every card; the parent grid refetched the domain instances twice per decision. ## Changes - DiscoveryInstanceDetail: busy gate released right after the POST; accepted/rejected cards removed optimistically (suppressedCandidateIds); the 3 refetches now run fire-and-forget with a 300ms trailing coalescer; loadTentativeCandidates filters stale payloads through the suppression set so a late response can never resurrect a decided card; suppression + timer reset on load/unmount. Batch paths follow the same pattern (batch reject now refreshes at all). - DomainSuggestionsCarousel: per-card busy set replaces the global busyId (7 decision fns + ~40 controls); merge-suggestion card keeps its own flag; removed a duplicate parent-refetch trigger in afterDecision. - DiscoveryDomainInstances: refetchInstances coalesces in-flight+trailing; stashed listing runs in parallel instead of sequentially. ## Tests - discovery-instance-tentative.spec.ts: global-gate test replaced by per-card busy isolation + stale-refetch-cannot-resurrect tests; stale-guard proven by mutation (test fails at the resurrection without the suppression filter). - 30 passed (spec alone), 42 with embedding-map suite, 126 carousel regression trio — all --retries=0; svelte-check 0 errors; build ok. Backend companion PR (set-based overlap + batched confirm + index) follows separately.
perf(web): optimistic tentative decisions — per-card busy gates, background refresh, no full-refetch wait
All checks were successful
Build and Deploy / Detect changed services and test scopes (push) Successful in 4s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 3m42s
62a7df898c
chris merged commit 641e7bd3c6 into main 2026-09-22 21:54:59 +02:00
Sign in to join this conversation.
No reviewers
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
chris/memories!820
No description provided.