Planning cleanup !233

merged merged by cmc on 2026-10-11 03:54 UTC · krz/orgstar:plan-cleanup into main

22 files changed, +201 −195

Layout: unified · split

docs/design.md +4 −2
@@ -334,7 +334,7 @@ Fidelity is checked against Emacs itself, using the same oracle pattern as orgo'
334 334
335Seven phases, each usable on its own. Phase 1 is read-only, so it can run next to Emacs from the first build. 335Seven phases, each usable on its own. Phase 1 is read-only, so it can run next to Emacs from the first build.
336 336
337Status, 2026-10-06: phases 1–6 are built for macOS. Owed from phase 1: the items left open below and the gate run on the M1 Air. The gates pass on an M-series Mac except peak memory for small real files (about 20x for a 161 kB file, from fixed overhead). Phase 7 has started: the iOS app has the agenda and capture, and runs in the Simulator; device builds need signing. 337Status, 2026-10-10: phases 1–7 are built. The Mac app is released as v0.2.0 (universal, notarized DMG, Homebrew cask). The iOS app is complete for Simulator builds; device signing and TestFlight are not set up. Owed: the phase-1 gate run on the M1 Air, and the VoiceOver check on both platforms. The gates pass on an M-series Mac except peak memory for small real files (about 20x for a 161 kB file, from fixed overhead).
338 338
3391. **Core and viewer:** `OrgCore` parser, workspace, index, read-only rendering, folding, search. 3391. **Core and viewer:** `OrgCore` parser, workspace, index, read-only rendering, folding, search.
3402. **Editor:** text editing, structure and heading commands, timestamps, `M-q`, table alignment, command palette, Emacs and Mac keymaps, remaining tree-sitter grammars. 3402. **Editor:** text editing, structure and heading commands, timestamps, `M-q`, table alignment, command palette, Emacs and Mac keymaps, remaining tree-sitter grammars.
@@ -344,6 +344,8 @@ Status, 2026-10-06: phases 1–6 are built for macOS. Owed from phase 1: the ite
3446. **Beyond Emacs:** clock reports, habit charts, table and kanban views over properties, Doom keymap. 3446. **Beyond Emacs:** clock reports, habit charts, table and kanban views over properties, Doom keymap.
3457. **iOS:** same core; touch input, capture and agenda first. 3457. **iOS:** same core; touch input, capture and agenda first.
346 346
347Plans in `docs/plans/` are ticked when their commits land, and a step that did not ship is marked in the plan. Open work is in the repository's issues.
348
347**Phase 1 scope** 349**Phase 1 scope**
348 350
349- [x] `OrgCore` package: lossless parser with UTF-16 ranges and the bytes-and-encoding contract; element-aware settings pass; inline rules ported from OrgSwift 351- [x] `OrgCore` package: lossless parser with UTF-16 ranges and the bytes-and-encoding contract; element-aware settings pass; inline rules ported from OrgSwift
@@ -387,7 +389,7 @@ Phase 2 (writable editor) does not start until every gate passes.
387 389
388## Open questions 390## Open questions
389 391
390- [ ] App name: Orgstar (chosen). 392- [x] App name: orgstar, spelt in lowercase.
391- [x] Save model: a user setting (see Saving). 393- [x] Save model: a user setting (see Saving).
392- [x] Minimum OS: macOS 26 and iOS 26. One release behind current (macOS 27). 394- [x] Minimum OS: macOS 26 and iOS 26. One release behind current (macOS 27).
393- [x] License: 0BSD. 395- [x] License: 0BSD.
docs/plans/2026-10-04-document-session.md +16 −16
@@ -44,7 +44,7 @@ Per-window session objects and main-actor wiring (they belong to the app target)
44**Interfaces:** 44**Interfaces:**
45- Produces: `MergeConflict(base:ours:theirs:)`, `MergeResult` (`.merged`, `.conflict`), `threeWayMerge(base:ours:theirs:)`, `lineEdits(from:to:) -> [TextEdit]`; internal `textLines`, `matchingLines`. 45- Produces: `MergeConflict(base:ours:theirs:)`, `MergeResult` (`.merged`, `.conflict`), `threeWayMerge(base:ours:theirs:)`, `lineEdits(from:to:) -> [TextEdit]`; internal `textLines`, `matchingLines`.
46 46
47- [ ] **Step 1: Add the target** 47- [x] **Step 1: Add the target**
48 48
49```swift 49```swift
50// swift-tools-version: 6.2 50// swift-tools-version: 6.2
@@ -66,7 +66,7 @@ let package = Package(
66) 66)
67``` 67```
68 68
69- [ ] **Step 2: Write the failing tests** 69- [x] **Step 2: Write the failing tests**
70 70
71```swift 71```swift
72import OrgCore 72import OrgCore
@@ -118,12 +118,12 @@ struct MergeTests {
118} 118}
119``` 119```
120 120
121- [ ] **Step 3: Run to verify failure** 121- [x] **Step 3: Run to verify failure**
122 122
123Run: `swift test --filter MergeTests` 123Run: `swift test --filter MergeTests`
124Expected: build failure, `cannot find 'threeWayMerge' in scope`. 124Expected: build failure, `cannot find 'threeWayMerge' in scope`.
125 125
126- [ ] **Step 4: Implement** 126- [x] **Step 4: Implement**
127 127
128```swift 128```swift
129import OrgCore 129import OrgCore
@@ -303,7 +303,7 @@ private func myers(_ a: [Int], _ b: [Int]) -> [(Int, Int)] {
303} 303}
304``` 304```
305 305
306- [ ] **Step 5: Run to verify pass, then commit** 306- [x] **Step 5: Run to verify pass, then commit**
307 307
308Run: `swift test --filter MergeTests` 308Run: `swift test --filter MergeTests`
309 309
@@ -324,7 +324,7 @@ git commit -m "Add OrgDocument target with three-way merge"
324- Consumes: `threeWayMerge`, `lineEdits` (Task 1); `OrgParser.reparse`, `SourceText`, `TextEdit`. 324- Consumes: `threeWayMerge`, `lineEdits` (Task 1); `OrgParser.reparse`, `SourceText`, `TextEdit`.
325- Produces: `DocumentState(bytes:defaults:)` with `source`, `text`, `tree`, `revision`, `mergeBase`, `isDirty`, `isEditable`, `canUndo`, `canRedo`, `encodedText()`, `apply(_:baseRevision:)`, `undo()`, `redo()`, `diskChanged(to:) -> ExternalChange`, `mergeOverwritten(_:base:)`, `didWrite(_:)`; `ViewState` with `mapped(through:)`, `pruned(to:)`; internal `mapOffset`, `utf16Slice`. 325- Produces: `DocumentState(bytes:defaults:)` with `source`, `text`, `tree`, `revision`, `mergeBase`, `isDirty`, `isEditable`, `canUndo`, `canRedo`, `encodedText()`, `apply(_:baseRevision:)`, `undo()`, `redo()`, `diskChanged(to:) -> ExternalChange`, `mergeOverwritten(_:base:)`, `didWrite(_:)`; `ViewState` with `mapped(through:)`, `pruned(to:)`; internal `mapOffset`, `utf16Slice`.
326 326
327- [ ] **Step 1: Write the failing tests** 327- [x] **Step 1: Write the failing tests**
328 328
329```swift 329```swift
330import OrgCore 330import OrgCore
@@ -446,12 +446,12 @@ struct ViewStateTests {
446} 446}
447``` 447```
448 448
449- [ ] **Step 2: Run to verify failure** 449- [x] **Step 2: Run to verify failure**
450 450
451Run: `swift test --filter DocumentStateTests` 451Run: `swift test --filter DocumentStateTests`
452Expected: build failure, `cannot find 'DocumentState' in scope`. 452Expected: build failure, `cannot find 'DocumentState' in scope`.
453 453
454- [ ] **Step 3: Implement `DocumentState.swift`** 454- [x] **Step 3: Implement `DocumentState.swift`**
455 455
456```swift 456```swift
457import OrgCore 457import OrgCore
@@ -612,7 +612,7 @@ func utf16Slice(_ text: String, _ range: Range<Int>) -> String {
612} 612}
613``` 613```
614 614
615- [ ] **Step 4: Implement `ViewState.swift`** 615- [x] **Step 4: Implement `ViewState.swift`**
616 616
617```swift 617```swift
618import OrgCore 618import OrgCore
@@ -658,7 +658,7 @@ func mapOffset(_ offset: Int, _ sortedEdits: [TextEdit]) -> Int {
658} 658}
659``` 659```
660 660
661- [ ] **Step 5: Run to verify pass, then commit** 661- [x] **Step 5: Run to verify pass, then commit**
662 662
663Run: `swift test --filter "DocumentStateTests|ViewStateTests"` 663Run: `swift test --filter "DocumentStateTests|ViewStateTests"`
664 664
@@ -679,7 +679,7 @@ git commit -m "Add document state and view state"
679- Consumes: `DocumentState` (Task 2). 679- Consumes: `DocumentState` (Task 2).
680- Produces: `FileSystem`, `RecoveryStore`, `SaveOutcome`, `SaveError`, `Saver(fileSystem:recovery:)` with `save(_:to:)`, `CoordinatedFileSystem`, `FileRecoveryStore(directory:limit:)` with `versions(for:)`. 680- Produces: `FileSystem`, `RecoveryStore`, `SaveOutcome`, `SaveError`, `Saver(fileSystem:recovery:)` with `save(_:to:)`, `CoordinatedFileSystem`, `FileRecoveryStore(directory:limit:)` with `versions(for:)`.
681 681
682- [ ] **Step 1: Write the failing tests** 682- [x] **Step 1: Write the failing tests**
683 683
684The fault-injection cases put another writer's change in place before each read and before the replace, and check that both versions survive. 684The fault-injection cases put another writer's change in place before each read and before the replace, and check that both versions survive.
685 685
@@ -880,12 +880,12 @@ struct FileStorageTests {
880} 880}
881``` 881```
882 882
883- [ ] **Step 2: Run to verify failure** 883- [x] **Step 2: Run to verify failure**
884 884
885Run: `swift test --filter SaveTests` 885Run: `swift test --filter SaveTests`
886Expected: build failure, `cannot find type 'FileSystem' in scope`. 886Expected: build failure, `cannot find type 'FileSystem' in scope`.
887 887
888- [ ] **Step 3: Implement `Saving.swift`** 888- [x] **Step 3: Implement `Saving.swift`**
889 889
890```swift 890```swift
891import Foundation 891import Foundation
@@ -971,7 +971,7 @@ public struct Saver: Sendable {
971} 971}
972``` 972```
973 973
974- [ ] **Step 4: Implement `FileStorage.swift`** 974- [x] **Step 4: Implement `FileStorage.swift`**
975 975
976```swift 976```swift
977import CryptoKit 977import CryptoKit
@@ -1068,12 +1068,12 @@ public struct FileRecoveryStore: RecoveryStore {
1068} 1068}
1069``` 1069```
1070 1070
1071- [ ] **Step 5: Run everything, including the iOS build** 1071- [x] **Step 5: Run everything, including the iOS build**
1072 1072
1073Run: `swift test`, then `xcodebuild -scheme OrgDocument -destination 'generic/platform=iOS' build` 1073Run: `swift test`, then `xcodebuild -scheme OrgDocument -destination 'generic/platform=iOS' build`
1074Expected: all pass; `BUILD SUCCEEDED`. 1074Expected: all pass; `BUILD SUCCEEDED`.
1075 1075
1076- [ ] **Step 6: Commit** 1076- [x] **Step 6: Commit**
1077 1077
1078```bash 1078```bash
1079git add Sources/OrgDocument/Saving.swift Sources/OrgDocument/FileStorage.swift Tests/OrgDocumentTests/SaveTests.swift 1079git add Sources/OrgDocument/Saving.swift Sources/OrgDocument/FileStorage.swift Tests/OrgDocumentTests/SaveTests.swift
docs/plans/2026-10-04-editing-spike.md +13 −13
@@ -39,9 +39,9 @@ Two bugs the differential test found and the plan fixes: a line split off by an
39Work for the performance plan: reparse structural edits within the innermost section instead of the top-level section; a faster parser (about 3x for the open gate); style the visible region first on open and the rest after. 39Work for the performance plan: reparse structural edits within the innermost section instead of the top-level section; a faster parser (about 3x for the open gate); style the visible region first on open and the rest after.
40 40
41Manual VoiceOver checklist (run `swift run OrgstarSpike <file>`, turn on VoiceOver): 41Manual VoiceOver checklist (run `swift run OrgstarSpike <file>`, turn on VoiceOver):
42- [ ] Line by line through a folded heading skips to the next visible heading. 42- [ ] Line by line through a folded heading skips to the next visible heading. — did not ship: the VoiceOver check is owed (see docs/design.md, phase 1)
43- [ ] Reading a heading with tags and a TODO keyword is understandable. 43- [ ] Reading a heading with tags and a TODO keyword is understandable. — did not ship: the VoiceOver check is owed (see docs/design.md, phase 1)
44- [ ] Selection announcements are correct across a fold. 44- [ ] Selection announcements are correct across a fold. — did not ship: the VoiceOver check is owed (see docs/design.md, phase 1)
45 45
46## File structure 46## File structure
47 47
@@ -65,7 +65,7 @@ Manual VoiceOver checklist (run `swift run OrgstarSpike <file>`, turn on VoiceOv
65**Interfaces:** 65**Interfaces:**
66- Produces: `StyleRole`, `StyleRun`, `IndentRun`, `Presentation.styles(_:in:)`, `Presentation.indents(_:in:)`, `Presentation.hiddenRanges(_:folds:)`, `Presentation.heading(containing:in:)`, `Presentation.headings(_:)`. 66- Produces: `StyleRole`, `StyleRun`, `IndentRun`, `Presentation.styles(_:in:)`, `Presentation.indents(_:in:)`, `Presentation.hiddenRanges(_:folds:)`, `Presentation.heading(containing:in:)`, `Presentation.headings(_:)`.
67 67
68- [ ] **Step 1: Write the failing tests** 68- [x] **Step 1: Write the failing tests**
69 69
70```swift 70```swift
71import OrgCore 71import OrgCore
@@ -148,7 +148,7 @@ struct FoldTests {
148} 148}
149``` 149```
150 150
151- [ ] **Step 2: Implement** 151- [x] **Step 2: Implement**
152 152
153```swift 153```swift
154import OrgCore 154import OrgCore
@@ -324,7 +324,7 @@ public enum Presentation {
324} 324}
325``` 325```
326 326
327- [ ] **Step 3: Run, build for iOS, commit** 327- [x] **Step 3: Run, build for iOS, commit**
328 328
329Run: `swift test --filter OrgPresentationTests`, then `xcodebuild -scheme OrgPresentation -destination 'generic/platform=iOS' build`. 329Run: `swift test --filter OrgPresentationTests`, then `xcodebuild -scheme OrgPresentation -destination 'generic/platform=iOS' build`.
330 330
@@ -346,7 +346,7 @@ git commit -m "Add platform-free presentation policy"
346- Consumes: `DocumentState`, `ViewState`, `Saver`, `lineEdits` (OrgDocument); Task 1. 346- Consumes: `DocumentState`, `ViewState`, `Saver`, `lineEdits` (OrgDocument); Task 1.
347- Produces: `OrgEditor(document:frame:)` with `textView`, `document`, `view`, `onEditTiming`, `makeScrollView()`, `setFolds(_:)`, `toggleFoldAtCaret()`, `toggleAllFolds()`, `save(using:to:)`. 347- Produces: `OrgEditor(document:frame:)` with `textView`, `document`, `view`, `onEditTiming`, `makeScrollView()`, `setFolds(_:)`, `toggleFoldAtCaret()`, `toggleAllFolds()`, `save(using:to:)`.
348 348
349- [ ] **Step 1: Make pruning cheap** 349- [x] **Step 1: Make pruning cheap**
350 350
351```diff 351```diff
352@@ -22,11 +22,22 @@ public struct ViewState: Sendable, Equatable { 352@@ -22,11 +22,22 @@ public struct ViewState: Sendable, Equatable {
@@ -376,7 +376,7 @@ git commit -m "Add platform-free presentation policy"
376 func mapOffset(_ offset: Int, _ sortedEdits: [TextEdit]) -> Int { 376 func mapOffset(_ offset: Int, _ sortedEdits: [TextEdit]) -> Int {
377``` 377```
378 378
379- [ ] **Step 2: Write the failing tests** 379- [x] **Step 2: Write the failing tests**
380 380
381The tests drive a real `NSTextView` in an offscreen window. `RestyleFuzzTests` compares the incrementally styled storage with a fresh editor after every random edit. 381The tests drive a real `NSTextView` in an offscreen window. `RestyleFuzzTests` compares the incrementally styled storage with a fresh editor after every random edit.
382 382
@@ -631,7 +631,7 @@ struct RestyleFuzzTests {
631} 631}
632``` 632```
633 633
634- [ ] **Step 3: Implement `Theme.swift`** 634- [x] **Step 3: Implement `Theme.swift`**
635 635
636```swift 636```swift
637#if os(macOS) 637#if os(macOS)
@@ -710,7 +710,7 @@ struct Theme {
710#endif 710#endif
711``` 711```
712 712
713- [ ] **Step 4: Implement `OrgEditor.swift`** 713- [x] **Step 4: Implement `OrgEditor.swift`**
714 714
715```swift 715```swift
716#if os(macOS) 716#if os(macOS)
@@ -1062,7 +1062,7 @@ final class FoldedHeadingFragment: NSTextLayoutFragment, @unchecked Sendable {
1062#endif 1062#endif
1063``` 1063```
1064 1064
1065- [ ] **Step 5: Run, including longer fuzz runs, then commit** 1065- [x] **Step 5: Run, including longer fuzz runs, then commit**
1066 1066
1067Run: `swift test`, then `ORGSTAR_RESTYLE_EDITS=1500 ORGSTAR_FUZZ_SEED=<n> swift test --filter RestyleFuzzTests` for several seeds. 1067Run: `swift test`, then `ORGSTAR_RESTYLE_EDITS=1500 ORGSTAR_FUZZ_SEED=<n> swift test --filter RestyleFuzzTests` for several seeds.
1068 1068
@@ -1079,7 +1079,7 @@ git commit -m "Add TextKit 2 editor with folding and incremental restyle"
1079- Modify: `Package.swift` (add the `OrgstarSpike` executable) 1079- Modify: `Package.swift` (add the `OrgstarSpike` executable)
1080- Create: `Sources/OrgstarSpike/main.swift` 1080- Create: `Sources/OrgstarSpike/main.swift`
1081 1081
1082- [ ] **Step 1: Implement** 1082- [x] **Step 1: Implement**
1083 1083
1084```swift 1084```swift
1085#if os(macOS) 1085#if os(macOS)
@@ -1173,7 +1173,7 @@ app.run()
1173#endif 1173#endif
1174``` 1174```
1175 1175
1176- [ ] **Step 2: Run by hand, measure, commit** 1176- [x] **Step 2: Run by hand, measure, commit** (measured; the VoiceOver checklist did not run)
1177 1177
1178Run: `swift run -c release OrgstarSpike <large file>`; type, fold with TAB and Shift-TAB, save with ⌘S, watch the printed p50/p95; then the VoiceOver checklist above. 1178Run: `swift run -c release OrgstarSpike <large file>`; type, fold with TAB and Shift-TAB, save with ⌘S, watch the printed p50/p95; then the VoiceOver checklist above.
1179 1179
docs/plans/2026-10-04-incremental-reparse.md +6 −6
@@ -41,7 +41,7 @@ The spec reparses structural edits from the innermost enclosing section. This pl
41- Consumes: `Parser`, `splitRawLines`, `classifyLine`, `SyntaxNode`, `GreenNode`, `randomDocument`/`fragments`/`SeededGenerator` from `RoundTripTests.swift`. 41- Consumes: `Parser`, `splitRawLines`, `classifyLine`, `SyntaxNode`, `GreenNode`, `randomDocument`/`fragments`/`SeededGenerator` from `RoundTripTests.swift`.
42- Produces: `TextEdit(range:replacement:)` with `apply(to:)`; `OrgParser.reparse(_:oldText:edit:defaults:) -> OrgTree`; internal `OrgParser.reparseWithStrategy` returning `(tree, ReparseStrategy)` with `.element`, `.sections`, `.full`; `Parser(text:settings:)`; `Parser.reparseElement(_:text:settings:) -> GreenNode?`. 42- Produces: `TextEdit(range:replacement:)` with `apply(to:)`; `OrgParser.reparse(_:oldText:edit:defaults:) -> OrgTree`; internal `OrgParser.reparseWithStrategy` returning `(tree, ReparseStrategy)` with `.element`, `.sections`, `.full`; `Parser(text:settings:)`; `Parser.reparseElement(_:text:settings:) -> GreenNode?`.
43 43
44- [ ] **Step 1: Write the failing tests** 44- [x] **Step 1: Write the failing tests**
45 45
46```swift 46```swift
47import Foundation 47import Foundation
@@ -148,12 +148,12 @@ struct IncrementalTests {
148} 148}
149``` 149```
150 150
151- [ ] **Step 2: Run to verify failure** 151- [x] **Step 2: Run to verify failure**
152 152
153Run: `swift test --filter IncrementalTests` 153Run: `swift test --filter IncrementalTests`
154Expected: build failure, `cannot find 'TextEdit' in scope`. 154Expected: build failure, `cannot find 'TextEdit' in scope`.
155 155
156- [ ] **Step 3: Let the parser take known settings** 156- [x] **Step 3: Let the parser take known settings**
157 157
158```diff 158```diff
159@@ -16,10 +16,25 @@ struct Parser { 159@@ -16,10 +16,25 @@ struct Parser {
@@ -188,7 +188,7 @@ Expected: build failure, `cannot find 'TextEdit' in scope`.
188 static func matchEnds(_ info: [ClassifiedLine]) -> [Int: Int] { 188 static func matchEnds(_ info: [ClassifiedLine]) -> [Int: Int] {
189``` 189```
190 190
191- [ ] **Step 4: Implement `Incremental.swift`** 191- [x] **Step 4: Implement `Incremental.swift`**
192 192
193```swift 193```swift
194import Foundation 194import Foundation
@@ -442,7 +442,7 @@ extension Parser {
442} 442}
443``` 443```
444 444
445- [ ] **Step 5: Run all tests, then the gate** 445- [x] **Step 5: Run all tests, then the gate**
446 446
447Run: `swift test` 447Run: `swift test`
448Expected: all pass. 448Expected: all pass.
@@ -450,7 +450,7 @@ Expected: all pass.
450Run: `ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull`, and again with `ORGSTAR_FUZZ_SEED=1`, `2`, `3`. 450Run: `ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull`, and again with `ORGSTAR_FUZZ_SEED=1`, `2`, `3`.
451Expected: pass. A failure prints the edit and the document; reduce it to a unit test before fixing. 451Expected: pass. A failure prints the edit and the document; reduce it to a unit test before fixing.
452 452
453- [ ] **Step 6: Commit** 453- [x] **Step 6: Commit**
454 454
455```bash 455```bash
456git add Sources Tests 456git add Sources Tests
docs/plans/2026-10-04-inline-objects.md +15 −15
@@ -41,7 +41,7 @@ Entities (`\alpha`), subscripts, `$...$` LaTeX, export snippets, citations, radi
41**Interfaces:** 41**Interfaces:**
42- Produces: `Timestamp` (`active`, `start: Point`, `end: Point?`, `repeater: Repeater?`, `warning: Warning?`), `Timestamp.parse(_:) -> Timestamp?`; internal `scanTimestamp(_ chars: [Character], at: Int, limit: Int) -> (stamp: Timestamp, end: Int)?`. 42- Produces: `Timestamp` (`active`, `start: Point`, `end: Point?`, `repeater: Repeater?`, `warning: Warning?`), `Timestamp.parse(_:) -> Timestamp?`; internal `scanTimestamp(_ chars: [Character], at: Int, limit: Int) -> (stamp: Timestamp, end: Int)?`.
43 43
44- [ ] **Step 1: Write the failing tests** 44- [x] **Step 1: Write the failing tests**
45 45
46```swift 46```swift
47import Testing 47import Testing
@@ -90,12 +90,12 @@ struct TimestampTests {
90} 90}
91``` 91```
92 92
93- [ ] **Step 2: Run to verify failure** 93- [x] **Step 2: Run to verify failure**
94 94
95Run: `swift test --filter TimestampTests` 95Run: `swift test --filter TimestampTests`
96Expected: build failure, `cannot find 'Timestamp' in scope`. 96Expected: build failure, `cannot find 'Timestamp' in scope`.
97 97
98- [ ] **Step 3: Implement** 98- [x] **Step 3: Implement**
99 99
100```swift 100```swift
101public struct Timestamp: Sendable, Equatable { 101public struct Timestamp: Sendable, Equatable {
@@ -281,12 +281,12 @@ private func scanSingleTimestamp(_ chars: [Character], at start: Int, limit: Int
281} 281}
282``` 282```
283 283
284- [ ] **Step 4: Run to verify pass** 284- [x] **Step 4: Run to verify pass**
285 285
286Run: `swift test --filter TimestampTests` 286Run: `swift test --filter TimestampTests`
287Expected: all pass. 287Expected: all pass.
288 288
289- [ ] **Step 5: Commit** 289- [x] **Step 5: Commit**
290 290
291```bash 291```bash
292git add Sources/OrgCore/Timestamp.swift Tests/OrgCoreTests/TimestampTests.swift 292git add Sources/OrgCore/Timestamp.swift Tests/OrgCoreTests/TimestampTests.swift
@@ -306,7 +306,7 @@ git commit -m "Add timestamp recognizer and value type"
306- Consumes: `scanTimestamp` (Task 1), `GreenBuilder`, `Parser`. 306- Consumes: `scanTimestamp` (Task 1), `GreenBuilder`, `Parser`.
307- Produces: `InlineScanner(chars:)` with `scan(_:into:inLink:)`; `Parser.inline(_ text: Substring)`; `Parser.span(from:through:)`; node kinds `title`, `tableCell`, `bold`, `italic`, `underline`, `strikeThrough`, `verbatim`, `code`, `link`, `linkDescription`, `timestamp`, `footnoteReference`, `statisticsCookie`, `target`, `macro`, `inlineSourceBlock`, `latexFragment`, `lineBreak`, `superscript`; token kinds `marker`, `linkPath`, `bullet`, `checkbox`. 307- Produces: `InlineScanner(chars:)` with `scan(_:into:inLink:)`; `Parser.inline(_ text: Substring)`; `Parser.span(from:through:)`; node kinds `title`, `tableCell`, `bold`, `italic`, `underline`, `strikeThrough`, `verbatim`, `code`, `link`, `linkDescription`, `timestamp`, `footnoteReference`, `statisticsCookie`, `target`, `macro`, `inlineSourceBlock`, `latexFragment`, `lineBreak`, `superscript`; token kinds `marker`, `linkPath`, `bullet`, `checkbox`.
308 308
309- [ ] **Step 1: Write the failing tests** 309- [x] **Step 1: Write the failing tests**
310 310
311```swift 311```swift
312import Testing 312import Testing
@@ -429,12 +429,12 @@ Update the two `ParserSectionTests` expectations that assumed `title` was a toke
429 @Test func todoKeywordsComeFromSettings() { 429 @Test func todoKeywordsComeFromSettings() {
430``` 430```
431 431
432- [ ] **Step 2: Run to verify failure** 432- [x] **Step 2: Run to verify failure**
433 433
434Run: `swift test --filter InlineTests` 434Run: `swift test --filter InlineTests`
435Expected: build failure on the new `SyntaxKind` cases. 435Expected: build failure on the new `SyntaxKind` cases.
436 436
437- [ ] **Step 3: Replace `SyntaxKind.swift`** 437- [x] **Step 3: Replace `SyntaxKind.swift`**
438 438
439```swift 439```swift
440public enum SyntaxKind: String, Sendable { 440public enum SyntaxKind: String, Sendable {
@@ -457,7 +457,7 @@ public enum SyntaxKind: String, Sendable {
457} 457}
458``` 458```
459 459
460- [ ] **Step 4: Create `Inline.swift`** 460- [x] **Step 4: Create `Inline.swift`**
461 461
462```swift 462```swift
463/// Characters allowed before an emphasis opener, besides whitespace and the start of the run. 463/// Characters allowed before an emphasis opener, besides whitespace and the start of the run.
@@ -838,7 +838,7 @@ extension Parser {
838} 838}
839``` 839```
840 840
841- [ ] **Step 5: Wire the scanner into the parser** 841- [x] **Step 5: Wire the scanner into the parser**
842 842
843```diff 843```diff
844diff --git a/Sources/OrgCore/Parser/Lines.swift b/Sources/OrgCore/Parser/Lines.swift 844diff --git a/Sources/OrgCore/Parser/Lines.swift b/Sources/OrgCore/Parser/Lines.swift
@@ -1037,12 +1037,12 @@ index ac210ff..6460486 100644
1037 builder.token(.whitespace, parts.trailing) 1037 builder.token(.whitespace, parts.trailing)
1038``` 1038```
1039 1039
1040- [ ] **Step 6: Run all tests** 1040- [x] **Step 6: Run all tests**
1041 1041
1042Run: `swift test` 1042Run: `swift test`
1043Expected: all pass. 1043Expected: all pass.
1044 1044
1045- [ ] **Step 7: Commit** 1045- [x] **Step 7: Commit**
1046 1046
1047```bash 1047```bash
1048git add Sources Tests 1048git add Sources Tests
@@ -1056,7 +1056,7 @@ git commit -m "Parse inline objects"
1056**Files:** 1056**Files:**
1057- Modify: `Tests/OrgCoreTests/RoundTripTests.swift` (fragment list) 1057- Modify: `Tests/OrgCoreTests/RoundTripTests.swift` (fragment list)
1058 1058
1059- [ ] **Step 1: Add inline fragments** 1059- [x] **Step 1: Add inline fragments**
1060 1060
1061```diff 1061```diff
1062@@ -20,6 +20,10 @@ let fragments = [ 1062@@ -20,6 +20,10 @@ let fragments = [
@@ -1072,12 +1072,12 @@ git commit -m "Parse inline objects"
1072 func randomDocument(_ rng: inout SeededGenerator) -> String { 1072 func randomDocument(_ rng: inout SeededGenerator) -> String {
1073``` 1073```
1074 1074
1075- [ ] **Step 2: Run the fuzz test and the private corpus** 1075- [x] **Step 2: Run the fuzz test and the private corpus**
1076 1076
1077Run: `swift test` then `ORGSTAR_CORPUS=~/Documents/notes swift test --filter corpusRoundTrips` 1077Run: `swift test` then `ORGSTAR_CORPUS=~/Documents/notes swift test --filter corpusRoundTrips`
1078Expected: all pass. 1078Expected: all pass.
1079 1079
1080- [ ] **Step 3: Commit** 1080- [x] **Step 3: Commit**
1081 1081
1082```bash 1082```bash
1083git add Tests 1083git add Tests
docs/plans/2026-10-04-orgcore-parser.md +40 −38
@@ -1,5 +1,7 @@
1# OrgCore Parser Foundation Implementation Plan 1# OrgCore Parser Foundation Implementation Plan
2 2
3Shipped as one squashed commit, f4591a4 "OrgCore parser foundation (!1)"; the commit names below are the steps as planned.
4
3> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. 5> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4 6
5**Goal:** A Swift package, `OrgCore`, that turns org file bytes into a lossless syntax tree of block-level elements, with the byte and encoding contract from the design. 7**Goal:** A Swift package, `OrgCore`, that turns org file bytes into a lossless syntax tree of block-level elements, with the byte and encoding contract from the design.
@@ -49,7 +51,7 @@ Inline objects (emphasis, links, timestamps), the semantic layer, incremental re
49**Interfaces:** 51**Interfaces:**
50- Produces: `SourceText(bytes: [UInt8])`, `SourceText(_ text: String)`, properties `originalBytes`, `hasBOM`, `isValidUTF8`, `isEditable`, `text`; `encode(_ newText: String) -> [UInt8]`. 52- Produces: `SourceText(bytes: [UInt8])`, `SourceText(_ text: String)`, properties `originalBytes`, `hasBOM`, `isValidUTF8`, `isEditable`, `text`; `encode(_ newText: String) -> [UInt8]`.
51 53
52- [ ] **Step 1: Create the package** 54- [x] **Step 1: Create the package**
53 55
54```swift 56```swift
55// swift-tools-version: 6.2 57// swift-tools-version: 6.2
@@ -68,7 +70,7 @@ let package = Package(
68) 70)
69``` 71```
70 72
71- [ ] **Step 2: Write the failing tests** 73- [x] **Step 2: Write the failing tests**
72 74
73```swift 75```swift
74import Testing 76import Testing
@@ -113,12 +115,12 @@ struct SourceTextTests {
113} 115}
114``` 116```
115 117
116- [ ] **Step 3: Run tests to verify they fail** 118- [x] **Step 3: Run tests to verify they fail**
117 119
118Run: `swift test --filter SourceTextTests` 120Run: `swift test --filter SourceTextTests`
119Expected: build failure, `cannot find 'SourceText' in scope`. 121Expected: build failure, `cannot find 'SourceText' in scope`.
120 122
121- [ ] **Step 4: Implement** 123- [x] **Step 4: Implement**
122 124
123```swift 125```swift
124import Foundation 126import Foundation
@@ -163,12 +165,12 @@ public struct SourceText: Sendable {
163} 165}
164``` 166```
165 167
166- [ ] **Step 5: Run tests to verify they pass** 168- [x] **Step 5: Run tests to verify they pass**
167 169
168Run: `swift test --filter SourceTextTests` 170Run: `swift test --filter SourceTextTests`
169Expected: 5 tests pass. 171Expected: 5 tests pass.
170 172
171- [ ] **Step 6: Commit** 173- [x] **Step 6: Commit**
172 174
173```bash 175```bash
174git add Package.swift Sources Tests 176git add Package.swift Sources Tests
@@ -188,7 +190,7 @@ git commit -m "Add OrgCore package and SourceText byte contract"
188**Interfaces:** 190**Interfaces:**
189- Produces: `SyntaxKind` (enum, `String` raw values), `GreenToken(kind:text:)`, `GreenNode(kind:children:)` with `.length`, `.text`; `GreenElement` (`.node`, `.token`); internal `GreenBuilder` with `start(_:)`, `token(_:_:)`, `finish()`, `build()`; `SyntaxNode` with `kind`, `range`, `text`, `children`, `tokens`, `descendants()`; `SyntaxToken`. `OrgTree` depends on `OrgSettings` (Task 4), so it is added in Task 5. 191- Produces: `SyntaxKind` (enum, `String` raw values), `GreenToken(kind:text:)`, `GreenNode(kind:children:)` with `.length`, `.text`; `GreenElement` (`.node`, `.token`); internal `GreenBuilder` with `start(_:)`, `token(_:_:)`, `finish()`, `build()`; `SyntaxNode` with `kind`, `range`, `text`, `children`, `tokens`, `descendants()`; `SyntaxToken`. `OrgTree` depends on `OrgSettings` (Task 4), so it is added in Task 5.
190 192
191- [ ] **Step 1: Write the failing tests** 193- [x] **Step 1: Write the failing tests**
192 194
193```swift 195```swift
194import Testing 196import Testing
@@ -238,12 +240,12 @@ struct SyntaxTreeTests {
238} 240}
239``` 241```
240 242
241- [ ] **Step 2: Run tests to verify they fail** 243- [x] **Step 2: Run tests to verify they fail**
242 244
243Run: `swift test --filter SyntaxTreeTests` 245Run: `swift test --filter SyntaxTreeTests`
244Expected: build failure, `cannot find 'GreenBuilder' in scope`. 246Expected: build failure, `cannot find 'GreenBuilder' in scope`.
245 247
246- [ ] **Step 3: Implement `SyntaxKind.swift`** 248- [x] **Step 3: Implement `SyntaxKind.swift`**
247 249
248```swift 250```swift
249public enum SyntaxKind: String, Sendable { 251public enum SyntaxKind: String, Sendable {
@@ -260,7 +262,7 @@ public enum SyntaxKind: String, Sendable {
260} 262}
261``` 263```
262 264
263- [ ] **Step 4: Implement `GreenTree.swift`** 265- [x] **Step 4: Implement `GreenTree.swift`**
264 266
265```swift 267```swift
266public struct GreenToken: Sendable, Equatable { 268public struct GreenToken: Sendable, Equatable {
@@ -352,7 +354,7 @@ struct GreenBuilder {
352} 354}
353``` 355```
354 356
355- [ ] **Step 5: Implement `SyntaxNode.swift`** 357- [x] **Step 5: Implement `SyntaxNode.swift`**
356 358
357```swift 359```swift
358/// A view of a green node at an absolute offset, with a parent link. Created on demand. 360/// A view of a green node at an absolute offset, with a parent link. Created on demand.
@@ -408,12 +410,12 @@ public struct SyntaxToken: Sendable, Equatable {
408} 410}
409``` 411```
410 412
411- [ ] **Step 6: Run tests to verify they pass** 413- [x] **Step 6: Run tests to verify they pass**
412 414
413Run: `swift test --filter SyntaxTreeTests` 415Run: `swift test --filter SyntaxTreeTests`
414Expected: 4 tests pass. 416Expected: 4 tests pass.
415 417
416- [ ] **Step 7: Commit** 418- [x] **Step 7: Commit**
417 419
418```bash 420```bash
419git add Sources Tests 421git add Sources Tests
@@ -431,7 +433,7 @@ git commit -m "Add green and red syntax tree"
431**Interfaces:** 433**Interfaces:**
432- Produces (internal): `RawLine(content: Substring, ending: Substring)`, `splitRawLines(_ text: String) -> [RawLine]`, `LineClass` enum, `ClassifiedLine(cls:indent:)`, `classifyLine(_ line: Substring) -> ClassifiedLine`, `Substring.trimmingTrailingWhitespace`. 434- Produces (internal): `RawLine(content: Substring, ending: Substring)`, `splitRawLines(_ text: String) -> [RawLine]`, `LineClass` enum, `ClassifiedLine(cls:indent:)`, `classifyLine(_ line: Substring) -> ClassifiedLine`, `Substring.trimmingTrailingWhitespace`.
433 435
434- [ ] **Step 1: Write the failing tests** 436- [x] **Step 1: Write the failing tests**
435 437
436```swift 438```swift
437import Testing 439import Testing
@@ -500,12 +502,12 @@ struct LinesTests {
500} 502}
501``` 503```
502 504
503- [ ] **Step 2: Run tests to verify they fail** 505- [x] **Step 2: Run tests to verify they fail**
504 506
505Run: `swift test --filter LinesTests` 507Run: `swift test --filter LinesTests`
506Expected: build failure, `cannot find 'splitRawLines' in scope`. 508Expected: build failure, `cannot find 'splitRawLines' in scope`.
507 509
508- [ ] **Step 3: Implement** 510- [x] **Step 3: Implement**
509 511
510```swift 512```swift
511/// One line of source: its content and its terminator ("", "\n" or "\r\n"), both as slices of 513/// One line of source: its content and its terminator ("", "\n" or "\r\n"), both as slices of
@@ -663,12 +665,12 @@ extension Substring {
663} 665}
664``` 666```
665 667
666- [ ] **Step 4: Run tests to verify they pass** 668- [x] **Step 4: Run tests to verify they pass**
667 669
668Run: `swift test --filter LinesTests` 670Run: `swift test --filter LinesTests`
669Expected: all pass. 671Expected: all pass.
670 672
671- [ ] **Step 5: Commit** 673- [x] **Step 5: Commit**
672 674
673```bash 675```bash
674git add Sources Tests 676git add Sources Tests
@@ -687,7 +689,7 @@ git commit -m "Add line splitting and classification"
687- Consumes: `RawLine`, `ClassifiedLine`, `LineClass` (Task 3). 689- Consumes: `RawLine`, `ClassifiedLine`, `LineClass` (Task 3).
688- Produces: `TodoKeyword`, `TodoSequence`, `Priorities`, `OrgSettings` with `.default`, `todoKeywordNames: Set<String>`, `isDone(_:)`; internal `SettingsScanner.scan(lines:info:blockEnds:defaults:) -> OrgSettings`, where `blockEnds: [Int: Int]` maps a block's begin line index to its end line index. 690- Produces: `TodoKeyword`, `TodoSequence`, `Priorities`, `OrgSettings` with `.default`, `todoKeywordNames: Set<String>`, `isDone(_:)`; internal `SettingsScanner.scan(lines:info:blockEnds:defaults:) -> OrgSettings`, where `blockEnds: [Int: Int]` maps a block's begin line index to its end line index.
689 691
690- [ ] **Step 1: Write the failing tests** 692- [x] **Step 1: Write the failing tests**
691 693
692```swift 694```swift
693import Testing 695import Testing
@@ -740,12 +742,12 @@ struct SettingsTests {
740} 742}
741``` 743```
742 744
743- [ ] **Step 2: Run tests to verify they fail** 745- [x] **Step 2: Run tests to verify they fail**
744 746
745Run: `swift test --filter SettingsTests` 747Run: `swift test --filter SettingsTests`
746Expected: build failure, `cannot find 'SettingsScanner' in scope`. 748Expected: build failure, `cannot find 'SettingsScanner' in scope`.
747 749
748- [ ] **Step 3: Implement** 750- [x] **Step 3: Implement**
749 751
750```swift 752```swift
751public struct TodoKeyword: Sendable, Hashable { 753public struct TodoKeyword: Sendable, Hashable {
@@ -879,12 +881,12 @@ enum SettingsScanner {
879} 881}
880``` 882```
881 883
882- [ ] **Step 4: Run tests to verify they pass** 884- [x] **Step 4: Run tests to verify they pass**
883 885
884Run: `swift test --filter SettingsTests` 886Run: `swift test --filter SettingsTests`
885Expected: all pass. 887Expected: all pass.
886 888
887- [ ] **Step 5: Commit** 889- [x] **Step 5: Commit**
888 890
889```bash 891```bash
890git add Sources Tests 892git add Sources Tests
@@ -904,7 +906,7 @@ git commit -m "Add in-buffer TODO and priority settings"
904- Consumes: Tasks 2–4. 906- Consumes: Tasks 2–4.
905- Produces: `public enum OrgParser { static func parse(_ text: String, defaults: OrgSettings = .default) -> OrgTree }`; `public struct OrgTree { green: GreenNode; settings: OrgSettings; root: SyntaxNode; text: String }`; internal `struct Parser` with `element(limit:floor:)` that Task 6 fills in. In this task `element` handles every class as a paragraph or a blank line. 907- Produces: `public enum OrgParser { static func parse(_ text: String, defaults: OrgSettings = .default) -> OrgTree }`; `public struct OrgTree { green: GreenNode; settings: OrgSettings; root: SyntaxNode; text: String }`; internal `struct Parser` with `element(limit:floor:)` that Task 6 fills in. In this task `element` handles every class as a paragraph or a blank line.
906 908
907- [ ] **Step 1: Write the failing tests** 909- [x] **Step 1: Write the failing tests**
908 910
909```swift 911```swift
910import Testing 912import Testing
@@ -975,12 +977,12 @@ struct ParserSectionTests {
975} 977}
976``` 978```
977 979
978- [ ] **Step 2: Run tests to verify they fail** 980- [x] **Step 2: Run tests to verify they fail**
979 981
980Run: `swift test --filter ParserSectionTests` 982Run: `swift test --filter ParserSectionTests`
981Expected: build failure, `cannot find 'OrgParser' in scope`. 983Expected: build failure, `cannot find 'OrgParser' in scope`.
982 984
983- [ ] **Step 3: Append `OrgTree` to `SyntaxNode.swift`** 985- [x] **Step 3: Append `OrgTree` to `SyntaxNode.swift`**
984 986
985```swift 987```swift
986public struct OrgTree: Sendable { 988public struct OrgTree: Sendable {
@@ -992,7 +994,7 @@ public struct OrgTree: Sendable {
992} 994}
993``` 995```
994 996
995- [ ] **Step 4: Implement `Parser.swift`** 997- [x] **Step 4: Implement `Parser.swift`**
996 998
997```swift 999```swift
998public enum OrgParser { 1000public enum OrgParser {
@@ -1226,12 +1228,12 @@ struct Parser {
1226} 1228}
1227``` 1229```
1228 1230
1229- [ ] **Step 5: Run tests to verify they pass** 1231- [x] **Step 5: Run tests to verify they pass**
1230 1232
1231Run: `swift test --filter ParserSectionTests` 1233Run: `swift test --filter ParserSectionTests`
1232Expected: all pass. 1234Expected: all pass.
1233 1235
1234- [ ] **Step 6: Commit** 1236- [x] **Step 6: Commit**
1235 1237
1236```bash 1238```bash
1237git add Sources Tests 1239git add Sources Tests
@@ -1250,7 +1252,7 @@ git commit -m "Parse document, sections and headings"
1250- Consumes: Task 5's `Parser`. 1252- Consumes: Task 5's `Parser`.
1251- Produces: nodes `block`, `dynamicBlock`, `drawer`, `keyword`, `affiliatedKeyword`, `comment`, `fixedWidth`, `horizontalRule`, `table`/`tableRow`/`tableFormula`, `footnoteDefinition`, `clock`, `plainList`/`item`, `planning` (after heading only), `propertyDrawer`/`nodeProperty`. 1253- Produces: nodes `block`, `dynamicBlock`, `drawer`, `keyword`, `affiliatedKeyword`, `comment`, `fixedWidth`, `horizontalRule`, `table`/`tableRow`/`tableFormula`, `footnoteDefinition`, `clock`, `plainList`/`item`, `planning` (after heading only), `propertyDrawer`/`nodeProperty`.
1252 1254
1253- [ ] **Step 1: Write the failing tests** 1255- [x] **Step 1: Write the failing tests**
1254 1256
1255```swift 1257```swift
1256import Testing 1258import Testing
@@ -1334,12 +1336,12 @@ struct ParserElementTests {
1334} 1336}
1335``` 1337```
1336 1338
1337- [ ] **Step 2: Run tests to verify they fail** 1339- [x] **Step 2: Run tests to verify they fail**
1338 1340
1339Run: `swift test --filter ParserElementTests` 1341Run: `swift test --filter ParserElementTests`
1340Expected: failures; every element parses as a paragraph. 1342Expected: failures; every element parses as a paragraph.
1341 1343
1342- [ ] **Step 3: Replace `element` and `continuesParagraph`, add the element parsers** 1344- [x] **Step 3: Replace `element` and `continuesParagraph`, add the element parsers**
1343 1345
1344```swift 1346```swift
1345 static let affiliatedKeys: Set<String> = ["NAME", "CAPTION", "RESULTS", "HEADER", "PLOT"] 1347 static let affiliatedKeys: Set<String> = ["NAME", "CAPTION", "RESULTS", "HEADER", "PLOT"]
@@ -1479,12 +1481,12 @@ Expected: failures; every element parses as a paragraph.
1479 } 1481 }
1480``` 1482```
1481 1483
1482- [ ] **Step 4: Run all tests** 1484- [x] **Step 4: Run all tests**
1483 1485
1484Run: `swift test` 1486Run: `swift test`
1485Expected: all pass, including Task 5's tests. 1487Expected: all pass, including Task 5's tests.
1486 1488
1487- [ ] **Step 5: Commit** 1489- [x] **Step 5: Commit**
1488 1490
1489```bash 1491```bash
1490git add Sources Tests 1492git add Sources Tests
@@ -1502,7 +1504,7 @@ git commit -m "Parse block-level elements"
1502- Consumes: `SourceText`, `OrgParser`, `SyntaxNode`. 1504- Consumes: `SourceText`, `OrgParser`, `SyntaxNode`.
1503- Produces: a seeded fuzz test (2,000 documents), a structural invariant check, and an opt-in corpus test driven by `ORGSTAR_CORPUS`. 1505- Produces: a seeded fuzz test (2,000 documents), a structural invariant check, and an opt-in corpus test driven by `ORGSTAR_CORPUS`.
1504 1506
1505- [ ] **Step 1: Write the tests** 1507- [x] **Step 1: Write the tests**
1506 1508
1507```swift 1509```swift
1508import Foundation 1510import Foundation
@@ -1582,17 +1584,17 @@ struct RoundTripTests {
1582} 1584}
1583``` 1585```
1584 1586
1585- [ ] **Step 2: Run the tests** 1587- [x] **Step 2: Run the tests**
1586 1588
1587Run: `swift test` 1589Run: `swift test`
1588Expected: all pass. The corpus test is skipped. 1590Expected: all pass. The corpus test is skipped.
1589 1591
1590- [ ] **Step 3: Run the private corpus locally** 1592- [x] **Step 3: Run the private corpus locally**
1591 1593
1592Run: `ORGSTAR_CORPUS=~/org swift test --filter corpusRoundTrips` 1594Run: `ORGSTAR_CORPUS=~/org swift test --filter corpusRoundTrips`
1593Expected: pass. Any failure names the file; reduce it to a fuzz fragment or a unit test before fixing. 1595Expected: pass. Any failure names the file; reduce it to a fuzz fragment or a unit test before fixing.
1594 1596
1595- [ ] **Step 4: Commit** 1597- [x] **Step 4: Commit**
1596 1598
1597```bash 1599```bash
1598git add Tests 1600git add Tests
docs/plans/2026-10-04-performance.md +10 −10
@@ -48,7 +48,7 @@ Run the gates: `ORGSTAR_GATES=1 ORGSTAR_GATE_FILE=<a large real file> swift test
48**Files:** 48**Files:**
49- Modify: `Sources/OrgCore/Parser/Inline.swift`, `Sources/OrgCore/Timestamp.swift` 49- Modify: `Sources/OrgCore/Parser/Inline.swift`, `Sources/OrgCore/Timestamp.swift`
50 50
51- [ ] **Step 1: Rewrite the scanner and the timestamp recognizer over `[Unicode.Scalar]`** 51- [x] **Step 1: Rewrite the scanner and the timestamp recognizer over `[Unicode.Scalar]`**
52 52
53The existing inline, timestamp and round-trip tests are the specification; they don't change. 53The existing inline, timestamp and round-trip tests are the specification; they don't change.
54 54
@@ -572,7 +572,7 @@ index da5ac94..bd71851 100644
572+} 572+}
573``` 573```
574 574
575- [ ] **Step 2: Run tests, the corpus and the reparse gate; commit** 575- [x] **Step 2: Run tests, the corpus and the reparse gate; commit**
576 576
577Run: `swift test`; `ORGSTAR_CORPUS=<folder> swift test -c release --filter corpusRoundTrips` for each local folder; `ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull`. 577Run: `swift test`; `ORGSTAR_CORPUS=<folder> swift test -c release --filter corpusRoundTrips` for each local folder; `ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull`.
578 578
@@ -592,7 +592,7 @@ git commit -m "Scan inline objects over unicode scalars"
592**Interfaces:** 592**Interfaces:**
593- Produces: `ReparseStrategy.region`; `SyntaxNode.children(overlapping:)`, `child(containing:)`, `firstChild(_:)`; `GreenBuilder.node(_:)`; `Parser.reusableRows`. 593- Produces: `ReparseStrategy.region`; `SyntaxNode.children(overlapping:)`, `child(containing:)`, `firstChild(_:)`; `GreenBuilder.node(_:)`; `Parser.reusableRows`.
594 594
595- [ ] **Step 1: Write the failing tests** 595- [x] **Step 1: Write the failing tests**
596 596
597```diff 597```diff
598@@ -49,8 +49,23 @@ struct IncrementalTests { 598@@ -49,8 +49,23 @@ struct IncrementalTests {
@@ -623,7 +623,7 @@ git commit -m "Scan inline objects over unicode scalars"
623 @Test func runGrowsUntilAHeadingEndsIt() { 623 @Test func runGrowsUntilAHeadingEndsIt() {
624``` 624```
625 625
626- [ ] **Step 2: Implement** 626- [x] **Step 2: Implement**
627 627
628```diff 628```diff
629diff --git a/Sources/OrgCore/Parser/Incremental.swift b/Sources/OrgCore/Parser/Incremental.swift 629diff --git a/Sources/OrgCore/Parser/Incremental.swift b/Sources/OrgCore/Parser/Incremental.swift
@@ -909,7 +909,7 @@ index 3473728..0430409 100644
909 [self] + children.flatMap { $0.descendants() } 909 [self] + children.flatMap { $0.descendants() }
910``` 910```
911 911
912- [ ] **Step 3: Run the gate on several seeds; commit** 912- [x] **Step 3: Run the gate on several seeds; commit**
913 913
914Run: `ORGSTAR_FUZZ_SEED=<n> ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull` for at least five seeds. 914Run: `ORGSTAR_FUZZ_SEED=<n> ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull` for at least five seeds.
915 915
@@ -929,7 +929,7 @@ git commit -m "Reparse structural edits within one section's body"
929**Interfaces:** 929**Interfaces:**
930- Produces: `OrgEditor.finishStyling()`, `OrgEditor.styledUpTo`, `OrgEditor.firstStyleChunk`, `OrgEditor.styleChunk`; test `Harness(_:layout:)`, `Harness.drainStyling()`. 930- Produces: `OrgEditor.finishStyling()`, `OrgEditor.styledUpTo`, `OrgEditor.firstStyleChunk`, `OrgEditor.styleChunk`; test `Harness(_:layout:)`, `Harness.drainStyling()`.
931 931
932- [ ] **Step 1: Write the failing tests** 932- [x] **Step 1: Write the failing tests**
933 933
934```diff 934```diff
935@@ -10,13 +10,24 @@ final class Harness { 935@@ -10,13 +10,24 @@ final class Harness {
@@ -989,7 +989,7 @@ git commit -m "Reparse structural edits within one section's body"
989+} 989+}
990``` 990```
991 991
992- [ ] **Step 2: Implement** 992- [x] **Step 2: Implement**
993 993
994```diff 994```diff
995diff --git a/Sources/OrgDocument/ViewState.swift b/Sources/OrgDocument/ViewState.swift 995diff --git a/Sources/OrgDocument/ViewState.swift b/Sources/OrgDocument/ViewState.swift
@@ -1179,7 +1179,7 @@ index 312d7f8..504e0b5 100644
1179 node = child 1179 node = child
1180``` 1180```
1181 1181
1182- [ ] **Step 3: Run the restyle fuzz on several seeds; commit** 1182- [x] **Step 3: Run the restyle fuzz on several seeds; commit**
1183 1183
1184Run: `ORGSTAR_FUZZ_SEED=<n> ORGSTAR_RESTYLE_EDITS=1500 swift test -c release --filter RestyleFuzzTests` for at least three seeds. 1184Run: `ORGSTAR_FUZZ_SEED=<n> ORGSTAR_RESTYLE_EDITS=1500 swift test -c release --filter RestyleFuzzTests` for at least three seeds.
1185 1185
@@ -1196,7 +1196,7 @@ git commit -m "Style the first screen first and narrow restyles"
1196- Create: `Tests/OrgEditorAppKitTests/GateTests.swift` 1196- Create: `Tests/OrgEditorAppKitTests/GateTests.swift`
1197- Modify: `docs/design.md` (memory gate) 1197- Modify: `docs/design.md` (memory gate)
1198 1198
1199- [ ] **Step 1: Add the gate suite** 1199- [x] **Step 1: Add the gate suite**
1200 1200
1201```swift 1201```swift
1202import AppKit 1202import AppKit
@@ -1306,7 +1306,7 @@ struct GateTests {
1306} 1306}
1307``` 1307```
1308 1308
1309- [ ] **Step 2: Run the gates; commit** 1309- [x] **Step 2: Run the gates; commit** (gates run on an M-series Mac, recorded in docs/design.md; the M1 Air run is owed)
1310 1310
1311Run: `ORGSTAR_GATES=1 ORGSTAR_GATE_FILE=<large real file> swift test -c release --filter GateTests` 1311Run: `ORGSTAR_GATES=1 ORGSTAR_GATE_FILE=<large real file> swift test -c release --filter GateTests`
1312 1312
docs/plans/2026-10-04-semantic-layer.md +17 −17
@@ -43,7 +43,7 @@ Merging `:results` values by group (collection, type, format, handling), languag
43**Interfaces:** 43**Interfaces:**
44- Produces: `SemanticSettings` (`.default`, `PropertyInheritance` `.none`/`.all`/`.only(Set<String>)` of upper-cased keys), `ValueSource` (`.defaults`, `.file`, `.heading(Int)`, `.element`), `Resolved<Value>(_:_:)`, `Property(key:value:additive:)` and internal `Property(line:)`, `Clock(start:end:minutes:)`, `HeadingInfo`, `displayWidth(_:)`, `TableModel` (internal `init(node:heading:)`), `SrcBlockInfo`, `HeaderArguments.defaults`, `HeaderArguments.parse(_:) -> [(key: String, value: String)]`. 44- Produces: `SemanticSettings` (`.default`, `PropertyInheritance` `.none`/`.all`/`.only(Set<String>)` of upper-cased keys), `ValueSource` (`.defaults`, `.file`, `.heading(Int)`, `.element`), `Resolved<Value>(_:_:)`, `Property(key:value:additive:)` and internal `Property(line:)`, `Clock(start:end:minutes:)`, `HeadingInfo`, `displayWidth(_:)`, `TableModel` (internal `init(node:heading:)`), `SrcBlockInfo`, `HeaderArguments.defaults`, `HeaderArguments.parse(_:) -> [(key: String, value: String)]`.
45 45
46- [ ] **Step 1: Write the failing tests** 46- [x] **Step 1: Write the failing tests**
47 47
48```swift 48```swift
49import Testing 49import Testing
@@ -64,12 +64,12 @@ struct SemanticValueTests {
64} 64}
65``` 65```
66 66
67- [ ] **Step 2: Run to verify failure** 67- [x] **Step 2: Run to verify failure**
68 68
69Run: `swift test --filter SemanticValueTests` 69Run: `swift test --filter SemanticValueTests`
70Expected: build failure, `cannot find 'HeaderArguments' in scope`. 70Expected: build failure, `cannot find 'HeaderArguments' in scope`.
71 71
72- [ ] **Step 3: Implement `SemanticSettings.swift`** 72- [x] **Step 3: Implement `SemanticSettings.swift`**
73 73
74```swift 74```swift
75/// App-wide settings that change what a document means without changing how it parses. 75/// App-wide settings that change what a document means without changing how it parses.
@@ -121,7 +121,7 @@ public struct Resolved<Value: Sendable & Equatable>: Sendable, Equatable {
121} 121}
122``` 122```
123 123
124- [ ] **Step 4: Implement `HeadingInfo.swift`** 124- [x] **Step 4: Implement `HeadingInfo.swift`**
125 125
126```swift 126```swift
127import Foundation 127import Foundation
@@ -193,7 +193,7 @@ public struct HeadingInfo: Sendable, Equatable {
193} 193}
194``` 194```
195 195
196- [ ] **Step 5: Implement `DisplayWidth.swift`** 196- [x] **Step 5: Implement `DisplayWidth.swift`**
197 197
198```swift 198```swift
199/// Columns a string occupies in a monospaced table: East Asian wide and fullwidth characters 199/// Columns a string occupies in a monospaced table: East Asian wide and fullwidth characters
@@ -215,7 +215,7 @@ func displayWidth(of character: Character) -> Int {
215} 215}
216``` 216```
217 217
218- [ ] **Step 6: Implement `TableModel.swift`** 218- [x] **Step 6: Implement `TableModel.swift`**
219 219
220```swift 220```swift
221import Foundation 221import Foundation
@@ -261,7 +261,7 @@ public struct TableModel: Sendable, Equatable {
261} 261}
262``` 262```
263 263
264- [ ] **Step 7: Implement `SrcBlockInfo.swift`** 264- [x] **Step 7: Implement `SrcBlockInfo.swift`**
265 265
266```swift 266```swift
267public struct SrcBlockInfo: Sendable, Equatable { 267public struct SrcBlockInfo: Sendable, Equatable {
@@ -302,12 +302,12 @@ public enum HeaderArguments {
302} 302}
303``` 303```
304 304
305- [ ] **Step 8: Run to verify pass** 305- [x] **Step 8: Run to verify pass**
306 306
307Run: `swift test --filter SemanticValueTests` 307Run: `swift test --filter SemanticValueTests`
308Expected: all pass. 308Expected: all pass.
309 309
310- [ ] **Step 9: Commit** 310- [x] **Step 9: Commit**
311 311
312```bash 312```bash
313git add Sources/OrgCore/Semantic Tests/OrgCoreTests/SemanticValueTests.swift 313git add Sources/OrgCore/Semantic Tests/OrgCoreTests/SemanticValueTests.swift
@@ -326,7 +326,7 @@ git commit -m "Add semantic value types"
326- Consumes: Task 1 types, `OrgTree`, `SyntaxNode`, `Timestamp.parse`, `SettingsScanner.keywordValue`, `splitRawLines`. 326- Consumes: Task 1 types, `OrgTree`, `SyntaxNode`, `Timestamp.parse`, `SettingsScanner.keywordValue`, `splitRawLines`.
327- Produces: `DocumentModel(tree:settings:)` with `headings`, `fileTags`, `fileProperties`, `tables`, `srcBlocks`, `ancestors(of:)`, `outlinePath(of:)`, `inherits(_:)`, `property(_:of:) -> Resolved<String>?`, `tags(of:) -> [Resolved<String>]`. 327- Produces: `DocumentModel(tree:settings:)` with `headings`, `fileTags`, `fileProperties`, `tables`, `srcBlocks`, `ancestors(of:)`, `outlinePath(of:)`, `inherits(_:)`, `property(_:of:) -> Resolved<String>?`, `tags(of:) -> [Resolved<String>]`.
328 328
329- [ ] **Step 1: Write the failing tests** 329- [x] **Step 1: Write the failing tests**
330 330
331```swift 331```swift
332import Testing 332import Testing
@@ -490,12 +490,12 @@ struct TableModelTests {
490} 490}
491``` 491```
492 492
493- [ ] **Step 2: Run to verify failure** 493- [x] **Step 2: Run to verify failure**
494 494
495Run: `swift test --filter HeadingInfoTests` 495Run: `swift test --filter HeadingInfoTests`
496Expected: build failure, `cannot find 'DocumentModel' in scope`. 496Expected: build failure, `cannot find 'DocumentModel' in scope`.
497 497
498- [ ] **Step 3: Implement** 498- [x] **Step 3: Implement**
499 499
500```swift 500```swift
501import Foundation 501import Foundation
@@ -791,12 +791,12 @@ public struct DocumentModel: Sendable {
791} 791}
792``` 792```
793 793
794- [ ] **Step 4: Run all tests** 794- [x] **Step 4: Run all tests**
795 795
796Run: `swift test` 796Run: `swift test`
797Expected: all pass. 797Expected: all pass.
798 798
799- [ ] **Step 5: Commit** 799- [x] **Step 5: Commit**
800 800
801```bash 801```bash
802git add Sources/OrgCore/Semantic/DocumentModel.swift Tests/OrgCoreTests/SemanticTests.swift 802git add Sources/OrgCore/Semantic/DocumentModel.swift Tests/OrgCoreTests/SemanticTests.swift
@@ -810,7 +810,7 @@ git commit -m "Add document model with inheritance and header arguments"
810**Files:** 810**Files:**
811- Modify: `Tests/OrgCoreTests/RoundTripTests.swift` 811- Modify: `Tests/OrgCoreTests/RoundTripTests.swift`
812 812
813- [ ] **Step 1: Build a model for every parsed document** 813- [x] **Step 1: Build a model for every parsed document**
814 814
815```diff 815```diff
816@@ -45,6 +45,7 @@ struct RoundTripTests { 816@@ -45,6 +45,7 @@ struct RoundTripTests {
@@ -831,12 +831,12 @@ git commit -m "Add document model with inheritance and header arguments"
831 } 831 }
832``` 832```
833 833
834- [ ] **Step 2: Run** 834- [x] **Step 2: Run**
835 835
836Run: `swift test` then `ORGSTAR_CORPUS=~/Documents/notes swift test --filter corpusRoundTrips` 836Run: `swift test` then `ORGSTAR_CORPUS=~/Documents/notes swift test --filter corpusRoundTrips`
837Expected: all pass, no crashes. 837Expected: all pass, no crashes.
838 838
839- [ ] **Step 3: Commit** 839- [x] **Step 3: Commit**
840 840
841```bash 841```bash
842git add Tests/OrgCoreTests/RoundTripTests.swift 842git add Tests/OrgCoreTests/RoundTripTests.swift
docs/plans/2026-10-04-viewer.md +11 −11
@@ -46,7 +46,7 @@
46**Interfaces:** 46**Interfaces:**
47- Produces: `FoldState`, `GlobalVisibility`, `OutlineEntry`, `Presentation.outline(_:)`, `cycle(_:in:_:)`, `cycleGlobal(from:in:)`, `foldState(for:in:)`, `foldState(showingLevels:in:)`, `startupFoldState(_:)`, `startupOptions(_:)`; `ViewState.bodyFolds`; `OrgEditor(document:frame:editable:)`, `foldState`, `setFolds(_ state: FoldState)`, `cycleAtCaret()`, `cycleGlobal()`, `reveal(_:)`, `diskChanged(to:)`, `hangingColumns(_:)`. 47- Produces: `FoldState`, `GlobalVisibility`, `OutlineEntry`, `Presentation.outline(_:)`, `cycle(_:in:_:)`, `cycleGlobal(from:in:)`, `foldState(for:in:)`, `foldState(showingLevels:in:)`, `startupFoldState(_:)`, `startupOptions(_:)`; `ViewState.bodyFolds`; `OrgEditor(document:frame:editable:)`, `foldState`, `setFolds(_ state: FoldState)`, `cycleAtCaret()`, `cycleGlobal()`, `reveal(_:)`, `diskChanged(to:)`, `hangingColumns(_:)`.
48 48
49- [ ] **Step 1: Write the failing tests** 49- [x] **Step 1: Write the failing tests**
50 50
51```diff 51```diff
52diff --git a/Tests/OrgEditorAppKitTests/EditorTests.swift b/Tests/OrgEditorAppKitTests/EditorTests.swift 52diff --git a/Tests/OrgEditorAppKitTests/EditorTests.swift b/Tests/OrgEditorAppKitTests/EditorTests.swift
@@ -214,7 +214,7 @@ index 6e1ca3d..7007d92 100644
214+} 214+}
215``` 215```
216 216
217- [ ] **Step 2: Implement** 217- [x] **Step 2: Implement**
218 218
219```swift 219```swift
220import OrgCore 220import OrgCore
@@ -658,7 +658,7 @@ index 504e0b5..1813443 100644
658 658
659``` 659```
660 660
661- [ ] **Step 3: Run and commit** 661- [x] **Step 3: Run and commit**
662 662
663Run: `swift test` 663Run: `swift test`
664 664
@@ -676,7 +676,7 @@ git commit -m "Cycle folds, apply #+STARTUP visibility and indent wrapped lines"
676- Create: `Sources/OrgApp/FileTree.swift`, `Sources/OrgApp/WorkspaceModel.swift`, `Sources/OrgApp/DocumentSession.swift` 676- Create: `Sources/OrgApp/FileTree.swift`, `Sources/OrgApp/WorkspaceModel.swift`, `Sources/OrgApp/DocumentSession.swift`
677- Test: `Tests/OrgAppTests/AppTests.swift` 677- Test: `Tests/OrgAppTests/AppTests.swift`
678 678
679- [ ] **Step 1: Write the failing tests** 679- [x] **Step 1: Write the failing tests**
680 680
681```swift 681```swift
682import Foundation 682import Foundation
@@ -796,7 +796,7 @@ struct DocumentSessionTests {
796} 796}
797``` 797```
798 798
799- [ ] **Step 2: Implement** 799- [x] **Step 2: Implement**
800 800
801```swift 801```swift
802import Foundation 802import Foundation
@@ -1202,7 +1202,7 @@ index 517c833..556ca69 100644
1202 /// One reconciliation's worth of changes, applied in a single transaction. 1202 /// One reconciliation's worth of changes, applied in a single transaction.
1203``` 1203```
1204 1204
1205- [ ] **Step 3: Run and commit** 1205- [x] **Step 3: Run and commit**
1206 1206
1207Run: `swift test --filter OrgAppTests` 1207Run: `swift test --filter OrgAppTests`
1208 1208
@@ -1219,7 +1219,7 @@ git commit -m "Add workspace and document session models"
1219- Modify: `Package.swift` (add the `Orgstar` executable), `README.md` 1219- Modify: `Package.swift` (add the `Orgstar` executable), `README.md`
1220- Create: `Sources/Orgstar/OrgstarApp.swift`, `ContentView.swift`, `EditorView.swift`, `DevelopmentHooks.swift`, `scripts/build-app.sh` 1220- Create: `Sources/Orgstar/OrgstarApp.swift`, `ContentView.swift`, `EditorView.swift`, `DevelopmentHooks.swift`, `scripts/build-app.sh`
1221 1221
1222- [ ] **Step 1: Implement** 1222- [x] **Step 1: Implement**
1223 1223
1224```swift 1224```swift
1225import OrgApp 1225import OrgApp
@@ -1598,7 +1598,7 @@ codesign --force --sign - "$app"
1598echo "$app" 1598echo "$app"
1599``` 1599```
1600 1600
1601- [ ] **Step 2: Build, run and snapshot** 1601- [x] **Step 2: Build, run and snapshot**
1602 1602
1603Run: `scripts/build-app.sh`, then with a seeded data directory: 1603Run: `scripts/build-app.sh`, then with a seeded data directory:
1604`ORGSTAR_DATA_DIR=<dir> ORGSTAR_OPEN=<file.org> ORGSTAR_SNAPSHOT=/tmp/shot.png .build/app/Orgstar.app/Contents/MacOS/Orgstar` 1604`ORGSTAR_DATA_DIR=<dir> ORGSTAR_OPEN=<file.org> ORGSTAR_SNAPSHOT=/tmp/shot.png .build/app/Orgstar.app/Contents/MacOS/Orgstar`
@@ -1606,7 +1606,7 @@ Check: outline column lists the file's headings by level; the editor shows hidde
1606 1606
1607Manual: add a folder with ⇧⌘O; ⌘P opens a file; ⇧⌘F search opens results that reveal the heading; TAB and Shift-TAB fold; editing the file in Emacs reloads the view. 1607Manual: add a folder with ⇧⌘O; ⌘P opens a file; ⇧⌘F search opens results that reveal the heading; TAB and Shift-TAB fold; editing the file in Emacs reloads the view.
1608 1608
1609- [ ] **Step 3: Commit** 1609- [x] **Step 3: Commit**
1610 1610
1611```bash 1611```bash
1612git add Package.swift README.md Sources/Orgstar scripts 1612git add Package.swift README.md Sources/Orgstar scripts
@@ -1622,7 +1622,7 @@ Per-line hanging indents gave every line its own `NSParagraphStyle`, which pushe
1622**Files:** 1622**Files:**
1623- Modify: `Sources/OrgEditorAppKit/OrgEditor.swift` 1623- Modify: `Sources/OrgEditorAppKit/OrgEditor.swift`
1624 1624
1625- [ ] **Step 1: Implement** 1625- [x] **Step 1: Implement**
1626 1626
1627```diff 1627```diff
1628@@ -59,6 +59,13 @@ public final class OrgEditor: NSObject { 1628@@ -59,6 +59,13 @@ public final class OrgEditor: NSObject {
@@ -1674,7 +1674,7 @@ Per-line hanging indents gave every line its own `NSParagraphStyle`, which pushe
1674 return clipped.isEmpty ? nil : NSRange(clipped) 1674 return clipped.isEmpty ? nil : NSRange(clipped)
1675``` 1675```
1676 1676
1677- [ ] **Step 2: Run the gates; commit** 1677- [x] **Step 2: Run the gates; commit** (gates run on an M-series Mac, recorded in docs/design.md; the M1 Air run is owed)
1678 1678
1679Run: `ORGSTAR_GATES=1 ORGSTAR_GATE_FILE=<large real file> swift test -c release --filter GateTests` 1679Run: `ORGSTAR_GATES=1 ORGSTAR_GATE_FILE=<large real file> swift test -c release --filter GateTests`
1680 1680
docs/plans/2026-10-04-workspace-index.md +18 −18
@@ -46,7 +46,7 @@ Agenda queries (phase 3), security-scoped bookmark creation in a sandbox (the Ma
46- Consumes: `OrgParser`, `DocumentModel`, `SourceText`, `Timestamp`. 46- Consumes: `OrgParser`, `DocumentModel`, `SourceText`, `Timestamp`.
47- Produces: `FileKind`, `IndexSettings(version:org:semantic:)`, `FileRecord(path:root:kind:bytes:mtime:settings:)`, `FileRecord.hash(_:)`, `HeadingRecord`, `TagRow`, `PropertyRow`, `TimestampRow`, `ClockRow`, `LinkRow`. 47- Produces: `FileKind`, `IndexSettings(version:org:semantic:)`, `FileRecord(path:root:kind:bytes:mtime:settings:)`, `FileRecord.hash(_:)`, `HeadingRecord`, `TagRow`, `PropertyRow`, `TimestampRow`, `ClockRow`, `LinkRow`.
48 48
49- [ ] **Step 1: Add the target** 49- [x] **Step 1: Add the target**
50 50
51```swift 51```swift
52// swift-tools-version: 6.2 52// swift-tools-version: 6.2
@@ -74,7 +74,7 @@ let package = Package(
74) 74)
75``` 75```
76 76
77- [ ] **Step 2: Write the failing tests** 77- [x] **Step 2: Write the failing tests**
78 78
79```swift 79```swift
80import OrgCore 80import OrgCore
@@ -144,7 +144,7 @@ struct FileRecordTests {
144} 144}
145``` 145```
146 146
147- [ ] **Step 3: Implement** 147- [x] **Step 3: Implement**
148 148
149```swift 149```swift
150import CryptoKit 150import CryptoKit
@@ -358,7 +358,7 @@ public struct FileRecord: Sendable, Equatable {
358} 358}
359``` 359```
360 360
361- [ ] **Step 4: Run to verify pass, then commit** 361- [x] **Step 4: Run to verify pass, then commit**
362 362
363Run: `swift test --filter FileRecordTests` 363Run: `swift test --filter FileRecordTests`
364 364
@@ -379,7 +379,7 @@ git commit -m "Add index file records"
379- Consumes: `FileRecord` (Task 1). 379- Consumes: `FileRecord` (Task 1).
380- Produces: `IndexStore(path:)`, `write(_:)`, `apply(_ change: IndexChange)`, `fileStates(root:) -> [String: FileState]`, `files()`, `search(_:overlay:limit:)`, `headings(withID:overlay:)`, `duplicateIDs(overlay:)`; `FileState`, `HeadingLocation`, `IndexChange`. 380- Produces: `IndexStore(path:)`, `write(_:)`, `apply(_ change: IndexChange)`, `fileStates(root:) -> [String: FileState]`, `files()`, `search(_:overlay:limit:)`, `headings(withID:overlay:)`, `duplicateIDs(overlay:)`; `FileState`, `HeadingLocation`, `IndexChange`.
381 381
382- [ ] **Step 1: Write the failing tests** 382- [x] **Step 1: Write the failing tests**
383 383
384```swift 384```swift
385import OrgCore 385import OrgCore
@@ -450,7 +450,7 @@ struct IndexStoreTests {
450} 450}
451``` 451```
452 452
453- [ ] **Step 2: Implement** 453- [x] **Step 2: Implement**
454 454
455```swift 455```swift
456import Foundation 456import Foundation
@@ -770,7 +770,7 @@ public final class IndexStore: Sendable {
770} 770}
771``` 771```
772 772
773- [ ] **Step 3: Run to verify pass, then commit** 773- [x] **Step 3: Run to verify pass, then commit**
774 774
775Run: `swift test --filter IndexStoreTests` 775Run: `swift test --filter IndexStoreTests`
776 776
@@ -792,7 +792,7 @@ git commit -m "Add SQLite index store with search and overlay"
792- Consumes: `FileKind` (Task 1). 792- Consumes: `FileKind` (Task 1).
793- Produces: `WorkspaceRoot(url:)` with `resolve()`, `DiscoveredFile`, `Discovery`, `FileClassification`, `WorkspaceScanner.classify(_:)`, `WorkspaceScanner.scan(_:)`, `AgendaScope(globs:)` with `contains(relativePath:kind:)`; test helper `Folder`. 793- Produces: `WorkspaceRoot(url:)` with `resolve()`, `DiscoveredFile`, `Discovery`, `FileClassification`, `WorkspaceScanner.classify(_:)`, `WorkspaceScanner.scan(_:)`, `AgendaScope(globs:)` with `contains(relativePath:kind:)`; test helper `Folder`.
794 794
795- [ ] **Step 1: Add the target** 795- [x] **Step 1: Add the target**
796 796
797```swift 797```swift
798// swift-tools-version: 6.2 798// swift-tools-version: 6.2
@@ -823,7 +823,7 @@ let package = Package(
823) 823)
824``` 824```
825 825
826- [ ] **Step 2: Write the failing tests** 826- [x] **Step 2: Write the failing tests**
827 827
828```swift 828```swift
829import Foundation 829import Foundation
@@ -900,7 +900,7 @@ struct ScanTests {
900} 900}
901``` 901```
902 902
903- [ ] **Step 3: Implement** 903- [x] **Step 3: Implement**
904 904
905```swift 905```swift
906import Foundation 906import Foundation
@@ -1015,7 +1015,7 @@ public struct AgendaScope: Sendable, Equatable {
1015} 1015}
1016``` 1016```
1017 1017
1018- [ ] **Step 4: Run to verify pass, then commit** 1018- [x] **Step 4: Run to verify pass, then commit**
1019 1019
1020Run: `swift test --filter "ClassificationTests|ScanTests"` 1020Run: `swift test --filter "ClassificationTests|ScanTests"`
1021 1021
@@ -1036,7 +1036,7 @@ git commit -m "Add workspace discovery and agenda scope"
1036- Consumes: Tasks 1–3. 1036- Consumes: Tasks 1–3.
1037- Produces: `Reconciler(index:settings:)` with `reconcile(root:)` and `reconcile(root:paths:)`, `ReconcileReport`. 1037- Produces: `Reconciler(index:settings:)` with `reconcile(root:)` and `reconcile(root:paths:)`, `ReconcileReport`.
1038 1038
1039- [ ] **Step 1: Write the failing tests** 1039- [x] **Step 1: Write the failing tests**
1040 1040
1041```swift 1041```swift
1042import Foundation 1042import Foundation
@@ -1122,7 +1122,7 @@ struct ReconcileTests {
1122} 1122}
1123``` 1123```
1124 1124
1125- [ ] **Step 2: Implement** 1125- [x] **Step 2: Implement**
1126 1126
1127```swift 1127```swift
1128import Foundation 1128import Foundation
@@ -1228,7 +1228,7 @@ public struct Reconciler: Sendable {
1228} 1228}
1229``` 1229```
1230 1230
1231- [ ] **Step 3: Run to verify pass, then commit** 1231- [x] **Step 3: Run to verify pass, then commit**
1232 1232
1233Run: `swift test --filter ReconcileTests` 1233Run: `swift test --filter ReconcileTests`
1234 1234
@@ -1248,7 +1248,7 @@ git commit -m "Add index reconciliation"
1248**Interfaces:** 1248**Interfaces:**
1249- Produces (macOS): `WatchEvent` (`.changed(URL)`, `.rescan(URL)`), `FSEventsWatcher(roots:latency:handler:)` with `start()`, `stop()`. 1249- Produces (macOS): `WatchEvent` (`.changed(URL)`, `.rescan(URL)`), `FSEventsWatcher(roots:latency:handler:)` with `start()`, `stop()`.
1250 1250
1251- [ ] **Step 1: Write the failing test** 1251- [x] **Step 1: Write the failing test**
1252 1252
1253```swift 1253```swift
1254import Foundation 1254import Foundation
@@ -1291,7 +1291,7 @@ final class Received: @unchecked Sendable {
1291} 1291}
1292``` 1292```
1293 1293
1294- [ ] **Step 2: Implement** 1294- [x] **Step 2: Implement**
1295 1295
1296```swift 1296```swift
1297#if os(macOS) 1297#if os(macOS)
@@ -1374,12 +1374,12 @@ public final class FSEventsWatcher: @unchecked Sendable {
1374#endif 1374#endif
1375``` 1375```
1376 1376
1377- [ ] **Step 3: Run everything, the iOS build and the gates** 1377- [x] **Step 3: Run everything, the iOS build and the gates** (gates run on an M-series Mac, recorded in docs/design.md; the M1 Air run is owed)
1378 1378
1379Run: `swift test`, then `xcodebuild -scheme OrgWorkspace -destination 'generic/platform=iOS' build`. 1379Run: `swift test`, then `xcodebuild -scheme OrgWorkspace -destination 'generic/platform=iOS' build`.
1380Gates: reconcile a folder of 10,000 org files into an empty index (under 30 s), then again with no changes (under 2 s), in a release build on the reference machine. 1380Gates: reconcile a folder of 10,000 org files into an empty index (under 30 s), then again with no changes (under 2 s), in a release build on the reference machine.
1381 1381
1382- [ ] **Step 4: Commit** 1382- [x] **Step 4: Commit**
1383 1383
1384```bash 1384```bash
1385git add Sources/OrgWorkspace/FSEventsWatcher.swift Tests/OrgWorkspaceTests/WatcherTests.swift 1385git add Sources/OrgWorkspace/FSEventsWatcher.swift Tests/OrgWorkspaceTests/WatcherTests.swift
docs/plans/2026-10-05-commands.md +4 −4
@@ -122,7 +122,7 @@ Run `swift test`, the reparse gate and the corpus round trip; commit: `git commi
122 122
123**Files:** create `Sources/OrgCore/Commands/Command.swift`, `Sources/OrgCore/Commands/HeadingCommands.swift`, `Tests/OrgCoreTests/EmacsOracle.swift`, `Tests/OrgCoreTests/HeadingCommandTests.swift`; modify `Sources/OrgCore/Parser/Incremental.swift` (its private `EditContext` becomes `ReparseContext`). 123**Files:** create `Sources/OrgCore/Commands/Command.swift`, `Sources/OrgCore/Commands/HeadingCommands.swift`, `Tests/OrgCoreTests/EmacsOracle.swift`, `Tests/OrgCoreTests/HeadingCommandTests.swift`; modify `Sources/OrgCore/Parser/Incremental.swift` (its private `EditContext` becomes `ReparseContext`).
124 124
125- [ ] **Step 1: The oracle and the tests** 125- [x] **Step 1: The oracle and the tests**
126 126
127```swift 127```swift
128import Foundation 128import Foundation
@@ -387,7 +387,7 @@ struct HeadingOracleTests {
387} 387}
388``` 388```
389 389
390- [ ] **Step 2: The command model** 390- [x] **Step 2: The command model**
391 391
392```swift 392```swift
393import Foundation 393import Foundation
@@ -487,7 +487,7 @@ public enum Commands {
487} 487}
488``` 488```
489 489
490- [ ] **Step 3: The heading commands** 490- [x] **Step 3: The heading commands**
491 491
492```swift 492```swift
493import Foundation 493import Foundation
@@ -893,7 +893,7 @@ index 9f8347a..976b9b4 100644
893 let edit: TextEdit 893 let edit: TextEdit
894``` 894```
895 895
896- [ ] **Step 4: Run the oracle, including a corpus; commit** 896- [x] **Step 4: Run the oracle, including a corpus; commit**
897 897
898Run: `swift test --filter HeadingOracleTests`, then `ORGSTAR_ORACLE_CORPUS=<folder> swift test --filter headingCommandsMatchEmacsOnACorpus` for each local folder. 898Run: `swift test --filter HeadingOracleTests`, then `ORGSTAR_ORACLE_CORPUS=<folder> swift test --filter headingCommandsMatchEmacsOnACorpus` for each local folder.
899 899
docs/plans/2026-10-05-fill.md +3 −3
@@ -25,9 +25,9 @@
25 25
26### Task 1: Fill 26### Task 1: Fill
27 27
28- [ ] Port; oracle over 16 variants (items, comments, quotes, line breaks, timestamps, links, captions, markup at line start, extra spaces) at both fill columns, and over corpus paragraphs (src blocks excluded). 28- [x] Port; oracle over 16 variants (items, comments, quotes, line breaks, timestamps, links, captions, markup at line start, extra spaces) at both fill columns, and over corpus paragraphs (src blocks excluded).
29- [ ] Commit "Port fill paragraph". 29- [x] Commit "Port fill paragraph".
30 30
31### Task 2: App 31### Task 2: App
32 32
33- [ ] M-q / ⌃⌘P; Settings fill column. 33- [x] M-q / ⌃⌘P; Settings fill column.
docs/plans/2026-10-05-highlighting.md +2 −2
@@ -25,5 +25,5 @@
25 25
26### Task 1: Highlighting 26### Task 1: Highlighting
27 27
28- [ ] Hook, highlighter, vendored grammars and scanners, embedded queries, theme colors; tests for categories in Python, shell and Emacs Lisp and for runs in a src block; app snapshot. 28- [x] Hook, highlighter, vendored grammars and scanners, embedded queries, theme colors; tests for categories in Python, shell and Emacs Lisp and for runs in a src block; app snapshot.
29- [ ] Commit "Highlight src blocks with tree-sitter". 29- [x] Commit "Highlight src blocks with tree-sitter".
docs/plans/2026-10-05-keymaps.md +5 −5
@@ -43,8 +43,8 @@
43 43
44`KeyChord.parse`, `KeySequence.parse/format`, `TOML.parse`, `Keymap(toml:problems:)`, `Keymap.layered`, `candidates(for:mode:)`, `isPrefix`, `continuations(of:)`, `keys(for:)`, `KeyContext.holds`, `KeyDispatcher.feed` returning `.pending`, `.complete`, `.undefined`, `.unbound` or `.cancelled`. 44`KeyChord.parse`, `KeySequence.parse/format`, `TOML.parse`, `Keymap(toml:problems:)`, `Keymap.layered`, `candidates(for:mode:)`, `isPrefix`, `continuations(of:)`, `keys(for:)`, `KeyContext.holds`, `KeyDispatcher.feed` returning `.pending`, `.complete`, `.undefined`, `.unbound` or `.cancelled`.
45 45
46- [ ] Tests: notation round trips and shift folding; TOML tables, escapes and error lines; bad entries skipped with problems; later layers win and `none` unbinds; prefix dispatch, undefined sequences and C-g; continuations; contexts; presets parse. 46- [x] Tests: notation round trips and shift folding; TOML tables, escapes and error lines; bad entries skipped with problems; later layers win and `none` unbinds; prefix dispatch, undefined sequences and C-g; continuations; contexts; presets parse.
47- [ ] Commit "Add keymaps". 47- [x] Commit "Add keymaps".
48 48
49### Task 2: Keys in the editor 49### Task 2: Keys in the editor
50 50
@@ -53,8 +53,8 @@
53- `edit.set-mark` starts a region that movement extends; C-g, editing, kill and copy end it. 53- `edit.set-mark` starts a region that movement extends; C-g, editing, kill and copy end it.
54- Option as Meta per side, from the device-dependent modifier bits. 54- Option as Meta per side, from the device-dependent modifier bits.
55- `onKeysPending(String?, [(key, title)])`, `onAppCommand(String)`, and `run(_ id:)` for menus and the palette. 55- `onKeysPending(String?, [(key, title)])`, `onAppCommand(String)`, and `run(_ id:)` for menus and the palette.
56- [ ] Tests with synthesized key events: C-c C-t cycles TODO; TAB folds on a heading and inserts a tab in a paragraph; C-SPC C-f C-w kills one character; M-f moves a word with left Option and types with right Option; C-x C-s reaches `onAppCommand`; an undefined sequence reports a message; pending keys are reported. 56- [x] Tests with synthesized key events: C-c C-t cycles TODO; TAB folds on a heading and inserts a tab in a paragraph; C-SPC C-f C-w kills one character; M-f moves a word with left Option and types with right Option; C-x C-s reaches `onAppCommand`; an undefined sequence reports a message; pending keys are reported.
57- [ ] Commit "Run commands from keys". 57- [x] Commit "Run commands from keys".
58 58
59### Task 3: App 59### Task 3: App
60 60
@@ -62,4 +62,4 @@
62- Echo area at the bottom of the editor: pending keys and command messages. which-key popup lists the continuations with command titles. 62- Echo area at the bottom of the editor: pending keys and command messages. which-key popup lists the continuations with command titles.
63- Command palette (M-x, ⇧⌘P): fuzzy search over command titles, showing each command's keys; runs on the editor. 63- Command palette (M-x, ⇧⌘P): fuzzy search over command titles, showing each command's keys; runs on the editor.
64- Org menu with the org commands. 64- Org menu with the org commands.
65- [ ] Verify with the snapshot hook; commit "Keymaps, echo area and palette in the app". 65- [x] Verify with the snapshot hook; commit "Keymaps, echo area and palette in the app".
docs/plans/2026-10-05-lists.md +4 −4
@@ -31,10 +31,10 @@
31 31
32### Task 1: List machinery and commands 32### Task 1: List machinery and commands
33 33
34- [ ] Port the machinery and the nine commands; unit tests; oracle over 13 variants at every caret and over the corpus (`ORGSTAR_ORACLE_CORPUS`, item lines in files up to 20 KB). 34- [x] Port the machinery and the nine commands; unit tests; oracle over 13 variants at every caret and over the corpus (`ORGSTAR_ORACLE_CORPUS`, item lines in files up to 20 KB).
35- [ ] Commit "Port plain list commands from org". 35- [x] Commit "Port plain list commands from org".
36 36
37### Task 2: Keys 37### Task 2: Keys
38 38
39- [ ] Emacs preset: item bindings on M-RET, M-S-RET, M-arrows, M-S-arrows with `when = "item"`; C-c C-c on items; C-c C-x C-b. Mac preset: the same on its chords, ⌃⌘C to toggle. 39- [x] Emacs preset: item bindings on M-RET, M-S-RET, M-arrows, M-S-arrows with `when = "item"`; C-c C-c on items; C-c C-x C-b. Mac preset: the same on its chords, ⌃⌘C to toggle.
40- [ ] Commit "Bind list keys". 40- [x] Commit "Bind list keys".
docs/plans/2026-10-05-options.md +5 −5
@@ -23,11 +23,11 @@ The user's Emacs is Doom, which sets tags column 0, M-RET after the subtree with
23 23
24### Task 1: Options in commands 24### Task 1: Options in commands
25 25
26- [ ] `EditingOptions`; plumb through every command; alphabetical bullets. 26- [x] `EditingOptions`; plumb through every command; alphabetical bullets.
27- [ ] Oracle: heading, structure and list suites again under the Doom options (`withOptions` binds the variables around each case), plus alphabetical list variants. 27- [x] Oracle: heading, structure and list suites again under the Doom options (`withOptions` binds the variables around each case), plus alphabetical list variants.
28- [ ] Commit "Make org editing options settings". 28- [x] Commit "Make org editing options settings".
29 29
30### Task 2: App 30### Task 2: App
31 31
32- [ ] Settings section; options to the editor and session; default keywords to documents and the index at launch. 32- [x] Settings section; options to the editor and session; default keywords to documents and the index at launch.
33- [ ] Commit "Org options in Settings". 33- [x] Commit "Org options in Settings".
docs/plans/2026-10-05-refile-archive.md +4 −4
@@ -24,10 +24,10 @@
24 24
25### Task 1: Core 25### Task 1: Core
26 26
27- [ ] Port refile, archive and statistics; oracles: refile within a file and to another file (4 sources × every caret × every target, 5 target files), archive (7 sources × 4 archive files), TODO cycle and TODO-heading insert with parent cookies. 27- [x] Port refile, archive and statistics; oracles: refile within a file and to another file (4 sources × every caret × every target, 5 target files), archive (7 sources × 4 archive files), TODO cycle and TODO-heading insert with parent cookies.
28- [ ] Commit "Port refile, archive and TODO statistics from org". 28- [x] Commit "Port refile, archive and TODO statistics from org".
29 29
30### Task 2: Session and app 30### Task 2: Session and app
31 31
32- [ ] `DocumentBuffer.selection` and `perform`; `PrecomputedEdit`; `DocumentSession.refile(to:)`, `archive()`; `WorkspaceModel.refileTargets`; prompt choices; keys and palette entries. 32- [x] `DocumentBuffer.selection` and `perform`; `PrecomputedEdit`; `DocumentSession.refile(to:)`, `archive()`; `WorkspaceModel.refileTargets`; prompt choices; keys and palette entries.
33- [ ] Commit "Refile and archive in the app". 33- [x] Commit "Refile and archive in the app".
docs/plans/2026-10-05-structure.md +6 −6
@@ -36,12 +36,12 @@
36 36
37### Task 1: Buffer and structure commands 37### Task 1: Buffer and structure commands
38 38
39- [ ] Port `org-insert-heading` (with `org--blank-before-heading-p`, `org-N-empty-lines-before-current`), `org-insert-todo-heading`, `org-move-subtree-down`, `org-promote-subtree`/`org-demote-subtree` (`org-map-tree`, `org-promote`, `org-demote`, `org-fix-position-after-promote`), `org-next-visible-heading`, `org-forward-heading-same-level`, `outline-up-heading`. 39- [x] Port `org-insert-heading` (with `org--blank-before-heading-p`, `org-N-empty-lines-before-current`), `org-insert-todo-heading`, `org-move-subtree-down`, `org-promote-subtree`/`org-demote-subtree` (`org-map-tree`, `org-promote`, `org-demote`, `org-fix-position-after-promote`), `org-next-visible-heading`, `org-forward-heading-same-level`, `outline-up-heading`.
40- [ ] Oracle: every command at every caret of ten variants (levels, blank lines, tags, text before the first heading, no final newline, non-BMP) and over the corpus (`ORGSTAR_ORACLE_CORPUS`, files up to 20 KB). 40- [x] Oracle: every command at every caret of ten variants (levels, blank lines, tags, text before the first heading, no final newline, non-BMP) and over the corpus (`ORGSTAR_ORACLE_CORPUS`, files up to 20 KB).
41- [ ] Commit "Port heading structure commands from org". 41- [x] Commit "Port heading structure commands from org".
42 42
43### Task 2: Tags and prompts 43### Task 2: Tags and prompts
44 44
45- [ ] `SetTags`: prompt with the current tags, then `org-set-tags` semantics (realign even when unchanged). Oracle with `completing-read-multiple` stubbed to the answer. 45- [x] `SetTags`: prompt with the current tags, then `org-set-tags` semantics (realign even when unchanged). Oracle with `completing-read-multiple` stubbed to the answer.
46- [ ] Editor `onPrompt`; app minibuffer field (Return answers, Escape cancels); key bindings in both presets. 46- [x] Editor `onPrompt`; app minibuffer field (Return answers, Escape cancels); key bindings in both presets.
47- [ ] Commit "Set tags through a prompt". 47- [x] Commit "Set tags through a prompt".
docs/plans/2026-10-05-tables.md +3 −3
@@ -25,9 +25,9 @@
25 25
26### Task 1: Visible widths 26### Task 1: Visible widths
27 27
28- [ ] `VisibleLine`; tag alignment, columns and fill use it; oracle passes refontified. 28- [x] `VisibleLine`; tag alignment, columns and fill use it; oracle passes refontified.
29 29
30### Task 2: Tables 30### Task 2: Tables
31 31
32- [ ] Port; oracle over 11 tables (numbers, rules, indentation, links, emphasis, entities, cookies, TBLFM, unicode, ragged rows) × every caret × 13 commands at both option sets; table creation; real tables in all three corpora. 32- [x] Port; oracle over 11 tables (numbers, rules, indentation, links, emphasis, entities, cookies, TBLFM, unicode, ragged rows) × every caret × 13 commands at both option sets; table creation; real tables in all three corpora.
33- [ ] Commit "Port org tables". 33- [x] Commit "Port org tables".
docs/plans/2026-10-05-timestamps.md +5 −5
@@ -24,14 +24,14 @@
24 24
25### Task 1: Date prompt 25### Task 1: Date prompt
26 26
27- [ ] Port; oracle over 52 inputs (relative, weekdays, ISO weeks, US and European dates, am/pm, `HHhMM`, ranges, durations). 27- [x] Port; oracle over 52 inputs (relative, weekdays, ISO weeks, US and European dates, am/pm, `HHhMM`, ranges, durations).
28- [ ] Commit "Port the date prompt". 28- [x] Commit "Port the date prompt".
29 29
30### Task 2: Timestamps, planning, repeats 30### Task 2: Timestamps, planning, repeats
31 31
32- [ ] Port; oracle over 7 texts × every caret × 9 commands × 6 answers, and 10 repeating entries. 32- [x] Port; oracle over 7 texts × every caret × 9 commands × 6 answers, and 10 repeating entries.
33- [ ] Commit "Port timestamp and planning commands". 33- [x] Commit "Port timestamp and planning commands".
34 34
35### Task 3: Keys 35### Task 3: Keys
36 36
37- [ ] Bind both presets; `timestamp` context. 37- [x] Bind both presets; `timestamp` context.
docs/plans/2026-10-05-writable-app.md +8 −8
@@ -63,9 +63,9 @@ extension OrgEditor: DocumentBuffer // plus `public var onChange: (() -> Void)
63 63
64`OrgEditor.update` records the text and selection, runs the change, and if the text changed: computes `lineEdits(from:to:)`, reloads the storage, maps folds and the selection through the edits, and removes the text view's undo actions (they refer to the old text). `save(using:to:)` and `diskChanged(to:)` become `update` calls; `diskChanged` returns the `ExternalChange`. 64`OrgEditor.update` records the text and selection, runs the change, and if the text changed: computes `lineEdits(from:to:)`, reloads the storage, maps folds and the selection through the edits, and removes the text view's undo actions (they refer to the old text). `save(using:to:)` and `diskChanged(to:)` become `update` calls; `diskChanged` returns the `ExternalChange`.
65 65
66- [ ] Tests: `overwrite` writes ours and keeps the replaced version; editor `update` replacing text keeps the caret on the same line content, keeps folds, and leaves nothing to undo; typing calls `onChange`. 66- [x] Tests: `overwrite` writes ours and keeps the replaced version; editor `update` replacing text keeps the caret on the same line content, keeps folds, and leaves nothing to undo; typing calls `onChange`.
67- [ ] Implement; `swift test` green. 67- [x] Implement; `swift test` green.
68- [ ] Commit "Add document buffers". 68- [x] Commit "Add document buffers".
69 69
70### Task 2: Session saving 70### Task 2: Session saving
71 71
@@ -99,9 +99,9 @@ extension WorkspaceModel {
99 99
100`fileChanged` calls `buffer.update { $0.diskChanged(to:) }` and sets `conflict` on a conflict; `diskBytes` goes away. `show(_:)` uses indexed offsets only when the buffer is clean. 100`fileChanged` calls `buffer.update { $0.diskChanged(to:) }` and sets `conflict` on a conflict; `diskBytes` goes away. `show(_:)` uses indexed offsets only when the buffer is clean.
101 101
102- [ ] Tests: edit then `save` writes and clears dirty; automatic mode saves after the delay, explicit does not; an external change merges into an edited buffer; a conflicting change sets `conflict`, blocks saving, and `keepMine` writes ours with theirs in recovery while `useDiskVersion` loads theirs with ours in recovery; search with the overlay finds an unsaved heading. 102- [x] Tests: edit then `save` writes and clears dirty; automatic mode saves after the delay, explicit does not; an external change merges into an edited buffer; a conflicting change sets `conflict`, blocks saving, and `keepMine` writes ours with theirs in recovery while `useDiskVersion` loads theirs with ours in recovery; search with the overlay finds an unsaved heading.
103- [ ] Implement; `swift test` green. 103- [x] Implement; `swift test` green.
104- [ ] Commit "Save from the session". 104- [x] Commit "Save from the session".
105 105
106### Task 3: The app 106### Task 3: The app
107 107
@@ -112,5 +112,5 @@ extension WorkspaceModel {
112- File ▸ Save (⌘S); Settings (⌘,) with the save mode in `@AppStorage("saveMode")`. 112- File ▸ Save (⌘S); Settings (⌘,) with the save mode in `@AppStorage("saveMode")`.
113- Switching files and quitting with unsaved edits: save in automatic mode, ask in explicit mode; a failed save cancels. 113- Switching files and quitting with unsaved edits: save in automatic mode, ask in explicit mode; a failed save cancels.
114- Conflict alert with the three choices. 114- Conflict alert with the three choices.
115- [ ] Verify in the built app with a scratch data dir: type, ⌘S, undo, external edit merges, conflicting external edit shows the alert, search finds unsaved text. 115- [x] Verify in the built app with a scratch data dir: type, ⌘S, undo, external edit merges, conflicting external edit shows the alert, search finds unsaved text.
116- [ ] Commit "Edit and save in the app". 116- [x] Commit "Edit and save in the app".
docs/review-2026-10-05.md +2
@@ -1,5 +1,7 @@
1# Orgstar review, 2026-10-05 1# Orgstar review, 2026-10-05
2 2
3Historical. Every tier below shipped between a831086 and 2d3da68 (258 commits). The living list of refusals and gaps is the manual, `docs/manual/guide/15-alongside-emacs.org`, "Known differences from Emacs Org". Of the defects table, the clock report still reads files from disk (`Sources/Orgstar/ClockViews.swift`), tracked as an issue.
4
3Branch `buffers` at a831086. Emacs 31.1 / Org 9.8.7 installed, so the oracle tests ran. 5Branch `buffers` at a831086. Emacs 31.1 / Org 9.8.7 installed, so the oracle tests ran.
4 6
5## 1. Current state 7## 1. Current state