#581 Measures: totals in the desktop file's SQLite index (#574)
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#581
- pull request
- state:merged
Closes #574 (with #579 and #580), part 3 of #570. Stacked on #577–#580: until they merge, this diff includes their commits. A desktop file's moment index keeps its **measure totals**, as the browser index (#579) and the PostgreSQL trees (#580) do. Overview groups therefore carry the same `totals` in every edition. ## sqlite-rational (vendored) These changes aren't upstream yet; `vendor/README.md` says so, and they should go to athanclark/sqlite-rational before the copy is next updated from there. - **Sums:** rows may carry a `sums` vector of exact rationals, in a new hidden column holding canonical rationals joined by `;`. - Every node totals the vectors per subtree as it totals weights: in inserts, updates (of the sums alone, or of the key), deletes and bulk builds. - A summary row's `sums` is its rows' vectors added, read from whole subtrees. - **`q_sum`:** an exact sum aggregate. - **Older indexes:** an index whose shadow table predates sums keeps working without them, and refuses rows with sums. - **Tests:** the README documents both. Three new tests cover `q_sum`, random edits against hand sums, and an old index. The extension's own tests now run in CI. ## native-store - **Filling:** each bucket's sums are its moments' values per declared measure, using `q_sum` over `metadata.measures`, in name order. - **Sparse saves:** they recount changed times. A change of measure names rebuilds the index. - **Overviews:** they map the sums back to names, and coalesced groups add their totals. - **Older files:** a file saved before this (index layout 2, bumped to 3) is re-indexed when opened, and a whole save remakes an older index. ## Tests A Rust test (`measure_total_tests`) checks every group's totals at four thresholds against hand sums at four points: - after a whole save; - after sparse moves, value edits, deletions and additions; - after the measures are renamed; - on reopening a file marked with the older layout. `cargo test --lib`: 37 pass. The extension's Python suite: 15 pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/circagraph/timeline-app/pull/581
Related
- #570 Measures: typed quantities on moments and durations, totalled in every summary
- #574 Measures 3: totals in the summary trees (browser, PostgreSQL, SQLite)
- #577 Measures: declarations, exact values, validation and formats (#572)
- #579 Measures: totals in the editor's index and its overview groups (#574)
- #580 Measures: totals in the PostgreSQL moment tree and its overviews (#574)
- #582 Measures: totals on summaries, values on hover cards, and plugins (#575)
- Merge pull request #581 from openchronology/feat/574-sqlite-totals
Open #581 Measures: totals in the desktop file's SQLite index (#574) in the timeline