Docs native S1a: say what triggers (d) and (e) can unblock (#170, 6)
Fable's finding 6: trigger (e) does nothing in production. That is so by the spec's own canRender, which reads neither inputPaused nor renderedGeneration: a writer paused by a refused command still holds it as pending input (trigger (b) draws when the queue drains), and a reader is paused for good but must keep seeing peers' changes, so canRender must not start reading inputPaused. Likewise didRender's half of (d) cannot unblock; projectionGeneration's can, and FlushTriggerTests covers it through the model. The calls stay (they cost nothing and keep the triggers complete if canRender changes); the comments and the (e) test now say it is a wiring test. Raised on #170 for a ruling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+10
−3
native/apple/Sources/DocsKit/DocsModel.swift+4 −1native/apple/Tests/DocsKitTests/FlushTriggerTests.swift+6 −2
diff --git a/native/apple/Sources/DocsKit/DocsModel.swift b/native/apple/Sources/DocsKit/DocsModel.swift| index edad274..e2881f5 100644 |
| --- a/native/apple/Sources/DocsKit/DocsModel.swift |
| +++ b/native/apple/Sources/DocsKit/DocsModel.swift |
| @@ -479,7 +479,10 @@ import RastrilloNative |
| // A delayed acknowledgement cannot retire the currently displayed source. |
| guard generation > renderedGeneration else { return } |
| renderedGeneration = generation |
| - // Trigger (d): the generation caught up. |
| + // Trigger (d), its didRender half. canRender reads |
| + // projectionGeneration, not renderedGeneration, so the half that |
| + // can unblock is projectionGeneration's didSet; this one is kept for |
| + // completeness (#170, finding 6). |
| surface.flushIfDeferred() |
| refreshToolbarSelection() |
| } |
diff --git a/native/apple/Tests/DocsKitTests/FlushTriggerTests.swift b/native/apple/Tests/DocsKitTests/FlushTriggerTests.swift| index d75f0b8..ae4900e 100644 |
| --- a/native/apple/Tests/DocsKitTests/FlushTriggerTests.swift |
| +++ b/native/apple/Tests/DocsKitTests/FlushTriggerTests.swift |
| @@ -110,8 +110,12 @@ import XCTest |
| SurfaceFixture.assertMatchesWholeRender(shown, publication.projection, "after the generation caught up") |
| } |
| - /// (e) With rendering held while input is paused, unpausing alone |
| - /// draws the waiting publication. |
| + /// (e) is wired: with a canRender that held rendering while input is |
| + /// paused, unpausing alone would draw the waiting publication. A |
| + /// wiring test only: production's canRender (spec §7 Design 6) does not |
| + /// read inputPaused, and must not (a reader is paused for good and |
| + /// still sees peers' changes), so no production state waits on (e) |
| + /// alone (#170, finding 6; DocsModel.inputPaused). |
| func testInputUnpausedDrawsTheWaitingPublication() throws { |
| let canRender = model.surface.hooks.canRender |
| model.surface.hooks.canRender = { [unowned self] generation in canRender(generation) && !model.inputPaused } |