Skip to content

Batch acknowledgment on a public upstream (D3) - #2380

Merged
neuromechanist merged 15 commits into
feature/issue-2182-epic-pq-decidefrom
feature/issue-2363-upstream-ack
Nov 25, 2026
Merged

neuromechanist merged 15 commits into
feature/issue-2182-epic-pq-decidefrom
feature/issue-2363-upstream-ack

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

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 table UPSTREAM_ACK_COPY, typed over every outcome plus the policy entry public-upstream-acknowledgment, all linking to https://docs.nemar.org/platform/identifier-screening/#public-upstream-acknowledgment (A10 publishes that section).
  • POST /admin/publish/acknowledge-batch (new route file backend/src/routes/admin/upstream-ack.ts): a dry run unless apply: true; at most 100 requests per call; per-request outcomes eligible, 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 with recordScreenAcknowledgment as the caller, conditional on the exact stored report. Nothing is approved.
  • recordScreenAcknowledgment gains an optional shown guard (exact report, request still requested, no acknowledgment yet) and audit details; the approve paths call it unchanged.
  • readDatasetLineage is 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 --apply sends back only what it printed as eligible.
  • The excluded requests (name class photo-face or questionnaire) are read from D2's d2-blockers.json, bundled into the Worker and parsed fail-closed; none is hard-coded.
  • ADR 0086 amendment 2026-11-25 appended as written, index line updated.
  • No migration.

Rule

Eligible only when: status requested; a stored screen whose commit is the current main; state not-screened, partially-screened, clean-edf-only-others-unscreened, or review with only image-or-document-file and tooling-debris; a complete scan; no acknowledgment yet; lineage compatible, compatible_attribution or compatible_nc with at least one resolved source read by datacite, openneuro or physionet; measured by D2 and not excluded.

Tests

  • test/upstream-ack.unit.test.ts: every branch eligible and ineligible, direct identifiers, local-user-path, unresolved and needs_permission lineage, 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_moved for 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.
  • Mutations: widening the eligible kinds with local-user-path fails 5 tests; accepting unresolved lineage 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.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2380

Version: 0.10.40-PR2380.ce9b4e4
Commit: ce9b4e4


🤖 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
@neuromechanist

Copy link
Copy Markdown
Contributor Author

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).

@neuromechanist
neuromechanist merged commit 1095dae into feature/issue-2182-epic-pq-decide Nov 25, 2026
51 of 53 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-2363-upstream-ack branch November 25, 2026 23:49

This branch was previously deployed

1 inactive deployment
npm — ce9b4e40 Deployed Nov 25, 2026 by neuromechanist via publish #4905
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant