circagraph
Sign inSign up

openchronology/timeline-app on GitHub

The OpenChronology repository on GitHub, mirrored by och-import-github: issues and pull requests as durations (ongoing while open), what happened to them as moments, plus releases, milestones, commits and branches. The Branches view shows the most recently active branches each in a track of its own.

Source: https://github.com/openchronology/timeline-app

3,131 moments · 2026-10-05 CE 20:21:49 UTC – 2026-11-16 CE 12:10:45 UTC · by @athan · @athan

#579 Measures: totals in the editor's index and its overview groups (#574)

–

  • github
  • github/openchronology/timeline-app
  • github/openchronology/timeline-app#579
  • pull request
  • state:merged

Part of #574, part 3 of #570. Stacked on #577 and #578: until they merge, this diff includes their commits. The editor's index keeps its moments' **measure totals** in an augmented tree, and every overview group carries its totals. PostgreSQL and SQLite follow in separate PRs. Durations count at their start in #576. - **`MeasureTree` (`src/measure-tree.ts`):** an AVL tree over distinct times. Each node keeps its own values and its subtree's totals, one exact rational per measure. - Addition is a monoid, so rotations regroup sums without changing them. - A range's totals take O(log n) nodes, and an edit rewrites one path. - **In `TimelineIndex`:** - The tree is built when first read, for a timeline with measures, then kept up to date through the existing `tally` hook: a moved or changed moment is one subtraction and one addition. - A change of declarations rebuilds it. - `measureTotals(lower, upper)` reads a range's totals. - Each overview group carries `totals`: canonical text by name, zeros left out. `coalesceGroups` adds the totals of the groups it merges (`addTotals`). - **Tests:** `test/measure-totals.test.mjs` compares ranges, overview groups at three widths, and coalesced groups against summing by hand. It runs through 2,000 random tree operations and 300 random index edits, and also checks that the tree stays AVL-balanced. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/circagraph/timeline-app/pull/579

Related

Open #579 Measures: totals in the editor's index and its overview groups (#574) in the timeline

#579 Measures: totals in the editor's index and its…