app: redesign the panel and add limit forecasts and daily week use #6

Merged
schmidt.florian merged 14 commits from 5-panel-redesign into master 2026-10-15 19:06:05 +02:00
Owner

Closes #5
Closes #7

What and why

The developer ran v1 on real data: the graphs were fine but the layout was not, and three figures were missing — a date of reaching the limit when over pace, the share of the week used today, and a per-day chart of the week. This PR redesigns the panel and adds those figures.

  • Core (LimitAnalysis, D7):
    • use at reset at the average rate;
    • a recent-rate forecast from the last 24 h;
    • for windows longer than a day: per-day use, today's use, even pace and daily budget;
    • the reach date from the first point over pace;
    • window instances that tolerate Claude's minute-level reset drift;
    • TokenSeriesByModel (one query instead of one per chart point);
    • no settings-defaults diagnostic on a normal first start.
  • App (D8):
    • a one-row header;
    • limit tiles with pace, forecasts, today's share and budget;
    • "Week use per day" column charts with even-pace and budget lines;
    • token stat tiles with one composition legend and an "Include cache reads" toggle;
    • hourly and daily charts side by side;
    • limit history with forecast extensions;
    • top-8 breakdowns with short project names;
    • collapsed diagnostics;
    • a sectioned settings window.
  • Colours are fixed design tokens; nothing uses the OS accent:
    • Claude orange and Codex blue, checked for colour-vision separation in both themes;
    • status colours always carry an icon and a label;
    • numbers are compact to 3 significant digits.

Decisions

type/decision: D7 adds the forecasts, window instances (15-minute reset tolerance), and days of a long window. D8 adds the panel layout and colour rules. Both were written before the code (ab0e46d, fd4f6f1, c7086e9).

How it was tested

On 73f79eb (Windows 11):

  • dotnet build FinalToken.slnx -c Release: 0 warnings, 0 errors.
  • dotnet test --solution FinalToken.slnx -c Release: 275 passed, 0 failed (Core 187, App 55, CLI 10, Stream Deck 23), twice; the worker ran it 3×.
  • python -B tools/docs/check_docs.py: 0 errors. python -B tools/test_publish.py: OK.
  • python -B tools/publish.py win-x64: 0 warnings.
  • Headless renders at 1280×900 and 1500×1000 in both themes, including the unavailable and collecting-history states, settings and popups; reviewed by the coordinator.
  • Two rounds on real data with native window captures, scrolled through the whole panel; the issues found were fixed in the polish rounds:
    • red OS-accent selection;
    • a green chip next to a red forecast;
    • a two-row header;
    • over-precise numbers;
    • identical reference lines;
    • an empty day-one chart.

Not verified: a full week of real Claude samples next to the estimates (the measured day bars fill as the app runs).

Rounds 3 and 4 (after a passing review of 73f79eb)

The developer ran 73f79eb on real data. Their feedback and my real-data checks led to:

  • D7 estimates from tokens (d2ff67b, 06b3585): price-weighted tokens scaled by the instance's measured use fill the days and burn-up stretches that have no samples. Estimates are always marked, never pass 100 %, and stop at an instance's real end. Forecasts start at 10 % of the window (round 5 adds: or as soon as the window is ahead).
  • App:
    • window burn-up charts replace the long limit history;
    • the breakdown has its columns back, is sortable and expands "Other";
    • one structured tooltip;
    • the wheel no longer changes selections.
  • The notes of #7 (dated forecasts, real recent-rate span, keyboard focus, settings names, tests), and version 1.1.0 (plugin 1.1.0.0).

Checked on ab8d245: dotnet build 0 warnings; dotnet test 302/302 (the worker ran it 3×); check_docs 0 errors; publish.py win-x64 0 warnings. Native captures on a copy of the developer's live data show:

  • the Claude week filled with estimated days;
  • capped past peaks with real spans;
  • no forecast for a Codex window one hour old;
  • the range control unchanged after wheel scrolling.

After the agent review of ab8d245 (fail) and its re-review (pass)

  • 15145f1 (D7) and 07a6456 (code): instance boundaries come from resets. Real instances keep their own samples and scale, gaps belong to no instance, and inferred instances exist only for long windows without samples.
  • Final state checked on 07a6456:
    • dotnet build 0 warnings;
    • dotnet test 310/310 (twice; the re-review ran it once more);
    • check_docs 0 errors;
    • publish.py win-x64 0 warnings;
    • window charts on a copy of the developer's live data show only real past sessions.

Head d477321 (test-only change after the passing re-review)

My Linux check of 07a6456 failed one headless test 3 of 3 times: it assumed a scroll offset that only Windows fonts produced. d477321 makes the test independent of font metrics and checks wheel up and down.

Checked on d477321:

  • Windows 11: dotnet build 0 warnings; dotnet test 310/310; check_docs 0 errors.
  • Linux (Arch container, distro SDK 10.0.112): build 0 warnings; dotnet test 310/310 twice; publish.py linux-x64 0 warnings (on 07a6456). The new panel renders on X11 under Xvfb.
  • The agent review of d477321 passed.

Round 5, final head 33458a4: forecasts for windows that are ahead early

Developer feedback, 2026-10-15: the reach date, the popup warning and the dotted forecast showed only for Claude. Codex had reset its week ten hours earlier and stood at 39 %, ahead by 33 points, but D7 started forecasts only after 10 % of a window (about 17 h of a week). Nothing in the forecast paths was provider-specific.

  • D7 (5b42cb8, written before the code): forecasts start once 10 % of the window has passed, or as soon as the window is ahead. Until then, the tile and the chart say when they will.
  • Code (33458a4): Pace.CanForecast is the one gate for the average, recent and popup forecasts, with the configured threshold, so it never disagrees with the chip. Pace.ForecastStartsAt gives the "Forecast from …" time.

Checked on 33458a4:

  • Windows 11: dotnet build 0 warnings; dotnet test 321/321 twice (the worker ran it 3 times); check_docs 0 errors; publish.py win-x64 0 warnings.
  • These failed before the fix: 4 Core tests and a headless check for the Codex "100 % on" line.
  • Headless screenshots, dark and light: the Codex tile with "⚠ 100 % on …", its burn-up with the dotted forecast and the 100 % marker, and "Forecast from …" on an early on-track window.
  • The new finaltoken-cli on a copy of the developer's live data: the Codex week (39 %, 6.4 % elapsed, Ahead) gets a reach date. The Claude windows are unchanged.
  • The agent review of 33458a4 passed.

Not verified: Linux for round 5 (the change touches no platform code).

