Skip to content

Release v1.9.2 - #71

Merged
sriinnu merged 3 commits into
mainfrom
fix/deep-rescan-guard-today-chart
Jul 15, 2026
Merged

Release v1.9.2#71
sriinnu merged 3 commits into
mainfrom
fix/deep-rescan-guard-today-chart

Conversation

@sriinnu

@sriinnu sriinnu commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Automated release v1.9.2. Deep-rescan sealed-day guard, today hourly chart (web), bar chart styles, codex/codex-desktop exact model attribution. 4-agent adversarial review applied. CI checks may show red on Actions billing, not code.

https://claude.ai/code/session_018Z5f5vrUcHM17HXg46gy7p

sriinnu added 3 commits July 15, 2026 16:35
…hourly chart on web

- rebuildRecentWindow now consults shouldKeepSealedDay: a sealed day is only
  replaced when the rebuild carries at least as much data, day total AND per
  provider bucket. Raw JSONL aging out / cleanup / a truncated read can no
  longer permanently shrink history (the 2026-07-12 incident; by today the
  unguarded path would have taken 4 more days, 2.4B tokens). force=true
  (threaded through rebuildRecentDays and /api/rescan?force=true) stays as
  the explicit override for parser-fix rescans.
- codex parser + readJsonlFile surface per-file fail-soft read errors via a
  new ScanFilterOptions.onWarning sink -> provider warnings, so gap-fill and
  rebuilds know a scan was partial instead of trusting a truncated result.
- gap-fill never seals days before the gap from a fresh-mtime multi-day
  file's partial slice; interior holes stay open for an explicit rescan.
- model summaries use the exact per-project (provider, model) cross-cut on
  the unfiltered path; even-split only remains as a fallback for
  pre-enrichment day files (fixes codex + codex-desktop showing identical
  fractional half-token rows for a shared model).
- web: "Today, hour by hour" panel - 24-bar hourly cost chart with custom
  hover tooltip (cost/tokens/records/top model), current-hour marker, and a
  whole-series switch to tokens when the day has no priced usage. "Today" is
  only labeled today when the entry's date matches the local calendar date.
- web: ensure-summary prefers the live daemon, accepts the summary cache only
  if scanned today, rescans otherwise - static builds can't bake stale data.
- tests: sealed-day guard end-to-end against a real codex fixture corpus,
  per-provider no-shrink contract, gap-fill interior-hole regression, exact
  model attribution parity.

Claude-Session: https://claude.ai/code/session_018Z5f5vrUcHM17HXg46gy7p

Bar (follow-up in same session):
- LAST 7 DAYS chart style is now user-selectable (line / bars / area) via a
  segmented picker in the settings popover, persisted as bar.weekChartStyle
  in config.json with schema parity in config-service.ts.
- ModelUsage rows are keyed by provider::model — the same model under two
  providers (codex + codex-desktop) no longer collides in SwiftUI identity
  and renders the first provider's cost twice.
- HubUserConfig strict decode now tolerates configs from before
  antigravityLivePolling / providerPaths existed (fixes the two failing
  HubConfigDecodeTests).

Post-review hardening (4-agent adversarial review of this diff):
- gap fill aborts only on whole-provider crashes: per-file fail-soft faults
  are tagged partial and no longer block sealing forever (one bad iCloud/
  EACCES file would have starved the gap until its days aged out)
- forced deep rescan refuses to shrink a sealed day for a provider that hit
  a truncated read during that rebuild
- shouldKeepSealedDay also guards cost: identical tokens at lower cost
  (kosha offline mid-rescan) keeps the sealed day
- provider warnings are replaced per refresh/rescan cycle instead of
  accumulating one duplicate per 12s tick in the warm daemon
- claude-code parser + readJsonlFileFromOffset wired into the onWarning
  fail-soft channel (was codex-only)
- SUMMARY_CACHE_VERSION 2 -> 3 so cached even-split model rows rebuild
- model-cost cross-cut requires a COMPLETE per-day bucket set (recordCount
  parity) before trusting it, else falls back per-day
- removed two literal NUL bytes from aggregates.ts doc comments that made
  git treat the file as binary (and corrected the composite-key claim)
- ensure-summary applies the scanned-today gate to daemon responses too
  (the daemon 200s a stale cache fallback when its own scan fails)
- today panel: top-model ranks cost-then-tokens (no mixed-unit weight),
  all-unpriced days fall back to token ranking with honest labeling,
  missing hourly records show an explicit unavailable state, tooltip
  anchors to container edges at hours 0-2/21-23
