droboticflow/docs/verification/admin-pool-counts-20261021.md
d-robotics 2876a14d4a 🐛 Separate administrative pool totals from bounded cursor pages
Administrator counters were derived from the stage-filtered first human-item page, while annotators used an aggregate. Add authorized whole-pool counters with a five-second bounded cache, page human items before joining task summaries, and search older metadata on the server. Cancel stale reads and preserve existing non-admin scope behavior. Cover permissions, mixed stages, real Mongo parity, old-page search, categories, pagination, stale responses and claim invalidation.
2026-10-21 15:31:05 +08:00

3.5 KiB

Administrator annotation pool totals — local verification

Base 867ca698, branch codex/rework-boundary-20261021. Diagnosis captured deployed fab5be57: administrator badges were the stage-filtered first 500 human records while annotator blind claim used an aggregate. The original metadata replay produced 495 vs 14902; screenshots were 496 vs 14911 at an earlier time.

Regression and implementation

TestAdminAnnotationPoolTotalsAndOldPageSearch first failed with 404 before adding the read endpoint. It now covers 610 added mixed-stage items, stable whole-pool counts across cursors, a search hit older than the previous 500-row window, and denial to annotators. Permission/cache/error tests cover role changes before cache access, normalized count keys independent of page/list filters, bounded page limits, malformed inputs, 5-second expiry and a failed aggregate returning an error rather than false zero.

The real page/HTTP fixture uses MemoryStore and synthetic records only:

ADMIN_POOL_BROWSER_TEST=1 go test ./internal/api -run 'TestAdminAnnotationPool' -count=1 -v

Covers 200→400 loaded cards with unchanged 606 available/611 all totals; search for CAPTURE_0001; status category returning zero without changing badges; all-pool review filtering; delayed old search response ignored; real local claim invalidating cached count. No page errors or unexpected browser writes.

Actual Mongo parity and timings use a new, unique synthetic database on local Mongo 27018, cleaned afterward:

POOL_LOCAL_MONGO_URI=mongodb://127.0.0.1:27018 go test ./internal/store -run '^TestAdminAnnotationPoolMongoParity$' -count=1 -v

1500 synthetic records in separate batches cover mixed stages/assignees, orphan and cross-organization rows, full old-page searches, literal rather than regex search, cursor de-duplication, persisted workflow categories, legacy Capture names obtained through Capture records, and absence of heavy annotationWorkspace on list responses. Timings are local store measurements, not claims about production latency.

Legacy API compatibility, shared Capture extraction, existing dashboard-cache defaults, annotator/review editing browser flows, TypeScript, build, production-bundle boot, and full frontend baseline gate are checked separately. No baseline entries are edited. Production data, workflow, indexes, Worker and delivery JSON are not changed in this task; no push, PR or deployment is included.

Final evidence

Store-level measurements with 1500 separate batches: counts 42.8 ms, first page 29.4 ms, old-record search 486.6 ms; these are synthetic local observations only. No new production index or statistical collection is required.

One combined browser run lost a fixture work session during the draft C/undo/redo scenario; there were no page errors. The same test passed unchanged in an isolated rerun, including the newer-draft recovery path. This is recorded separately rather than erased from the results or accepted by changing test expectations. The administrator browser flow and existing boundary browser passed in that combined run. Logs remain in untracked local test results and /tmp/admin-pool-all-browser.log / /tmp/admin-pool-slice-isolated.log for this session.

The final combined administrator + slice-phase browser rerun passed with the newer-draft case, and no runtime errors. Final frontend gate retains only 13 known baseline failures; TypeScript, Go build, web build and production boot pass. Old non-admin project scope/dependency behavior is preserved, so local annotator filters do not trigger the new administrator queries.