Skip to content

Fix explicit-self capture in the sidebar tint closure - #8313

Closed
ejc3 wants to merge 1 commit into
manaflow-ai:mainfrom
ejc3:fix-sidebar-explicit-self
Closed

ejc3 wants to merge 1 commit into
manaflow-ai:mainfrom
ejc3:fix-sidebar-explicit-self

Conversation

@ejc3

@ejc3 ejc3 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

main does not compile on Xcode 26.2 toolchains since #8270: the NSImage drawing handler in SidebarWorkspaceRowSlotViews references the view's color property without self, which strict capture-semantics checking rejects as an error (SidebarWorkspaceRowSlotViews.swift:101). One token: self.color.set().


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Fix build on Xcode 26.2 by making the tinting closure explicitly capture self in the sidebar PR icon view. Replaces color.set() with self.color.set() in the NSImage drawing handler in SidebarWorkspaceRowSlotViews.swift.

Written for commit 65e4db0. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the tint color applied to pull request icons when displayed in their closed state.

The NSImage drawing handler is an escaping closure, and referencing the
view's color property without self fails to compile under strict
explicit-self capture checking (Xcode 26.2 toolchains):

  SidebarWorkspaceRowSlotViews.swift:101:21: error: reference to property
  'color' in closure requires explicit use of 'self' to make capture
  semantics explicit
@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes a compilation regression on Xcode 26.2 toolchains where the NSImage drawing handler closure inside SidebarRowPullRequestIconView.draw(_:) referenced color without an explicit self., causing the compiler's strict capture-semantics check to reject it as an error.

  • Adds self.color.set() in place of bare color.set() on line 101, making the instance-property capture explicit inside the closure. No behavior change; this is a one-token mechanical fix.
  • No other properties are implicitly captured in the same closure (image is a local constant and drawRect is a parameter), so no further changes are required.

Confidence Score: 5/5

Safe to merge — the change is a single token that unblocks compilation on Xcode 26.2 with no behavior difference.

The closure already captured self implicitly through color; making that capture explicit with self.color changes nothing at runtime. The rest of the closure (image, drawRect) are a local constant and a parameter respectively, so no other implicit captures exist. The fix is complete and isolated.

No files require special attention.

Important Files Changed

Filename Overview
Sources/Sidebar/AppKitList/Cells/SidebarWorkspaceRowSlotViews.swift Adds explicit self.color.set() inside the NSImage drawing handler closure to satisfy Xcode 26.2's strict capture-semantics checking, fixing a compilation error introduced in #8270.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant AppKit
    participant draw as SidebarRowPullRequestIconView.draw(_:)
    participant closure as NSImage drawingHandler closure
    AppKit->>draw: draw(_ dirtyRect:)
    draw->>draw: color.setStroke() [direct, no closure]
    draw->>closure: NSImage(size:flipped:drawingHandler:)
    closure->>closure: image.draw(in:drawRect, ...)
    closure->>closure: self.color.set() [explicit capture — Xcode 26.2 fix]
    closure->>closure: drawRect.fill(using: .sourceAtop)
    closure-->>draw: return true
    draw->>AppKit: tinted.draw(in: rect, ...)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant AppKit
    participant draw as SidebarRowPullRequestIconView.draw(_:)
    participant closure as NSImage drawingHandler closure
    AppKit->>draw: draw(_ dirtyRect:)
    draw->>draw: color.setStroke() [direct, no closure]
    draw->>closure: NSImage(size:flipped:drawingHandler:)
    closure->>closure: image.draw(in:drawRect, ...)
    closure->>closure: self.color.set() [explicit capture — Xcode 26.2 fix]
    closure->>closure: drawRect.fill(using: .sourceAtop)
    closure-->>draw: return true
    draw->>AppKit: tinted.draw(in: rect, ...)
Loading

Reviews (1): Last reviewed commit: "sidebar: make the tint closure's color c..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 40ffbfaa-f6e6-4648-95a7-f8611879d5b8

📥 Commits

Reviewing files that changed from the base of the PR and between b7bd901 and 65e4db0.

📒 Files selected for processing (1)
  • Sources/Sidebar/AppKitList/Cells/SidebarWorkspaceRowSlotViews.swift

📝 Walkthrough

Walkthrough

The closed-state rendering path for SidebarRowPullRequestIconView now applies its tint using self.color instead of color. No other drawing or icon-selection behavior changed.

Changes

Sidebar icon rendering

