fix: address codex-review P2 findings (upload race, compare dupes, annotated clip) - #154
Merged
Conversation
…notated clip)
- upload: atomic no-clobber write (fsutil::write_new / os.link) instead of
exists()-then-rename/replace, closing the TOCTOU where a concurrently
created file could be overwritten despite the never-overwrite contract.
Both the Rust companion and the Python bridge.
- compare: validate_spec now rejects duplicate variant 'value's, which
otherwise collide as the keyed-{#each} key and the returned 'selected'
(covers native + remote via the companion validator).
- annotated_image: apply max_height to the <img> so the whole image scales
into the stage instead of being clipped by the overflow-hidden stage —
clicks near the visible bottom no longer normalize to the wrong y.
Adds fsutil write_new no-clobber test + compare dup-value validation tests.
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.
Behebt die drei P2-Findings aus dem Codex-Review des Feature-Batches (keine Blocker, keine Security-Lücken — aber echte Korrektheits-Bugs, vor dem Release gefixt).
exists()-Check + clobberndesrename/os.replace; ein zwischen Check und Write angelegtes File konnte trotz „never overwrite"-Zusage überschrieben werden. Ersetzt durch atomares Hard-Link-into-place (fsutil::write_newin Rust,os.linkin Python), das mit „already exists" fehlschlägt statt zu clobbern. Beide Bridges.compare-Duplicate-Values —validate_specließ zwei Varianten mit gleichemvaluedurch; die kollidieren als keyed-{#each}-Key und als zurückgegebenesselected. Wird jetzt vor dem Render abgelehnt (deckt native + remote über den Companion-Validator ab).annotated_imageclippt statt skaliert —max_heightlag nur auf deroverflow:hidden-Stage, nicht auf dem<img>; das Bild wurde abgeschnitten und Klicks unten normalisierten auf ein falschesy.max_heightliegt jetzt auf dem Bild → das ganze Bild skaliert in die Stage, Koordinaten stimmen.Neue Tests:
fsutil::write_newNo-Clobber,compareDup-Value-Validierung (+ bestehende Python-Upload-No-Clobber-Tests decken den Python-Pfad).Lokal grün: cargo test 162 · clippy clean · svelte-check 0 Fehler · vite build · pytest 52. Kein Versions-Bump (bleibt
0.8.3), CHANGELOG[Unreleased] → ### Fixed.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.