mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 02:39:13 +00:00
* sessions: attribute PR spend per turn instead of per session The by-PR surfaces attributed a session's full cost to every PR it referenced, so one orchestration session that touched many PRs rendered identical full-session rows. Capture per-turn PR references during transcript parsing and attribute each turn's cost to the PR set active at that turn (split evenly across a multi-PR merge-sweep turn), carrying the most recent PR set forward across turns that reference nothing. Turns before the first reference form an unattributed bucket. A session whose transcript expired before per-turn capture keeps its session-level prLinks but has no per-turn refs; it falls back to an even whole-session split, and any row carrying such a portion is flagged approximate. Rows are now summable: the CLI and app footers report the attributed sum plus the unattributed remainder instead of a distinct-session total. Bumps the session cache version so surviving transcripts re-parse and populate the new per-turn field. Daily-cache versioning is untouched. * sessions: harden PR attribution and add models + category breakdown Addresses the review findings on the per-turn PR attribution and adds the model and task-category surfaces. Correctness: - Cache migration: the 5 -> 6 session-cache bump now adopts the prior v5 file's expired-source PR entries instead of abandoning them, and the claude scan preserves and surfaces PR-bearing orphans, so a session whose transcript was deleted still appears as a legacy even-split instead of vanishing. The daily cache is untouched. - Date-range carry: the parser captures the PR set active at the start of the in-range turn slice and seeds the state machine with it, so a PR referenced before the window still owns its later, in-range, ref-less turns instead of the session falling back to a whole-session approx split. - Calls are split across a multi-PR turn by largest-remainder, keeping per-PR counts whole (a 1-call, 2-PR turn no longer renders as 2 calls). - The CLI and app footers reconcile to the rounded row values actually shown. - Distinct sessions are keyed by project + sessionId, not sessionId alone. - The app tolerates an older by-reference payload (no attributedCost): it keeps the old non-summable footer and never renders NaN. Features: - Each PR contribution records the models of its calls and the turn's task category (split by the same share on a multi-PR turn); legacy even-split rows carry the model union but no category breakdown. - Payload rows gain models (short names, cost-desc) and categories (label + cost, cost-desc, omitted when empty); the payload gains otherPrCount/otherPrCost for the PRs beyond the sent top 20. - CLI --by-pr gains a Models column. The desktop table is now full-width with a Models column and click-to-expand rows showing a per-category cost breakdown with proportional bars, keyboard accessible, with an "Other (N more PRs)" row when capped. Tests: state-machine seed/models/categories/largest-remainder/dedup, the prRefs round-trip through the real incremental-append path (continuation + straddle), v5 adoption of an expired PR session, payload round-trip, and the desktop expansion/models/old-payload cases. * sessions: reconcile mixed PR rows, harden v5 adoption, bound models Round-2 review follow-ups. - Mixed legacy/live category breakdown: a PR row that combines an expired legacy contribution (even-split, no turn data) with a live per-turn contribution now emits an explicit "Legacy estimate (no per-turn detail)" category carrying the legacy share, so the expansion reconciles to the row cost instead of silently dropping it. A legacy-only row still shows no breakdown. - v5 adoption is now per cached file: one malformed entry is skipped instead of rejecting the whole v5 cache and dropping every valid expired PR session. - The desktop "Other (N more PRs)" line moved to the table footer as a muted, separated summary rather than a sorted row. - Row expansion resets when the PR set changes (period/provider/data), so a stale expansion cannot linger on a row that is gone. - Payload models per row are capped to the top 4 by attributed cost, with a name-ascending tie-break; categories get the same stable tie-break. Tests: mixed live+legacy reconciliation, legacy-only omission, model cap and tie-break, corrupt-plus-valid v5 adoption, and the desktop expansion-reset. * session-cache: validate optional agentType and failed during v5 adoption; app: reset PR expansion on period switch A v5 entry that was valid except for a malformed optional field (agentType, failed) passed per-file validation and flowed downstream as a non-string. The expansion reset keyed only on the row URL set, so a period switch that returned the same PRs kept a stale expansion open over changed numbers. --------- Co-authored-by: reviewer <review@local> |
||
|---|---|---|
| .. | ||
| fixtures | ||
| providers | ||
| security | ||
| setup | ||
| sharing | ||
| act-journal.test.ts | ||
| act-model-defaults.test.ts | ||
| act-report.test.ts | ||
| act-undo.test.ts | ||
| antigravity-statusline.test.ts | ||
| audit-report.test.ts | ||
| bash-commands.test.ts | ||
| blob-to-text.test.ts | ||
| budget.test.ts | ||
| cache-persistence-coldstart.test.ts | ||
| cache-refresh-lock-process.test.ts | ||
| cache-refresh-lock.test.ts | ||
| classifier.test.ts | ||
| cli-budget.test.ts | ||
| cli-date.test.ts | ||
| cli-deepseek-v4-pricing.test.ts | ||
| cli-devin-model-variants.test.ts | ||
| cli-durable-totals.test.ts | ||
| cli-emitters.test.ts | ||
| cli-export-date-range.test.ts | ||
| cli-json-daily.test.ts | ||
| cli-model-savings.test.ts | ||
| cli-plan.test.ts | ||
| cli-price-override.test.ts | ||
| cli-provider-validation.test.ts | ||
| cli-proxy-path.test.ts | ||
| cli-settings-json.test.ts | ||
| cli-status-menubar.test.ts | ||
| codex-cache-invalidation.test.ts | ||
| codex-credits.test.ts | ||
| codex-rich-capture.test.ts | ||
| compare-stats.test.ts | ||
| content-utils.test.ts | ||
| currency-rounding.test.ts | ||
| daily-cache-carry-forward.test.ts | ||
| daily-cache.test.ts | ||
| dashboard.test.ts | ||
| date-range-filter.test.ts | ||
| day-aggregator-savings.test.ts | ||
| day-aggregator.test.ts | ||
| defer-plans.test.ts | ||
| devices-json.test.ts | ||
| doctor.test.ts | ||
| export.test.ts | ||
| fetch-utils.test.ts | ||
| format-mark-estimated.test.ts | ||
| fs-utils.test.ts | ||
| granular-history.test.ts | ||
| guard-hooks.test.ts | ||
| guard-install.test.ts | ||
| hydration-interrupt-convergence.test.ts | ||
| kiro-cache-invalidation.test.ts | ||
| local-model-savings.test.ts | ||
| mcp-coverage.test.ts | ||
| mcp-deferral.test.ts | ||
| mcp-redact.test.ts | ||
| mcp-server.test.ts | ||
| mcp-tables.test.ts | ||
| menubar-carried-headline.test.ts | ||
| menubar-installer.test.ts | ||
| menubar-json.test.ts | ||
| menubar-report-parity.test.ts | ||
| menubar-savings.test.ts | ||
| minimax.test.ts | ||
| model-breakdown.test.ts | ||
| model-efficiency.test.ts | ||
| models-hoist.test.ts | ||
| models-report.test.ts | ||
| models.test.ts | ||
| optimize-apply.test.ts | ||
| optimize-fs.test.ts | ||
| optimize-zero-edit-savings.test.ts | ||
| optimize.test.ts | ||
| otel-cache-aggregation.test.ts | ||
| overview.test.ts | ||
| parser-advisor-usage.test.ts | ||
| parser-antigravity-timestamp.test.ts | ||
| parser-cache-refresh-timeout.test.ts | ||
| parser-claude-cwd.test.ts | ||
| parser-compact-entry.test.ts | ||
| parser-estimated-cost.test.ts | ||
| parser-filter.test.ts | ||
| parser-gemini-cache.test.ts | ||
| parser-hydration-lock.test.ts | ||
| parser-incremental-append.test.ts | ||
| parser-large-json-scanner-parity.test.ts | ||
| parser-large-json-scanner.test.ts | ||
| parser-large-session.test.ts | ||
| parser-local-savings.test.ts | ||
| parser-mcp-inventory.test.ts | ||
| parser-number-helpers.test.ts | ||
| parser-proxy-codex-only.test.ts | ||
| parser-proxy-merge.test.ts | ||
| parser-proxy-pricing.test.ts | ||
| parser-rich-capture.test.ts | ||
| parser-single-pass-scanner.test.ts | ||
| parser-skip-line.test.ts | ||
| parser-subagent-collection.test.ts | ||
| parser.test.ts | ||
| plan-usage.test.ts | ||
| plans.test.ts | ||
| pricing-fallback-data.test.ts | ||
| provider-registry.test.ts | ||
| provider-turn-grouping.test.ts | ||
| quota.test.ts | ||
| scan-progress.test.ts | ||
| session-cache-rich-capture.test.ts | ||
| session-cache-v5-adoption.test.ts | ||
| session-cache.test.ts | ||
| sessions-by-branch.test.ts | ||
| sessions-by-pr.test.ts | ||
| sessions-report.test.ts | ||
| spend-flow.test.ts | ||
| sync-e2e.test.ts | ||
| sync-headless-e2e.test.ts | ||
| sync-infra-e2e.test.ts | ||
| sync-ledger-otlp.test.ts | ||
| sync-push.test.ts | ||
| sync.test.ts | ||
| token-estimate.test.ts | ||
| usage-aggregator.test.ts | ||
| web-dashboard.test.ts | ||
| workflow-insights.test.ts | ||
| yield-overlap-attribution.test.ts | ||
| yield-repo-grouping.test.ts | ||
| yield.test.ts | ||