#555 End ongoing durations now where they're drawn and listed; open details without phantom edits
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#555
- pull request
- state:merged
Four bugs found while screenshotting a timeline mirrored from this repository. This is stacked on #554 (both touch `server/store.mjs`); I'll retarget it to `main` once that merges. ## 1. Open items listed as "start → start" (#537) A duration's **Related to** list showed an open issue as `2026-11-07 05:59:15 UTC → 2026-11-07 05:59:15 UTC`, instead of ending now. - **Server:** the `related` query reads spans from `oc_entity_search`, which holds an ongoing duration as a point at its start. It now ends the page's ongoing durations at the server's clock, as the `duration` query does. They're found through the `oc_duration_nodes` ID index. - **Browser:** the local list called `resolveDuration` without the clock. It now passes `model.now()`. So do the other places that show or fit a duration: - fitting a duration, or a timeline of durations alone; - a group's durations; - read-only details and labels; - unsaved changes. ## 2. Open items never drawn on server timelines (#537) On a server timeline, no open issue was drawn as a band up to now. They were all behind the **+N more durations** chip, as points at their starts. - **Cause:** `RemoteWorkspace.overlayDurations` lays unsaved edits over every server frame. It re-resolved each band without a clock, so an ongoing band the server had ended at now collapsed back to its start, and ranked shortest. - **Fix:** it now keeps the end the server resolved. - **Separated tracks too:** `filterDocument` builds each separated side, both the server's derived view trees and the browser's own. It rewrote every kept duration with the end it resolved to without a clock, so an ongoing duration became a fixed point at its start. It now keeps `{"ongoing": true}`, resolved when a window is read. - Derived views are cached per timeline revision. On a server running main since #540, separated views built before this keep the frozen ends until their timeline is next saved. No release has ongoing durations yet, so I didn't add a migration to clear `oc_views`. ## 3. An edit nobody made Open a duration whose metadata is in another order than its details write it, then **Separate related**. The timeline then said **Unsaved server changes** and Undo was enabled. Durations mirrored by `och-import-github` or made through the API have their metadata in another order (`url` before `tags`). - **Cause:** the form puts extra fields first, and `applyDuration` compared the form's duration with the stored one as JSON text. - **Fix:** they're now compared with each object's keys sorted. ## Tests - `test/ongoing-durations-postgres.mjs`: the related query ends an ongoing duration now, and keeps a finished one's end. - `test/ongoing-durations.test.mjs`: - a server window's ongoing band keeps its end under the overlay; - a separated side keeps an ongoing end and draws it to the clock. - `test/ongoing-durations-postgres.mjs`: a separated window includes the ongoing duration, ending now. - `test/relationships-browser.mjs`: - an ongoing duration among a moment's related entries ends after it begins; - opening a reordered duration and separating its relationships leaves nothing to undo. Each test fails without its fix and passes with it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/pull/555