Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
ccedf40
feat(stats): define usage event and message contracts
k1yt Jul 18, 2026
4e31639
feat(stats): add append-only local usage store and aggregation
k1yt Jul 18, 2026
bf866f5
feat(stats): record final usage for each API attempt
k1yt Jul 18, 2026
1c3946c
fix(types): prefix unused destructured vars with underscore in usage-…
Aug 2, 2026
e1cd226
fix: add Task.usage-stats.spec.ts to eslint-suppressions for no-expli…
Aug 2, 2026
59a5241
feat(usage): add usage aggregation service
Jul 29, 2026
a62c8e9
feat(usage): add costRecalculation module and tests from B15 source
Aug 2, 2026
4c57443
fix(types): remove non-existent task-organization export from index.ts
Aug 2, 2026
82f36ee
fix(types): replace any with proper typed casts in Task.usage-stats.s…
Aug 2, 2026
4890096
fix(ci): strip BOM from costRecalculation files and fix qwen-code pri…
Aug 2, 2026
4377751
fix(ci): prune stale eslint suppressions after rebase onto b13
Aug 2, 2026
b2fc91e
feat(usage): add usage aggregation service
Jul 29, 2026
a0c8d98
feat(stats): add usage capture — provider deltas, Task finalization, …
Jul 29, 2026
4a1e74b
fix(types): resolve all TS errors from B15 cherry-pick - cast any to …
Aug 2, 2026
f90bd90
fix(stats): restore base behaviors clobbered by B15 cherry-pick
Aug 2, 2026
a5a38f2
fix(types): remove non-existent task-organization export from index.ts
Aug 2, 2026
98688b1
fix(stats): add rootTaskId and endpoint to CSV export columns
Aug 3, 2026
4bc5cce
fix(stats): add rootTaskId to UsageEventV1 schema for CSV export
Aug 3, 2026
721573c
fix(stats): extract endpoint domain for MiMo provider
Aug 3, 2026
ec300b4
feat(usage): add usage aggregation service
Jul 29, 2026
8419378
feat(stats): expose stats query export and clear handlers
k1yt Jul 18, 2026
5b34966
feat(stats): add slash entry and statistics webview
k1yt Jul 18, 2026
494856a
fix(stats): resolve blockers B1/B2/B3 and highs H1/H3
k1yt Jul 19, 2026
d12f355
feat(stats): add autocomplete entry and time-axis groupBy in UI
k1yt Jul 19, 2026
fcffc44
test(stats): add coverage tests for UsageStatsService, UsageHeatmap, …
k1yt Jul 19, 2026
e0dbb8d
i18n(stats): add translations for 17 languages
k1yt Jul 19, 2026
a4d828e
fix(i18n): remove BOM from package.nls.ca.json
k1yt Jul 19, 2026
a2cfc8b
fix(i18n): remove BOM from all package.nls locale files
k1yt Jul 19, 2026
2e6a071
fix(i18n): restore missing opening brace in all package.nls locale files
k1yt Jul 19, 2026
17eb5cf
i18n(stats): apply CodeRabbit translation review fixes (de, fr, vi, z…
k1yt Jul 19, 2026
2916356
refactor(stats): convert all Korean comments to English
k1yt Jul 19, 2026
55cfdbc
feat(dashboard): remove /stats command and add Dashboard sidebar entry
k1yt Jul 19, 2026
23fc9b1
feat(dashboard): add DashboardView with summary, time range, and brea…
k1yt Jul 19, 2026
0f54a66
feat(dashboard): add session list with titles and model/provider filters
k1yt Jul 19, 2026
0874752
feat(dashboard): add session detail with expandable API call list
k1yt Jul 19, 2026
1dc67f1
feat(dashboard): add translations for all 17 languages
k1yt Jul 19, 2026
4cb24b8
test(stats): remove stale 'stats' command test assertions
k1yt Jul 19, 2026
2f6876c
refactor(dashboard): remove orphaned StatsView, i18n relative time, e…
k1yt Jul 19, 2026
2a78f06
feat(dashboard): default Custom date range to yesterday-today
k1yt Jul 19, 2026
03838b7
feat(dashboard): compute missing costs at query time and fix session …
k1yt Jul 19, 2026
26f0d50
feat(dashboard): add usage dashboard with mode column, multi-model ag…
k1yt Jul 20, 2026
8b7dd32
feat(heatmap): blue gradient 6 levels, white borders, and 221 new tests
k1yt Jul 20, 2026
56dd2f1
feat(dashboard): responsive heatmap, 30d/60d/120d/360d ranges, CI fix…
k1yt Jul 20, 2026
b4c515c
feat(stats): make UsageHeatmap self-fetching for independent range se…
k1yt Jul 20, 2026
e7e05bd
test(stats): add comprehensive DashboardView test suite for codecov p…
k1yt Jul 20, 2026
1599b21
fix(stats): remove unused variables in DashboardView.spec.tsx to fix …
k1yt Jul 20, 2026
14c1d80
fix(stats): correct totalTokens calculation, provider pricing, and da…
k1yt Jul 20, 2026
b5fab1d
fix(stats): remove day axis from breakdown groupBy to eliminate dupli…
k1yt Jul 20, 2026
e9948fb
feat(stats): add endpoint domain extraction for provider identificati…
k1yt Jul 20, 2026
0ec9c5c
fix(stats): update MiMo pricing, remove session filters, add NDJSON c…
k1yt Jul 21, 2026
6b384de
feat(dashboard): add multi-window refresh, cache ratio estimation, an…
k1yt Jul 24, 2026
bfc5f87
fix(stats): pass all CI checks after rebase onto main
k1yt Jul 24, 2026
aa3d304
fix(dashboard): remove unknownEventCount display and utility scripts
k1yt Jul 24, 2026
9fad1e5
fix(ci): pass test:coverage
k1yt Jul 24, 2026
18bcde8
fix(ci): revert e2e timeout + add coverage tests
k1yt Jul 24, 2026
b842006
fix(stats): add totalCost to provider streams and fix TaskOrganizatio…
Jul 27, 2026
68010ec
feat(stats): distribute dashboard streaming code to feature/local-usa…
Jul 30, 2026
43685e1
fix(stats): store day buckets in local timezone and add v2 migration
Jul 30, 2026
baed01a
perf(stats): serve dashboard snapshots from rollup tables instead of …
Jul 30, 2026
c58c96c
fix(stats): heatmap values now use tokens instead of cost (R3) and UI…
Jul 30, 2026
b3d3ac1
fix(stats): DST-correct startOfDay by evaluating offset at target mid…
Jul 30, 2026
59617d9
fix(stats): use daily rollups for date-bounded breakdown queries inst…
Jul 30, 2026
bca8cc2
fix(stats): rebuild rollup tables from usage_events when derived tabl…
Jul 31, 2026
157ad3d
chore: remove non-functional files (debug tests, session docs, temp f…
Jul 31, 2026
d464f68
feat(dashboard): add loading indicator during preset range transitions
Jul 31, 2026
daf2ee9
fix(dashboard): resolve infinite loading by clearing loading on error…
Jul 31, 2026
f36de21
feat(stats): optimize dashboard streaming performance with fast path …
Jul 31, 2026
6d40dc6
feat(stats): support uncachedInputTokens in rollup tables for dynamic…
Jul 31, 2026
945cafe
fix(dashboard): add ErrorBoundary, fix stale mocks, fix ESLint errors
Jul 31, 2026
3fbc59d
fix(stats): use raw usage_events for rollup staleness detection inste…
Aug 1, 2026
feeec5a
fix(stats): make rollup rebuild non-blocking with setImmediate and us…
Aug 1, 2026
c4131c0
fix(dashboard): prevent race condition in subscription epoch check us…
Aug 1, 2026
20a503e
fix(stats): fix inverted timezone offset sign and add v4 migration - …
Aug 1, 2026
ecafaa1
fix(types): resolve all TS errors from B16 cherry-pick - eslint-disab…
Aug 2, 2026
3d12d47
fix(stats): resolve CI failures after rebase onto B15
Aug 2, 2026
5fd2b5c
fix(task): restore task.run() in scheduleTask to fix subtask timeout
Aug 2, 2026
a774633
test(stats): scale perf shape tests to sizes that fit CI coverage budget
Aug 2, 2026
f2a8574
test(stats): remove empty dashboardStatsStreaming integration spec
myk1yt Aug 2, 2026
6a327e0
fix(stats): resolve DB WAL lock leak, CSV export fields, and Dashboar…
Aug 3, 2026
ecf4980
fix(mimo): restore full mimo.ts with strict tool schema and parallel …
Aug 3, 2026
ef8fa6a
fix(mimo): convert tools for OpenAI in MimoHandler
Aug 3, 2026
0c6da1b
feat(dashboard): add History-first task catalog and rename Sessions t…
Aug 3, 2026
4edaa60
feat(stats): add task-level SQLite usage projection
Aug 3, 2026
23822ef
feat(stats): add task projection and shared IPC contracts
Aug 3, 2026
be7bf22
feat(stats): wire task projection into provider, service, and stream
Aug 3, 2026
dccbc2d
feat(dashboard): rename SessionList to TaskList and update locale keys
Aug 3, 2026
843a448
fix(tests): repair CI-blocking spec failures
Aug 3, 2026
725dd0e
fix(task-persistence): reconcile delegation state after globalState m…
Aug 3, 2026
610d190
fix(stats): clear SQLite projection on clearStats
Aug 3, 2026
16ebb28
fix(stats): record rootTaskId at usage capture sites
Aug 3, 2026
7dd3579
fix(stats): semantics-aware uncached input in rollups
Aug 3, 2026
e7f0483
fix(stats): flip legacy timezone offset sign during NDJSON migration
Aug 3, 2026
710311f
fix(stats): remove dead getDashboardStats message and unsubscribe str…
Aug 3, 2026
2db27ca
fix(stats): remove duplicate CSV rootTaskId/endpoint columns and case…
Aug 3, 2026
549f9b1
feat(stats): apply dashboard date range to tasks list membership, fig…
Aug 3, 2026
7416b14
test(stats): add getCoordinator mock to usage stats routing spec for …
Aug 3, 2026
e86bcad
fix(dashboard): tolerate legacy sessions-shaped snapshots in stream r…
Aug 4, 2026
75ef5e2
fix(dashboard): render Tasks rows by giving Virtuoso a definite cappe…
Aug 4, 2026
5afc7ea
fix(dashboard): stop infinite resync spinner on repeated preset clicks
Aug 4, 2026
00098b7
feat(stats): group dashboard tasks under root tasks with expandable s…
Aug 4, 2026
80333c3
test(stats): add childrenByParentId to task-page handler catalog mocks
Aug 4, 2026
9a76613
chore: remove docs contamination
Aug 4, 2026
642965b
fix(stats): use bulkAppend in migration flushBatch to avoid CI timeout
Aug 4, 2026
12e860a
chore(pr/b16): remove non-functional docs and temp files
Aug 4, 2026
6ba1f75
test(b16): add safeWriteJson, messageHandler, and TaskOrganizationSto…
Aug 5, 2026
3447d88
fix(tsc): restore lost telemetry methods in Task.ts and fix spread ty…
Aug 5, 2026
b764bbe
fix(b16): remove 28 as-any casts in safeUpdateJson tests, prune stale…
Aug 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 236 additions & 0 deletions docs/260805_0001_session_ci-all-green/172159_debug-coverage-b16.md

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions docs/260805_0001_session_ci-all-green/173510_code-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Code Mode Task Report

## Task Summary

Wrote tests for PR #1134 (`pr/b16-stats-ui-v2`) to fix `codecov/patch` (backend 74.6% → 80% target). Added coverage for `src/utils/safeWriteJson.ts` (the new `safeUpdateJson()`), `src/core/webview/taskOrganizationMessageHandler.ts`, and expanded `src/core/task-persistence/TaskOrganizationStore.ts`.

## Actions Taken

1. Read the coverage report `docs/260805_0001_session_ci-all-green/172159_debug-coverage-b16.md`, the three target source files, existing tests, and the `@roo-code/types` task-organization schemas.
2. Created `src/utils/__tests__/safeUpdateJson.test.ts` (14 tests): read-modify-write happy path, `allowCreate: true` create-on-missing, `allowCreate: false` missing-file error, invalid JSON propagation, updater throw leaves file unchanged, directory creation failure, non-ENOENT target-file access error, non-ENOENT read failure, temp-write failure rollback, final-rename failure rollback, rollback-failure logging, backup-cleanup failure, lock release on error, lock-acquisition failure.
3. Created `src/core/webview/__tests__/taskOrganizationMessageHandler.spec.ts` (5 tests): valid mutation success + correlated result, invalid payload validation error (`TASK_ORG/VALIDATION/001`), missing payload with empty requestId, store throw → log + `TASK_ORG/PERSISTENCE/005`, typed failure result passed through as-is.
4. Expanded `src/core/task-persistence/__tests__/TaskOrganizationStore.spec.ts` (added 24 tests, +427 lines): additional mutation error paths (moveToFolder/removeFromFolder/deleteFolder not-found, createFolder duplicate ID, renameFolder invalid name, control-character names, invalid mutation payload, embedded requestId), `save()` concurrency guards (FUTURE_SCHEMA + PERSISTENCE/005 when on-disk aggregate is newer), onChange callback, target resolution (folder unit move, autoGroup move, autoGroup pin canonical-root), setPinned no-ops, reconcile edge cases (surviving-descendant re-adding, autoGroup pin prune, folder pin retain, no-change no-write, future-schema no-op), normalize() de-duplication on load, lifecycle (waitForInitialized, double dispose).
5. Verified: targeted suites + full backend suite pass; ran coverage; computed patch coverage via `parse_b16_patch_v2.py` methodology.
6. Cleaned up an unintended side effect: the `--prune-suppressions` ESLint flag rewrote `src/eslint-suppressions.json` (86KB diff). Restored the file byte-exact from `git show HEAD:src/eslint-suppressions.json` (read-only; no forbidden git write commands used).

## Result

Success. All tests pass and the backend patch-coverage gap is closed.

### Test Results

- Targeted suites (`safeWriteJson.test.ts` + `safeUpdateJson.test.ts` + `taskOrganizationMessageHandler.spec.ts` + `TaskOrganizationStore.spec.ts`): **89 tests passed** (4 files).
- Full backend suite (all stats/task/task-persistence/webview/provider tests + safeWriteJson suites): **129 test files passed, 2617 tests passed, 1 skipped** — no regressions.

### Patch Coverage (added executable lines, base `myk1yt/pr/b15-usage-capture-v2`)

| File | Before | After |
| ---------------------------------------------------- | --------------------- | --------------------- |
| `src/utils/safeWriteJson.ts` | 0/64 (0.0%) | **60/64 (93.8%)** |
| `src/core/webview/taskOrganizationMessageHandler.ts` | 0/15 (0.0%) | **15/15 (100.0%)** |
| `src/core/task-persistence/TaskOrganizationStore.ts` | 35/344 (10.2%) | **295/344 (85.8%)** |
| **Backend Overall** | **1948/2613 (74.6%)** | **2322/2613 (88.9%)** |

Backend patch coverage now comfortably exceeds the 80% target (+374 covered lines; only ~141 were needed).

Remaining uncovered `safeWriteJson.ts` lines (285-286 `onCompromised`, 388 backup-cleanup-after-failed-rollback, 403 unlock-error catch) require mocking `proper-lockfile` internals and were intentionally left untested — diminishing returns, no risk to the threshold.

## Issues Discovered

1. **Commit/push not performed**: Per the ABSOLUTE constraint "No Git/Version Control Commands" (Code mode may not run `git commit`/`git push`; version control is VP-only), I did NOT run the commit/push from the delegation. Files are staged-ready in the working tree. VP must run:
```
git add src/utils/__tests__/safeUpdateJson.test.ts src/core/webview/__tests__/taskOrganizationMessageHandler.spec.ts src/core/task-persistence/__tests__/TaskOrganizationStore.spec.ts docs/260805_0001_session_ci-all-green/
git commit -m "test(b16): add safeWriteJson, messageHandler, and TaskOrganizationStore coverage for codecov/patch"
git push myk1yt HEAD:pr/b16-stats-ui-v2 --force --no-verify
```
⚠️ Do NOT use `git add -A`: the working tree contains unrelated untracked analysis artifacts (`b16_*.json`, `parse_*.py`, `backend-cov*.txt`, `webview-cov.txt`, `cross_ref_b05_coverage.py`, `src/backend-cov2.txt`) that must not enter this commit.
2. `eslint-suppressions.json` was rewritten by `--prune-suppressions` during lint verification; restored byte-exact. No suppression counts changed for the touched files (verified via baseline diff before restore).
3. `setPinned` no-op mutations still increment `revision` (by design — `applyMutation` bumps revision before dispatch). Two of my initial test assertions were corrected to match this intended monotonic-revision behavior; the store itself was not modified.

## Next Step Recommendations

1. VP: commit + force-push per the exact commands above (targeted file list, not `-A`).
2. Re-check `codecov/patch` on the PR; expected backend > 80%.
3. Optional future work (not required for the threshold): cover `safeWriteJson` lines 285-286/388/403 via a `proper-lockfile` mock, and the 49 remaining `TaskOrganizationStore` lines (watcher branches, `mapError` ENOENT, `getState` structuredClone fallback).

## Affected File List

- `src/utils/__tests__/safeUpdateJson.test.ts` (new, 14 tests)
- `src/core/webview/__tests__/taskOrganizationMessageHandler.spec.ts` (new, 5 tests)
- `src/core/task-persistence/__tests__/TaskOrganizationStore.spec.ts` (expanded, +24 tests / +427 lines)
Loading
Loading