bug(wizard): Stage 4 unlocks on first chartread pass before averaging #110

Closed
opened 2026-08-26 15:03:59 +01:00 by gronod · 1 comment
Owner
Field Value
Labels Kind/Bug, Priority/High
Priority High
Milestone v0.3.3 hotfix
Related #87, issue 01
Branch fix/averaging-unique-ti3 (from development)
Pair with 01-averaging-overwrite.md — same PR

Description

On the first successful chartread exit, chartread.js calls wizardState.setTarget and setStage3Result. verify_stage_artefacts then sees {basename}.ti3 and enables Stage 4 in the stepper.

The operator can jump to colprof while the averaging panel is still offering Measure Another Sheet. Combined with issue 01, Stage 4 may profile a single overwritten pass and never wait for average.

Current behaviour

In the process:exit handler for chartread_${basename} when code === 0:

  1. State is set to FINISHED.
  2. The pass is pushed onto recordedPasses.
  3. The averaging panel is shown.
  4. wizardState.setTarget(basename, cwd) and setStage3Result(basename, cwd) run immediately.

Step 4 of the wizard therefore unlocks as soon as the first .ti3 exists, which is before Finish / Average.

Proposed solution

Treat Stage 3 as incomplete until the operator clicks Finish and Average (or an explicit Accept single pass control).

  • Do not call setStage3Result or wizardState.setTarget from the per-pass process:exit handler.
  • Call them only from:
    • #btnFinishAndAverage after a successful average (or the single-pass short-circuit), or
    • an explicit Use this pass button if auto-advance is kept as an option.
  • Keep the averaging panel visible after pass 1.
  • Keep step 4 disabled until finish.
  • Keep advanceToStage4() on the finish path only.

Optional UX: stepper tooltip Complete measurement (Finish) before profiling.

If issue 01 snapshots passes to _passN.ti3 and only writes {basename}.ti3 at Finish, this ticket is mostly free: verify_stage_artefacts already keys Stage 3 on {basename}.ti3. Implement them together.

Prefer not to add a new stage3_accepted flag in state.js unless the canonical-file rule cannot be used.

Files

  • src/js/chartread.js
  • src/js/state.js — only if a new flag is required
  • src/index.html — optional tooltip / button label

Acceptance criteria

  • After pass 1, Stage 4 sidebar step remains disabled.
  • After Finish (one pass or N averaged passes), Stage 4 unlocks and {basename}.ti3 exists.
  • Cancelling a pass does not unlock Stage 4.
  • Reloading the app with only _passN.ti3 files and no {basename}.ti3 does not unlock Stage 4.
  • Single-pass Finish still advances to Stage 4 without calling average.

Dependencies

Depends on issue 01 (unique pass files and canonical {basename}.ti3 written only at Finish). Same PR.

| Field | Value | |---|---| | Labels | `Kind/Bug`, `Priority/High` | | Priority | High | | Milestone | v0.3.3 hotfix | | Related | #87, issue 01 | | Branch | `fix/averaging-unique-ti3` (from `development`) | | Pair with | [01-averaging-overwrite.md](01-averaging-overwrite.md) — same PR | ## Description On the first successful `chartread` exit, `chartread.js` calls `wizardState.setTarget` and `setStage3Result`. `verify_stage_artefacts` then sees `{basename}.ti3` and enables Stage 4 in the stepper. The operator can jump to `colprof` while the averaging panel is still offering **Measure Another Sheet**. Combined with issue 01, Stage 4 may profile a single overwritten pass and never wait for `average`. ## Current behaviour In the `process:exit` handler for `chartread_${basename}` when `code === 0`: 1. State is set to `FINISHED`. 2. The pass is pushed onto `recordedPasses`. 3. The averaging panel is shown. 4. `wizardState.setTarget(basename, cwd)` and `setStage3Result(basename, cwd)` run immediately. Step 4 of the wizard therefore unlocks as soon as the first `.ti3` exists, which is before Finish / Average. ## Proposed solution Treat Stage 3 as incomplete until the operator clicks **Finish and Average** (or an explicit **Accept single pass** control). - Do **not** call `setStage3Result` or `wizardState.setTarget` from the per-pass `process:exit` handler. - Call them only from: - `#btnFinishAndAverage` after a successful average (or the single-pass short-circuit), or - an explicit **Use this pass** button if auto-advance is kept as an option. - Keep the averaging panel visible after pass 1. - Keep step 4 `disabled` until finish. - Keep `advanceToStage4()` on the finish path only. Optional UX: stepper tooltip `Complete measurement (Finish) before profiling`. If issue 01 snapshots passes to `_passN.ti3` and only writes `{basename}.ti3` at Finish, this ticket is mostly free: `verify_stage_artefacts` already keys Stage 3 on `{basename}.ti3`. Implement them together. Prefer not to add a new `stage3_accepted` flag in `state.js` unless the canonical-file rule cannot be used. ## Files - `src/js/chartread.js` - `src/js/state.js` — only if a new flag is required - `src/index.html` — optional tooltip / button label ## Acceptance criteria - [ ] After pass 1, Stage 4 sidebar step remains `disabled`. - [ ] After Finish (one pass or N averaged passes), Stage 4 unlocks and `{basename}.ti3` exists. - [ ] Cancelling a pass does not unlock Stage 4. - [ ] Reloading the app with only `_passN.ti3` files and no `{basename}.ti3` does not unlock Stage 4. - [ ] Single-pass Finish still advances to Stage 4 without calling `average`. ## Dependencies Depends on issue 01 (unique pass files and canonical `{basename}.ti3` written only at Finish). Same PR.
gronod added this to the v0.3.3 Hot fixes milestone 2026-08-26 15:03:59 +01:00
gronod added the Kind/Bug
Reviewed
Confirmed
1
Priority
High
2
labels 2026-08-26 15:03:59 +01:00
gronod changed title from # bug(wizard): Stage 4 unlocks on first chartread pass before averaging to bug(wizard): Stage 4 unlocks on first chartread pass before averaging 2026-08-27 15:30:03 +01:00
Author
Owner

Resolved and verified in milestone v0.3.3 Hot fixes via PR #118 (Fix/averaging unique ti3).

Resolution Summary:

  • Stage 3 measurement workflow now keeps Stage 4 locked until the user explicitly completes the measurement session via Finish and Average or accepts a single pass.
  • Deferred wizardState.setTarget and setStage3Result until final measurement acceptance/averaging completes.
  • Stage 4 sidebar step enablement remains properly gated on canonical {basename}.ti3 generation.
Resolved and verified in milestone `v0.3.3 Hot fixes` via PR #118 (`Fix/averaging unique ti3`). ### Resolution Summary: - Stage 3 measurement workflow now keeps Stage 4 locked until the user explicitly completes the measurement session via **Finish and Average** or accepts a single pass. - Deferred `wizardState.setTarget` and `setStage3Result` until final measurement acceptance/averaging completes. - Stage 4 sidebar step enablement remains properly gated on canonical `{basename}.ti3` generation.
Sign in to join this conversation.