check-overlay-glass: hover card bodies draw only on the one glass window (stacked on #23801)
Native hover cards can't turn solid again. The new lint rules apply to every hover card body.
Leo-ask: ask-d547ac77f0
Stacked on #23801, which adds scripts/cmux-next/check-overlay-glass.py. This branch starts from #23801's head (433dfb01), so review only the top commit (2df1ca09). After #23801 squash-merges, a base merge reduces the diff to that commit.
Audit (native). Every native hover card already shows in the app's one hover card window, HoverCardPanel, which is plain themed glass (#23740; #23801 made the card fill opt-in). None needed a fix:
- tab and tab group cards (
TabHoverCardView,GroupHoverCardView) - link chip preview in Home (
HomeLinkPreviewCardView) - sidebar workspace and group cards (
WorkspaceHoverCard) - sidebar pull request card (
SidebarPullRequestCard) - What's New highlights (
SidebarUpdateCardView+Popover)
The only fills inside them are Palette.hoverFill (thumbnail placeholder, row hover), clear, and a pill tint at 14%.
Change. check-overlay-glass.py now treats any file that hands a body to that window (HoverCardBody() or reports a card's lines (HoverCardTextReporting) as a hover card body, and flags:
hover-own-window: the body builds its own window or material (NSPanel,NSPopover,NSWindow,NSVisualEffectView,OverlaySurfaceView,makeOverlayPanel).hover-body-fill: abackgroundColor,fillColoror.background(...)that isn'tPalette.hoverFill, clear,nil, or a color under 0.6 alpha. Each branch of a ternary is checked.
The panel and its definitions are exempt (HoverCardPanel.swift, HoverCardSource.swift, HoverCardRow.swift). The glass-opaque-allow: escape and the ALLOWED table work as before. check-overlay-glass.test.sh adds fixtures that should fail (popover, own glass, solid fill, solid ternary branch) and ones that should pass (hover fill, clear, 14% pill, escaped dot, the same fill outside a body).
The web hover cards are covered by #23997.
Verification (huge-blue):
python3 -I scripts/cmux-next/check-overlay-glass.py .โ ok.bash scripts/cmux-next/tests/check-overlay-glass.test.shโ ok.- Mutation check: adding
layer?.backgroundColor = Palette.background.cgColortoTabHoverCardView.swiftgives[hover-body-fill]at that line. Reverted afterwards.
This commit changes no Swift; the only Swift in the diff comes from #23801.
No capture: lint only, nothing on screen changes.
Agent session: cosmic-gray
๐ค Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Adds hover card body rules to check-overlay-glass.py so native hover cards can't turn solid again. With #23801 merged into base, this branch carries only the lint and its tests. Hover card bodies must draw only on the app's one glass hover card window (HoverCardPanel).
hover-own-windowflags a body that builds its own window or material (NSPanel,NSPopover,NSWindow,NSVisualEffectView,OverlaySurfaceView,makeOverlayPanel).hover-body-fillflags abackgroundColor/fillColor/.background(...)that isn'tPalette.hoverFill, clear,nil, or under 0.6 alpha; each ternary branch is checked.- Existing
glass-opaque-allow:comments and theALLOWEDtable still apply, and stale allowances fail. check-overlay-glass.test.shadds failing and passing fixtures for each rule form.