You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "liuxiaocs7 (via GitHub)" <gi...@apache.org> on 2026/09/19 21:10:20 UTC

[I] perf(storage): Usage filter changes rebuild unchanged range statistics [maka]

liuxiaocs7 opened a new issue, #5516:
URL: https://github.com/apache/maka/issues/5516

   ## What happened
   
   Changing only the Usage activity search text or status rebuilds the complete screen statistics even when the resolved time range and Usage revision have not changed. Headline accounting, provider/model/tool breakdowns, pricing and provenance do not depend on those activity filters.
   
   At `0117d76c5688475e7467ee6db83057bf65edbabd`, the public `readUsageScreen` facade repeats four range aggregation/grouping queries and the unreadable-checkpoint SUM for each such request. A deterministic regression with 62 model records plus one tool observes **5 aggregation statements instead of 0** after changing the search text, while the expected range statistics remain identical.
   
   Expected: reuse a bounded complete statistics projection for the same reader/database lifecycle, Usage revision and exact `from`/`to` boundaries. Read the revision, activity count and page in the same transaction. Keep all existing accounting, capacity and revision-fencing behavior.
   
   ## How to reproduce
   
   1. Build Core and Storage from the baseline above.
   2. Populate an interactive root with model/tool Usage history.
   3. Read a screen with `{ range: { from, to }, search: '', status: 'all' }`.
   4. Without changing the data or range, request another screen with search `gpt` or a different activity status.
   5. Observe that `usage-screen.ts` recomputes the model aggregate, provider/model/tool groups, pricing and provenance before reading the filtered activity, despite returning the same statistics.
   
   The regression test and reproducible A/B harness will be linked from the implementation PR. Measurements must distinguish same-revision filter changes from range/revision changes, where recomputation is expected.
   
   ## Environment
   
   - Maka baseline: `0117d76c5688475e7467ee6db83057bf65edbabd`
   - Surface: Storage `readUsageScreen`, consumed by Runtime Host / Desktop Usage
   - macOS / arm64; Node 24.14.0 / SQLite 3.51.2
   - Also verify the shipped Electron SQLite runtime
   
   ## Logs, screenshots, or additional context
   
   Acceptance:
   
   - [ ] Reuse complete range statistics across search/status changes at the same revision and resolved time boundaries, with a fixed cache size owned by the existing reader lifecycle.
   - [ ] Publish cached values only after the outermost transaction commits; a rollback and subsequent reuse of the revision counter cannot expose rolled-back statistics.
   - [ ] Returned results remain independent: Host projection/mutation and deep freezing cannot corrupt or freeze the cached values.
   - [ ] Data, pricing, repair, range, root and reader-lifecycle changes cannot return stale statistics. Cache hits preserve a coherent snapshot under external WAL writes and the existing capacity failure contract.
   - [ ] Include regression coverage and same-process before/after measurements, including cache misses. Record performance evidence in the PR description.
   
   Parent tracker: #5038. This is the statistics-reuse follow-up to #5515 / #5514. Pagination SQL and count improvements remain in #5514; frontend debounce and navigation remain in #5410. Continuous writes may invalidate the cache frequently. First-range aggregation, exact filtered counts and sparse substring searches remain range-sized work.
   
   AI assistance: Codex inspected the source, reproduced the repeated work and drafted this issue under contributor direction.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] perf(storage): Usage filter changes rebuild unchanged range statistics [maka]

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 closed issue #5516: perf(storage): Usage filter changes rebuild unchanged range statistics
URL: https://github.com/apache/maka/issues/5516


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org