{{ message }}
Repository navigation
Avoid phantom metadata in upload_artifact for missing sources - #6880
Merged
c-bata merged 2 commits intoOct 20, 2026
Merged
Conversation
Member
Contributor
|
This pull request has not seen any recent activity. |
c-bata
requested changes
Oct 20, 2026
c-bata
left a comment
Member
There was a problem hiding this comment.
Thank you for your pull request and sorry for my delayed review. I left one request for change.
Comment on lines
+111
to
+117
Member
There was a problem hiding this comment.
Could we register the metadata after artifact_store.write succeeds? This would also avoid leaving metadata behind if the artifact store write fails.
A failed metadata update could leave an unreferenced artifact in the store, but the artifact would not appear as uploaded.
Contributor
Author
There was a problem hiding this comment.
Thanks for the suggestion! I’ll move metadata registration after artifact_store.write() succeeds.
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.

Motivation
upload_artifactcurrently stores artifact metadata before opening the source. A missing file raisesFileNotFoundErrorbut leaves an artifact record with no uploaded content.Description of the changes
Open the source before registering metadata while keeping metadata registration before the backend write. Keep both operations in the existing file context so the source closes on success or failure.
Add regressions for Study, Trial and FrozenTrial using in-memory, SQLite and journal storage. They verify unchanged pre-existing metadata after a missing-source failure and a subsequent readable upload.
Validation: the 9 regressions fail against the base implementation and pass with the fix; 26 local artifact tests, repository-wide Ruff checks and formatting, and mypy pass.
Checklist