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

#597 Measures: the PostgreSQL change index, balances and split totals (#595)

–

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

Part 2 of #595. Stacked on #596: until that merges, this diff includes its commit. A server timeline keeps a **change index**: a persistent AVL tree (`oc_change_nodes`, rooted at `change_root`) of the times its measures' changes apply. Each node keeps its own changes and its subtree's totals. - **Forks and views:** the tree is versioned like the other index tables, so forks share and retire its rows. Separation views build their own (`oc_view_change_nodes`). - **Maintenance:** - Rebuilds and views write it whole (`changePoints`). - Sparse saves subtract each changed moment's and duration's old changes and add their new ones. Durations move with the moments they follow. - Changing where a measure's durations apply (start or end) rebuilds the index. - **Reading:** `oc_change_prefixes` reads the changes up to several times, one path each, in a single call per query. It has view and fork variants like the other walks. - **Overviews** split their totals across summaries and give `balances` and `balanceAfter`, using the same functions as the editor. Every change in the window counts once. - **Migration:** index version 4. Timelines with measures indexed before this are rebuilt once. - **Ongoing durations:** their placeholders no longer adjust totals, since the totals already count their changes. **Tests:** - `test/measure-balance-postgres.mjs`, added to CI, checks split totals and balances against hand sums. It runs through random sparse saves (moments and durations added, moved, revalued and deleted; durations ending where moments are), in a copy reading through to its original and saving on its own, in a tag separation, and after a rebuild forced by changing where a measure's durations apply. - Locally, these also pass: `incremental-postgres`, `fork-read-through-postgres` (482 revisions), `summaries-postgres`, `views-postgres`, `durations-postgres`, `ongoing-durations-postgres`, `tree-paths-postgres`, `openapi-postgres`, `measures-postgres` and `measure-totals-postgres`. The last now checks every duration starting in the window. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/circagraph/timeline-app/pull/597

Related

Open #597 Measures: the PostgreSQL change index, balances and split totals (#595) in the timeline

#597 Measures: the PostgreSQL change index, balances and…