Skip to content

chore: dithering binding robustness, pipeline repair, and docs#46

Closed
davelee98 wants to merge 1 commit into
OpenDisplay:mainfrom
davelee98:chore/dithering-robustness-and-tooling
Closed

chore: dithering binding robustness, pipeline repair, and docs#46
davelee98 wants to merge 1 commit into
OpenDisplay:mainfrom
davelee98:chore/dithering-robustness-and-tooling

Conversation

@davelee98

@davelee98 davelee98 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Phases 3-5 of the dithering code-review follow-up: binding robustness, tooling, and docs. Follows #45 (now merged); rebased onto main, so this contains only its own changes.

Robustness

  • ImageBuffer::new validates width and buffer length (panics on zero width / ragged buffer) instead of silently truncating in release builds; backed by unit tests.
  • Python and WASM dither_image validate image dimensions and accent_idx before constructing the buffer/palette, returning proper ValueError/JsValue errors instead of panicking the extension.
  • JS ditherImage throws a clear error when a measured palette's accent name isn't one of its colors (previously passed -1 into WASM → opaque abort). New vitest case.

Tooling & docs

  • Expose tone_compress, gamut_compress, and rgb_to_oklab_buffer on the Python _rs module and repair scripts/pipeline.py, which imported modules deleted in the Rust port. Verified it runs end-to-end producing the 6-panel visualization.
  • Drop the stale examples/wab_sweep.rs reference in the WAB doc comment (the file never existed).
  • CALIBRATION.md: document that palette values must be sRGB-encoded (not linear-light), with the encoding formula for linear-workflow (DNG) measurements — otherwise every color reads too dark.

CHANGELOGs updated for all three packages (covering the #45 fixes and these changes).

Verification

Core 51 unit + 3 regression tests, Python 81 pytest, JS 39 vitest all pass; WASM core rebuilt; pipeline.py runs clean and ruff-checked.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog is generated by release please.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog is generated by release please.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog is generated by release please.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix and resubmit.

Phases 3-5 of the code-review follow-up (stacked on the math + perf fixes):

Robustness (Issues OpenDisplay#7, OpenDisplay#9):
- ImageBuffer::new validates width and buffer length (panics on zero width / ragged
  buffer) instead of silently truncating in release; contract backstopped by tests.
- Python and WASM dither_image validate image dimensions and accent_idx before
  constructing the buffer/palette, returning proper ValueError/JsValue errors rather
  than panicking the extension.
- JS ditherImage throws a clear error when a measured palette's accent name is not one
  of its colors (previously passed -1 into WASM → opaque abort). Adds a vitest case.

Tooling & docs (Issues OpenDisplay#5, OpenDisplay#6, OpenDisplay#10):
- Expose tone_compress, gamut_compress, and rgb_to_oklab_buffer on the Python _rs module
  and repair scripts/pipeline.py, which imported modules deleted in the Rust port. Runs
  end-to-end again.
- Drop the stale examples/wab_sweep.rs reference in the WAB doc comment.
- CALIBRATION.md: document that palette values must be sRGB-encoded (not linear-light),
  with the encoding formula for linear-workflow (DNG) measurements.

CHANGELOGs updated for all three packages.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@davelee98 davelee98 force-pushed the chore/dithering-robustness-and-tooling branch from fb25f39 to 2ade88a Compare July 5, 2026 18:13
@davelee98

Copy link
Copy Markdown
Contributor Author

Superseded by #48 (fresh PR with identical content).

@davelee98 davelee98 closed this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants