Skip to content

B6: license permission evidence workflow - #2393

Merged
neuromechanist merged 16 commits into
feature/issue-2182-epic-pq-decidefrom
feature/issue-2182-license-permission
Nov 26, 2026
Merged

neuromechanist merged 16 commits into
feature/issue-2182-epic-pq-decidefrom
feature/issue-2182-license-permission

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Part of #2391. Part of #2182.

Card B6 of the publication-queue plan: the license permission evidence workflow (ADR 0139 decision 7, owner decision of 2026-11-25).

What changes

  • Depositor message. LINEAGE_PERMISSION_REQUEST in shared/license-lineage.ts holds one sentence per outcome that needs action, worded from the owner's: send evidence from the original authors (for redistribution_prohibited, from the source repository such as PhysioNet) to [email protected], quoting the dataset id. unresolved asks for a link to the license. licensePermissionRequest (shared/license-permission.ts) fills the placeholders from closed license words and identifiers of a known form only; a URL or free-text identifier is named generically and a malformed dataset id is not quoted.
  • Notice. After a first run stores license_lineage_unconfirmed on a request still waiting, the requester gets one mail with that sentence (license_permission_notices, claimed before the send, once per request and outcome), through the dev mail fence. GET /datasets/:id/publish/status returns the same lines as license_permission_lines, and nemar dataset publish status prints them.
  • Basis. The inputs route now stores, on each review, the lineage it served (publication_reviews.lineage_basis: outcome, target license, the sources behind the outcome), which is what a permission is matched against.
  • Recording. nemar admin dataset publish license-permission <dataset> --ticket <id> --evidence <text> [--apply] (alias path repo, ADR 0135), backed by POST /admin/publish/:id/license-permission. Dry run by default; --apply writes the license_permissions row and a license_permission_recorded audit row in one batch. The ticket must exist and be visible to the administrator (ADR 0112's predicate). The evidence (1 to 1,000 characters) is never echoed, audited, logged, shown to a depositor or sent to a model.
  • Effect. A permission covers a review when its outcome and target license match and it names every source behind the outcome (never the dataset's own unreadable files). It then clears license_lineage_unconfirmed, and only that, for the request and for later requests of the dataset with the same basis; the stored verdict is re-derived without that reason when the column still equals what its report derives (no model re-run). The admin show, the detail contract and the administrators' mail print "License permission recorded on (date) by (administrator), ticket (ticket)".
  • ADR 0139 gains the dated amendment.
  • Migration 0154: the lineage_basis column and the two tables.

Deviations from the card

  • A permission is also bound to the lineage outcome and the target license, not only the sources, following the owner's wording ("this specific license on the copy that we are publishing"). A later request under another license needs new evidence. Recorded in the ADR amendment.
  • A table license_permission_notices holds the once-per-request-and-outcome claim.
  • The reason's cure sentence now names the evidence workflow instead of "records the source's permission".

Tests

  • test/license-permission.unit.test.ts: each outcome's message; no free text interpolated; the basis; coverage; what the derivation clears.
  • backend/test/license-permission.test.ts: basis stored on serve; notice once per request and outcome; fenced in dev; dry run records nothing; apply records with audit; unknown and hidden tickets refused; clears for the request and a later one with the same sources, not a different source or target license; never clears question_failed; never reaches back to an earlier request; evidence absent from status, detail, audit and the next review's inputs; migration 0154 on Miniflare's D1.
  • test/admin-publish-license-permission-cli.test.ts: the command end to end.
  • Mutation checks, each killed: source match widened to any source; a permission clearing question_failed; and 13 more (dry run, ticket check, target and outcome binding, own files, free-text id, reach-back, notice dedupe, fence state, basis store, verdict re-derivation, mail line, clearing at all).
  • bun run typecheck, bun run lint, backend typecheck, bunx biome check on touched files, bun run migrations:d1-check. Pure tier: 28194 pass, 5 fail on the first run; 3 were this branch's (a view-to-mail import and two key pins), fixed in the last commits; the other 2 (test/account-copy-parity.test.ts against the local website checkout, test/git-annex-remote.test.ts local push) touch nothing in this diff.

Tested: migrations:d1-check, publication-review-migration.test.ts.
Tested: test/license-permission.unit.test.ts.
Tested: contract, cure-split, admin-routes, inputs tests.
Tested: backend/test/license-permission.test.ts.
Tested: backend/test/license-permission.test.ts, route inventory.
Tested: test/admin-publish-license-permission-cli.test.ts.
Tested: identifier-screen-stored, publish-request-ci-pending.
Tested: backend/test/license-permission.test.ts.
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2393

Version: 0.10.40-PR2393.21191a5
Commit: 21191a5


🤖 Updated on each push.

Tested: backend/test/license-permission.test.ts.
Tested: backend/test/license-permission.test.ts, mutation-checked.
Review round 1 items 1 to 3. Tested: backend/test/license-permission.test.ts.
Review round 1 items 4, 6, 7, 8, 9. Tested: backend/test/license-permission.test.ts.
Review round 1 items 5, 9, 10. Tested: test/license-permission.unit.test.ts.
Mutation-checked: no unique index, conflict not refused, mail on conflict, unreadable as not_ready.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Merge gate (lead): head 21191a5; every remote check passes. Review: round 1 panel (code+tests; errors+comments+types), 6 important findings (concurrent records; mails sent without an insert; ticket binding, now trust-the-administrator but visible, with the subject and sender shown and audited and a warning when the sender is not the depositor; an unreadable review read as not_ready; mail failures hidden in the CLI; no_recipient) and 4 more fixed; round 2 delta review resolved all ten, and its two suggestions are rejected with reasons (the audit is admin-only and the ticket already holds the address; the warning is advisory). Implements the owner's license permission workflow of 2026-11-25.

@neuromechanist
neuromechanist merged commit 0826116 into feature/issue-2182-epic-pq-decide Nov 26, 2026
27 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-2182-license-permission branch November 26, 2026 03:41

This branch was previously deployed

1 inactive deployment
npm — 21191a55 Deployed Nov 26, 2026 by neuromechanist via publish #4959
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