Closes #5 Closes #7 ## What and why The developer ran v1 on real data: the graphs were fine but the layout was not, and three figures were missing — a date of reaching the limit when over pace, the share of the week used today, and a per-day chart of the week. This PR redesigns the panel and adds those figures. - **Core** (`LimitAnalysis`, D7): - use at reset at the average rate; - a recent-rate forecast from the last 24 h; - for windows longer than a day: per-day use, today's use, even pace and daily budget; - the reach date from the first point over pace; - window instances that tolerate Claude's minute-level reset drift; - `TokenSeriesByModel` (one query instead of one per chart point); - no `settings-defaults` diagnostic on a normal first start. - **App** (D8): - a one-row header; - limit tiles with pace, forecasts, today's share and budget; - "Week use per day" column charts with even-pace and budget lines; - token stat tiles with one composition legend and an "Include cache reads" toggle; - hourly and daily charts side by side; - limit history with forecast extensions; - top-8 breakdowns with short project names; - collapsed diagnostics; - a sectioned settings window. - **Colours** are fixed design tokens; nothing uses the OS accent: - Claude orange and Codex blue, checked for colour-vision separation in both themes; - status colours always carry an icon and a label; - numbers are compact to 3 significant digits. ## Decisions `type/decision`: D7 adds the forecasts, window instances (15-minute reset tolerance), and days of a long window. D8 adds the panel layout and colour rules. Both were written before the code (`ab0e46d`, `fd4f6f1`, `c7086e9`). ## How it was tested On `73f79eb` (Windows 11): - `dotnet build FinalToken.slnx -c Release`: 0 warnings, 0 errors. - `dotnet test --solution FinalToken.slnx -c Release`: 275 passed, 0 failed (Core 187, App 55, CLI 10, Stream Deck 23), twice; the worker ran it 3×. - `python -B tools/docs/check_docs.py`: 0 errors. `python -B tools/test_publish.py`: OK. - `python -B tools/publish.py win-x64`: 0 warnings. - Headless renders at 1280×900 and 1500×1000 in both themes, including the unavailable and collecting-history states, settings and popups; reviewed by the coordinator. - Two rounds on real data with native window captures, scrolled through the whole panel; the issues found were fixed in the polish rounds: - red OS-accent selection; - a green chip next to a red forecast; - a two-row header; - over-precise numbers; - identical reference lines; - an empty day-one chart. Not verified: a full week of real Claude samples next to the estimates (the measured day bars fill as the app runs). ## Rounds 3 and 4 (after a passing review of `73f79eb`) The developer ran `73f79eb` on real data. Their feedback and my real-data checks led to: - **D7 estimates from tokens** (`d2ff67b`, `06b3585`): price-weighted tokens scaled by the instance's measured use fill the days and burn-up stretches that have no samples. Estimates are always marked, never pass 100 %, and stop at an instance's real end. Forecasts start at 10 % of the window (round 5 adds: or as soon as the window is ahead). - **App:** - window burn-up charts replace the long limit history; - the breakdown has its columns back, is sortable and expands "Other"; - one structured tooltip; - the wheel no longer changes selections. - **The notes of #7** (dated forecasts, real recent-rate span, keyboard focus, settings names, tests), and version **1.1.0** (plugin `1.1.0.0`). Checked on `ab8d245`: `dotnet build` 0 warnings; `dotnet test` 302/302 (the worker ran it 3×); check_docs 0 errors; `publish.py win-x64` 0 warnings. Native captures on a copy of the developer's live data show: - the Claude week filled with estimated days; - capped past peaks with real spans; - no forecast for a Codex window one hour old; - the range control unchanged after wheel scrolling. ## After the agent review of `ab8d245` (fail) and its re-review (pass) - `15145f1` (D7) and `07a6456` (code): instance boundaries come from resets. Real instances keep their own samples and scale, gaps belong to no instance, and inferred instances exist only for long windows without samples. - Final state checked on `07a6456`: - `dotnet build` 0 warnings; - `dotnet test` 310/310 (twice; the re-review ran it once more); - check_docs 0 errors; - `publish.py win-x64` 0 warnings; - window charts on a copy of the developer's live data show only real past sessions. ## Head `d477321` (test-only change after the passing re-review) My Linux check of `07a6456` failed one headless test 3 of 3 times: it assumed a scroll offset that only Windows fonts produced. `d477321` makes the test independent of font metrics and checks wheel up and down. Checked on `d477321`: - Windows 11: `dotnet build` 0 warnings; `dotnet test` 310/310; check_docs 0 errors. - Linux (Arch container, distro SDK 10.0.112): build 0 warnings; `dotnet test` 310/310 twice; `publish.py linux-x64` 0 warnings (on `07a6456`). The new panel renders on X11 under Xvfb. - The agent review of `d477321` passed. ## Round 5, final head `33458a4`: forecasts for windows that are ahead early Developer feedback, 2026-10-15: the reach date, the popup warning and the dotted forecast showed only for Claude. Codex had reset its week ten hours earlier and stood at 39 %, ahead by 33 points, but D7 started forecasts only after 10 % of a window (about 17 h of a week). Nothing in the forecast paths was provider-specific. - **D7** (`5b42cb8`, written before the code): forecasts start once 10 % of the window has passed, or as soon as the window is ahead. Until then, the tile and the chart say when they will. - **Code** (`33458a4`): `Pace.CanForecast` is the one gate for the average, recent and popup forecasts, with the configured threshold, so it never disagrees with the chip. `Pace.ForecastStartsAt` gives the "Forecast from …" time. Checked on `33458a4`: - Windows 11: `dotnet build` 0 warnings; `dotnet test` 321/321 twice (the worker ran it 3 times); check_docs 0 errors; `publish.py win-x64` 0 warnings. - These failed before the fix: 4 Core tests and a headless check for the Codex "100 % on" line. - Headless screenshots, dark and light: the Codex tile with "⚠ 100 % on …", its burn-up with the dotted forecast and the 100 % marker, and "Forecast from …" on an early on-track window. - The new `finaltoken-cli` on a copy of the developer's live data: the Codex week (39 %, 6.4 % elapsed, Ahead) gets a reach date. The Claude windows are unchanged. - The agent review of `33458a4` passed. Not verified: Linux for round 5 (the change touches no platform code).
schmidt.florian added the type/featuretype/decision labels 2026-10-14 22:59:41 +02:00
schmidt.florian added 5 commits 2026-10-14 22:59:42 +02:00
D7 now shows the date of reaching 100 % from the first point over
pace, adds the use at reset and a recent-rate forecast, and defines
today's use, per-day use and the daily budget of a long window. D8
says what the panel leads with and fixes provider and status colours.
Developer feedback on v1.

Refs #5
Refs #5
Claude reports reset times to the minute and drifts between probes, so
an instance is the samples whose resets lie within 15 minutes.

Refs #5
LimitAnalysis computes the use at reset at the average rate, a
recent-rate forecast from the last 24 h of samples, and for windows
longer than a day the use of each local day, today's use, the even
pace and the daily budget. Pace now projects the date of reaching
100 % whenever usage is over pace, not only past the threshold.
Samples whose resets lie within 15 minutes form one window instance,
because Claude's reset times drift by a minute between probes.
TokenSeriesByModel replaces one query per chart point, and a missing
settings.json on first start is no longer a diagnostic.

Refs #5
The panel is now a dashboard: a one-row header with range and provider
controls, a tile per limit window with pace, forecasts, today's share
of the week and the daily budget, per-day week charts with even-pace and
budget lines, token stat tiles with one composition legend, hourly and
daily charts side by side, limit history, and top-8 breakdowns. Colours
follow fixed provider and status tokens instead of the OS accent;
numbers are compact to three significant digits. Settings are grouped
into cards with a sticky footer. Developer feedback on v1.

Refs #5
Author
Owner

Linux check on 73f79eb (Arch container, distro SDK 10.0.112):

  • dotnet build: 0 warnings.
  • dotnet test: 275/275.
  • publish.py linux-x64: 0 warnings.
  • The NativeAOT app renders the new panel on X11 (Xvfb) in its no-CLI state: unavailable tiles and empty charts. Capture: runs/shots/linux/redesign-xvfb.png.
  • Cosmetic: with no limit samples at all, the "Limit history" heading shows with nothing under it.
Linux check on `73f79eb` (Arch container, distro SDK 10.0.112): - `dotnet build`: 0 warnings. - `dotnet test`: 275/275. - `publish.py linux-x64`: 0 warnings. - The NativeAOT app renders the new panel on X11 (Xvfb) in its no-CLI state: unavailable tiles and empty charts. Capture: `runs/shots/linux/redesign-xvfb.png`. - Cosmetic: with no limit samples at all, the "Limit history" heading shows with nothing under it.
Author
Owner

Agent review: pass on 73f79eb6ac

Blocking

None.

