docs(usage): design revision-consistent bounded screen reads - #5023
docs(usage): design revision-consistent bounded screen reads#5023Sun-GLiang wants to merge 4 commits into
Conversation
Generated-by: Codex
Align the design draft and PR scope around the core P1 contract, leaving concrete Storage boundaries and mechanisms for likun before implementation. Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
|
从问题定义和奥卡姆剃刀角度看,我认可核心方向:单个 Storage 事务返回首屏、SQL 聚合、明细按需游标分页、后续页校验 revision,且不保留 Host 侧的整批数据快照。这比用容量、租约、释放协议维护全量副本更直接。 建议把问题定义收敛为:
这里需要区分三个独立目标:数据一致性、资源有界、产品可用性。前两个成立,不自动意味着第三个成立。文档已经列出相关取舍,但建议在继续细化实现前,先明确两个产品决策:
最小实现方向仍建议保留上述核心,以及现有计费、完整性、搜索语义。不要为简化而把未计价当成零费用,或把范围搜索缩成当前页搜索。细粒度 revision、额外列表分页、通用查询抽象则应按实际约束和证据决定,不必预先全部引入;暂不分页的集合仍需明确上限及超限行为。 另外,SQL 聚合减少的是应用侧物化、JSON 解码和传输,不自动消除随历史规模增长的扫描/分组工作;现有单源 SQLite probe 的结论边界应继续保留。 结论:支持核心方向,但先把“数据大了能否拒绝展示”和“写入活跃时能否打断翻页”定清楚,再选择具体 Storage 机制和预算。这是设计意见,不是实现批准。 AI-assisted:本评论由 Codex 根据本任务中的讨论整理并经用户授权发布。基于设计文档 |
Summary
Settings Usage should return its statistics, pricing/coverage, and first bounded activity page from one Storage read transaction and one revision through the existing
usage:summaryIPC. Further pages are on-demand Storage cursor reads checked against that revision. A mismatch refreshes the whole screen; Host retains no per-reader dataset and Desktop never drains pages or aggregates activity rows.This is a design-only draft for #4058, following the maintainer's P1 review and Storage/protocol rules. It does not implement or claim measured production improvements.
Design: Revision-consistent, bounded Usage screen reads.
Review focus
The document now provides author proposals, code-based trade-offs, a real writer-path matrix, candidate metadata lifecycles, and a concrete bounded-admission option. These are inputs for likun's Storage decisions, not decisions made on his behalf. Product behavior needs separate confirmation. Please accept, replace, or request evidence for each item:
Agreement with the core direction permits design progress. Implementation approval still requires the selected mechanisms, budgets, product outcomes, and remaining feasibility evidence to be recorded. Material product decisions follow the project's public discussion process.
Implementation plan
Verification
93a8dd785; design review covers the document linked above.(ts DESC, storage_key DESC)index, and generated 10k/50k/250k legacy-source rows. Every display ID is duplicated; ten rows share each timestamp.The deep cursor skips about 90% of the rows and returns 101 keys including lookahead. Predicate visits are counted by an instrumented SQLite function, not VM-step or disk-I/O counts; the script verifies that instrumented and uninstrumented EXPLAIN plans match. The redundant form chose
(ts>? AND ts<?); removing the redundant upper bound after cursor validation chose(ts>? AND (ts,storage_key)<(?,?)). Neither plan used a temporary sort for this fixture.This only supports the single-source scalar admission/seek shape. It does not prove multi-source accounting, aggregate plans, repair/completeness bounds, byte budgets, sparse search, migrations, concurrency, physical I/O bounds or end-to-end performance. Runtime tests, build, typecheck, UI exercises and production-path benchmarks have not been run for this documentation-only change.
Reproduce the SQL feasibility probe
At this PR checkout, save the following as an untracked
usage-design-probe.mjsin the repository root and runnode usage-design-probe.mjs. It creates only in-memory databases; remove the scratch file afterwards. Requires Node with TypeScript stripping andnode:sqlite; record the reported Node/SQLite versions when comparing plans.AI use
Select exactly one:
Tool(s) and scope: Codex inspected the repository, drafted and reviewed the design and decision tables, and ran the synthetic SQL probe. Sun-GLiang is the contributor of record. Documentation commits carry
Generated-by: Codex.Checklist
These implementation checks remain pending; this draft changes documentation only.
Does this PR entail a change in behavior?
The current diff has no runtime behavior change. Update this selection when implementation lands.