Layer / File(s) Summary
Closed icon tint application
Sources/Sidebar/AppKitList/Cells/SidebarWorkspaceRowSlotViews.swift
The closed pull request icon drawing branch sets the graphics color using self.color.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: azooz2003-bit

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change and why, but it omits most required template sections like Testing, Demo Video, Review Trigger, and Checklist. Add the required template sections, especially Testing, Demo Video, Review Trigger, and Checklist, with concrete details or notes if not applicable.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the change: a one-token fix for explicit-self capture in the sidebar tint closure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed The edit is inside an @MainActor NSView UI type and only adds explicit self in a drawing closure; it doesn't introduce or worsen any actor-isolation debt.
Cmux Swift Blocking Runtime ✅ Passed Diff only adds self.color in an NSImage closure; no semaphores, waits, sleeps, sync calls, or locks were introduced.
Cmux Browser Automation Off-Main ✅ Passed PR only edits SidebarWorkspaceRowSlotViews.swift for a self.color tint fix; no browser.* routing, worker-lane, or policy-test changes are involved.
Cmux Expensive Synchronous Load ✅ Passed Diff only adds explicit self in an NSImage drawing closure; no agent-history/session-store loads or other expensive synchronous paths were added or moved.
Cmux Cache Substitution Correctness ✅ Passed PASS: This is a transient NSImage tinting closure fix, not a cache/persistence substitution, and no freshness or cold-cache issue is implicated.
Cmux No Hacky Sleeps ✅ Passed The PR only changes a Swift drawing closure (color -> self.color); no sleeps, timers, polling, or runtime delay workarounds are present.
Cmux Algorithmic Complexity ✅ Passed Only a one-token self-color capture fix in an NSImage drawing closure; no collection scans, batching, sorting, or other scalable-workload complexity change.
Cmux Swift Concurrency ✅ Passed Only a self-qualified reference inside an AppKit NSImage drawing callback changed; no legacy async patterns were added or expanded.
Cmux Swift @Concurrent ✅ Passed Diff only changes a closure capture to self.color.set(); no async work or @concurrent/nonisolated isolation changed.
Cmux Swift Package Boundaries ✅ Passed PASS: This is a one-token fix inside a leaf AppKit view; the rule explicitly allows small UI/AppKit glue in the app target, not reusable domain logic.
Cmux Swiftpm Lockfiles ✅ Passed Only a Swift source file changed; no Package.resolved, .gitignore, Xcode project, or dependency files were modified.
Cmux Swift Logging ✅ Passed The only code change is color.set() -> self.color.set() inside an image-drawing closure; no print/debugPrint/dump/NSLog/Logger changes were added.
Cmux User-Facing Error Privacy ✅ Passed The patch only changes color.set() to self.color.set() in a drawing closure; it adds no user-facing errors, alerts, or sensitive copy.
Cmux Full Internationalization ✅ Passed The diff only changes color.set() to self.color.set() in a Swift drawing closure; no user-facing text, catalogs, or locale files were added or changed.
Cmux Swiftui State Layout ✅ Passed Only an AppKit bridge NSView changed; no ObservableObject, GeometryReader, lazy-row store refs, or render-time state mutation were introduced.
Cmux Architecture Rethink ✅ Passed Small local AppKit capture-semantics fix; no timing, extra owner, or split lifecycle state introduced, and the invariant stays with SidebarRowPullRequestIconView.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed The diff only changes NSView drawing in SidebarRowPullRequestIconView; no NSWindow/NSPanel/WindowGroup, cmux.* identifiers, or cmuxAuxiliaryWindowIdentifiers are involved.
Cmux Source Artifacts ✅ Passed The only changed path is a hand-written source file, and the diff adds no local/generated artifacts, scratch dirs, or build outputs.
Cmux No Test Or Debug Seam In Production Source ✅ Passed SidebarWorkspaceRowSlotViews.swift only changes color to self.color; no test/debug seam, guard, or testing-only accessor is added.
Cmux No Ambient Global State ✅ Passed The diff only changes an existing NSImage closure to use self.color; it adds no new top-level funcs, vars, namespaces, or singletons.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@azooz2003-bit

Copy link
Copy Markdown
Collaborator

Superseded by #8329 (merged) — same explicit-capture fix for the tint closure that broke app builds from main after #8270. Thanks for jumping on it.

1 similar comment
@azooz2003-bit

Copy link
Copy Markdown
Collaborator

Superseded by #8329 (merged) — same explicit-capture fix for the tint closure that broke app builds from main after #8270. Thanks for jumping on it.

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.

2 participants