When Stage 2 executes ArgyllCMS printtarg to format target pages (.ti2 and .tif files) from a .ti1 target definition, patch layouts on pages are generated non-deterministically. Re-running Stage 2 or opening a previously generated .ti1 file produces a different patch arrangement in .ti2 and new .tif target sheets, breaking reproducibility and making previously printed sheets incompatible with regenerated .ti2 files.
Root Cause Analysis
ArgyllCMS printtarg Default Randomization:
By default, printtarg randomizes the target patch distribution across pages using a non-deterministic, time/process-based seed unless explicitly constrained.
Missing Seed / Ordering Arguments in ICCery:
In src-tauri/src/commands.rs, build_printtarg_args() builds CLI arguments without passing the ArgyllCMS -R <seed> (fixed pseudo-random seed) or -r (raster order / no randomization) flags.
As a result, every invocation of printtarg against the same .ti1 file yields a distinct .ti2 patch layout. If a user prints a target sheet, closes ICCery, and subsequently opens the .ti1 file to resume profiling, regenerating .ti2 causes a mismatch between the physical target print and the .ti2 reference file needed by chartread (Stage 3).
Proposed Solution
Deterministic Target Layout by Default:
Update build_printtarg_args in src-tauri/src/commands.rs to pass a deterministic seed flag (e.g. -R 1 or a seed derived deterministically from the .ti1 basename / hash) by default whenever a specific seed is not explicitly specified.
Backend Configuration (PrinttargConfig):
Add optional layout control fields to PrinttargConfig:
random_seed: Option<u32> (defaults to Some(1) or deterministic seed).
no_randomize: Option<bool> (for passing -r if raster order is desired).
Frontend UI Controls (Stage 2):
Add a "Patch Layout Order" setting in Stage 2 (Print Layout) or within an Advanced Layout settings drawer:
Deterministic Random (Default, Seed = 1): Reproducible pseudo-random distribution.
Custom Seed: Allows users to specify a fixed integer seed.
Raster Order (-r): Unrandomized sequential patch layout.
Automated Unit Testing:
Add unit tests in src-tauri/src/commands.rs verifying that build_printtarg_args includes -R <seed> or -r flags correctly.
### Problem Description
When Stage 2 executes ArgyllCMS `printtarg` to format target pages (`.ti2` and `.tif` files) from a `.ti1` target definition, patch layouts on pages are generated non-deterministically. Re-running Stage 2 or opening a previously generated `.ti1` file produces a different patch arrangement in `.ti2` and new `.tif` target sheets, breaking reproducibility and making previously printed sheets incompatible with regenerated `.ti2` files.
### Root Cause Analysis
1. **ArgyllCMS `printtarg` Default Randomization**:
- By default, `printtarg` randomizes the target patch distribution across pages using a non-deterministic, time/process-based seed unless explicitly constrained.
2. **Missing Seed / Ordering Arguments in ICCery**:
- In `src-tauri/src/commands.rs`, `build_printtarg_args()` builds CLI arguments without passing the ArgyllCMS `-R <seed>` (fixed pseudo-random seed) or `-r` (raster order / no randomization) flags.
- As a result, every invocation of `printtarg` against the same `.ti1` file yields a distinct `.ti2` patch layout. If a user prints a target sheet, closes ICCery, and subsequently opens the `.ti1` file to resume profiling, regenerating `.ti2` causes a mismatch between the physical target print and the `.ti2` reference file needed by `chartread` (Stage 3).
---
### Proposed Solution
1. **Deterministic Target Layout by Default**:
- Update `build_printtarg_args` in `src-tauri/src/commands.rs` to pass a deterministic seed flag (e.g. `-R 1` or a seed derived deterministically from the `.ti1` basename / hash) by default whenever a specific seed is not explicitly specified.
2. **Backend Configuration (`PrinttargConfig`)**:
- Add optional layout control fields to `PrinttargConfig`:
- `random_seed: Option<u32>` (defaults to `Some(1)` or deterministic seed).
- `no_randomize: Option<bool>` (for passing `-r` if raster order is desired).
3. **Frontend UI Controls (Stage 2)**:
- Add a "Patch Layout Order" setting in Stage 2 (Print Layout) or within an Advanced Layout settings drawer:
- **Deterministic Random (Default, Seed = 1)**: Reproducible pseudo-random distribution.
- **Custom Seed**: Allows users to specify a fixed integer seed.
- **Raster Order (`-r`)**: Unrandomized sequential patch layout.
4. **Automated Unit Testing**:
- Add unit tests in `src-tauri/src/commands.rs` verifying that `build_printtarg_args` includes `-R <seed>` or `-r` flags correctly.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem Description
When Stage 2 executes ArgyllCMS
printtargto format target pages (.ti2and.tiffiles) from a.ti1target definition, patch layouts on pages are generated non-deterministically. Re-running Stage 2 or opening a previously generated.ti1file produces a different patch arrangement in.ti2and new.tiftarget sheets, breaking reproducibility and making previously printed sheets incompatible with regenerated.ti2files.Root Cause Analysis
printtargDefault Randomization:printtargrandomizes the target patch distribution across pages using a non-deterministic, time/process-based seed unless explicitly constrained.src-tauri/src/commands.rs,build_printtarg_args()builds CLI arguments without passing the ArgyllCMS-R <seed>(fixed pseudo-random seed) or-r(raster order / no randomization) flags.printtargagainst the same.ti1file yields a distinct.ti2patch layout. If a user prints a target sheet, closes ICCery, and subsequently opens the.ti1file to resume profiling, regenerating.ti2causes a mismatch between the physical target print and the.ti2reference file needed bychartread(Stage 3).Proposed Solution
build_printtarg_argsinsrc-tauri/src/commands.rsto pass a deterministic seed flag (e.g.-R 1or a seed derived deterministically from the.ti1basename / hash) by default whenever a specific seed is not explicitly specified.PrinttargConfig):PrinttargConfig:random_seed: Option<u32>(defaults toSome(1)or deterministic seed).no_randomize: Option<bool>(for passing-rif raster order is desired).-r): Unrandomized sequential patch layout.src-tauri/src/commands.rsverifying thatbuild_printtarg_argsincludes-R <seed>or-rflags correctly.