- bar: strict config decode now clamps refreshSeconds/scanIntervalSeconds
  (legacy files reached the unclamped path after the optional widening);
  duplicate model names render a small provider label to disambiguate
Copilot AI review requested due to automatic review settings July 15, 2026 14:41
@sriinnu
sriinnu merged commit f676ed2 into main Jul 15, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Automated release PR for v1.9.2, focused on preventing sealed-history shrink regressions in the core relay pipeline, improving “today” correctness and freshness in the web dashboard/build, and enhancing macOS bar configurability and model/provider attribution.

Changes:

  • Core: add sealed-day no-shrink guard (with force override) + surface per-file partial-scan warnings to prevent silent truncation from overwriting sealed history.
  • Web: add “Today, hour by hour” panel + ensure “today” is truly local-today; prevent static builds from baking stale summaries.
  • macOS bar: add 7‑day chart style setting + fix duplicate model/provider row identity and labeling; bump versions/docs for release.

Reviewed changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/release.sh Include README.md in the release commit staging set.
scripts/bump-version.sh Update README release badge during version bumps.
README.md Add release badge for v1.9.2.
packages/web/src/pages/dashboard/DashboardOverviewSection.tsx Add “Today, hour by hour” dashboard panel wiring.
packages/web/src/pages/dashboard/buildDashboardInsights.ts Add today/hourly insight shaping and ensure “today” matches local date.
packages/web/src/charts/TodayHourlyChart.tsx New 24-hour bar chart component with custom tooltip.
packages/web/scripts/ensure-summary.ts Prefer daemon summary and gate cached summary to “scanned today”; otherwise rescan.
packages/web/package.json Bump web package version to 1.9.2.
packages/tui/package.json Bump TUI package version to 1.9.2.
packages/tokmeter/package.json Bump main package version to 1.9.2.
packages/mcp/src/daemon/server.ts Add ?force=true option to deep rescan API call into core.
packages/mcp/package.json Bump MCP package version to 1.9.2.
packages/macos-bar/Sources/TokmeterBar/SettingsPopover.swift Add segmented picker for 7-day chart style (persisted config).
packages/macos-bar/Sources/TokmeterBar/Models.swift Fix SwiftUI row identity to include provider + model.
packages/macos-bar/Sources/TokmeterBar/HubSettings.swift Read antigravity polling via nil-safe computed config property.
packages/macos-bar/Sources/TokmeterBar/HubConfigStore.swift Add WeekChartStyle, nil-safe defaults, config sanitization, and decode-tolerant schema changes.
packages/macos-bar/Sources/TokmeterBar/DataSections.swift Show provider for ambiguous duplicate model names; render week chart by configured style.
packages/macos-bar/bundle.sh Bump CFBundleVersion default (build number).
packages/core/src/types.ts Add ScanWarning.partial and ScanFilterOptions.onWarning hook.
packages/core/src/tokmeter-core.ts Prevent warning accumulation; add force to rebuildRecentDays; replace provider/history warnings per cycle.
packages/core/src/summary-cache.ts Bump summary cache schema version to 3.
packages/core/src/scan-pipeline.ts Thread onWarning through parser scans as provider partial warnings.
packages/core/src/relay-loader.ts Add sealed-day guard integration + gap-fill rules + forced rescan behavior handling for partial providers.
packages/core/src/relay-loader.test.ts Add regression tests for sealed-day guard and pre-gap sealing behavior.
packages/core/src/parsers/utils.ts Add optional error callbacks to JSONL readers to distinguish empty vs read-failed tails/files.
packages/core/src/parsers/codex.ts Surface per-file truncation/read faults via onWarning so rebuilds know scans are partial.
packages/core/src/parsers/claude-code.ts Propagate read faults via onWarning in append/full reads.
packages/core/src/config-service.ts Add persisted bar.weekChartStyle config with normalization + defaults.
packages/core/src/aggregate-migration-parity.test.ts Add parity test for exact (provider, model) attribution when model names overlap.
packages/core/src/aggregate-consumers.ts Prefer per-project cross-cut buckets for exact model cost attribution; fall back only when incomplete.
packages/core/package.json Bump core package version to 1.9.2.
packages/cli/package.json Bump CLI package version to 1.9.2.
CHANGELOG.md Add v1.9.2 release notes covering the fixes/additions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +142 to +146
import { mkdirSync, writeFileSync } from "node:fs";
import { type DailyAggregate, shouldKeepSealedDay } from "./aggregates.js";
import { rebuildRecentWindow } from "./relay-loader.js";
import type { ScanWarning } from "./types.js";

@sriinnu
sriinnu deleted the fix/deep-rescan-guard-today-chart branch September 9, 2026 13:14
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.

2 participants