Skip to content

B4: review inputs widened to metadata, and the review record - #2382

Merged
neuromechanist merged 24 commits into
feature/issue-2182-epic-pq-decidefrom
feature/issue-2188-review-inputs
Nov 26, 2026
Merged

neuromechanist merged 24 commits into
feature/issue-2182-epic-pq-decidefrom
feature/issue-2188-review-inputs

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Part of #2188. Part of #2182.

Card B4 of the publication-queue plan: the publication review now reads the dataset's metadata besides ADR 0102's root documents, never its data, and every review stores and shows a reproducibility record (ADR 0139, decisions 5, 6, 7 and 9). This follows the lead ruling of 2026-11-25: the workflow run-publication-review.yml is unchanged, and the Worker serves the widened inputs.

What changed

  • New callback route POST /webhooks/publication-review-inputs, beside the claim and the result. It uses the same authentication (the review's callback token and nonce). It answers only for a claimed review that has not reported (409 otherwise). It is read-only and returns:

    • the enrichment (seven fields of datasets.enrichment_json, with its update instant; an anonymous release gets no creators);
    • the license lineage, computed by the Worker with the shared resolver and its cache, from the description and README at the reviewed head;
    • the resubmission note, read by readResubmissionNote;
    • the screen's coverage counts per format, from a version 1 or version 2 report.

    A failed read answers 502. The dispatch payload is unchanged, and a test pins its keys.

  • The job (scripts/ci/publication-review.ts) fetches the inputs after the claim and before anything is examined. A failure, or any answer other than 200, is the new run error inputs_unavailable (copy, migration CHECK and vocabulary added; it is not a verdict and never eligible for an automatic deny). The job never reviews with part of its inputs.

  • Pre-send (presendInputs) normalizes, cuts and scans each of the five sections (enrichment, registry records, lineage, coverage, note) under its own budget. It uses the same rules and the same single mint as for documents. A section with a finding is withheld whole and recorded as a text_withheld part.

  • Prompt (publication-review-prompt/2): five more fenced, untrusted sections; a metadata state block in the facts; and the fifth question, note_addresses_reasons, asked only when a note was shown.

  • Verdict:

    • the five lineage outcomes that need action become one reason, license_lineage_unconfirmed (unknown class, an override clears it);
    • compatible_attribution with no SourceDatasets credit adds the platform finding source_credit_missing (concern);
    • a note answered fail or unknown adds resubmission_note_unaddressed (unknown class). It can never produce pass or fail.
  • Report version 2 carries the record: prompt version, model calls with their effort, the SHA-256 input digest (the fixed nonce makes it stable across runs), and the resolver version. Stored version 1 reports still parse.

  • Migration 0152 rebuilds publication_reviews, with every row and index kept. It adds scanner_id, reader_versions, resolver_version, models, prompt_version and input_digest, and the inputs_unavailable word. The scanner and reader versions come from the Worker's own copy of the screen report.

  • Display: the record shows in nemar admin dataset publish show and in nemar dataset publish status (as review_record and review_record_lines).

  • ADR 0139: dated amendment to decision 7, and the index line updated.

Tests

  • New: test/publication-review-inputs.test.ts and backend/test/publication-review-inputs.test.ts. They cover:
    • fences and the pre-send scan per section;
    • path and name-like values withheld and recorded;
    • coverage carries counts only, and the payload keys are unchanged;
    • the digest is stable and changes with one byte;
    • unresolved gives license_lineage_unconfirmed and never fail;
    • the note can never produce pass or fail;
    • the route's refusals;
    • migration 0152 applied on Miniflare's D1 with a row kept.
  • The workflow chain test runs the Review step's own arguments end to end, with the inputs fetched from a stand-in Worker: no workflow change is needed.
  • The end-to-end test runs the real route over real git contents at the head, and asserts the stored record and the depositor's status.
  • Mutation: with the enrichment's scanJsonSection(object) call removed, two tests fail ("an enrichment with a patient name under an identifier key, deep inside a field" and "an enrichment with a file URL"). The lineage class widened to fail, the unresolved entry removed, the note's class widened to fail, the note coercion removed and the claim check removed each fail at least one test.

Gates

  • bun run typecheck, bun run lint, cd backend && bun run typecheck, bunx biome check on every touched file: clean on the head.
  • Targeted: every publication-review* test (root and backend), the license-lineage route, the ADR index and the resubmission note: 1,631 tests, all green after the last fix.
  • Pure tier (bash scripts/ci/unit-pure-files.sh | xargs bun test --parallel=4): 28,069 tests in 1,001 files, with 6 failures. Two came from this change and are fixed in the last commit: the status keys pin and the webhooks route inventory. Three are unrelated to this diff, which touches none of their files: the two account-copy parity tests, which read a local website checkout, and the git-annex UUID retry test. They were not re-run on the base.

Notes for review

  • The registry records carry what the resolver returns: id, resolver, resource type, license and its version, URL and status. The resolver does not return a title, creators or a publisher, so those are not sent (patch note for the D1 owner).
  • The budgets are counted in characters, as the existing document caps are.
  • The lineage section is absent when no upstream source is declared, so the offline calibration and production still send the same request.
  • workerLineageCache is imported from the admin lineage route module, to avoid editing D1's files.

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

Version: 0.10.40-PR2382.2e3df25
Commit: 2e3df25


🤖 Updated on each push.

@neuromechanist

Copy link
Copy Markdown
Contributor Author

Merge gate (lead): head 2e3df25, with the decide branch (B3, D3) merged in. Every remote check passes after one rerun of integration shard 4 (the repull CLI flake, #2377). Review: round 1 panel (code+tests; errors+comments+types), 1 important finding (screen reason codes reaching the model through the previous denial: now an allowlist of non-screen codes) and 5 more fixed, plus the lead's rulings (the Worker inputs endpoint with no workflow change; registry title, creators and publisher; the lineage cache service; inputs_unavailable after served inputs counted against the cap); round 2 delta review resolved all six items, and its three suggestions are fixed in 2e3df25.

@neuromechanist
neuromechanist merged commit b8bcd9e into feature/issue-2182-epic-pq-decide Nov 26, 2026
51 of 53 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-2188-review-inputs branch November 26, 2026 00:29

This branch was previously deployed

1 inactive deployment
npm — 2e3df253 Deployed Nov 26, 2026 by neuromechanist via publish #4915
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