Skip to content

feat: interactive dashboard opens on Today, falls back to 7 days when today is empty - #1113

Merged
iamtoruk merged 1 commit into
mainfrom
feat/1111-default-today
Aug 23, 2026
Merged

iamtoruk merged 1 commit into
mainfrom
feat/1111-default-today

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Fixes #1111. Stacked on #1109 (base = perf/1107-progressive-cold; retarget as the stack merges).

Where the defaults actually lived

Only the CLI TUI defaulted to 7 days (src/main.ts report -p default). The desktop app and web dashboard already opened on Today — they only needed the fallback half. Menubar untouched.

Decision flow

  • TUI: auto mode only when -p came from the default source, no --day/--from/--to, and TTY. The probe is the today-slice of the parse the dashboard already runs inside withSinglePassParse (6-month declared range → slicing is free). Zero sessions today → open 7 Days. (A project-count probe was wrong — a project survived the slice on subagent anchors with 0 sessions; caught by measurement, probe counts sessions.)
  • Cold (perf: progressive cold start — paint the default 7-day view first, index the rest in the background #1107 progressive) interplay: painting 7d off a Today first-paint floor would show only 48h, so the empty-today cold case re-paints once on the 7d floor — pass-1 files come from the cache pass 1 just wrote, not a re-parse.
  • Period strip shows what actually opened ([ Today ] / [ 7 Days ]); keys 1-6 and every explicit selection win; app's persisted defaultPeriod preference always wins.
  • App/dash: one effect flips today→week on a first payload with 0 sessions, disarmed by any manual period change. No payload changes.

Parity (frozen 16.7k-file corpus, isolated caches, vs base)

12 command/flag combinations (report unset/-p today|week|month|30days/--day/--from--to, status --format menubar-json ×2, sessions, models, export): all identical (same /generated-only exception as #1105/#1108/#1109). Piped/non-TTY codeburn and all JSON defaults are byte-for-byte unmoved (still week).

Perf (real corpus, pty, time to first frame, median of 3)

scenario base branch
warm, data today 3617ms 3345ms
warm, today empty 3562ms 3452ms (falls back free)
cold, data today 4705ms 3604ms (−23%)
cold, today empty 4405ms 6747ms (+2.3s — the honest cost, paid only on empty cache AND an unused day)

Docs

README updated (2 lines + -p help). Website repo lines that need the same edit are listed in the report on the issue — separate repo, will follow up there.

Tests

tests/default-today-period.test.ts (5) + 2 app tests. CLI suite 234 files / 3195 green; app suite 41 files / 540 green; tsc clean in root, app/, dash/. No cache/payload/dep changes.

… when today is empty

The unset default opened on 7 days everywhere. It now opens on today and
only falls back to 7 days when today holds no sessions yet — the decision
is made from the today-scoped slice of the parse the first paint already
runs, so the probe costs a filter, not a second pass.

Explicit selections are untouched: -p/--period, --day, --from/--to, the
TUI period keys, the app's persisted default period, and every one-shot
(--format json, report/sessions/status, the piped non-TTY render) keep
the 7-day default they had.

Fixes #1111
@iamtoruk
iamtoruk changed the base branch from perf/1107-progressive-cold to main August 23, 2026 11:28
@iamtoruk
iamtoruk merged commit 2a53b85 into main Aug 23, 2026
15 checks passed
@iamtoruk
iamtoruk deleted the feat/1111-default-today branch August 23, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: default period Today across surfaces, falling back to 7d when today is empty

1 participant