annotationReadCache handed the same *HumanItemRecord to every lookup in a
request, and write handlers mutate the item they load (version, status,
assignment, payload keys) before the versioned write. After a failed or
conflicting write, later lookups in that request would see unsaved state.
Keep the single store read per request but return a copy per lookup, with
the payload, assignment and processing-job input maps cloned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Six follow-ups from the round8-12 hotfix retrospective:
- web-ci.yml: lint + Go/frontend tests on every push and PR (nothing ran
app checks before; the round10 dev-mode regression shipped green)
- tests/known-failures.json + check-test-baseline.mjs: gate by exact
failing-test id instead of hand-counted failure totals (14 frontend,
70 Go upstream debts recorded from the dev tip)
- devboot.test.mjs: boots the real Vite dev server and pins the movi
loader contract that broke round10 (query-less DEV url, /vendor stays
off the module pipeline)
- scripts/local/smoke-workbench.mjs: pre-release smoke covering the
seven recurring acceptance points (login/pool/claim/play-while-loading/
captions/4x/playhead), 3x green against the local replica
- docs/CODING_STANDARDS.md + AGENTS pointer: eligibility flags are
server-shipped, the UI renders them (rounds 9+12 lesson)
- vendor README host-element quirks section, HANDOFF gate pointers and
movi-path verification rule, perf-audit report pinned with the
post-round12 production 500 observation
- husky pre-commit: lint-staged (repo prettier scope) + tsc + gofmt
- gofmt: restore lint:go green on the dev tip (drift shipped silently
in the perf merge and round12 because nothing gated it)
The review workspace counted the available pool server-side but guessed
claim eligibility client-side. In the project-scoped workspace that guess
depends on listMembers data (review-only accounts skip the fan-out), so
absent or empty member data emptied the random-claim candidates while the
pool tab still showed claimable items — exactly the reported 可领取3但领取不了.
The pool listing now computes canClaim for quality reviewers exactly like
it already did for acceptance reviewers, and canClaimHumanItem resolves
batches through the request-scoped list-read cache (the listing's N+1
guard test stays green). The frontend honors server canClaim first, and
the empty-candidates notice now distinguishes no-permission from no-tasks.
Also fixes a dev-only regression from the rate-cap hotfix: the ?v=
cache-bust query on the vendored movi import defeats Vite's public-dir
resolver and hard-blocks every dev page with an error overlay. Dev now
injects a module script tag on the query-less path; built deployments
keep the cache-busted import URL.
User report on production: reviewers saw 正在加载任务… for a long time and
then 任务关联数据缺失,请联系管理员核查; annotator loading slow; acceptance
fast. Production traces showed three distinct causes:
1. /api/human-items available pool 12-14s: the role pools filtered stages
only in-memory, so Mongo sorted the whole 17,220-doc unassigned backlog
(~7s per fetch round, up to 6 rounds) before the handler dropped nearly
every row. Acceptance was fast because its query already pushed stageId.
Fix: HumanItemQuery.StageIDs pushdown (parseHumanItemQuery accepts
stageIds=a,b,c merged with stageId); the quality/clip-quality/acceptance
workspaces send their stage set; review pool joins no longer depend on
the backlog sort.
2. 任务关联数据缺失 regression (introduced by the round4 task-list
pagination): review pool pages reference tasks across the whole backlog,
but the tasks fetch took a newest-first 200 window — only 60/500 pool
items could find their task. Fix: review workspaces (reviewOnly) fetch
tasks by the pool page's legacyTaskIds via the new ids= parameter
(id_unique ); ListAnnotationTasksFiltered gains an IDs mode in both
stores; the misleading 任务关联数据缺失 empty-state is scoped to
non-review workspaces (review pool loading shows its own message).
3. claim-count 3.4s: one per-candidate GetHumanBatch point lookup over
12,009 legacy batches. Fix: single ListHumanBatchAccessRecords read;
its projection now also carries status (the completed check read a
missing field before).
Verified on the 17k-item stress replica: pool 421→308ms with stage pushdown;
ids join returns 500/500 pool items in 78ms (was 0/440 outside the window);
claim-count 128ms. Full suites: 65 failures = the 65 pre-existing upstream
debt, no new.