You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6b5345c
Browse filesBrowse the repository at this point in the historyBrowse files
Fix the seven findings from the fourth /code-review xhigh pass
The drift check's exemption keyed off the wrong thing, and let real
drift through.
`if src in unpredicted` read as "the planner claimed nothing for this
source", but it recorded "the probe failed" - and those come apart under
--webp false, where possible_output_names returns the source's own name
before it ever consults `animated`. So for any file whose probe failed,
a writer that produced a name nobody claimed got a warning and an exit 0
instead of the error the check exists to raise. The warning even said
"the de-confliction pass held no name for it" while `claimed` held one.
Rather than correct the condition, remove the case: optimize_raster now
takes the planner's `animated` answer instead of re-deriving it with its
own `getattr(img, "is_animated", False)` a few lines later. Two answers
to one question was the whole reason a source could be unpredictable
here and processable there. A source whose animation is undetermined is
now refused in optimize_raster, counted by process_file as one file's
error like any other, and never reaches the check - so the planner's
"claims nothing" is always accurate and the exemption has nothing left
to describe. Both answers already came from the same access on the same
file, so this only changes behaviour on a transient.
The per-source plan is one record (Plan: dst_rel, names, animated)
instead of a dst dict beside a parallel set - every parallel structure
this pass has grown ended up disagreeing with the one next to it, which
is what both of the last two rounds' bugs were.
Also:
- The drift message reports `plan.names`, the claim as the planner wrote
it, not `claimed`'s casefolded keys - reporting "diagram.svg" for a
source that claimed "Diagram.SVG" points the reader at a case mismatch
that isn't the problem.
- The check compares with == rather than `is`: Path defines __eq__, and
identity held only because two loops happened to share list objects.
- The uppercase test asserts the written name per case, not just that one
file came out.
Dropped test_drift_is_refused_even_when_the_probe_failed as written: it
stubbed the probe to False - a probe that succeeded - so it demonstrated
nothing about the exemption and passed against the unfixed tree. The
regression for that hole is the --webp False half of
test_an_undetermined_probe_skips_one_file_and_no_more, which fails
against it.
206 + 33 + 189 pass; scripts/ unchanged from base. Real 299-image corpus
byte-for-byte identical, and act gives the same database md5 for the
fourth round running.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments