Repository navigation
Add deterministic EZID DOI naming - #112
neuromechanist merged 4 commits into
Conversation
Use createIdentifier (PUT /id/) instead of mintIdentifier (POST /shoulder/) for predictable DOI names based on dataset IDs. Concept: doi:10.82901/NEMAR.NM000104 Version: doi:10.82901/NEMAR.NM000104.V1.0.0 Eliminates the placeholder-then-update two-step pattern. Closes #111
- Add idempotency handling to createEzidConceptDoi (catch "already exists" and fallback to getIdentifier) - Capture createIdentifier return value in createEzidVersionDoi - Extract resolveShoulder helper, simplify ezidRequest body param
- resolveEzidAuth now throws when sandbox=true but sandbox credentials are missing, instead of silently using production - Log unknown doi_provider values before falling back to default
- Wrap webhook JSON parse in try-catch (return 400 on malformed) - Separate DB writes from DOI publication (non-fatal after public) - Surface BIDS metadata, DB, and concept DOI update failures in webhook response instead of swallowing silently - Add response.text() error context in ezidRequest - Log warnings for unknown EZID status values and percent-decode fallbacks - Add warnings field to DoiResult for partial failure visibility
PR Review SummaryRan comprehensive review with 6 specialized agents (code-reviewer, silent-failure-hunter, test-coverage-analyzer, type-design-analyzer, code-simplifier, comment-analyzer). All findings addressed. Critical Issues Fixed (3)
Important Issues Fixed (5)
Medium Issues Fixed (3)
Simplifications Applied (code-simplifier)
Test Coverage313 tests pass, 0 failures. Test coverage analyzer confirmed no critical gaps; pure functions ( |
Summary
createIdentifier()to EZID service usingPUT /id/{identifier}for exact DOI namesbuildConceptIdentifier()andbuildVersionIdentifier()helpers for deterministic DOI namingcreateEzidConceptDoiandcreateEzidVersionDoito eliminate placeholder-then-update patternNaming convention:
doi:10.82901/NEMAR.NM000104doi:10.82901/NEMAR.NM000104.V1.0.0doi:10.5072/FK2NM099999Test plan
buildConceptIdentifier(production + sandbox)buildVersionIdentifier(production + sandbox + pre-release)createIdentifier(deterministic naming, collision detection, version DOI)bun test)RUN_EZID_TESTS=true bun test test/ezid-sandbox.test.tsCloses #111