Commit ace1a9a099

ace1a9a099c5ca37033f51a20c0706249399c386

parent: d14a973265

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 20:15 UTC

Call the throwing backlinks from the workspace gates

Ref #193

Layout: unified · split

Tests/OrgEditorAppKitTests/WorkspaceGateTests.swift +6 −6
@@ -51,12 +51,12 @@ extension GateTests {
5151 }
5252
5353 /// One pass of the backlinks pane: the file's backlinks and the heading's.
54 static func backlinks(_ model: WorkspaceModel) -> (found: Int, time: Duration) {
54 static func backlinks(_ model: WorkspaceModel) throws -> (found: Int, time: Duration) {
5555 let path = model.files.first { $0.name == "note-0.org" }!.path
5656 var found = 0
57 let time = ContinuousClock().measure {
58 found += model.backlinks(to: Backlinks.Target(path: path)).count
59 found += model.backlinks(to: Backlinks.Target(path: path, title: "Heading 0.1", id: "0-1")).count
57 let time = try ContinuousClock().measure {
58 found += try model.backlinks(to: Backlinks.Target(path: path)).count
59 found += try model.backlinks(to: Backlinks.Target(path: path, title: "Heading 0.1", id: "0-1")).count
6060 }
6161 return (found, time)
6262 }
@@ -78,7 +78,7 @@ extension GateTests {
7878 let items = agenda.days.reduce(0) { $0 + $1.items.count }
7979 #expect(items > 0)
8080
81 let (found, backlinks) = Self.backlinks(model)
81 let (found, backlinks) = try Self.backlinks(model)
8282 #expect(found > 0)
8383 print("GATE 10,000 notes: index build \(build), agenda refresh cold \(cold) / warm \(warm) (\(items) items), backlinks over 49,400 links \(backlinks)")
8484 #expect(build < .seconds(15), "index build")
@@ -92,7 +92,7 @@ extension GateTests {
9292 let scratch = try Self.scratch()
9393 defer { try? FileManager.default.removeItem(at: scratch) }
9494 let (model, _) = try await Self.workspace(1_000, fiveLinks: 1_000, in: scratch)
95 let (found, time) = Self.backlinks(model)
95 let (found, time) = try Self.backlinks(model)
9696 #expect(found > 0)
9797 print("GATE 1,000 notes: backlinks over 5,000 links \(time)")
9898 #expect(time < .milliseconds(150), "backlinks, 5,000 links")