Repository navigation
Sync to nemar.org on version DOI publish - #463
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR463Version: 🤖 Updated on each push. |
Code Review: PR #463 — Sync to nemar.org on version DOI publishReviewed with Sonnet. Checked: CriticalNone. Important
The predicate only blocks Suggested fix — add to if (input.datasetId.startsWith("xx")) {
return { trigger: false, reason: "sandbox" };
}And add Redundant guard if (zenodoSyncDecision.trigger && published.doi) {
Suggestions
Error persistence confirmed correct
Double-sync risk: none identified The admin
The EZID decision handler has Test NEMAR_USERNAME "missing" actually tests empty string ( The test description says "skips when NEMAR_USERNAME is missing" but the test value is Test coverage is real — no mocks used All 7 tests exercise the exported False positives / Intentional behaviors
MergeabilityMerge after addressing the |
- Add xx-prefix (sandbox) to shouldSyncToNemarAfterVersionDoi skip list; sandbox datasets pass the gate, causing false-alarm failed sync rows - Remove redundant && published.doi guard on the Zenodo trigger: true already guarantees versionDoi is non-null via the no_doi predicate; align with EZID caller which doesn't repeat this check - Add sandbox log line to the Zenodo else branch for consistency - Add backend/test/version-doi-sync-trigger.test.ts covering all decision paths including the new sandbox case (10 tests)
Review findings addressed (commit a6aa426)Important #1: xx-prefix gap in shouldSyncToNemarAfterVersionDoi Added New test file: Important #2: Redundant Removed the redundant All 46 backend tests pass. |
Closes #339.
Summary
The version-DOI webhook (
POST /webhooks/publish-version-doi) splitsinto an EZID branch and a Zenodo branch. The EZID branch was already
triggering an nemar.org sync via
c.executionCtx.waitUntil(...), butthe Zenodo branch wasn't — so any dataset on the Zenodo provider would
mint a new version DOI and leave nemar.org showing the previous
version's metadata indefinitely.
Changes:
shouldSyncToNemarAfterVersionDoi()from the EZID inlinepredicate into a pure helper. Returns either
{ trigger: true }or{ trigger: false, reason }so logging can stay specific.the same
syncToNemarAfterVersionDoi(c.env, dataset, version, published.doi)background call as EZID, matching the non-fatal,background-waitUntil pattern.
no_doiskip reason for the edge case whereZenodo publish succeeds but returns no DOI string (EZID can't hit
this path).
The downstream
syncToNemarAfterVersionDoi()helper was alreadynon-fatal: it catches errors, writes them to
datasets.nemar_sync_errornemar_sync_status='failed', and never throws. Triggering it fromthe Zenodo branch inherits that behavior unchanged.
Test plan
bun test test/version-doi-sync-trigger.test.ts(7/7 pass)exercises every branch of the gating predicate: trigger, missing
username, missing password, on-prefix, null DOI, empty DOI string,
and ordering (credentials check beats provenance check).
cd backend && bun run typecheckbun run buildSCCN dev backend and confirm a row appears in
dataexplorer_datasetwith the new version DOI.