Repository navigation
The detection tests' zip cases have the same ids in every worker - #299
Merged
Merged
Conversation
Their bytes are parametrize ids, and an entry written by name alone carries the current time, so two xdist workers collecting in different seconds collected different ids and the run stopped. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…f the bytes Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…stable ids Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
...
Why
The unit job runs under pytest-xdist, and every worker must collect the same test ids.
tests/unit/test_document_extraction.pybuilds four zip fixtures at import time, and their bytes become the parametrize ids oftest_detect_format_reads_content_before_the_nameandtest_detect_format_refuses_what_the_bytes_do_not_support.ZipFile.writestrwith a bare name stamps each entry with the current time, in two-second steps. Two workers that import the module in different two-second windows therefore collect different ids, and xdist stops the run with "Different tests were collected between gw13 and gw4". On the development host it happened in one of six full-n 16runs.The four zip cases now carry names as their ids (
docx,pptx,xlsx,plain-zip), which read better in a failure than 600 characters of escaped zip._zipalso writes each entry through aZipInfo, which dates it 1980-01-01, so its bytes are the same in every process and a zip row added later without a name keeps a stable id. What the tests detect is unchanged: detection reads the entry names, not their dates.Scope and risk
Four parametrize rows and their helper in one test file. No server or extractor code changes. The other zip helpers in the unit suite build their bytes inside a test or a fixture, not in a parametrize list, so their timestamps never reach an id.
Compatibility, rollout and rollback
Tests
Collecting the whole unit suite twice, three seconds apart, gives the same 27,592 ids with this change. Without it, collecting
test_document_extraction.pytwice the same way gives four different ids.tests/unit/test_document_extraction.pypasses (186).AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. The author reproduced the collection difference and checked it is gone.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.main; no merged migration is edited.frontend/changed.docs/describe the system as it now is.git commit -s).🤖 Generated with Claude Code