Repository navigation
fix(backup): report an unset completed_at as None - #2217
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
Weaviate serializes the completedAt of a backup or export that is still running as Go's zero time, 0001-01-01T00:00:00.000Z. list_backups() and export.get_status() returned it as datetime(1, 1, 1) instead of None.
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
This branch has not been 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.
What this changes
Weaviate serializes the
completedAttimestamp of a backup or export that has not finished yet as Go's zero time,0001-01-01T00:00:00.000Z. The client parsed that value as-is, so for a running backup or export:client.backup.list_backups(...)returnedcompleted_at=datetime(1, 1, 1, tzinfo=UTC).client.export.get_status(...)returnedcompleted_at=datetime(1, 1, 1, tzinfo=UTC).Both fields are typed
Optional[datetime]with aNonedefault, so code that checkscompleted_at is Noneto detect an unfinished operation, or that computes a duration from it, gets a wrong answer.This change adds a field validator to
BackupListReturn.completed_atandExportStatusReturn.completed_atthat maps the zero time toNone. Real timestamps pass through unchanged.Fixes #2216
Reproduction
Against Weaviate 1.40.0 with
backup-filesystemandEXPORT_ENABLED=true:The raw response from
GET /v1/backups/filesystemwhile the backup runs:[{"classes":["Article"],"completedAt":"0001-01-01T00:00:00.000Z","id":"bk1","startedAt":"2026-10-21T06:49:36.565Z","status":"STARTED"}]Tests
test/test_backup.py: an unsetcompletedAtmaps toNone; a set one is kept.test/test_export.py(new): the same two cases forExportStatusReturn.pytest test/test_backup.py test/test_export.py: 2 of the new tests fail without the fix and all 7 pass with it.pytest testpasses (546 passed, 1 skipped).ruff format,ruff check, andflake8are clean on the changed files.