uttrflow / uttrflow/uttrflow-swift
Insights never charts unless every day in the retention window has a dictation, and promises "Charts appear on" a weekday that never comes
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
Insights draws its charts only once dictations exist on at least 7 distinct days (`InsightsPresenter.daysBeforeCharting = 7`, `Sources/UttrflowUX/InsightsPresentation.swift:147`, checked at `:159`). Those days are counted from entries *inside the retention window* (`:156-158`), and the history store deletes anything older.
- Retention defaults to 7 days (`Settings.defaultRetentionDays`, `Sources/UttrflowSettings/SettingsStore.swift:118`). The window is 7 × 24 hours (`DictationRecord.survives`, `Sources/UttrflowHistory/DictationRecord.swift:54-57`), so it touches at most 8 calendar days, and charts need dictations on 7 of them. Skip any two days, a weekend for example, and the count cannot reach 7 until they have dictated on nearly every day for another week.
- Retention can be set to 1 or 3 days (`SettingsRetention.offeredDays`, `Sources/UttrflowUX/SettingsChoices.swift:108`). Those windows touch at most 2 or 4 calendar days, so Insights can never chart.
Meanwhile the empty state keeps promising a date:
- "Charts appear on " (`remaining(spoken:now:calendar:locale:)`, `:357-362`; its daylight-saving arithmetic is #615) assumes the missing days are dictated on consecutively and ignores retention. With 0 days spoken it adds exactly 7 days, which is **today's weekday**: on a Monday it says "Charts appear on Monday".
- The message says "Insights compare this week against your own baseline" (`:333-336`), but nothing on the charted page compares against a baseline (`Docs/ux-figures.md` removed the comparison on purpose).
- Once charted, the "Left as dictated" tile's meter is labelled "Now" (`:265`) although it is the whole window's figure.
## Why it matters
With default settings most people who dictate on workdays only will open Insights to "Not enough to chart yet … Charts appear on Friday" week after week, and Friday never comes. Someone who picked a short retention for privacy is shown a feature that cannot work for them, with a date.
## How to reproduce
In `InsightsPresentationTests`, build a snapshot with the default settings and entries on 5 weekdays of the last 7 days: `emptyState` is set and the trailing text names a weekday. Repeat with `transcriptRetentionDays: 3` and entries on every day: still empty. With no entries, `remaining` returns the current weekday.
## Acceptance criteria
- Insights shows something useful within the retention the user chose: for example chart once there are N days spoken within the window where N is at most the window, or chart from the first day with a note that the picture fills in (product call, hence `needs-info`).
- When the retention makes charting impossible, the empty state says so and links to Privacy settings rather than naming a weekday.
- The weekday line is dropped or correct (never today's weekday for "7 more days"); the "baseline" sentence and the "Now" label say what the page actually shows.
- Tests in `Tests/UttrflowUXTests/InsightsPresentationTests.swift` cover default retention with a gap day, a 1- and 3-day retention, and zero days spoken.
Contributor guide
Research direction
Start with Sources/UttrflowUX/InsightsPresentation.swift, especially InsightsPresenter.daysBeforeCharting and remaining(spoken:now:calendar:locale:), then read SettingsStore.swift and DictationRecord.swift for retention behavior. Run Tests/UttrflowUXTests/InsightsPresentationTests.swift using the listed gap-day, short-retention, and zero-day scenarios. Done means the empty state and labels match actual chart behavior and the acceptance cases are covered, after the product call is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- desktop, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100