fix: Lifetime period end to end in the desktop app and menubar labels

The desktop app's Life tab failed with 'invalid period': the renderer
and CLI both learned lifetime, but the electron IPC allowlist between
them did not. The menubar's period row also overflowed once Lifetime
joined it; labels compact to the desktop strip's forms (7D, 30D, 6M,
Life). Period selection is not persisted by raw value, so the label
change is safe. Follow-up worth doing: derive the IPC allowlist from
the renderer's period module so a new period cannot miss one layer of
three again.
This commit is contained in:
reviewer 2026-07-20 21:55:48 +02:00
parent ae1d1c026b
commit bc1998e63a
2 changed files with 8 additions and 5 deletions

View file

@ -133,7 +133,7 @@ function configSourceArgs(source: string | null): string[] {
// Renderer-supplied strings become argv, so reject anything that could smuggle a
// flag or shell metacharacter before it reaches the CLI. Thrown from the argv
// builders, these surface through the same error envelope as any CliError.
const PERIODS = new Set(['today', 'week', '30days', 'month', 'all'])
const PERIODS = new Set(['today', 'week', '30days', 'month', 'all', 'lifetime'])
function vPeriod(period: string): string {
if (!PERIODS.has(period)) throw new CliError('bad-args', 'invalid period')
return period

View file

@ -1502,12 +1502,15 @@ enum InsightMode: String, CaseIterable, Identifiable {
}
enum Period: String, CaseIterable, Identifiable {
// Compact labels: six segments plus the calendar button share one narrow
// popover row, so the longer names ("6 Months", "Lifetime") wrapped.
// Matches the desktop app's strip (Today / 7D / 30D / Month / 6M / Life).
case today = "Today"
case sevenDays = "7 Days"
case thirtyDays = "30 Days"
case sevenDays = "7D"
case thirtyDays = "30D"
case month = "Month"
case all = "6 Months"
case lifetime = "Lifetime"
case all = "6M"
case lifetime = "Life"
var id: String { rawValue }