timescale.info
Sign inSign up

How OpenChronology was built

Every merged pull request of openchronology/timeline-app, its first week of commits and its releases; and before them the 2020 PureScript editor, from snapshots of its deleted repositories in the Wayback Machine. Written to this server through the HTTP API.

327 moments · 2020-03-09T00:15:08Z CE – 2026-11-02T20:11:21Z CE · by @athan · @athan

#397 · Pull request change lists show durations that move with moments they move

  • timeline-app
  • pull request

Fixes #395 A pull request that moves a moment changes the span of every duration anchored to it. Before this change, those durations weren't listed unless the pull request also edited them, because the summary only compares stored definitions. Now they are listed as **moved**, with their span old → new and the moments they move with. Before: only the moments, e.g. `Changed: Crowning · 1970 CE → 1970-01-02 CE`; nothing for `Reign`, though its span changes After: `Moved duration: Reign · 1970 CE – 1970-01-11 CE → 1970-01-02 CE – 1970-01-13 CE (moves with moments Crowning and Abdication)` A removed anchor: `Moved duration: Orphan · 1970 CE – 1970-01-21 CE → 1970 CE – the time of moment doomed (anchored moment missing) (moves with moment Doomed)` The count: `3 durations move with moments it moves.` ## Changes - **Summary (`server/collaboration.mjs`)**: - A moment whose time differs between base and proposal counts as moved: changed, removed or added. - For each page of moved moments, `movedDurations` finds the durations both revisions hold with the **same** definition, anchored at either end to one of those moments. They count in `durations.moved`, and the first thirty become `durationExamples` with `change: "moved"`. `before` and `after` are both the definition, `times` shows the span old → new, and `movedWith` holds `[{id, title?}]`. - A duration the pull request also edits differs between the revisions, so it stays listed only as changed. A duration anchored at both ends is counted once. - `anchorTimes` is now `anchorMoments`. It returns events, not times, so `movedWith` can carry the moments' titles. It is still one query per revision. - **History (`server/history.mjs`, `server/schema.sql`)**: - `anchoredDurations` is one query. Each level of the proposal's lineage finds the versions whose start or end names those moments, using new partial indexes `oc_history_durations_start_moment` and `oc_history_durations_end_moment` on `(timeline_id, definition->'start'/'end'->>'moment')`. - The candidates are then read at both revisions by primary key and compared. Read-through levels and overrides are handled by `visible`, as in `differences`. - **Revisions kept as documents** use the shared `durationsMovedWith` in `src/durations.ts` on the documents already loaded, so they cost no query. - **Editor (`src/community-ui.ts`)**: - Shows the moved count and the moved examples. - Its fallback for very old servers that sent both documents (`summarize`) now also compares durations: added, removed, changed, and moved through `durationsMovedWith`. Before, it counted durations as zero. - Servers from before this change send no `moved`, and the editor shows nothing extra for them. - **Website (`platform/components/pull-review.jsx`)**: the count line, a "moved" section, and "N more moved durations". A moved entry shows its definition once. - **Wording (`src/wording.ts`)**: `changeText` handles `moved` and `movedWith`. `movedDurationsText` writes the count line. - **API**: additive only. - `durations.moved` is added to the counts. - The `change` enum of `durationExamples` gains `moved`, and examples gain an optional `movedWith`. - Older readers filter by the kinds they know, so they ignore the new kind. Both are documented in the OpenAPI schema and in `docs/collaboration.md`. ## Cost - Zero queries when no moment's time changes. - One query per page of 20,000 moved moments. A pull request rarely moves more than that, so usually one. - Plus the existing anchor lookup, one query per revision, which is shared with other anchored examples. - The PostgreSQL test checks that a summary moving `m0` and `m1` costs exactly 1 query more than the same pull request without the moves. It also checks that the query count is the same with 200 and with 2,000 unanchored durations. - `EXPLAIN ANALYZE` on a timeline with 50,000 durations: index scans on the new anchor indexes, then primary-key lookups. 1.7 ms for 50 moved durations. ## Tests - `test/collaboration.test…

Sources

Open #397 · Pull request change lists show durations that move with moments they move in the timeline