Skip to content

v1.4.2 — precision pass (full audit)

Choose a tag to compare

@jayson-jia-dev jayson-jia-dev released this 20 Apr 13:29

Full audit of every data source, calculation, and derived display

Triggered by a user request to "find every remaining issue at once". Audited 10 subsystems; 4 fixes + 1 cleanup + 1 comment rewrite. All backed by the existing 7-case regression suite plus 4 new cases (11/11 green).

What changed

U-1 — calc_user_level now dedups by msg.id

The user-level scoring counted every assistant row as a separate message, so session-resume rewrites were inflating "median session length" 40-80%. Same seen_ids set now used there as in scan(). Scoring is honest again.

R-1 + R-2 — recalc_remote_cost removed entirely

Only recalculated total_cost but not per-day daily.cost, creating a permanent ~$4 gap between the menu header and Daily Details 合计 line. Also used a token-ratio approximation for per-model allocation instead of home-mac's exact per-message sum. Trust what each machine wrote; auto_update guarantees fleet-wide version convergence within 24h anyway.

Verified on real data: home-mac cost now shows $426.16 (was recalc'd to $430.45); fleet total $2,058.67 = $1,632.51 local + $426.16 remote exactly; Daily 合计 agrees with header to $0.02 (was off by $4.27).

S-2 — save_sync preserves per-day sessions field

Previously dropped when writing, so remote per-day session counts were lost from fleet views. Now passes through the merge.

M-2 — Pro-rated months_active for ROI math

Was max(days/30, 1) — users in their first 30 days got charged a full month in the savings/multiplier calculation. Now pro-rated with only a 1/30-day floor to keep division safe.

D-1 — Dashboard drops get("inp") + get("input_tokens") OR-trick

load_remotes now normalizes every field to scan()'s shape (inp/out/cw/cr), so there's one getter per field. Previous code only worked because remotes happened to lack short aliases.

C-1 — Stale comment in _file_fingerprints rewritten

Old text cited 'avoid double-count' reasoning from pre-dedup era. Replaced with current 'cache invalidation parity' explanation.

Tests

+4 cases (total 11/11 green):

  • test_remote_total_cost_not_recalculated
  • test_remote_daily_sum_matches_total_cost
  • test_remote_fields_normalized_to_scan_shape
  • test_level_uses_deduped_session_length

What this release does NOT change

  • User-visible cost numbers stay the same as v1.4.1 (no new pricing or token-source changes)
  • Consistency between menu sections is now exact where before it had small gaps
  • No breaking config or sync-file format changes

Audit artifacts

The full 10-subsystem audit and the decision rationale for each finding lives in the commit message.