Skip to content

Docs: Document the phase model and diagnose body side effects#62

Merged
phranck merged 4 commits into
mainfrom
issue/58-render-phase-docs
Jul 21, 2026
Merged

Docs: Document the phase model and diagnose body side effects#62
phranck merged 4 commits into
mainfrom
issue/58-render-phase-docs

Conversation

@phranck

@phranck phranck commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Closes #58 and completes #13 (last sub-issue). Design spec: .claude/openspec/render-phase-effect-commit.md (status set to Implemented in this PR).

Summary

  • Diagnose unsupported user side effects inside body: a traversal window on AppState reports same-thread invalidations raised while the render loop traverses the tree into RuntimeDiagnostics (identity-tagged, deduplicated per frame); the invalidation is still honored, and background tasks plus committed effect actions stay silent
  • Rewrite RenderCycle.md for the phase-separated pipeline: per-pass collectors, the traversal diagnostics window, the frame commit step, corrected onAppear timing (fires at commit, never during traversal), and change-driven onPreferenceChange semantics
  • Add the conceptual "Render Phases and the Frame Commit" section: phases and their guarantees, the collector/pending-record split with the SwiftUI analogy, the one-question classification rule, and what a discarded pass guarantees
  • Mark the OpenSpec as implemented

Test plan

  • ./scripts/test-linux.sh green on macOS (native, Swift 6.0.3) and Linux (Docker) — 1315 tests, only the pre-existing [P0-09] Preserve subtree liveness across EquatableView cache hits #14 marker remains
  • New: BodySideEffectDiagnosticTests — state and status-bar mutations during traversal are diagnosed once per frame; committed effect mutations stay silent
  • DocC builds without diagnostics
  • No public API change (manifest untouched)

phranck added 4 commits July 22, 2026 00:52
- Add a traversal window to AppState: main-thread invalidations raised while the render loop traverses the view tree report through a violation handler; background tasks and post-commit effect actions stay silent
- Route violations into RuntimeDiagnostics with the mutating subtree's identity, deduplicated per frame
- Honor the invalidation itself so rendering stays consistent (diagnose, never swallow)
- Add a conceptual "Render Phases and the Frame Commit" section: phases, the collector/pending-record split with the SwiftUI analogy, the one-question classification rule, and discarded-pass guarantees
- Update the pipeline steps for per-pass collectors, the traversal diagnostics window, and the commit step
- Correct onAppear timing (fires at frame commit, never during traversal) and document change-driven onPreferenceChange semantics
- Compare against the traversal thread's identity instead of Thread.isMainThread, which is not reliable under the Swift concurrency runtime on Linux
@phranck
phranck merged commit da0c247 into main Jul 21, 2026
6 checks passed
@phranck
phranck deleted the issue/58-render-phase-docs branch July 21, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P0-08d] Document the phase model and diagnose body side effects

1 participant