Skip to content

fix: defer composer height measurements#474

Merged
mubarakcoded merged 2 commits into
masterfrom
pip/whitenoise-mac-469
Jul 13, 2026
Merged

fix: defer composer height measurements#474
mubarakcoded merged 2 commits into
masterfrom
pip/whitenoise-mac-469

Conversation

@agent-p1p

@agent-p1p agent-p1p commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #469

Summary

  • defer the initial composer height measurement until after makeNSView returns
  • remove the duplicate synchronous measurement from updateNSView and retain its deferred measurement
  • keep direct measurement in textDidChange, which runs from the AppKit delegate event rather than SwiftUI's representable update transaction

Verification

  • git diff --check — passed
  • static lifecycle inspection — both makeNSView and updateNSView contain exactly one deferred measurement and no synchronous binding write
  • scripts/ci/macos-sanity-checks.sh — unavailable on this Linux host (xcodebuild: command not found)
  • xcrun swift-format lint --configuration .swift-format --recursive --parallel --strict whitenoise-mac whitenoise-macTests whitenoise-macUITests — unavailable on this Linux host (xcrun: command not found)
  • Xcode unit test command — unavailable on this Linux host (xcodebuild: command not found)

No regression test was added: this bug is specifically SwiftUI/AppKit lifecycle scheduling, and a meaningful behavior test requires macOS execution. A source-scrape test or test-only visibility hook would be more brittle and complex than the two-call fix. CI will run the native checks.

Sensitive paths

None.


Open in Stage

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mubarakcoded, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e011459a-56c3-425d-a588-5b190b56a9a4

📥 Commits

Reviewing files that changed from the base of the PR and between 490ca5b and 8edcd5e.

📒 Files selected for processing (1)
  • whitenoise-mac/Views/ComposerViews.swift
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pip/whitenoise-mac-469

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@stage-review

stage-review Bot commented Jul 12, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 1 individual chapter for you:

Title
1 Defer composer height measurements
Open in Stage

Chapters generated by Stage for commit 8edcd5e on Jul 13, 2026 12:41pm UTC.

@agent-p1p

Copy link
Copy Markdown
Contributor Author

Adversarial review

Verdict: implementation is correct; no code changes requested. Merge remains blocked by red CI.

Code review

  • makeNSView now schedules height measurement after the representable lifecycle transaction instead of writing the parent @State synchronously.
  • updateNSView retains only its existing deferred measurement. There is no lifecycle-path synchronous write left.
  • The immediate call in textDidChange is appropriate: it runs from the AppKit edit delegate, not from SwiftUI's representable update transaction, and preserves responsive growth while typing.
  • Scope is minimal: one file, 3 additions / 2 deletions, no sensitive paths, no unrelated abstraction or state.

Blocking — workflow / CI

The PR's PR Checks job failed. The full 418-test plan recorded three expectations in messageMediaDiskCacheReadDeletionMaintainsTrackedFootprint() and skipped the release smoke step:
https://github.com/marmot-protocol/whitenoise-mac/actions/runs/29178456073

This is demonstrably pre-existing and unrelated to this SwiftUI-only diff: the same test and same three assertions fail on base commit 0454dbf's master run:
https://github.com/marmot-protocol/whitenoise-mac/actions/runs/29100021269

Existing issue #457 tracks the broken baseline test. No scope expansion is requested here, but Pip policy forbids merging any PR that has had red CI, so this remains a workflow blocker for #474.

Verification

  • git diff --check origin/master...0ed5357 — passed
  • CI Swift format lint — passed
  • CI macOS project sanity checks — passed
  • CI Static Analysis — passed
  • CI unit tests — failed only in the unrelated baseline media-cache test above
  • CodeRabbit review was rate-limited; it posted no findings

Counts: 1 blocking workflow finding, 0 code blockers, 0 suggestions, 0 nitpicks.

@mubarakcoded
mubarakcoded marked this pull request as ready for review July 13, 2026 14:28
@mubarakcoded
mubarakcoded merged commit f7dba8f into master Jul 13, 2026
3 checks passed
@mubarakcoded
mubarakcoded deleted the pip/whitenoise-mac-469 branch July 13, 2026 15:57
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.

Bug: composer text view writes the measuredHeight @Binding synchronously inside makeNSView/updateNSView (mutating state during a view update)

2 participants