feat(cli): add apply-metadata --license-only#21
Merged
Conversation
The license-side sibling of --creators-only: swap just a record's license,
preserving its title/description/creators/version/date/related_identifiers. This
is what's needed to correct a mis-declared license across a whole concept without
clobbering curated per-version titles (a full apply-metadata would overwrite
them).
License equality normalizes the string vs {'id': ...} shapes and Zenodo's
`mit` (SPDX, what .zenodo.json writes) vs `mit-license` (the deposit id Zenodo
stores) asymmetry, so already-correct records are skipped and re-runs converge.
Motivated by virtualcell/vcell, whose 492 records carry cc-by-4.0 (445) and
other-open (46) despite the software being MIT.
- cli: --license-only handling in cmd_apply_metadata + _license_equal/_license_norm
- tests: license equality (string/dict forms, mit vs mit-license)
- README + SKILL: document the flag
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZx7w9BexQc9wWU5JoHYaF
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.
What
Adds
apply-metadata --license-only— the license-side sibling of--creators-only. It swaps just a record'slicense, preserving title/description/creators/version/date/related_identifiers.Why
virtualcell/vcellis MIT-licensed but its 492 archived records carry the wrong license (445cc-by-4.0+ 46other-open, 1 already MIT). A fullapply-metadatacan't fix this safely — it would overwrite vcell's curated per-version titles (Virtual Cell 8.0, etc.).--license-onlychanges nothing but the license.Idempotency subtlety
Zenodo stores MIT as the deposit id
mit-license, while.zenodo.json(and every tool-managed repo) writes the SPDX idmit._license_equalnormalizes that asymmetry (and the string vs{'id': ...}shapes), so already-correct records are skipped and re-runs converge. Verified against vcell: a dry-run reports491 to update, 1 already correct.Tests / checks
ruff+mypy --strictclean; 39 unit tests pass (added license-equality cases). Dry-run exercised live against the vcell concept.Paired with virtualcell/vcell#1717 (fixes the repo
.zenodo.jsonsource). Once this merges, the 491 mislicensed records get normalized with:zenodo-maint --repo virtualcell/vcell --concept 7796386 --zenodo-json .zenodo.json apply-metadata --license-only --execute🤖 Generated with Claude Code
https://claude.ai/code/session_01BZx7w9BexQc9wWU5JoHYaF