oficina / docs Public

Live push slice 0: the native remote-updates probe sees publications again

RealtimeAuditE2ETests observed DocsModel.projection, which S1a made
@ObservationIgnored, so testEndToEndRemoteUpdates saw no publication and
reported n=0. It now observes projectionGeneration, which every remote
change moves. run-e2e.py: n=30, 40/40 seen, peer POST start -> visible
median 18 ms at 1 page, 63 ms at 20 pages (whole-document render in the
probe).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 8e9af18c79f3d36e03e49ceaacb16ab67956cf65 parent fdefef3
1 file changed, +9 −4
  • native/apple/Tests/DocsKitTests/RealtimeAuditE2ETests.swift +9 −4
diff --git a/native/apple/Tests/DocsKitTests/RealtimeAuditE2ETests.swift b/native/apple/Tests/DocsKitTests/RealtimeAuditE2ETests.swift
index 9dfc682..4a497a1 100644
--- a/native/apple/Tests/DocsKitTests/RealtimeAuditE2ETests.swift
+++ b/native/apple/Tests/DocsKitTests/RealtimeAuditE2ETests.swift
@@ -100,15 +100,20 @@ import XCTest
}
/// The text view's part: one render and one reconcile per published
- /// projection (a reused source keeps its generation number, so the
- /// publication itself is observed, as SwiftUI does).
+ /// generation. Since S1a `projection` is `@ObservationIgnored` (the editor
+ /// draws per block from the surface), so this observes
+ /// `projectionGeneration`, which every remote change moves (a fresh
+ /// source). A local keystroke that reuses its source keeps its generation
+ /// and is not re-rendered here, as the app no longer redraws it whole.
+ /// (Observing `projection` saw nothing, and the remote probe reported
+ /// n=0 from S1a until the live-push slice 0.)
final class Published: @unchecked Sendable { var changed = true }
let published = Published()
func armObservation() {
- withObservationTracking { _ = model.projection } onChange: { [published] in published.changed = true }
+ withObservationTracking { _ = model.projectionGeneration } onChange: { [published] in published.changed = true }
}
func viewRender(_ storage: NSTextStorage, _ last: inout UInt64, _ mainCost: inout [Double]) -> NSAttributedString? {
- guard published.changed, let projection = model.projection, model.canRender(model.projectionGeneration) else { return nil }
+ guard published.changed || model.projectionGeneration != last, let projection = model.projection, model.canRender(model.projectionGeneration) else { return nil }
published.changed = false; armObservation()
let t = ContinuousClock.now
let content = NativeTextProjection.render(projection)