Notes

  • src/FinalToken.App/PanelViewModel.cs:122: Display.Forecast prints ddd HH:mm with no date. On a 7-day window a forecast 6 to 7 days out shows today's weekday, so it reads as today. The popup used to show an unambiguous date through Display.Projection (line 96). That method is now used only by its tests. PanelWindow.cs:192 and PanelWindow.cs:207 build the same ddd HH:mm text again. Put one forecast and reset date formatter in Display, add the date when the time is 6 or more days away, and delete Display.Projection or reuse it.
  • src/FinalToken.App/PanelWindow.cs:207: the "Last 24 h" label also covers 5-hour windows and spans as short as 3 h. The tooltip gives the real span, but the label claims 24 h.
  • src/FinalToken.App/Charts.cs:73: the limit history x-axis runs out to the forecast point, which can be the reset up to 7 days ahead. In the 24 h range, a week window's samples fill about an eighth of the chart width.
  • src/FinalToken.App/Charts.cs:220: the daily tooltip prints "cumulative %" with no number for future days, because Cumulative is null there.
  • src/FinalToken.App/Charts.cs:212: the previous window's outline bars are matched to this window's days by position, not by date. That works for back-to-back instances. A window that starts later than the last one ended (Codex can do this) compares different weekdays under the same label.
  • src/FinalToken.App/SettingsWindow.cs:86: check boxes get their names from their labels. That gives two controls each named Enabled, PopupsEnabled, Ahead and Behind (one set for Claude, one for Codex). Nothing breaks today, but a test or lookup by name would hit the wrong one. Add the provider to the name, as ClaudeCliPath already does.
  • src/FinalToken.App/Ui.cs:49 and :64: the custom segment and check box templates draw no focus indicator, so keyboard focus can't be seen anywhere on the panel or in settings. The check box template also adds an IsCheckedChanged handler each time the template is applied.
  • No tests cover the new Display.Duration format, the in-flight refresh guard (DesktopApp.Refresh / Refreshing), the settings Cancel, Quit and Open folder buttons, or the chip labels from Display.State. All of them are small. The headless test already drives the settings window, so clicking Cancel and Quit there would be cheap to add.
  • src/FinalToken.Core/AGENTS.md:47: "Store changed percent/reset samples" no longer holds exactly. A reset that moves by up to 15 minutes now counts as unchanged (D7 window instance). Add that to the line.
  • Not verified here: tools/publish.py NativeAOT publish, Linux rendering, and the real-data screenshots. The PR body names these; Linux is still open.

Checked

Commit 73f79eb6acf6935e1f863bcd56be79e94c5f91b4. First review, since the PR has no earlier agent review.

  • Read: the PR body, issue #5 and its comments, the root AGENTS.md, the AGENTS.md of every touched project (App, Core, App.Tests, Core.Tests), docs/requirements.md, D5 to D9 in docs/decisions.md, and the full diff origin/master...73f79eb (20 files).
  • Spec: the issue asks for a date of reaching the limit when over pace (Pace.Calculate now projects for every d > 0), today's share of the week, and a per-day chart of the week (LimitAnalysis.Days, DailyLimitChart). All three are there.
  • Decisions: the PR carries type/decision. The code follows the edited D7 (forecasts, the 15-minute window instance, partial first and last days, even pace and budget, unknown baselines kept unknown) and the edited D8 (panel order, collapsed diagnostics, fixed provider colours, status chips with icon and label). The D9 snapshot still carries the projection, which now also appears below the alert threshold, as D7 says.
  • Ran in a separate worktree at the head:
    • dotnet build FinalToken.slnx -c Release: 0 warnings, 0 errors.
    • dotnet test --solution FinalToken.slnx -c Release: 275 passed, 0 failed.
    • python -B tools/docs/check_docs.py: 0 errors.
  • Looked at the headless screenshots from the test run (limits, week per day, limit history and breakdown at 1500×1000 dark and 1280×900 light).
**Agent review: pass** on 73f79eb6acf6935e1f863bcd56be79e94c5f91b4 ## Blocking None. ## Notes - `src/FinalToken.App/PanelViewModel.cs:122`: `Display.Forecast` prints `ddd HH:mm` with no date. On a 7-day window a forecast 6 to 7 days out shows today's weekday, so it reads as today. The popup used to show an unambiguous date through `Display.Projection` (line 96). That method is now used only by its tests. `PanelWindow.cs:192` and `PanelWindow.cs:207` build the same `ddd HH:mm` text again. Put one forecast and reset date formatter in `Display`, add the date when the time is 6 or more days away, and delete `Display.Projection` or reuse it. - `src/FinalToken.App/PanelWindow.cs:207`: the "Last 24 h" label also covers 5-hour windows and spans as short as 3 h. The tooltip gives the real span, but the label claims 24 h. - `src/FinalToken.App/Charts.cs:73`: the limit history x-axis runs out to the forecast point, which can be the reset up to 7 days ahead. In the 24 h range, a week window's samples fill about an eighth of the chart width. - `src/FinalToken.App/Charts.cs:220`: the daily tooltip prints "cumulative %" with no number for future days, because `Cumulative` is null there. - `src/FinalToken.App/Charts.cs:212`: the previous window's outline bars are matched to this window's days by position, not by date. That works for back-to-back instances. A window that starts later than the last one ended (Codex can do this) compares different weekdays under the same label. - `src/FinalToken.App/SettingsWindow.cs:86`: check boxes get their names from their labels. That gives two controls each named `Enabled`, `PopupsEnabled`, `Ahead` and `Behind` (one set for Claude, one for Codex). Nothing breaks today, but a test or lookup by name would hit the wrong one. Add the provider to the name, as `ClaudeCliPath` already does. - `src/FinalToken.App/Ui.cs:49` and `:64`: the custom segment and check box templates draw no focus indicator, so keyboard focus can't be seen anywhere on the panel or in settings. The check box template also adds an `IsCheckedChanged` handler each time the template is applied. - No tests cover the new `Display.Duration` format, the in-flight refresh guard (`DesktopApp.Refresh` / `Refreshing`), the settings Cancel, Quit and Open folder buttons, or the chip labels from `Display.State`. All of them are small. The headless test already drives the settings window, so clicking Cancel and Quit there would be cheap to add. - `src/FinalToken.Core/AGENTS.md:47`: "Store changed percent/reset samples" no longer holds exactly. A reset that moves by up to 15 minutes now counts as unchanged (D7 window instance). Add that to the line. - Not verified here: `tools/publish.py` NativeAOT publish, Linux rendering, and the real-data screenshots. The PR body names these; Linux is still open. ## Checked Commit `73f79eb6acf6935e1f863bcd56be79e94c5f91b4`. First review, since the PR has no earlier agent review. - Read: the PR body, issue #5 and its comments, the root `AGENTS.md`, the `AGENTS.md` of every touched project (App, Core, App.Tests, Core.Tests), `docs/requirements.md`, D5 to D9 in `docs/decisions.md`, and the full diff `origin/master...73f79eb` (20 files). - Spec: the issue asks for a date of reaching the limit when over pace (`Pace.Calculate` now projects for every `d > 0`), today's share of the week, and a per-day chart of the week (`LimitAnalysis.Days`, `DailyLimitChart`). All three are there. - Decisions: the PR carries `type/decision`. The code follows the edited D7 (forecasts, the 15-minute window instance, partial first and last days, even pace and budget, unknown baselines kept unknown) and the edited D8 (panel order, collapsed diagnostics, fixed provider colours, status chips with icon and label). The D9 snapshot still carries the projection, which now also appears below the alert threshold, as D7 says. - Ran in a separate worktree at the head: - `dotnet build FinalToken.slnx -c Release`: 0 warnings, 0 errors. - `dotnet test --solution FinalToken.slnx -c Release`: 275 passed, 0 failed. - `python -B tools/docs/check_docs.py`: 0 errors. - Looked at the headless screenshots from the test run (limits, week per day, limit history and breakdown at 1500×1000 dark and 1280×900 light).
schmidt.florian added 1 commit 2026-10-15 08:45:08 +02:00
The day chart stayed empty until the app had sampled a whole week,
although the token history covers it. D7 now scales price-weighted
tokens by the measured use of the instance to estimate spans without
samples, always marked as estimates. D8 replaces the long limit
history with a burn-up chart per window instance, an expandable
"Other" and one tooltip component. Developer feedback on the redesign.

Refs #5
schmidt.florian added 1 commit 2026-10-15 09:18:42 +02:00
On real data, estimates of past weeks passed 200 %, a Codex window one
hour old forecast 100 % within two days, and Codex windows that ended
early were labelled with reset dates in the future. D7 now caps
estimates at the limit, starts forecasts once 10 % of the window has
passed, and ends an instance when the next one begins.

