Files
CatoandClaude Opus 5 cd48d59423 fix(deliver): "reflect" padding silently became solid black (#52)
`fit_and_pad`'s "reflect" and "edge" modes ran through numpy, and numpy was
never a declared dependency of this package. The `except ImportError` arm
rewrote pad_mode to "black", so on any machine without numpy — including a
clean `pip install -e '.[dev]'`, verified — the documented default silently
drew solid black instead of reflected artwork.

`deliver_mural` calls it to build the full mural before splitting panels, so
`printcraft deliver` produced a mural with black bars wherever the source
aspect did not match the surface, split those bars into panel files, and
reported them print-ready. Measured before the fix: a 50x100 source into a
200x100 surface came out with 150 of 200 columns pure black.

Reflect and edge are now pure PIL, reusing the `reflect_expand` written for
panel bleed in #51 and a new `edge_expand`. The numpy branch is gone entirely
rather than the dependency being declared: that removes the silent-fallback
arm and a dependency in one move, and a test now fails if anything in the
package imports numpy again.

Mirroring can only supply as much as the artwork holds — numpy's np.pad would
have raised here too — so an aspect mismatch too large to mirror now says so
and names both ways forward (`deliver-panels`, or `--pad edge`, which repeats
a border pixel and has no distance limit). Both suggestions were exercised end
to end and both work. An unknown pad_mode is refused instead of quietly
falling through to black, and `deliver`/`deliver-panels` print these as a
one-line error and exit 1 rather than a rich traceback.

Verified: 10 new tests (26 total, up from 16); each part mutation-verified —
restoring the black fallback, making edge fall back to black, or reintroducing
a numpy import each fails a different named test. End to end through the real
CLI: a mild mismatch delivers 2 bled panels and exits 0; the extreme case
prints the guidance and exits 1; `--pad edge` and `deliver-panels` both then
succeed. Root `pnpm run verify` still exits 0 (the JS app is untouched) and
the real duschwand-roli project still loads.

Still open from #51's notes: `Panel.pixels()` truncates float error with
`int()` (2.54cm at 100 dpi gives 99px, not 100). One pixel, physically
irrelevant, left alone deliberately.


Claude-Session: https://claude.ai/code/session_01SZGjXtzLGk2q9zPUkA3vMf

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 04:38:33 +00:00
..