#393 · Pull request change lists print anchored duration ends as times
- timeline-app
- pull request
Fixes #386 A duration whose start or end is anchored to a moment used to print that end as "the time of moment " in pull request change lists, on the website review page and in the editor's pull-request dialog. Now it prints the moment's time in the timeline's display, taken from the revision that version belongs to: the base for removed and old versions, the proposal for added and new ones. Before: `Changed duration: Renamed · 1969-12-31 CE – the time of moment moving` After: `Changed duration: Renamed · 1969-12-31 CE – 1970 CE → 1969-12-31 CE – 1970-01-02 CE` (its end's anchor moved a day) ## Changes - **`server/collaboration.mjs`**: `changes()` collects the examples first. `anchorTimes` then gathers the anchor moment IDs of every duration example for each side and reads each side's set in one query. Revisions kept as documents resolve from the documents already loaded, with no query. - **`server/history.mjs`**: `differences` exposes the two lineages it already read (`lineages`). `valuesAt` takes an optional lineage, so with one it costs a single query. - **`src/presentation.ts`**: `printEntityTime` takes an optional moment-time lookup: - a string prints in the display; - `undefined` (the revision lacks the moment) prints "the time of moment (anchored moment missing)"; - `null`, or no lookup, keeps the old wording. - **Editor fallback for older servers** (`src/community-ui.ts`, `src/app.ts`): anchors resolve from the documents that very old servers sent. Otherwise they resolve from the open timeline, where a moment it lacks counts as not at hand (null) rather than missing. - **Docs**: the API schema description and `docs/collaboration.md`. The payload's shape is unchanged. ## Cost At most one query per revision (two per summary), and only when the listed examples have anchors. Without anchors there are no extra queries. The PostgreSQL test checks that 13 anchored examples on both sides cost exactly 2 more queries than the same summary with exact times. ## Tests - `test/collaboration.test.mjs` covers: - an anchored end printed as a date; - an anchored start; - a missing anchor; - a moved anchor shown old → new; - a custom display; - the editor's null and undefined lookups. The #384 expectation for the anchored duration was updated. - `test/pull-history-postgres.mjs` covers the same cases from history rows, plus the query count. - `test/next-postgres.mjs` checks that the review page shows an added duration's anchored start as a date. Note: a duration whose definition is unchanged but whose anchor moved is still not listed as a changed duration, because the summary compares stored definitions. That behaviour is the same as before.
Sources
Open #393 · Pull request change lists print anchored duration ends as times in the timeline