#136 Optional saved history per timeline
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#136
- issue
- state:closed
## Goal Let a timeline's owner turn off **saved history** for that timeline. This is for high-volume timelines, such as logs fed by the syslog receiver or `och-import-logs`, whose past revisions nobody reviews. ## Why Since #134, a timeline's history is kept as rows: each version of a moment, duration, relationship or the settings, valid from one revision to the next. In an append-only timeline every moment has one history version about the size of its live row. So history roughly **doubles the timeline's storage and quota charge**. Turning it off also avoids: - the one-time history copy when the timeline is created, forked, or migrated; - writing versions on each save (about 0.6 s of a 5,000-moment save at 1M moments). It doesn't help with save time in general: the cost of large batches is the moment index (#135). Retention already prunes history to its window. For a timeline with a short retention period the saving is smaller, but within the window it's still a second copy. ## What depends on history Code that reads past revisions (`revisionDocument` in `server/store.mjs`): - **History pages:** listing, inspecting and exporting past revisions (`Versioning.history` and `historical`). - **Fork syncing:** `Versioning.sync` merges three ways from the common ancestor revision. - **Pull requests:** `Collaboration` reads the base and source revisions, and stores whole documents. These don't depend on it, so they keep working without history: - the live view, viewport queries, search; - concurrent-edit protection (`oc_timelines.revision`); - live updates, editor undo, retention; - forking from the current state (read from the live index); - browser forks of the head. ## Proposed behaviour - **Setting:** **Keep saved history** in the timeline's settings, owner only, on by default. Possibly also a server default for new timelines, or for timelines the log tools create. - **While off:** - Saves still number their revisions and record revision rows (author, time, parents) so ancestry stays intact. They write no history versions and no patches, and are charged nothing for history. - The head is always readable from the live index. - Older revisions are listed as unavailable. - **Turning it off:** - deletes the existing history versions, keeping anything forks or pull requests still refer to, as timeline deletion does; - the settings page warns first and says how much storage it frees. - **Turning it on:** history starts from the current state with one copy made in the database, as `migrate` does (`startHistory` in `server/history.mjs`). - **Features that need history** say so instead of failing: - the history page shows "This timeline doesn't keep saved history"; - **Sync** on a fork of such a timeline, and **pull requests** into it, are disabled with that reason (or allowed only when the base is the current head; to decide). - **API and quota:** the API reports the setting, and quota accounting reflects it. ## Questions to settle - Should forks be blocked, allowed but unsyncable, or allowed with a warning? - Should turning history off be reversible within a grace period, or delete immediately? - Should the log tools offer creating timelines with history off? ## Tests - **Versions:** saves with history off write no versions, and their revisions read as unavailable except the head. - **Switching:** turning it off frees storage (and the quota charge) while keeping what forks and pull requests need; turning it on starts with one copy, after which saves are charged their changes again. - **Dependent features:** the history page, sync and pull requests give their reasons; forking from the head works. https://github.com/openchronology/timeline-app/issues/136
Related
Open #136 Optional saved history per timeline in the timeline