Skip to content

fix: prevent stale pages after switching lists - #5004

Merged
vincentkoc merged 1 commit into
mainfrom
fix/audit-feed-request-ownership
Nov 30, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/audit-feed-request-ownership

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Switching audit tabs or changing an Official organization search while pagination is active can append results from the previous list. An older audit request can also release the current request's loading guard, allowing the same page to load twice.

User Impact

Pagination keeps results attached to the current tab or search. Switching lists no longer mixes unrelated rows or duplicates a pending page; normal loading, retry, and end-of-list behavior remain intact.

Why This Change Was Made

Audit requests and observer callbacks retain the feed generation that created them. Only the current generation can clear its loading guard. The shared load-more observer ignores callbacks after cleanup, including callbacks already queued before disconnect. The existing audit and shared observer margins remain 420px and 200px respectively.

Evidence

  • Mounted regression tests: baseline 96 passed / 5 expected failures; candidate 101 passed across seven existing route/observer suites. Coverage includes stale success and rejection, replacement/disabled/unmounted observers, current-page append, retry, and completion.
  • Real local ClawHub + disposable Convex fixtures: all six candidate browser cases passed at 1280px/light and 390px/dark. The baseline reproduced mixed audit rows, 70 rows with only 60 unique items, and organization results from the previous search. The candidate retained the current list, issued one pending pagination request, and finished with the expected unique rows. All candidate runtime-error checks passed.
  • Full gates passed: 10,648 unit tests, 6 skipped; static checks, application/Convex production typechecks and build, schema/CLI TypeScript, and admin typecheck.
  • Scoped source-only autoreview and independent source review found no blocking issues. The native formatter delta was also reviewed.
Commands and proof boundaries
bunx vitest run src/__tests__/audits-route.test.tsx src/lib/useLoadMoreObserver.test.tsx src/__tests__/official-pagination.test.tsx src/__tests__/official-route.test.tsx src/__tests__/packages-route.test.tsx src/routes/templates/-index.test.tsx src/__tests__/template-catalog-loading.test.tsx
bun run test:pw:local-auth -- --config .artifacts/audit-feed-request-proof/playwright.config.ts --retries=0
bun run ci:static
bun run ci:unit
bun run ci:types-build
bunx tsc -p packages/schema/tsconfig.json --noEmit
bunx tsc -p packages/clawhub/tsconfig.json --noEmit
bun run --cwd packages/clawhub-admin typecheck

The temporary browser scenario used the real app at http://127.0.0.1:4173 and an isolated local Convex runtime on ports 3210/3211. Existing seed functions created 60 skills, 60 plugins, and 60 organizations. Actual IntersectionObserver entries and real query responses were retained and delivered in a controlled order; no response bodies were fabricated. This proves the specified interleavings, not their natural frequency. Two initial harness attempts checked navigation too early; their failures were retained, and the corrected organization proof waits for completed navigation between distinct A/B result sets.

Browser and full-gate runs used separate, subsequently released native leases with identical source and dependency inputs. No production deployment or data changes were made. Before/after screenshots are attached in the proof comment.

AI-assisted implementation and source review. I reviewed the change, understand its request-ownership boundary, and can maintain it.

@vercel

vercel Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clawhub Ready Ready Preview Nov 30, 2026 10:34am UTC

Request Review

@clawsweeper

clawsweeper Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
Pull request received.

@vincentkoc

Copy link
Copy Markdown
Member Author

The candidate passes all six real-browser cases at desktop/light and mobile/dark. The attached before/after frames cover all three reproduced defects: mixed audit rows, duplicate pending audit pages, and organization results from the previous search.

Baseline: e8ca6be212af33cf7dadf4a9c9a3a1a2aab12f02. Candidate: 71f29a61bb13bf2d55bc8b7974763ad776d54591.

Proof used a running local ClawHub instance (http://127.0.0.1:4173) and isolated Convex fixtures: 60 skills, 60 plugins, and 60 organizations. It delayed delivery of actual IntersectionObserver callbacks and real requests to reproduce specific interleavings. Query responses were unchanged; this is controlled scheduling, not a claim about natural race frequency.

  • Audit tab switch: baseline appended 10 old skill rows under Plugins; candidate ignored the old callback and loaded the correct 60 plugin rows.
  • Audit pending request: baseline issued two requests for the same next page and displayed 70 rows/60 unique; candidate issued one request and displayed 60 unique rows.
  • Official search A → B: baseline appended five A organizations to B; candidate ignored the old callback and displayed all 30 B organizations.

All candidate runtime-error checks passed. Mounted regression tests passed 101/101, and the full unit gate passed 10,648 tests with 6 skipped. Static, type/build, schema, CLI, and admin gates passed. Source-only autoreview was supplemented by independent source review and the runtime evidence above.

AFTER — audit pending request: 60 unique rows

BEFORE — audit pending request: 70 rows with duplicates

AFTER — Official search: only B organizations

BEFORE — Official search: stale A organizations appended

AFTER — mobile audit: only current plugin rows

BEFORE — mobile audit: stale skill rows under Plugins

@vincentkoc
vincentkoc marked this pull request as ready for review November 30, 2026 10:33
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. labels Nov 30, 2026
@vincentkoc
vincentkoc merged commit 3ddfa3d into main Nov 30, 2026
40 of 41 checks passed
@vincentkoc
vincentkoc deleted the fix/audit-feed-request-ownership branch November 30, 2026 10:40

This branch was successfully deployed

1 active deployment
Preview – clawhub — 71f29a61 Deployed Nov 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant