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

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>
This commit was merged in pull request #304.
This commit is contained in:
nessarandClaude Opus 5.5 committed 2026-10-19 10:45:28 +02:00
1 parent 58be749949
commit c6af6d45ab
4 files changed
+55 -27

No files matched your search

@@ -220,7 +220,7 @@ describe('Indicative wait progress', () => {
});
expect(at(10_000)).toMatchObject({ percent: 47, overrun: false });
expect(at(19_999)).toMatchObject({ percent: 94, overrun: false });
expect(at(20_000)).toEqual({ percent: 95, remaining: null, overrun: true });
expect(at(20_000)).toEqual({ percent: 95, remaining: null, overrun: false });
expect(at(600_000)).toEqual({ percent: 95, remaining: null, overrun: true });
progress('complete');
expect(duration.wait()).toEqual({ percent: 100, remaining: null, overrun: false });
@@ -229,10 +229,25 @@ describe('Indicative wait progress', () => {
it('shows the remaining time only for expected waits of at least 3 seconds', () => {
start(2_999);
expect(at(1_000)).toEqual({ percent: 31, remaining: null, overrun: false });
expect(at(2_999)).toEqual({ percent: 95, remaining: null, overrun: true });
expect(at(2_999)).toEqual({ percent: 95, remaining: null, overrun: false });
resolve({ kind: 'PlanningIncomplete', completedStages: [], reasons: [] });
});
it.each([
[2_999, { minimum: 1, maximum: 9, unit: 'seconds' }, 9_000],
[20_000, { minimum: 10, maximum: 60, unit: 'seconds' }, 60_000],
[300_000, { minimum: 2, maximum: 15, unit: 'minutes' }, 900_000],
])(
'warns of an overrun of a %i ms expected wait only past the top of the range shown before Calculate',
(expectedMs, shown, topMs) => {
start(expectedMs);
expect(duration.estimate()).toEqual(shown);
expect(at(expectedMs)).toEqual({ percent: 95, remaining: null, overrun: false });
expect(at(topMs - 1)!.overrun).toBe(false);
expect(at(topMs)!.overrun).toBe(true);
},
);
it('rounds the remaining time to seconds, then 5-second steps, then minutes', () => {
start(3_000);
expect(at(0)!.remaining).toEqual({ value: 3, unit: 'seconds' });