Refs #5
schmidt.florian added 2 commits 2026-10-15 09:38:11 +02:00
Claude limit samples exist only while the app runs, so the day chart
and history of a week stayed empty although the token history covers
it. TokenWeights applies the providers' price ratios and LimitEstimates
scales the weighted tokens by the instance's measured use to estimate
spans without samples: days, the burn-up series and the peaks of past
instances, each marked measured or estimated. Estimates stop at the
limit, an instance ends where the next one begins, and forecasts wait
until 10 % of the window has passed.

Refs #5
From developer feedback on the redesign:
- Week use per day draws estimated days hatched beside measured ones.
- Limit history becomes a burn-up chart per window instance: even-pace
  diagonal, used line without point markers, forecast to the reset,
  the previous instance faintly, and a strip of past peaks with their
  real start and end.
- The breakdown has its detail columns back, sorts by any column and
  expands "Other" to every row.
- One tooltip component, a title and a label/value grid, for every
  chart and table.
Also the review notes of #7: dated forecasts, the real span of the
recent rate, keyboard focus, distinct settings names, a wheel that no
longer changes selections, and version 1.1.0.

Refs #5, #7
Author
Owner

Agent review: fail on ab8d245df8

Blocking

  1. src/FinalToken.Core/LimitEstimates.cs:53: when a sampled previous instance ended more than 15 minutes before the current one started, known is false. The loop then makes up an instance that ends at the current start and covers cursor.Start - length, and it never looks at the real one. This gap is the normal case for 5-hour session windows, because a session starts with the first message after the last one ran out. The made-up instance takes the real session's tokens, is estimated with the current k, and ignores the real samples. On the next pass the real instance is cut to the made-up start. I checked this with a scratch test. Previous session 03:00–08:00 with measured samples of 10 % at 03:30 and 80 % at 07:30, and current session 14:00–19:00. Analyze returns Past[0] = 04:00–09:00, estimated, peak 90, and Past[1] = 03:00–04:00, peak 10. The measured 80 % is not used. This breaks D7: "An instance ends at its reset or when the next instance's samples begin", "past instances are labelled with their real start and end", and "A finished instance uses its own last sample for k when it has one". It also feeds the faint previous line in the burn-up chart, the past-peaks strip and Days.Previous. Fix: when the newest span with First < cursor.First has a reset before cursor.Start, use that span (its own start, ending at its reset). Make up an instance only when no sampled one exists, and never let it overlap a sampled instance. Add a regression test for a session gap with a sampled previous instance.

Notes

  • src/FinalToken.Core/LimitEstimates.cs:45: when an earlier instance's reset lies after the next instance's nominal start (an early replacement), the next instance's start moves to its first sample. Two things follow. Tokens between the real start (reset − length) and that first sample go to the previous instance. And k for the new instance is worked out from a start that is not at 0 %. Scratch test: Codex 5 h, previous reset 12:00 with 50 % at 09:00, new reset 15:00 (start 10:00) with its first sample at 11:00. The previous instance shows "limit reached (estimated)" at 10:20 from the new instance's tokens, and the current k is 0.2 instead of 40/500. D7's "ends when the next instance's samples begin" allows the end. If that is intended, consider stating the start rule in D7. Otherwise use reset − length as the boundary when it comes after the earlier instance's last sample.
  • src/FinalToken.App/Charts.cs:211: #7 asked to pair the previous week's outline bars by date. The App AGENTS.md now says "Align past days by index", which matches the elapsed-time alignment of the burn-up. That is a reasonable answer, but it is a choice, not the fix #7 describes. Say so on #7, since this PR closes it.
  • src/FinalToken.App/PanelViewModel.cs:98: Breakdown still builds a top-8 list plus "Other" for HistoryView.Models/Projects. The panel now passes AllModels/AllProjects to BreakdownTable, which builds its own "Other", so only tests use the precomputed one. One of the two can go.
  • tests/FinalToken.Core.Tests/ProcessTests.cs:18: FakeClockTimeoutTerminatesChild failed once in the full run, because the temp directory was still locked when it was deleted on Windows. It passed in three reruns of Core.Tests. This PR does not touch it, but it is flaky.
  • Not verified here: Linux rendering of the new panel and the real-data captures. The PR body names both.

Checked

Commit ab8d245df8f4772af356107a7dc9eed8ca19633e. The earlier review of 73f79eb passed, so this is a full review of origin/master...ab8d245 (29 files), with weight on the rounds 3 and 4 commits (d2ff67b, 06b3585, e687a40, ab8d245).

  • Read: the PR body, issues #5 and #7 with their comments, the earlier agent review, the root AGENTS.md, the App and Core AGENTS.md, docs/agents/review.md, D5 to D9 in docs/decisions.md, and the whole diff.
  • Spec: #5's three figures are present (the reach date from the first point over pace, today's share, per-day week chart), as are the round 3 changes (token estimates, burn-up window charts, breakdown with "Other", sortable columns, one tooltip). Items of #7 that are fixed: dated forecasts through Display.Projection, "Last ", no cumulative value for future days, unique settings control names, focus styles and NeutralCheckBox, tests for duration, refresh guard, chip labels and the settings buttons, the Core AGENTS.md line, and no empty history heading. Item 5 is answered as a choice (see notes).
  • Decisions: the PR carries type/decision, and the D7 and D8 edits came before the code. The code follows them, apart from the blocking finding.
  • Ran in a separate worktree at the head:
    • dotnet build FinalToken.slnx -c Release: 0 warnings, 0 errors.
    • dotnet test --solution FinalToken.slnx -c Release: 301 of 302 passed. The one failure is the unrelated flaky ProcessTests above. Core.Tests then passed 3 times, 203 of 203.
    • python -B tools/docs/check_docs.py: 0 errors. python -B tools/test_publish.py and python -B tools/docs/test_check_docs.py: OK.
    • Two scratch tests on LimitAnalysis.Analyze (session gap, early replacement), deleted afterwards.
  • Looked at the headless captures from this run: limits and window charts at 1500×1000, dark theme.
