feat: Stage 3 - Interactive chartread Subprocess State Machine & Swatch Grid #13

Merged
gronod merged 1 commits from feature/stage-3-chartread into feature/stage-2-printtarg 2026-08-22 18:27:19 +01:00
Owner

Summary

Implements Milestone 3 (Issues #5 and #6: Interactive Reading Engine & Swatch Grid Visualization).

This stage introduces real-time IPC stream processing for chartread -u, allowing the UI to drive spectrophotometer measurement workflows via a state machine and visualize incoming color patches with CIEDE2000 quality scoring.

Changes

Backend (Rust)

  • ProcessManager stdout stream update: Added prefix matching for ROW_COLORS_JSON: to emit structured process:json_row events while preserving raw log streaming to process:stdout.
  • JsonRowPayload & emit_json_row: Added structured event payload type for row completion events.
  • ChartreadConfig & build_chartread_args: Maps target configuration to chartread CLI flags (-v -u <basename>).
  • run_chartread Tauri Command: Added binary invocation handler and registered in lib.rs.
  • Unit Tests: Added test for chartread command argument construction.

Frontend (HTML / JS / CSS)

  • chartread.js: Implemented state machine controller (IDLE, CALIBRATING, AWAITING_STRIP, READING, ERROR, FINISHED) with stdin keystroke injection (" \n", "s\n", "q\n").
  • swatch_grid.js: Built dynamic swatch grid renderer reacting to process:json_row events, featuring patch progress tracking and live stats.
  • delta_e.js: Pure JavaScript implementation of the CIEDE2000 (\Delta E_{00}) color difference formula (validated against CIE 142-2001 / Sharma 2005 test pairs).
  • color_convert.js: D50 CIE L*a*b* to sRGB conversion pipeline for UI swatch rendering.
  • index.html & main.css: Added Stage 3 UI container, interactive status bar, traffic light indicators (Green \Delta E < 2, Amber \Delta E < 5, Red \Delta E \ge 5), and progress bar.

Testing & Mocking

  • chartread.mock: Included executable shell script to simulate chartread -u prompts and JSON row emissions for offline hardware testing.

Closes #5
Closes #6

## Summary Implements Milestone 3 (Issues #5 and #6: Interactive Reading Engine & Swatch Grid Visualization). This stage introduces real-time IPC stream processing for `chartread -u`, allowing the UI to drive spectrophotometer measurement workflows via a state machine and visualize incoming color patches with CIEDE2000 quality scoring. ## Changes ### Backend (Rust) - **`ProcessManager` stdout stream update**: Added prefix matching for `ROW_COLORS_JSON:` to emit structured `process:json_row` events while preserving raw log streaming to `process:stdout`. - **`JsonRowPayload` & `emit_json_row`**: Added structured event payload type for row completion events. - **`ChartreadConfig` & `build_chartread_args`**: Maps target configuration to `chartread` CLI flags (`-v -u <basename>`). - **`run_chartread` Tauri Command**: Added binary invocation handler and registered in `lib.rs`. - **Unit Tests**: Added test for `chartread` command argument construction. ### Frontend (HTML / JS / CSS) - **`chartread.js`**: Implemented state machine controller (IDLE, CALIBRATING, AWAITING_STRIP, READING, ERROR, FINISHED) with stdin keystroke injection (`" \n"`, `"s\n"`, `"q\n"`). - **`swatch_grid.js`**: Built dynamic swatch grid renderer reacting to `process:json_row` events, featuring patch progress tracking and live stats. - **`delta_e.js`**: Pure JavaScript implementation of the CIEDE2000 ($\Delta E_{00}$) color difference formula (validated against CIE 142-2001 / Sharma 2005 test pairs). - **`color_convert.js`**: D50 CIE L\*a\*b\* to sRGB conversion pipeline for UI swatch rendering. - **`index.html` & `main.css`**: Added Stage 3 UI container, interactive status bar, traffic light indicators (Green $\Delta E < 2$, Amber $\Delta E < 5$, Red $\Delta E \ge 5$), and progress bar. ### Testing & Mocking - **`chartread.mock`**: Included executable shell script to simulate `chartread -u` prompts and JSON row emissions for offline hardware testing. Closes #5 Closes #6
gronod added 1 commit 2026-08-22 17:56:44 +01:00
gronod merged commit 9d54faeba3 into feature/stage-2-printtarg 2026-08-22 18:27:19 +01:00
Sign in to join this conversation.