Repository navigation
Batch acknowledgment on a public upstream (D3) - #2380
neuromechanist merged 15 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2380Version: 🤖 Updated on each push. |
…e' into feature/issue-2363-upstream-ack # Conflicts: # .context/decisions/0086-publication-requests-are-screened-for-identifiers-in-ci-and-the-admin-mail-waits-for-the-verdict.md # backend/src/routes/admin/index.ts # src/commands/admin-publish.ts # src/lib/api/publish.ts # test/admin-route-inventory.unit.test.ts
|
Merge gate (lead): head ce9b4e4, which merges the decide branch (B3) in. Every remote check passes after one rerun of integration shard 5 (the repull CLI flake, #2377). Review: round 1 panel (code+tests; errors+comments+types), 2 important findings (audit fail-open; per-item isolation) and 4 more fixed, plus lead changes (a run-time tree check with a shared classifier, BIDS _photo excluded, a cap of 20 per call, the approve check compares the acknowledgment author, one D1 transaction for the acknowledgment and its audit row, a generated excluded-id module in place of the bundled JSON); round 2 delta review resolved all six items, and its two suggestions are fixed (not_recorded:write_failed; one source for screen_state). |
1095dae
into
feature/issue-2182-epic-pq-decide
Part of #2363. Part of #2182.
Card D3 of the publication-queue plan: an administrator acknowledges, in one documented act, the identifier screens of queued requests that are conversions of a public, redistributable upstream dataset (owner decision 2026-11-25, CP-D1).
What changed
shared/upstream-ack.ts: the one eligibility rule, the recorded reason (at most 500 characters) and the copy tableUPSTREAM_ACK_COPY, typed over every outcome plus the policy entrypublic-upstream-acknowledgment, all linking tohttps://docs.nemar.org/platform/identifier-screening/#public-upstream-acknowledgment(A10 publishes that section).POST /admin/publish/acknowledge-batch(new route filebackend/src/routes/admin/upstream-ack.ts): a dry run unlessapply: true; at most 100 requests per call; per-request outcomeseligible,not_eligible:<reason>,acknowledged,state_moved. An apply carries the state and screened commit the dry run showed, re-reads, re-runs the whole rule, and records withrecordScreenAcknowledgmentas the caller, conditional on the exact stored report. Nothing is approved.recordScreenAcknowledgmentgains an optionalshownguard (exact report, request stillrequested, no acknowledgment yet) and auditdetails; the approve paths call it unchanged.readDatasetLineageis extracted from the D1 lineage route so the batch reads lineage at the screened commit with the same resolver.nemar admin dataset publish acknowledge-batch --all-requested | --ids <file> [--apply] [--json]: prints the full dry run first, pages 20 requests per call, and with--applysends back only what it printed as eligible.photo-faceorquestionnaire) are read from D2'sd2-blockers.json, bundled into the Worker and parsed fail-closed; none is hard-coded.Rule
Eligible only when: status
requested; a stored screen whose commit is the currentmain; statenot-screened,partially-screened,clean-edf-only-others-unscreened, orreviewwith onlyimage-or-document-fileandtooling-debris; a complete scan; no acknowledgment yet; lineagecompatible,compatible_attributionorcompatible_ncwith at least one resolved source read bydatacite,openneuroorphysionet; measured by D2 and not excluded.Tests
test/upstream-ack.unit.test.ts: every branch eligible and ineligible, direct identifiers,local-user-path,unresolvedandneeds_permissionlineage, the reason with 10 sources at most 500 characters, the exclusions read from the real D2 file, and the copy table complete.backend/test/upstream-ack-route.test.ts: the real admin router over in-memory D1, a GitHub stand-in and the recorded registry responses; dry run records nothing; apply records the caller's reason and audits the lineage;state_movedfor a screen re-run between dry run and apply and for a report rewritten between read and write; the acknowledgment satisfies the gate for the same administrator and not another; forged apply entries are re-checked.local-user-pathfails 5 tests; acceptingunresolvedlineage fails 2; dropping the exclusion, the completeness, the already-acknowledged or the D2-measured check, widening the own-record resolvers, dropping the shown-report guard, or applying without re-running the rule each fail at least one.bun run typecheck,bun run lint,cd backend && bun run typecheck, biome on every touched file,test/adr-index.unit.test.ts, the route-inventory and export-surface pins.