NCC-28 Fixing when to freeze dataset, if the dataset is not submitted… - #3
Merged
Conversation
… yet, do not freeze. wait until it is fully submitted. otherwise, we risk minting a stale version
There was a problem hiding this comment.
Pull request overview
This pull request adjusts DOI minting readiness checks so datasets are only frozen/minted after they’ve actually been submitted, preventing write-once “frozen” snapshots from being taken too early.
Changes:
- Centralizes submission-date parsing into
neotomaDOI._submission_dates()and uses it to gate freezing/minting. - Moves the submission-readiness check earlier in
mint_doi()(beforefreeze_data()). - Clarifies the intent of
DatasetNotReadyand silences N818 naming lint with an explicit rationale.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/neotomadoi/neotomaDOI.py | Adds _submission_dates() and ensures readiness is checked before freezing data during mint_doi(). |
| src/neotomadoi/exceptions.py | Documents why DatasetNotReady intentionally lacks an Error suffix and applies # noqa: N818. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+296
to
+300
| submitted = [ | ||
| datetime.strptime(i.get("date"), "%Y-%m-%d") | ||
| for i in self.data.get("dates") | ||
| if i.get("dateType") == "Submitted" | ||
| ] |
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.
… yet, do not freeze. wait until it is fully submitted. otherwise, we risk minting a stale version
This pull request improves how the code checks for dataset submission readiness before minting a DOI, ensuring that a DOI is only minted for datasets that have actually been submitted. The changes refactor and centralize the logic for handling submission dates, and clarify the intent behind the
DatasetNotReadyexception.Readiness and submission date handling:
_submission_dates()method toneotomaDOI.pythat parses and returns all submission dates in order, raisingDatasetNotReadyif none are found. This centralizes the logic and makes it reusable.mint_doi()to call_submission_dates()before freezing data, ensuring that only datasets that have actually been submitted are frozen and minted. This prevents permanently attaching a stale snapshot to a DOI.mint_doi(), replacing it with the new method.Exception clarity:
# noqa: N818to theDatasetNotReadyexception inexceptions.pyto clarify that it intentionally does not use theErrorsuffix, as it indicates a normal, temporary state rather than an error.