fix(svg): reject draw: true when nothing drives draw_progress - #413
Merged
Merged
Conversation
An svg with draw: true and no driver renders the finished mark. Two PNGs, one with the flag and one without, come back byte-identical: draw_active takes the draw branch, draw_progress sits at its resting sentinel, progress resolves to 1.0, and the >= 1.0 arm delegates straight to resvg -- the same call paint_static makes. The field's own doc comment claimed this was a feature, "static draw trace view, no animation needed". It is not: there is no trace at progress 1.0, only the finished render. The rule file repeated the claim, listing draw: true as a way to reveal a stroke progressively. Both are corrected. Rejecting it at validation rather than reinterpreting it as progress 0: a silently-ignored flag is the failure mode this audit keeps finding, and progress 0 would make the mark vanish, which is a different surprise rather than an answer. The error names the three drivers that work. draw: true is not needed even with a driver -- the painter switches as soon as draw_progress is inside [0, 1). The flag only widens that window, so it is never the thing that makes a stroke animate.
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.
Closes #318.
The premise, verified
Two stills of the same mark, one with
draw: trueand one without, come backbyte-identical (
cmpon the PNGs). The flag changes nothing:With nothing driving it,
draw_progresssits at its resting sentinel,progressresolves to
1.0, and the>= 1.0arm delegates straight to resvg.Two documents said otherwise
(static draw trace view, no animation needed)." There is no trace at progress
1.0, only the finished render.
rules/draw-progress-stroke.mdlisteddraw: trueas a way to reveal a strokeprogressively.
Both corrected. The doc comment is schemars-visible, so it is interface text and
stays — it now says what the flag actually does and that it needs a driver.
Why reject rather than reinterpret
The issue offered two readings. Treating an undriven
drawas progress 0 makesthe mark vanish — a different surprise, not an answer. Rejecting it names the
problem where the author can act on it, which is the discipline this audit keeps
arriving at.
A driver is a
draw_in/stroke_revealpreset,keyframesondraw_progressordraw_start, or awiggleon either.Worth knowing
draw: trueis not needed even with a driver: the painter switches as soon asdraw_progressis inside[0, 1). The flag only widens that window, so it isnever the thing that makes a stroke animate. The rule file now says so.
Tests
draw_with_nothing_driving_progress_is_pixel_identical_to_no_drawpins thesymptom itself, next to six validator tests covering each driver and each
non-driver.
Gate
cargo fmt --all --checkclean ·cargo clippy --workspace --all-targets --features rustmotion/studio -D warningsclean ·cargo test --workspace1778 passed.