mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-24 16:04:34 +00:00
Issue #767 item 3 reports two different active-day counts on one dashboard screen: the Daily Activity panel shows "of 37" (from a bounded live scan of surviving session files) while the same period's headline can reflect more days via the durable daily cache, which also counts days whose session files have since expired. Each count is correct for what it measures - the panel intentionally scans a fixed six-month window independent of the selected period tab so scrolling always works, while the headline is scoped to the active period tab. Re-deriving the panel's count from the durable series was considered and rejected: it would need a second buildDurablePeriod call scoped to six months independent of the period tab, which is a behavior and perf change, not polish. Kept the count unchanged and instead labelled the denominator - dailyActivityFooter (src/dashboard.tsx) now renders "of N days scanned" instead of a bare "of N", so the panel reads as "here's what the live scan covered" rather than as a contradiction of the headline. Checked the Optimize view's similar "Showing X-Y of Z" footer (line ~794): it counts findings, not days, and isn't part of this ambiguity. Also fixes an adjacent gap found while investigating: overview.ts's non-interactive report already had a footnote for durable-cache carry-forward ("includes $X preserved from expired session logs") when carriedCostUSD > 0; the interactive dashboard's Overview panel had no equivalent, so a headline that included carried-forward cost had no explanation anywhere on screen. Extracted the wording as carriedCostNote (format.ts) and surfaced carriedCostUSD through DurableOverview so the TUI shows the same footnote. This is separate from the active-day-count fix above - it explains cost carry-forward, not day counts. Fixes getagentseal/codeburn#767 (item 3).
20 lines
928 B
TypeScript
20 lines
928 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
|
|
import { carriedCostNote } from '../src/format.js'
|
|
|
|
// Issue #767 item 3: the dashboard TUI's Daily Activity panel counts active
|
|
// days from a bounded live scan while the Overview headline (durable cache)
|
|
// can include cost from days whose session files have since expired. The two
|
|
// numbers are each internally consistent but read as a contradiction with no
|
|
// explanation. overview.ts already has a footnote for exactly this case
|
|
// ("includes $X preserved from expired session logs"); this helper is the
|
|
// shared, testable piece of that same wording so dashboard.tsx can reuse it.
|
|
describe('carriedCostNote', () => {
|
|
it('is null when nothing was carried forward', () => {
|
|
expect(carriedCostNote(0)).toBeNull()
|
|
})
|
|
|
|
it('explains carried cost when present', () => {
|
|
expect(carriedCostNote(1.23)).toBe('includes $1.23 preserved from expired session logs')
|
|
})
|
|
})
|