**Agent review: fail** on ab8d245df8f4772af356107a7dc9eed8ca19633e ## Blocking 1. `src/FinalToken.Core/LimitEstimates.cs:53`: when a sampled previous instance ended more than 15 minutes before the current one started, `known` is false. The loop then makes up an instance that ends at the current start and covers `cursor.Start - length`, and it never looks at the real one. This gap is the normal case for 5-hour session windows, because a session starts with the first message after the last one ran out. The made-up instance takes the real session's tokens, is estimated with the current `k`, and ignores the real samples. On the next pass the real instance is cut to the made-up start. I checked this with a scratch test. Previous session 03:00–08:00 with measured samples of 10 % at 03:30 and 80 % at 07:30, and current session 14:00–19:00. `Analyze` returns `Past[0]` = 04:00–09:00, estimated, peak 90, and `Past[1]` = 03:00–04:00, peak 10. The measured 80 % is not used. This breaks D7: "An instance ends at its reset or when the next instance's samples begin", "past instances are labelled with their real start and end", and "A finished instance uses its own last sample for `k` when it has one". It also feeds the faint previous line in the burn-up chart, the past-peaks strip and `Days.Previous`. Fix: when the newest span with `First < cursor.First` has a reset before `cursor.Start`, use that span (its own start, ending at its reset). Make up an instance only when no sampled one exists, and never let it overlap a sampled instance. Add a regression test for a session gap with a sampled previous instance. ## Notes - `src/FinalToken.Core/LimitEstimates.cs:45`: when an earlier instance's reset lies after the next instance's nominal start (an early replacement), the next instance's start moves to its first sample. Two things follow. Tokens between the real start (`reset − length`) and that first sample go to the previous instance. And `k` for the new instance is worked out from a start that is not at 0 %. Scratch test: Codex 5 h, previous reset 12:00 with 50 % at 09:00, new reset 15:00 (start 10:00) with its first sample at 11:00. The previous instance shows "limit reached (estimated)" at 10:20 from the new instance's tokens, and the current `k` is 0.2 instead of 40/500. D7's "ends when the next instance's samples begin" allows the end. If that is intended, consider stating the start rule in D7. Otherwise use `reset − length` as the boundary when it comes after the earlier instance's last sample. - `src/FinalToken.App/Charts.cs:211`: #7 asked to pair the previous week's outline bars by date. The App `AGENTS.md` now says "Align past days by index", which matches the elapsed-time alignment of the burn-up. That is a reasonable answer, but it is a choice, not the fix #7 describes. Say so on #7, since this PR closes it. - `src/FinalToken.App/PanelViewModel.cs:98`: `Breakdown` still builds a top-8 list plus "Other" for `HistoryView.Models`/`Projects`. The panel now passes `AllModels`/`AllProjects` to `BreakdownTable`, which builds its own "Other", so only tests use the precomputed one. One of the two can go. - `tests/FinalToken.Core.Tests/ProcessTests.cs:18`: `FakeClockTimeoutTerminatesChild` failed once in the full run, because the temp directory was still locked when it was deleted on Windows. It passed in three reruns of Core.Tests. This PR does not touch it, but it is flaky. - Not verified here: Linux rendering of the new panel and the real-data captures. The PR body names both. ## Checked Commit `ab8d245df8f4772af356107a7dc9eed8ca19633e`. The earlier review of `73f79eb` passed, so this is a full review of `origin/master...ab8d245` (29 files), with weight on the rounds 3 and 4 commits (`d2ff67b`, `06b3585`, `e687a40`, `ab8d245`). - Read: the PR body, issues #5 and #7 with their comments, the earlier agent review, the root `AGENTS.md`, the App and Core `AGENTS.md`, `docs/agents/review.md`, D5 to D9 in `docs/decisions.md`, and the whole diff. - Spec: #5's three figures are present (the reach date from the first point over pace, today's share, per-day week chart), as are the round 3 changes (token estimates, burn-up window charts, breakdown with "Other", sortable columns, one tooltip). Items of #7 that are fixed: dated forecasts through `Display.Projection`, "Last <span>", no cumulative value for future days, unique settings control names, focus styles and `NeutralCheckBox`, tests for duration, refresh guard, chip labels and the settings buttons, the Core `AGENTS.md` line, and no empty history heading. Item 5 is answered as a choice (see notes). - Decisions: the PR carries `type/decision`, and the D7 and D8 edits came before the code. The code follows them, apart from the blocking finding. - Ran in a separate worktree at the head: - `dotnet build FinalToken.slnx -c Release`: 0 warnings, 0 errors. - `dotnet test --solution FinalToken.slnx -c Release`: 301 of 302 passed. The one failure is the unrelated flaky `ProcessTests` above. Core.Tests then passed 3 times, 203 of 203. - `python -B tools/docs/check_docs.py`: 0 errors. `python -B tools/test_publish.py` and `python -B tools/docs/test_check_docs.py`: OK. - Two scratch tests on `LimitAnalysis.Analyze` (session gap, early replacement), deleted afterwards. - Looked at the headless captures from this run: limits and window charts at 1500×1000, dark theme.
schmidt.florian added 1 commit 2026-10-15 09:43:43 +02:00
The agent review of ab8d245 found that a gap between two session
windows made the analysis invent a previous instance up to the current
start and drop the real one's samples, and that an early Codex reset
gave the old window tokens from before the new window's first sample.
D7 now takes boundaries from resets, keeps real instances, infers past
instances only without samples and never for short windows.

Refs #5
Author
Owner

Author reply to the agent review of ab8d245.

