Repository navigation
fix(demo): refuse to overwrite existing user files with example ZIP - #47
Merged
Merged
Conversation
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.
Reproduction
The public
python examples/create_demo_zip.py --output PATHcommand previously usedzipfile.ZipFile(PATH, 'w'). On Linux, a disposable existing file containingORIGINAL_SENTINEL_DATAwas silently replaced by a 1,291-byte archive, and the command returned success. This is inappropriate for a first-run example that accepts an arbitrary caller-selected output path.Fix
xbbefore writing the ZIP; refuse both preexisting regular files and preexisting symlinks instead of following or truncating them.Verification
python -m compileall -q backendandgit diff --checkpassed.Limits
The example writes only caller-selected local paths and makes no network or model calls. This does not substitute for independent external first-run testing. Require fresh Python 3.11/3.12/3.13, frontend, browser and CodeQL CI before merge.
Python 3.12 CI feedback and correction
The first CI attempt exposed an additional reproducibility bug: ZIP string-member creation recorded wall-clock timestamps. Two generator runs crossed a two-second DOS timestamp boundary, causing the archive-equality test to fail on Python 3.12 even though the other backend matrices passed. The updated generator now sets each ZIP member's timestamp to 1980-01-01 00:00:00 and pins a portable Unix regular-file mode/creator; the regression asserts those exact fields. All 104 backend tests passed again locally on Python 3.12. Fresh CI on the updated head is required before merge.