gate: a branch taken per operating system needs a test that injects one - #509
Conversation
A guard's screen-lock and idle probes returned early on anything but macOS. The suite was green on a Mac and red on Linux CI with "unexpectedly None", because the branch under test only ever ran on the author's machine. The coverage gate now asks any detector that reads sys.platform for a test that passes a platform in. Backtested against the tests as first written: fires. Against the fixed ones: silent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KU2pPKob4MJ1NqjsfTNyYJ Change-Id: I0ebec990b0153ad5e64e4725cbe045d4cd428ed4
Owner
Author
|
This pull request is part of a Mergify stack:
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_5ede4904-9e80-419f-8b01-70487cd603c6) |
This was referenced Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A guard's screen-lock and idle probes returned early on anything but macOS.
The suite was green on a Mac and red on Linux CI with "unexpectedly None",
because the branch under test only ever ran on the author's machine.
The coverage gate now asks any detector that reads sys.platform for a test
that passes a platform in. Backtested against the tests as first written:
fires. Against the fixed ones: silent.
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01KU2pPKob4MJ1NqjsfTNyYJ
Depends-On: #508
Note
Low Risk
Changes only the static coverage checker and its tests; no runtime hook or detector behavior is modified in this diff.
Overview
Extends the hook test coverage gate so detectors that branch on the host OS cannot pass with only positive/negative tests that run on whatever machine executes CI.
check_hooknow flags hooks whosedetect.pyreferencessys.platformorplatform.systemunless at least one test file contains platform injection patterns (e.g.platform='linux'). The error message tells authors to pass platform in instead of relying on the host, so non-macOS paths are exercised on Linux CI.Unit tests in
TestPlatformBranchRulecover fail-without-injection, pass-with-injection, and no-op for inline detectors without OS branches.Reviewed by Cursor Bugbot for commit 1ec58f5. Bugbot is set up for automated code reviews on this repo. Configure here.