Blocking finding: fixed in 07a6456. D7 now takes instance boundaries from resets (15145f1). Real instances are kept with their own samples and scale, gaps stay unassigned, and inferred instances exist only for long windows without samples, never overlapping a real one.

  • Regression tests: LimitInstanceTests (the review's session-gap case, several sessions with gaps, an early Codex reset, inferred weeks, a mixed real and inferred history); 7 of 8 failed before the fix.
  • On a copy of the developer's live data, the session strip now shows only the real past sessions.

Notes:

  • Early-reset boundary: fixed by the same change (the new instance starts at reset minus length).
  • #7 item 5: answered on the issue; the legend now says "same day of the window".
  • Dead top-8 builder: removed.
  • Flaky ProcessTests test: tracked in #8.

Checked on 07a6456: dotnet build 0 warnings; dotnet test 310/310 twice; check_docs 0 errors; publish.py win-x64 0 warnings.

**Author reply to the agent review of `ab8d245`.** **Blocking finding: fixed** in `07a6456`. D7 now takes instance boundaries from resets (`15145f1`). Real instances are kept with their own samples and scale, gaps stay unassigned, and inferred instances exist only for long windows without samples, never overlapping a real one. - Regression tests: `LimitInstanceTests` (the review's session-gap case, several sessions with gaps, an early Codex reset, inferred weeks, a mixed real and inferred history); 7 of 8 failed before the fix. - On a copy of the developer's live data, the session strip now shows only the real past sessions. **Notes:** - Early-reset boundary: fixed by the same change (the new instance starts at reset minus length). - #7 item 5: answered on the issue; the legend now says "same day of the window". - Dead top-8 builder: removed. - Flaky `ProcessTests` test: tracked in #8. Checked on `07a6456`: `dotnet build` 0 warnings; `dotnet test` 310/310 twice; check_docs 0 errors; `publish.py win-x64` 0 warnings.
schmidt.florian added 1 commit 2026-10-15 09:59:32 +02:00
The agent review of ab8d245 found that a gap between two instances,
normal for 5 h sessions, made the analysis infer a previous instance
up to the current start and drop the real one with its samples, and
that an early reset gave the old window tokens from before the new
window's first sample. Instance boundaries now come from resets; real
instances are kept with their own scale, gaps stay unassigned, and
inferred instances exist only for long windows without samples and
never overlap a real one. The dead top-8 breakdown builder is removed
and the day chart legend names the day-of-window pairing.

Refs #5
Author
Owner

Agent review: pass on 07a645657d

Blocking

None.

Notes

  • src/FinalToken.Core/LimitEstimates.cs:80: an instance's token weight stops at Hour(end), exclusive. When a gap follows the instance, nobody owns the hour that holds its reset. Example: a Codex session that resets at 15:13 loses the 15:00 to 15:13 tokens from its estimate and from its k, and the next session does not get them either. The old code did the same through tokenEnd, so this is not a regression. The effect is at most one hour per instance. If you want to keep the D5 boundary rule, the ending instance could own its reset hour when no instance starts in it.
  • The PR body still names ab8d245 under "How it was tested". The checks on 07a6456 are only in the author reply. Update the body before the squash merge so it describes what merges.
  • tests/FinalToken.Core.Tests/ProcessTests.cs: still flaky, tracked in #8. It passed in this run.
  • Not verified here: Linux rendering of the new panel and the real-data captures. The PR body names both.

Checked

Commit 07a645657d1463aecf049153fd68db36aef13875. This is a re-review: the last agent review failed on ab8d245.

  • The blocking finding of ab8d245 is fixed.
    • 15145f1 rewrites D7 so instance boundaries come from resets: an instance starts at its reset minus its length. Gaps belong to no instance. Instances are inferred only for windows longer than a day, and never overlap a real one. The D7 edit came before the code, and the PR carries type/decision.
    • 07a6456 builds each sampled group as its own span with its own anchor. It trims a span only where the next span starts earlier, and steps back through the real spans first.
    • The reviewer's own case is now a test (SessionGapKeepsTheReviewersMeasuredSessionAndItsOwnScale). It keeps 03:00 to 08:00 with its 10 % and 80 % samples and k = 0.2, and leaves the 1M-token gap unassigned.
  • The early-replacement note is fixed too. EarlyCodexReplacement… covers it for 5 h and 168 h: the new instance starts at reset minus length, and the current k is 40/500.
  • Commits reviewed: only the author's commits since ab8d245, 15145f1 and 07a6456, from git log -p --no-merges ^ab8d245 ^origin/master 07a6456. I also read the full LimitEstimates.cs and LimitAnalysis.cs at the head.
  • Reasoning about the new past-instance loop:
    • After trimming, span ends rise with span starts, so checking only the nearest real span is enough to keep an inferred window from overlapping any real one.
    • spans.Single cannot see two current spans, because every observation within 15 minutes of the current reset joins group 0 first.
    • Real spans with no data move the cursor without being added.
  • App changes:
    • Removing the dead top-8 builder leaves HistoryView.Models/Projects as full lists. The only consumer is BreakdownTable, which builds its own "Other".
    • No other project reads them (grep over src and tests).
    • The test was renamed and changed to match.
    • The day chart legend now says "same day of the window", which matches the answer on #7.
  • Other things I read: the PR body and comments, issues #5 and #7 with their comments, both earlier agent reviews, the root AGENTS.md, the AGENTS.md of App, Core, Core.Tests and App.Tests, docs/agents/review.md, and D7 in docs/decisions.md.
  • Ran in a separate worktree at the head:
    • dotnet build FinalToken.slnx -c Release: 0 warnings, 0 errors.
    • dotnet test --solution FinalToken.slnx -c Release: 310 of 310 passed (Core, App, CLI, Stream Deck).
    • python -B tools/docs/check_docs.py: 0 errors.
**Agent review: pass** on 07a645657d1463aecf049153fd68db36aef13875 ## Blocking None. ## Notes - `src/FinalToken.Core/LimitEstimates.cs:80`: an instance's token weight stops at `Hour(end)`, exclusive. When a gap follows the instance, nobody owns the hour that holds its reset. Example: a Codex session that resets at 15:13 loses the 15:00 to 15:13 tokens from its estimate and from its `k`, and the next session does not get them either. The old code did the same through `tokenEnd`, so this is not a regression. The effect is at most one hour per instance. If you want to keep the D5 boundary rule, the ending instance could own its reset hour when no instance starts in it. - The PR body still names `ab8d245` under "How it was tested". The checks on `07a6456` are only in the author reply. Update the body before the squash merge so it describes what merges. - `tests/FinalToken.Core.Tests/ProcessTests.cs`: still flaky, tracked in #8. It passed in this run. - Not verified here: Linux rendering of the new panel and the real-data captures. The PR body names both. ## Checked Commit `07a645657d1463aecf049153fd68db36aef13875`. This is a re-review: the last agent review failed on `ab8d245`. - **The blocking finding of `ab8d245` is fixed.** - `15145f1` rewrites D7 so instance boundaries come from resets: an instance starts at its reset minus its length. Gaps belong to no instance. Instances are inferred only for windows longer than a day, and never overlap a real one. The D7 edit came before the code, and the PR carries `type/decision`. - `07a6456` builds each sampled group as its own span with its own anchor. It trims a span only where the next span starts earlier, and steps back through the real spans first. - The reviewer's own case is now a test (`SessionGapKeepsTheReviewersMeasuredSessionAndItsOwnScale`). It keeps 03:00 to 08:00 with its 10 % and 80 % samples and `k` = 0.2, and leaves the 1M-token gap unassigned. - **The early-replacement note is fixed too.** `EarlyCodexReplacement…` covers it for 5 h and 168 h: the new instance starts at reset minus length, and the current `k` is 40/500. - **Commits reviewed:** only the author's commits since `ab8d245`, `15145f1` and `07a6456`, from `git log -p --no-merges ^ab8d245 ^origin/master 07a6456`. I also read the full `LimitEstimates.cs` and `LimitAnalysis.cs` at the head. - **Reasoning about the new past-instance loop:** - After trimming, span ends rise with span starts, so checking only the nearest real span is enough to keep an inferred window from overlapping any real one. - `spans.Single` cannot see two current spans, because every observation within 15 minutes of the current reset joins group 0 first. - Real spans with no data move the cursor without being added. - **App changes:** - Removing the dead top-8 builder leaves `HistoryView.Models`/`Projects` as full lists. The only consumer is `BreakdownTable`, which builds its own "Other". - No other project reads them (grep over `src` and `tests`). - The test was renamed and changed to match. - The day chart legend now says "same day of the window", which matches the answer on #7. - **Other things I read:** the PR body and comments, issues #5 and #7 with their comments, both earlier agent reviews, the root `AGENTS.md`, the `AGENTS.md` of App, Core, Core.Tests and App.Tests, `docs/agents/review.md`, and D7 in `docs/decisions.md`. - **Ran in a separate worktree at the head:** - `dotnet build FinalToken.slnx -c Release`: 0 warnings, 0 errors. - `dotnet test --solution FinalToken.slnx -c Release`: 310 of 310 passed (Core, App, CLI, Stream Deck). - `python -B tools/docs/check_docs.py`: 0 errors.
schmidt.florian added 1 commit 2026-10-15 10:13:42 +02:00
On Linux the window selector already fits in the viewport, so the page
stays at offset 0 and a wheel up cannot scroll it: the test assumed a
positive offset that only Windows fonts produced. It now centres the
selector with room in both directions and checks a wheel up and down
without the selection changing.

Refs #5
Author
Owner

New commit after the passing re-review: d477321 (test only).

My Linux check of 07a6456 failed HeadlessTests.ViewsRenderAndInteractionsApplySettingsAndPopupActions in 3 of 3 runs. With Linux fonts the window selector already fits in the viewport, so the page stays at offset 0 and the test's "wheel up scrolls up" assumption failed; the product behaviour (the wheel never changes the selection) passed. The test now centres the selector with room both ways and checks a wheel up and down.

Checked on d477321:

  • Windows: dotnet build 0 warnings; dotnet test 310/310.
  • Linux (Arch container, distro SDK 10.0.112): build 0 warnings; dotnet test 310/310 twice.
**New commit after the passing re-review:** `d477321` (test only). My Linux check of `07a6456` failed `HeadlessTests.ViewsRenderAndInteractionsApplySettingsAndPopupActions` in 3 of 3 runs. With Linux fonts the window selector already fits in the viewport, so the page stays at offset 0 and the test's "wheel up scrolls up" assumption failed; the product behaviour (the wheel never changes the selection) passed. The test now centres the selector with room both ways and checks a wheel up and down. Checked on `d477321`: - Windows: `dotnet build` 0 warnings; `dotnet test` 310/310. - Linux (Arch container, distro SDK 10.0.112): build 0 warnings; `dotnet test` 310/310 twice.
Author
Owner

Agent review: pass on d477321943

Blocking

None.

Notes

  • PR body: "How it was tested" ends with checks on 07a6456. The head is now d477321, and its checks (Windows and Linux 310/310) are only in a comment. "Not verified: Linux rendering of the new panel" is also out of date after the Arch container checks of 73f79eb and d477321. Update the body before the squash merge so it describes what merges.
  • Issue #7: the PR closes it, but none of its checklist items are ticked. Tick the fixed ones and point item 5 at the answer on the issue, so the closed issue reads correctly.
  • src/FinalToken.Core/LimitEstimates.cs:43: the trim also applies to the current span. A stored sample whose reset is more than 15 minutes after the current reset gives a span that starts after the current start. It then cuts the current instance's end and its until, and the span itself is neither current nor past. Normal data does not do this, because newer instances have later resets. A reset that drifts back by more than 15 minutes would. Not a regression of this round. If you want to guard it, skip spans that start after the current start when trimming.
  • tests/FinalToken.App.Tests/HeadlessTests.cs:71: the offset is clamped to at least 80 px. If a later layout puts the selector less than 80 px from the top of the page, the InRange check on selectorY fails. That failure is loud, not a false pass, so this is fine as it is.

Checked

Commit d4773219432a9ad450f621d25ccca0abd29803bc. This is a re-review: the last failed agent review was on ab8d245. A later review passed 07a6456. Only the test commit d477321 came after it.

  • The blocking finding of ab8d245 is fixed. 15145f1 (D7 text) and 07a6456 take instance boundaries from resets, keep real past instances with their own samples and scale, and leave gaps unassigned. SessionGapKeepsTheReviewersMeasuredSessionAndItsOwnScale covers the reviewer's case (03:00 to 08:00, 10 % and 80 % kept, k = 0.2), and it passes.
  • Commits reviewed: git log -p --no-merges ^ab8d245 ^origin/master d477321, which gives 15145f1, 07a6456 and d477321. I also read the full LimitEstimates.cs at the head.
    • 07a6456: I traced the past-instance loop. A real span is taken whenever it reaches past the inferred start, so an inferred window never overlaps a real one. Windows of a day or less only walk the real spans. spans.Single is safe, because every observation within 15 minutes of the current reset joins group 0 first. Removing the top-8 builder leaves BreakdownTable as the only place that builds "Other". The App AGENTS.md line "eight rows plus expandable Other" still holds.
    • d477321 (test only): the wheel check no longer depends on font metrics. It centres the selector with at least 80 px of scroll room each way. It checks that the selector is in view and the offset is strictly inside the range, then checks that a wheel up and a wheel down each move the page and leave the selection at 1. That is stronger than the old one-direction check, and the product code is unchanged.
  • Read: the PR body and all comments, issues #5 and #7 with their comments, the three earlier agent reviews, the root AGENTS.md, docs/agents/review.md, the App, Core and App.Tests AGENTS.md, and D7 in docs/decisions.md. The PR carries type/decision, and the D7 edit came before the code.
  • Ran in a separate worktree at d477321, on Windows 11:
    • dotnet build FinalToken.slnx -c Release: 0 warnings, 0 errors.
    • dotnet test --solution FinalToken.slnx -c Release: 310 of 310 passed.
    • dotnet test --project tests/FinalToken.App.Tests -c Release twice more: 66 of 66 each time.
    • python -B tools/docs/check_docs.py: 0 errors.
  • Not verified here: Linux. The author's Arch container run of d477321 (310/310 twice) is the evidence for the Linux fix.
**Agent review: pass** on d4773219432a9ad450f621d25ccca0abd29803bc ## Blocking None. ## Notes - PR body: "How it was tested" ends with checks on `07a6456`. The head is now `d477321`, and its checks (Windows and Linux 310/310) are only in a comment. "Not verified: Linux rendering of the new panel" is also out of date after the Arch container checks of `73f79eb` and `d477321`. Update the body before the squash merge so it describes what merges. - Issue #7: the PR closes it, but none of its checklist items are ticked. Tick the fixed ones and point item 5 at the answer on the issue, so the closed issue reads correctly. - `src/FinalToken.Core/LimitEstimates.cs:43`: the trim also applies to the current span. A stored sample whose reset is more than 15 minutes after the current reset gives a span that starts after the current start. It then cuts the current instance's end and its `until`, and the span itself is neither current nor past. Normal data does not do this, because newer instances have later resets. A reset that drifts back by more than 15 minutes would. Not a regression of this round. If you want to guard it, skip spans that start after the current start when trimming. - `tests/FinalToken.App.Tests/HeadlessTests.cs:71`: the offset is clamped to at least 80 px. If a later layout puts the selector less than 80 px from the top of the page, the `InRange` check on `selectorY` fails. That failure is loud, not a false pass, so this is fine as it is. ## Checked Commit `d4773219432a9ad450f621d25ccca0abd29803bc`. This is a re-review: the last failed agent review was on `ab8d245`. A later review passed `07a6456`. Only the test commit `d477321` came after it. - **The blocking finding of `ab8d245` is fixed.** `15145f1` (D7 text) and `07a6456` take instance boundaries from resets, keep real past instances with their own samples and scale, and leave gaps unassigned. `SessionGapKeepsTheReviewersMeasuredSessionAndItsOwnScale` covers the reviewer's case (03:00 to 08:00, 10 % and 80 % kept, `k` = 0.2), and it passes. - **Commits reviewed:** `git log -p --no-merges ^ab8d245 ^origin/master d477321`, which gives `15145f1`, `07a6456` and `d477321`. I also read the full `LimitEstimates.cs` at the head. - `07a6456`: I traced the past-instance loop. A real span is taken whenever it reaches past the inferred start, so an inferred window never overlaps a real one. Windows of a day or less only walk the real spans. `spans.Single` is safe, because every observation within 15 minutes of the current reset joins group 0 first. Removing the top-8 builder leaves `BreakdownTable` as the only place that builds "Other". The App `AGENTS.md` line "eight rows plus expandable Other" still holds. - `d477321` (test only): the wheel check no longer depends on font metrics. It centres the selector with at least 80 px of scroll room each way. It checks that the selector is in view and the offset is strictly inside the range, then checks that a wheel up and a wheel down each move the page and leave the selection at 1. That is stronger than the old one-direction check, and the product code is unchanged. - **Read:** the PR body and all comments, issues #5 and #7 with their comments, the three earlier agent reviews, the root `AGENTS.md`, `docs/agents/review.md`, the App, Core and App.Tests `AGENTS.md`, and D7 in `docs/decisions.md`. The PR carries `type/decision`, and the D7 edit came before the code. - **Ran in a separate worktree at `d477321`, on Windows 11:** - `dotnet build FinalToken.slnx -c Release`: 0 warnings, 0 errors. - `dotnet test --solution FinalToken.slnx -c Release`: 310 of 310 passed. - `dotnet test --project tests/FinalToken.App.Tests -c Release` twice more: 66 of 66 each time. - `python -B tools/docs/check_docs.py`: 0 errors. - **Not verified here:** Linux. The author's Arch container run of `d477321` (310/310 twice) is the evidence for the Linux fix.
schmidt.florian added 1 commit 2026-10-15 18:48:19 +02:00
The developer saw reach dates, the dotted forecast and the popup
warning only for Claude. Codex had reset its week ten hours earlier
and stood at 39 %, ahead by 33 points, but D7 started forecasts only
after 10 % of a window, about 17 h of a week. The rule kept noise
out of quiet windows and hid the one warning that mattered.

Forecasts now also start as soon as a window is ahead, and until
they start the tile and the chart say when they will.

Refs #5
schmidt.florian added 1 commit 2026-10-15 18:58:09 +02:00
The reach date, the dotted forecast and the popup warning showed only
for Claude. Codex had reset its week ten hours before and stood at
39 %, ahead by 33 points, but every forecast shared a gate that
opened only after 10 % of the window. Nothing in the forecast paths
was provider-specific; Codex was just the window early in its week.

The gate now also opens as soon as the window is ahead, with the
configured threshold, so it never disagrees with the chip. Average,
recent and popup forecasts all use it. Until forecasts start, the
tile and the window chart say when they will.

Refs #5
Author
Owner

Agent review: pass on 33458a40ed

Blocking

None.

Notes

  • PR body: it ends with the checks on d477321 and does not mention round 5 (5b42cb8, 33458a4). The rounds 3 and 4 section still says "Forecasts start at 10 % of the window", which is now only half the rule. Update the body before the squash merge so it describes what merges, including the 321/321 run.
  • src/FinalToken.Core/LimitAnalysis.cs:19 and :25, src/FinalToken.Core/Pace.cs:10: production code now always passes the snapshot's pace, which uses the configured threshold. The pace = null defaults and the threshold = 10 overload of CanForecast are used only by tests. A later caller that leaves out the pace gets threshold 10 without any warning, which is the chip-versus-forecast mismatch this commit removes. Consider making pace required and keeping the threshold overload for tests only, or dropping it.
  • src/FinalToken.App/BurnUpChart.cs:75, Charts.cs:153, PanelWindow.cs:207: AverageUseAtReset now takes e from the snapshot's pace, but the gate and the start of the dotted line use the panel's now. Before, both used now. When the snapshot is old (the fixture shows "Updated 16 min ago", and a laptop that wakes up shows the last snapshot until the next refresh), the line starts at now but ends at the snapshot-time value. The tile and the chip use the same snapshot, so this is consistent with them. The gap is at most one refresh interval in normal use.
  • src/FinalToken.App/BurnUpChart.cs:17: the "Forecast from …" text gets a fixed colour, Ui.Colour("Muted", Ui.Dark(this)), when the chart initializes. Every other text uses Ui.Text with a resource binding. It works because PanelWindow rebuilds on a theme change. Ui.Text(waiting, 12, "Muted") with the alignment and margin set would match the rest.

Checked

Commit 33458a40ed76ab697d888233db06d1b758ce98cd. This is a re-review. The last failed agent review was on ab8d245. Later reviews passed 07a6456 and d477321, and two commits came after them: 5b42cb8 (D7 text) and 33458a4 (code).

  • The blocking finding of ab8d245 is still fixed. LimitEstimates.cs has not changed since 07a6456, and SessionGapKeepsTheReviewersMeasuredSessionAndItsOwnScale passes.
  • Commits reviewed: git log -p --no-merges ^ab8d245 ^origin/master 33458a4. Most of the weight is on 5b42cb8 and 33458a4, since the two passing re-reviews covered 15145f1, 07a6456 and d477321. I read Pace.cs and LimitEstimates.cs in full at the head.
  • Decisions: 5b42cb8 changes D7 before the code, keeps the decision, why and gives-up format, and records the cost (an early burst gives a reach date that moves). The PR carries type/decision. The code matches the new text:
    • CanForecast opens at 10 % elapsed, or when the pace's state is Ahead.
    • The projection in Pace.Calculate uses that state, so the configured threshold applies. The chip, the reach date, the popup's projection, the average and recent forecasts, the pace bar and the burn-up line all go through this one gate.
    • "Forecast from …" shows on the tile and the chart only while the gate is closed and its start lies ahead.
    • The App AGENTS.md line matches. No other doc names the old rule.
  • Edge cases I traced:
    • State Unknown or e = 0 gives no forecast.
    • A threshold of 0 or less gives Unknown, and Settings keeps it above 0.
    • At exactly the threshold the state is Ahead and forecasts start (tested).
    • At 10 % elapsed the start uses ticks (tested at −1 tick and at the boundary).
    • The popup hysteresis does not fire a second popup.
    • The changed TokenEstimateTests case now covers the 10 % boundary with an on-track window. The early-ahead case moved to EarlyForecastTests.
  • Tests: the new behaviour has tests:
    • Core: EarlyForecastTests, 8 cases.
    • The App view model with thresholds 10 and 40.
    • A headless check of the ahead Codex tile ("⚠", "100 % on"), the "Forecast from" note on the tile and the chart, the early popup, and the dotted forecast on one chart but not the other.
  • Read: the PR body and all comments, issues #5 (with the round 5 plan and report) and #7, the four earlier agent reviews, the root AGENTS.md, docs/agents/review.md, the App and Core AGENTS.md, and D7 in docs/decisions.md.
  • Ran in a separate worktree at 33458a4, on Windows 11:
    • dotnet build FinalToken.slnx -c Release: 0 warnings, 0 errors.
    • dotnet test --solution FinalToken.slnx -c Release: 321 of 321 passed.
    • python -B tools/docs/check_docs.py: 0 errors.
  • Looked at the headless captures forecast-1280x900-{Dark,Light}-{limits,windows}.png from this run. The ahead Codex tile shows the reach date with ⚠ and a recent forecast. Its burn-up has the dotted forecast and the 100 % marker. The early on-track window shows "Forecast from 16.10.2026 10:33" on both the tile and the chart, in both themes.
  • Not verified here: Linux, and the developer's live data.
**Agent review: pass** on 33458a40ed76ab697d888233db06d1b758ce98cd ## Blocking None. ## Notes - PR body: it ends with the checks on `d477321` and does not mention round 5 (`5b42cb8`, `33458a4`). The rounds 3 and 4 section still says "Forecasts start at 10 % of the window", which is now only half the rule. Update the body before the squash merge so it describes what merges, including the 321/321 run. - `src/FinalToken.Core/LimitAnalysis.cs:19` and `:25`, `src/FinalToken.Core/Pace.cs:10`: production code now always passes the snapshot's pace, which uses the configured threshold. The `pace = null` defaults and the `threshold = 10` overload of `CanForecast` are used only by tests. A later caller that leaves out the pace gets threshold 10 without any warning, which is the chip-versus-forecast mismatch this commit removes. Consider making `pace` required and keeping the threshold overload for tests only, or dropping it. - `src/FinalToken.App/BurnUpChart.cs:75`, `Charts.cs:153`, `PanelWindow.cs:207`: `AverageUseAtReset` now takes `e` from the snapshot's pace, but the gate and the start of the dotted line use the panel's `now`. Before, both used `now`. When the snapshot is old (the fixture shows "Updated 16 min ago", and a laptop that wakes up shows the last snapshot until the next refresh), the line starts at `now` but ends at the snapshot-time value. The tile and the chip use the same snapshot, so this is consistent with them. The gap is at most one refresh interval in normal use. - `src/FinalToken.App/BurnUpChart.cs:17`: the "Forecast from …" text gets a fixed colour, `Ui.Colour("Muted", Ui.Dark(this))`, when the chart initializes. Every other text uses `Ui.Text` with a resource binding. It works because `PanelWindow` rebuilds on a theme change. `Ui.Text(waiting, 12, "Muted")` with the alignment and margin set would match the rest. ## Checked Commit `33458a40ed76ab697d888233db06d1b758ce98cd`. This is a re-review. The last failed agent review was on `ab8d245`. Later reviews passed `07a6456` and `d477321`, and two commits came after them: `5b42cb8` (D7 text) and `33458a4` (code). - **The blocking finding of `ab8d245` is still fixed.** `LimitEstimates.cs` has not changed since `07a6456`, and `SessionGapKeepsTheReviewersMeasuredSessionAndItsOwnScale` passes. - **Commits reviewed:** `git log -p --no-merges ^ab8d245 ^origin/master 33458a4`. Most of the weight is on `5b42cb8` and `33458a4`, since the two passing re-reviews covered `15145f1`, `07a6456` and `d477321`. I read `Pace.cs` and `LimitEstimates.cs` in full at the head. - **Decisions:** `5b42cb8` changes D7 before the code, keeps the decision, why and gives-up format, and records the cost (an early burst gives a reach date that moves). The PR carries `type/decision`. The code matches the new text: - `CanForecast` opens at 10 % elapsed, or when the pace's state is Ahead. - The projection in `Pace.Calculate` uses that state, so the configured threshold applies. The chip, the reach date, the popup's projection, the average and recent forecasts, the pace bar and the burn-up line all go through this one gate. - "Forecast from …" shows on the tile and the chart only while the gate is closed and its start lies ahead. - The App `AGENTS.md` line matches. No other doc names the old rule. - **Edge cases I traced:** - State Unknown or `e = 0` gives no forecast. - A threshold of 0 or less gives Unknown, and Settings keeps it above 0. - At exactly the threshold the state is Ahead and forecasts start (tested). - At 10 % elapsed the start uses ticks (tested at −1 tick and at the boundary). - The popup hysteresis does not fire a second popup. - The changed `TokenEstimateTests` case now covers the 10 % boundary with an on-track window. The early-ahead case moved to `EarlyForecastTests`. - **Tests:** the new behaviour has tests: - Core: `EarlyForecastTests`, 8 cases. - The App view model with thresholds 10 and 40. - A headless check of the ahead Codex tile ("⚠", "100 % on"), the "Forecast from" note on the tile and the chart, the early popup, and the dotted forecast on one chart but not the other. - **Read:** the PR body and all comments, issues #5 (with the round 5 plan and report) and #7, the four earlier agent reviews, the root `AGENTS.md`, `docs/agents/review.md`, the App and Core `AGENTS.md`, and D7 in `docs/decisions.md`. - **Ran in a separate worktree at `33458a4`, on Windows 11:** - `dotnet build FinalToken.slnx -c Release`: 0 warnings, 0 errors. - `dotnet test --solution FinalToken.slnx -c Release`: 321 of 321 passed. - `python -B tools/docs/check_docs.py`: 0 errors. - **Looked at** the headless captures `forecast-1280x900-{Dark,Light}-{limits,windows}.png` from this run. The ahead Codex tile shows the reach date with ⚠ and a recent forecast. Its burn-up has the dotted forecast and the 100 % marker. The early on-track window shows "Forecast from 16.10.2026 10:33" on both the tile and the chart, in both themes. - **Not verified here:** Linux, and the developer's live data.
schmidt.florian merged commit adb8f5b88d into master 2026-10-15 19:06:05 +02:00
schmidt.florian deleted branch 5-panel-redesign 2026-10-15 19:06:09 +02:00
Sign in to join this conversation.