feat(planning): follow the indicative wait in calculation progress #304

Merged
nessar merged 3 commits from feature/calculation-progress into develop 2026-10-19 13:59:09 +02:00
Owner

Closes #300.

Summary

  • The calculation overlay percentage follows the indicative wait instead of a fixed stage mapping: linear to 95% at the expected wait e (captured at Calculate, including local refinement, timed from the calibration's requestedAt), held at 95%, and 100% only when the planner reports completion.
  • Beneath the status, a visible line names the current planning stage (Applying "<rule name>" for optimization/preference stages), and a second line shows About N s left when e ≥ 3 s, or Taking longer than expected once elapsed reaches e (announced once through the existing live status).
  • Cancel freezes the percentage, hides both lines and keeps "Cancelling…"; Cancel stays available.
  • PlanningCalculationService now exposes pending (stage + submitted request) and drops stageProgress; stage reports after Cancel are ignored so a late complete cannot show 100%. PlanningDurationService owns wait on a 250 ms tick.
  • New text localized in EN, FR, ES and DE; docs/planning-duration.md gains a "During a calculation" section.

Decisions to confirm

  • The overrun line appears at e, the centre of the pre-Calculate range (e.g. at 20 s for "10–60 s"), as the issue specifies; once calibrated, roughly half of runs will show it.
  • Remaining time rounds up under 10 s (never "0 s"), then to the nearest 5 s, switching to minutes from 60 s.
  • The stage and remaining lines sit below the "Calculating..." status.

Testing

  • Controlled-clock service tests: linear climb and hold, 3 s threshold, rounding, frozen e across form/calibration changes, monotonic progress on repeated stages, no 100% after cancel, incomplete outcomes or errors.
  • Component tests: every stage's text in all four languages, overrun announced once, freeze and hidden lines after Cancel.
  • bun run typecheck, eslint and the full suite (768 tests) pass. Not checked in a real browser.

🤖 Generated with Claude Code

Closes #300. ## Summary - The calculation overlay percentage follows the **indicative wait** instead of a fixed stage mapping: linear to 95% at the expected wait `e` (captured at Calculate, including local refinement, timed from the calibration's `requestedAt`), held at 95%, and 100% only when the planner reports completion. - Beneath the status, a visible line names the current **planning stage** (`Applying "<rule name>"` for optimization/preference stages), and a second line shows `About N s left` when `e` ≥ 3 s, or `Taking longer than expected` once elapsed reaches `e` (announced once through the existing live status). - Cancel freezes the percentage, hides both lines and keeps "Cancelling…"; Cancel stays available. - `PlanningCalculationService` now exposes `pending` (stage + submitted request) and drops `stageProgress`; stage reports after Cancel are ignored so a late `complete` cannot show 100%. `PlanningDurationService` owns `wait` on a 250 ms tick. - New text localized in EN, FR, ES and DE; `docs/planning-duration.md` gains a "During a calculation" section. ## Decisions to confirm - The overrun line appears at `e`, the centre of the pre-Calculate range (e.g. at 20 s for "10–60 s"), as the issue specifies; once calibrated, roughly half of runs will show it. - Remaining time rounds up under 10 s (never "0 s"), then to the nearest 5 s, switching to minutes from 60 s. - The stage and remaining lines sit below the "Calculating..." status. ## Testing - Controlled-clock service tests: linear climb and hold, 3 s threshold, rounding, frozen `e` across form/calibration changes, monotonic progress on repeated stages, no 100% after cancel, incomplete outcomes or errors. - Component tests: every stage's text in all four languages, overrun announced once, freeze and hidden lines after Cancel. - `bun run typecheck`, eslint and the full suite (768 tests) pass. Not checked in a real browser. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Pushed f128af6. The three decisions listed under "Decisions to confirm" are now confirmed, with one change: "Taking longer than expected" appears only past the top of the range shown before Calculate, not at e. Between e and that top, the ring holds at 95% with no remaining-time line. Tests and docs/planning-duration.md are updated. Typecheck, lint and the full suite (771 tests) pass. The issue comment on #300 records the changed acceptance criterion.

Pushed f128af6. The three decisions listed under "Decisions to confirm" are now confirmed, with one change: "Taking longer than expected" appears only past the top of the range shown before Calculate, not at e. Between e and that top, the ring holds at 95% with no remaining-time line. Tests and docs/planning-duration.md are updated. Typecheck, lint and the full suite (771 tests) pass. The issue comment on #300 records the changed acceptance criterion.
nessar added 3 commits 2026-10-19 10:50:00 +02:00
Both terms are user-visible in the calculation overlay that #300
revises: the stage line names the planning stage, and the remaining
time comes from the indicative wait.

Refs #300.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The overlay percentage now rises linearly to 95% at the expected wait
captured at Calculate, holds there, and shows 100% only when the planner
completes. Beneath the status, one line names the current planning stage
(with the rule name for rule stages) and another shows the approximate
remaining time, or "Taking longer than expected" once the wait is
exceeded, announced once through the live status. Cancel freezes the
percentage and hides both lines.

PlanningCalculationService reports the stage and submitted request
instead of fixed per-stage percentages; PlanningDurationService owns the
wait progress on a 250 ms tick.

Closes #300

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat(planning): warn of an overrun only past the displayed range
CI / policy (pull_request) Successful in 7s
CI / validate (pull_request) Successful in 22s
CI / benchmark (pull_request) Successful in 1m9s
CI / build (pull_request) Successful in 34s
CI / security (pull_request) Successful in 55s
CI / test (pull_request) Successful in 1m45s
CI / images (pull_request) Successful in 53s
CI / required (pull_request) Successful in 2s
CI / policy (push) Successful in 12s
CI / validate (push) Successful in 31s
CI / build (push) Successful in 29s
CI / benchmark (push) Successful in 1m53s
CI / security (push) Successful in 1m31s
CI / test (push) Successful in 2m12s
CI / images (push) Successful in 1m15s
CI / required (push) Successful in 3s
c6af6d45ab
The expected wait sits near the middle of recent waits, so about half of
all runs pass it. Between the expected wait and the top of the range
shown before Calculate, the percentage now holds at 95% with no
remaining-time line; "Taking longer than expected" appears and is
announced only past that top.

Refs #300

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nessar force-pushed feature/calculation-progress from 428c0fc641 to c6af6d45ab 2026-10-19 10:50:00 +02:00 Compare
nessar merged commit c6af6d45ab into develop 2026-10-19 13:59:09 +02:00
nessar deleted branch feature/calculation-progress 2026-10-19 13:59:09 +02:00
Sign in to join this conversation.