Skip to content

test(hidden-bar): require geometry and cover panel lifecycle - #982

Merged
BarutSRB merged 2 commits into
OmniNull:mainfrom
hezhizhen:codex/hidden-bar-test-lifecycle-geometry
Oct 26, 2026
Merged

BarutSRB merged 2 commits into
OmniNull:mainfrom
hezhizhen:codex/hidden-bar-test-lifecycle-geometry

Conversation

@hezhizhen

@hezhizhen hezhizhen commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Hidden Bar's native-panel guard accepts default window bounds and menu-bar frames that silently disable status-level panel detection when a caller omits them. The original status-layer test relies on those defaults rather than checking the actual exclusion rule. The native-panel lifecycle fixture also retains its controller, and the production menu-bar strip calculation is not directly tested.

Addresses the three optional follow-ups in #978 (review).

Result

  • Require WindowInfo.bounds and isMenuOpen(menuBarFrames:) at every call site. Popup-only tests explicitly supply empty geometry; the status-window test supplies a menu-bar strip and independently checks empty bounds and status items contained within that strip.
  • Capture the controller weakly in the lifecycle test's sleeper and assert that the fixture releases it after the test.
  • Extract the existing menu-bar frame calculation into a helper used by the service. Test status-bar thickness, the notch inset, and the visible-frame top gap on an offset display through the WindowServer coordinate conversion.

Verification

  • make verify: passed. Its 13 lint warnings are in files outside this PR.
  • Full serial swift test: 7,079 tests executed, 42 skipped, 0 failures.
  • Final focused lifecycle and menu-guard tests: 36 passed.
  • Compile-time checks: omitting either bounds or menuBarFrames compiles before the change and is rejected afterward.
  • Isolated negative controls using the revised status-window test body: removing either the empty-bounds check or menu-bar containment check causes an assertion failure; the complete guard passes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved menu-bar detection across displays with varying status-bar heights, safe-area insets, and visible-frame gaps.
    • Status windows with empty bounds or bounds contained within the menu bar are no longer mistaken for open menus. This provides more consistent hidden-bar behavior when interacting with menu-bar items.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1a2c3262-eb04-4b69-98b6-4208a5ccea69
Commits

Reviewing files that changed from the base of the PR and between 17797d2 and e30289d.

Files selected for processing: 2
  • Sources/OmniWM/UI/HiddenBar/HiddenBarMenuGuard.swift
  • Tests/OmniWMTests/HiddenBarMenuGuardTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The menu-open check now uses a helper to calculate and convert menu-bar rectangles. The guard requires explicit window bounds and menu-bar frames. Tests cover frame calculations, status-window bounds, and controller release.

Changes: Menu-bar detection

Layer / File(s) Summary
Menu-bar frame and guard contract
Sources/OmniWM/UI/HiddenBar/MenuBarItemService.swift, Sources/OmniWM/UI/HiddenBar/HiddenBarMenuGuard.swift, Tests/OmniWMTests/HiddenBarMenuGuardTests.swift
isMenuOpen(ownerPIDs:) uses menuBarFrame to calculate menu-bar rectangles. The helper uses the maximum of status-bar thickness, safe-area top inset, and frame-to-visible-frame top difference. The guard requires explicit window bounds and menu-bar frames. Tests cover frame calculations and status-window bounds.

Lifecycle test updates

Layer / File(s) Summary
Controller release check
Tests/OmniWMTests/HiddenBarLifecyclePolicyTests.swift
The sleeper closure captures the controller weakly and checks temporary-reveal state only if the controller remains available. Teardown asserts that the controller was released.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • OmniNull/OmniWM#978: Introduced the status-level native-panel detection inputs and geometry that this change makes explicit, extracts, and tests.

Suggested reviewers: barutsrb

Merge Risk: Minimal · up to e3028

No actionable merge-blocking risk is identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main changes: requiring geometry inputs and covering the native-panel lifecycle. It is concise and specific.
Description check Passed The description includes all required sections: Problem, Result, and Verification. It explains the motivation, implementation changes, test coverage, and verification results in sufficient detail.
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.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@hezhizhen
hezhizhen force-pushed the codex/hidden-bar-test-lifecycle-geometry branch from 71e6dd2 to 17797d2 Compare October 26, 2026 01:43
@hezhizhen

Copy link
Copy Markdown
Contributor Author

@dappermint I just rebased on the latest main (after #987 is merged)

@hezhizhen hezhizhen changed the title test(hidden-bar): cover panel fixture lifetime and menu-bar geometry test(hidden-bar): require geometry and cover panel lifecycle Oct 26, 2026
@hezhizhen

Copy link
Copy Markdown
Contributor Author

@BarutSRB Please take a look.

@BarutSRB

Copy link
Copy Markdown
Collaborator

Thanks for rebasing this and adding the coverage. I've reviewed the current head: the explicit geometry requirements, unchanged production frame calculation and lifecycle release check look good. CI is green, and this is ready to merge independently of #977.

@BarutSRB
BarutSRB merged commit 715c474 into OmniNull:main Oct 26, 2026
5 checks passed
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