Skip to content

Verify the retained SwiftUI publication boundary #3003

Description

@jsmestad

Roadmap: #2744

Depends on evidence from: #2999

Corrective context: #2748, PR #2922

Type: Chore (Investigation)

What

Determine whether macOS SwiftUI chrome needs any explicit publication boundary after the editor snapshot work in #2999, or whether direct focused Observation is sufficient in the production hierarchy.

Why

Minga has repeatedly moved between aggregate tokens, domain channels, direct Observation, and observed backing. #2906 proved direct Observation for two leaves, then #2922 generalized that evidence and removed the system-wide fallback. The next decision must come from production consumer behavior and invalidation cost, not another architecture preference.

Acceptance Criteria

  1. The production SwiftUI consumer graph is audited after macOS editor content remains coherent through scrolling and presentation #2999 without injected dependencies.
    • Cover toolbar/tabs, FileTree/sidebar, status bar, editor overlays, window overlays, extension overlays, messages, notifications, and native focus-bearing controls.
    • Record the exact observable property each production body reads and whether type erasure, stable reference bags, closures, conditional structure, or helper extraction can hide that dependency.
  2. Deterministic production-host counters and region captures measure focused updates.
    • For each semantic update class, record which host bodies reevaluate, which NSView representables update, whether first responder or local state changes, and which pixels change.
    • Tests use the production initializer and production views. Optional probes may observe body execution but must not read the state whose dependency is under test.
  3. Direct leaf Observation is tested against real failure and performance cases.
    • Include FileTree activation, tab/status updates, completion/hover changes, picker changes, extension overlays, theme replacement, rejected transactions, reconnect/recovery, and unrelated editor frames.
    • One focused update must survive a later unrelated frame without stale pixels.
    • Cursor and local-scroll frames must not reevaluate unrelated SwiftUI chrome.
  4. Alternatives are evaluated without pre-approval.
    • Direct leaf Observation remains the baseline.
    • Immutable focused host inputs may be considered where production dependencies are otherwise brittle.
    • Narrow explicit publication signals may be considered only for consumers that cannot establish a reliable focused dependency.
    • One monolithic observable GUI frame and coarse four-slot roots remain rejected unless measurements disprove the broad-invalidation concern and no smaller boundary works.
  5. Any proposed boundary must replace, not wrap, mutable publication authorities.
    • No redraw token is presented as data coherence.
    • Telemetry remains passive.
    • Stable NSView, responder, IME, hover, drag, animation, and local presentation identity are preserved.
    • Changed-domain classification is derived from prepared outputs rather than duplicated in another manually maintained impact switch.
  6. The investigation leaves one auditable outcome.
    • If direct Observation passes production correctness and invalidation budgets, document it as the retained architecture and add source/production regression guards.
    • If focused consumers fail, file the smallest consumer-specific implementation ticket with measured evidence and deletion work.
    • A broad publication framework requires a separate architecture review and explicit proof that every narrower option failed.

Developer Notes

Approach: Run this only after #2999 removes the editor's fragmented publication path so editor noise does not contaminate SwiftUI measurements. Build an exhaustive command-to-production-consumer evidence matrix. Use body/update counters and deterministic region captures as measurement, not as invalidation inputs.

Specialist Guidance: The original monolithic immutable frame was rejected because Observation would track the root property. Four publication slots were refined out because a coarse shell root could still reevaluate unrelated toolbar, sidebar, and status bodies. Archie considered focused immutable projections durable only if they contain actual values and replace mutable backing, but the refined Swift review did not authorize them without production evidence.

Files/areas to inspect: macos/Sources/ContentView.swift, focused State and View pairs, GUIState.swift, CommandDispatcher.swift, GUIFramePresentationMetrics.swift, NativeSidebarRegistry.swift, GUIFrameSwiftUIInvalidationTests.swift, ContentViewTests.swift, and Observation guardrails.

Verification budgets: Unchanged production hosts execute zero times for a focused update. Editor-only frames do not update shell/sidebar/overlay representables. Shell-only changes do not update the editor NSView. Local interaction identity remains stable. Record body/update counts and commit-to-region-pixel timing under Release configuration.

Non-goals: This ticket does not implement a monolithic frame, restore GUIFrameStore, reintroduce system-wide frame tokens, or assume four domains are the correct granularity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: macos-guimacOS native GUI frontend (Swift/Metal)area: performancePerformance optimizations and concurrency improvementsarea: renderingRendering pipeline, display list, damage trackingprototypeExperimental proof-of-concept work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions