From 0aced20d65c80c9225edc7deb5095aa26dc8b8fe Mon Sep 17 00:00:00 2001 From: Graham Barber Date: Thu, 23 Jul 2026 09:53:09 -0700 Subject: [PATCH] docs(openspec): archive persist-collapsed-state --- .../.openspec.yaml | 0 .../design.md | 0 .../proposal.md | 0 .../specs/block-graph/spec.md | 0 .../specs/outline-editor/spec.md | 0 .../tasks.md | 0 openspec/specs/block-graph/spec.md | 22 +++++++++++++++++++ openspec/specs/outline-editor/spec.md | 19 ++++++++++++++++ 8 files changed, 41 insertions(+) rename openspec/changes/{persist-collapsed-state => archive/2026-07-23-persist-collapsed-state}/.openspec.yaml (100%) rename openspec/changes/{persist-collapsed-state => archive/2026-07-23-persist-collapsed-state}/design.md (100%) rename openspec/changes/{persist-collapsed-state => archive/2026-07-23-persist-collapsed-state}/proposal.md (100%) rename openspec/changes/{persist-collapsed-state => archive/2026-07-23-persist-collapsed-state}/specs/block-graph/spec.md (100%) rename openspec/changes/{persist-collapsed-state => archive/2026-07-23-persist-collapsed-state}/specs/outline-editor/spec.md (100%) rename openspec/changes/{persist-collapsed-state => archive/2026-07-23-persist-collapsed-state}/tasks.md (100%) diff --git a/openspec/changes/persist-collapsed-state/.openspec.yaml b/openspec/changes/archive/2026-07-23-persist-collapsed-state/.openspec.yaml similarity index 100% rename from openspec/changes/persist-collapsed-state/.openspec.yaml rename to openspec/changes/archive/2026-07-23-persist-collapsed-state/.openspec.yaml diff --git a/openspec/changes/persist-collapsed-state/design.md b/openspec/changes/archive/2026-07-23-persist-collapsed-state/design.md similarity index 100% rename from openspec/changes/persist-collapsed-state/design.md rename to openspec/changes/archive/2026-07-23-persist-collapsed-state/design.md diff --git a/openspec/changes/persist-collapsed-state/proposal.md b/openspec/changes/archive/2026-07-23-persist-collapsed-state/proposal.md similarity index 100% rename from openspec/changes/persist-collapsed-state/proposal.md rename to openspec/changes/archive/2026-07-23-persist-collapsed-state/proposal.md diff --git a/openspec/changes/persist-collapsed-state/specs/block-graph/spec.md b/openspec/changes/archive/2026-07-23-persist-collapsed-state/specs/block-graph/spec.md similarity index 100% rename from openspec/changes/persist-collapsed-state/specs/block-graph/spec.md rename to openspec/changes/archive/2026-07-23-persist-collapsed-state/specs/block-graph/spec.md diff --git a/openspec/changes/persist-collapsed-state/specs/outline-editor/spec.md b/openspec/changes/archive/2026-07-23-persist-collapsed-state/specs/outline-editor/spec.md similarity index 100% rename from openspec/changes/persist-collapsed-state/specs/outline-editor/spec.md rename to openspec/changes/archive/2026-07-23-persist-collapsed-state/specs/outline-editor/spec.md diff --git a/openspec/changes/persist-collapsed-state/tasks.md b/openspec/changes/archive/2026-07-23-persist-collapsed-state/tasks.md similarity index 100% rename from openspec/changes/persist-collapsed-state/tasks.md rename to openspec/changes/archive/2026-07-23-persist-collapsed-state/tasks.md diff --git a/openspec/specs/block-graph/spec.md b/openspec/specs/block-graph/spec.md index 3ff849e..245ad34 100644 --- a/openspec/specs/block-graph/spec.md +++ b/openspec/specs/block-graph/spec.md @@ -174,3 +174,25 @@ loading stale state. `snapshot.loro.prev`, and a subsequent open that finds the current snapshot undecodable fails with an error naming that fallback instead of silently loading it + +### Requirement: Fold state is document content +Each block SHALL support a boolean fold flag stored in the block's Loro +meta map (alongside `block_type` and `content`), persisted and merged with +the document like any other content, so that fold state survives restarts, +follows the document across (future) sync, and can be authored by (future) +templates. The flag SHALL NOT appear in the block's `properties` map, +property queries, or derived property indexes. An absent flag SHALL be +read as expanded; the flag's presence MUST NOT require a graph +format-version bump or migration. + +#### Scenario: Fold flag round-trips through storage +- **WHEN** a block's fold flag is set to true and the graph is closed and reopened +- **THEN** reading the block's fold flag returns true, and blocks never flagged read as expanded + +#### Scenario: Fold flag is invisible to the property system +- **WHEN** a block is folded and the graph's properties are queried +- **THEN** no property derived from the fold flag appears on the block, and property indexes are unchanged + +#### Scenario: Pre-existing graphs are unaffected +- **WHEN** a graph created before the fold flag existed is opened by this build +- **THEN** it opens without migration at its recorded format version, and every block reads as expanded diff --git a/openspec/specs/outline-editor/spec.md b/openspec/specs/outline-editor/spec.md index e2bea11..5fa10b4 100644 --- a/openspec/specs/outline-editor/spec.md +++ b/openspec/specs/outline-editor/spec.md @@ -225,3 +225,22 @@ unaffected — this is rendering only. - **WHEN** the user presses Up from the first child block - **THEN** focus lands on the heading exactly as it previously landed on the root bullet, and editing it behaves as editing the root block always has + +### Requirement: Fold state persists across relaunch +Fold state SHALL be part of the document: toggling a fold writes a +per-block flag into the block graph and persists it as an acknowledged +edit, and opening a graph SHALL restore each block's folded rendering from +that flag. Blocks with no recorded fold state render expanded, so existing +graphs open exactly as before. + +#### Scenario: Folded block stays folded after relaunch +- **WHEN** the user folds a block with descendants, quits the app, and relaunches on the same graph +- **THEN** the block renders folded (descendants hidden, fold indicator shown) and unfolding it reveals its descendants as before + +#### Scenario: Fold survives a kill after acknowledgement +- **WHEN** the process is killed after a fold toggle has rendered in the UI +- **THEN** on next launch the block renders folded + +#### Scenario: Graphs without fold state open expanded +- **WHEN** a graph written before fold persistence existed is opened +- **THEN** every block renders expanded and folding works normally from there -- 2.51.2