Skip to content

B3: resubmission note on publication requests - #2379

Merged
neuromechanist merged 7 commits into
feature/issue-2182-epic-pq-decidefrom
feature/issue-2368-resubmission-note
Nov 25, 2026
Merged

neuromechanist merged 7 commits into
feature/issue-2182-epic-pq-decidefrom
feature/issue-2368-resubmission-note

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Part of #2368. Part of #2182.

Card B3 of the publication-queue plan (ADR 0139, decision 5): a publication request can carry a resubmission note of at most 2,000 characters, the CLI asks for one after a denial, and administrators see it wherever they see the request.

What changed

  • Migration 0151 adds resubmission_note TEXT and previous_request_id INTEGER to publication_requests (both nullable). D4 (D4: quiet, paced re-screen of the queue #2373) adds 0150 and had not merged when this PR was opened, so 0150 is absent from this branch; 0151 touches no column 0150 does, and if D4: quiet, paced re-screen of the queue #2373 merges first, merge the base into this branch before merging it.
  • One rule in shared/resubmission-note.ts, used by the Worker and the CLI: trimmed, empty becomes NULL, at most 2,000 characters (code points) after trimming, no control character except a line break (CRLF is read as a line break). A refused note is a 400 invalid_resubmission_note with the rule's sentence and a reason, and nothing is written or mailed.
  • POST /datasets/:id/publish/request reads resubmission_note from its optional JSON body, stores it, links previous_request_id to the dataset's most recent earlier request when that one was denied and not withdrawn (ADR 0104), echoes resubmission_note_recorded on success, and keeps an earlier note when a held request is asked again without one.
  • GET /datasets/:id/publish/status gains denied_by_kind (agent when an auto_deny audit row names the request, else administrator, null unless the request was denied and not withdrawn). The constant AUTO_DENY_AUDIT_ACTION is shared so the denial that writes the row (B5) and this read use one word.
  • nemar dataset publish request [--note <text> | --note-file <path>]: with neither flag and a denied (not withdrawn) last request, a terminal is asked once with the card's sentence, and a session with no terminal is told a note can be added and goes on. The CLI refuses a note the Worker would refuse before it sends anything.
  • Administrators: the note and previous_request_id are on the review detail (GET /admin/publish/:id/review, so show, next and the web detail JSON) and on the list rows (the row already spreads pr.*); show prints the note quoted under the label "Depositor's note" with a line saying the depositor wrote it; list marks a request that has one; the admin mail renders it as a labeled, quoted, fully escaped block. The depositor's own mails and status answer never carry it.

Tests

  • backend/test/resubmission-note.test.ts (real routes over bun:sqlite with every migration applied, GitHub and Resend as local stand-ins): the rule at its edges (2,000 and 2,001, emoji, padding, control characters, non-text), no row and no mail on a refusal, held-request keep and replace, previous_request_id for a denial, a first request, a withdrawal, and a withdrawal after a denial, the status answer's agent and administrator readings including a payload that is not JSON, the list row and review detail, the mail (escaped HTML and Markdown, no block without a note, read from the row whichever caller sends it), and that the depositor's denial mail never carries the note.
  • test/publish-resubmission-note-cli.test.ts (the CLI spawned against the real backend app, a pseudo-terminal for the prompts): --note, --note-file, both flags, an unreadable file, 2,000 vs 2,001, a control character, the offer with no terminal, no offer after a withdrawal or for a first request, the prompt at a terminal (administrator and agent wording, Enter to skip, an over-long answer refused), and show, show --json and list.
  • Existing tests that pin exact response shapes were updated for the new keys: the request 200 body and the status body in test/helpers/pending-cli.ts, the review detail's key list, and one source regex for the INSERT.
  • The pure unit tier (994 files, run in four shards on a loaded machine) passed except for failures that are not from this change: account-copy-parity and publication-review-copy-parity (the sibling website checkout lacks keys), git-annex-remote (the same failure on the decide branch), and one compute test that passed on rerun. Each rule was checked by reverting its line and confirming a test fails (28 mutations, including widening and narrowing the bound, UTF-16 length, the withdrawal exclusion in both the link and the prompt, the escaping, and the json_valid guard).

Not done here

  • The web request form lives in nemarOrg/website and needs the same question and a resubmission_note field; the sentence and limit are in shared/resubmission-note.ts.
  • B4 passes the note to the model after the pre-send scan; this PR only stores and shows it.
  • openapi.json documents only the public catalog routes, so there was nothing to change in it.
  • The local migration apply (wrangler d1 migrations apply --local) fails on the older migration 0021 ("contains several transactions"), before reaching 0151; the migration is applied by every test through freshDb, which applies all migrations in order.

@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@PR2379

Version: 0.10.40-PR2379.53a642a
Commit: 53a642a


🤖 Updated on each push.

…e' into feature/issue-2368-resubmission-note

# Conflicts:
#	backend/src/services/identifier-screen.ts
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Merge gate (lead): head 53a642a. Every remote check passes after one rerun of integration shard 4 (the repull CLI timeout flake, #2377). Review: round 1 panel (code+tests; errors+comments+types), 1 important finding and 7 more fixed; round 2 delta review resolved all eight items. One suggestion (optional chaining on the readline handle) is rejected: a TypeError on an inquirer change fails the Ctrl+C test at once, where optional chaining would hide it. The depositor mail derives its text part from html that never holds the note.

@neuromechanist
neuromechanist merged commit 3aa8a21 into feature/issue-2182-epic-pq-decide Nov 25, 2026
51 of 53 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-2368-resubmission-note branch November 25, 2026 23:11

This branch was previously deployed

1 inactive deployment
npm — 53a642a8 Deployed Nov 25, 2026 by neuromechanist via publish #4891
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