Repository navigation
Add --sandbox flag to admin publish approve command - #85
Merged
Merged
Conversation
- Add --sandbox option to CLI command - Update API client to pass sandbox parameter - Update backend schema to accept sandbox - Use sandbox parameter when selecting Zenodo API key - Pass sandbox to createDeposition() call - Add sandbox warning banner in CLI output Fixes #83
- Add environment safety checks to doi_create step - Block production DOI in non-production environments - Block publishing sandbox datasets (xx-prefix) - Fix error message consistency - Add missing warning line about DOI resolution Addresses code review findings from PR #85
Contributor
Author
Code Review Complete ✅Ran comprehensive code review using Issues Found & FixedCritical Issues (Fixed in 3ff7796)
Important Issues (Fixed in 3ff7796)
What Works Correctly ✅
Changes Made
All TypeScript checks pass. Ready for merge. |
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR85Version: 🤖 Updated on each push. |
- backend: Add visibility column to dataset INSERT (defaults to 'private') - api: Support TEST_API_URL environment variable for testing - api: Require visibility field in dataset validation Fixes unit test failures where datasets were returned without visibility field. Root cause: test/.env.test was pointing to production API which has older version. Note: test/.env.test (gitignored) updated to use dev API for local testing.
Test was failing because nm099999 already has DOI, so backend returns 'already has a concept DOI' instead of 'Production DOI blocked'.
Zenodo API returns 403 (Forbidden) for invalid tokens, not 401.
Bug: When creating a DOI with --sandbox flag, the dataset's is_sandbox flag was not being updated to match. This caused inconsistent state where database said is_sandbox=0 but DOI was actually on sandbox.zenodo.org. Fix: Update both concept_doi UPDATE statements to also set is_sandbox based on the sandbox parameter. This prevents future inconsistencies between database flag and actual Zenodo environment.
After fixing is_sandbox flag, nm099999 is correctly marked as sandbox dataset. Backend now blocks production DOI creation with 'Cannot create DOI for sandbox datasets' error. Test updated to accept all three valid blocking errors.
This was referenced Jul 31, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
--sandboxflag tonemar admin publish approvecommand to allow testing the full publication workflow on Zenodo sandbox.Changes
CLI (src/commands/admin.ts)
--sandboxoption to publish approve commandAPI Client (src/lib/api.ts)
sandboxparameter toapprovePublication()functionTEST_API_URLenvironment variable for testingBackend (backend/src/routes/admin.ts)
sandboxfield toapproveSchemacreateDeposition()Backend (backend/src/routes/datasets.ts)
visibilitycolumn (defaults to 'private')Tests (test/zenodo-sandbox.test.ts)
Tests (test/.env.test)
Testing
Before & After
Before:
After:
--sandboxflagCI Results
All tests passing:
Fixes #83