Repository navigation
refactor(desktop): fold idle-gate media exemption into MediaPlaybackDetector (unblocks beta train) - #11565
Conversation
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Confidence score: 5/5
- In
desktop/macos/Desktop/Tests/MediaPlaybackIdleExemptionTests.swift, the new test appears to validate idle values only, so the documented “logs once per episode” behavior anddidLogExemptionreset path may regress unnoticed, weakening confidence in telemetry-related behavior—add assertions for single-log-per-episode and explicit reset-path coverage.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="desktop/macos/Desktop/Tests/MediaPlaybackIdleExemptionTests.swift">
<violation number="1" location="desktop/macos/Desktop/Tests/MediaPlaybackIdleExemptionTests.swift:24">
P3: The new test's doc comment claims it verifies the wrapper 'logs once per episode,' but the test only asserts the returned idle values (0 and 90). The once-per-episode logging and the `didLogExemption` reset path that were folded into `effectiveIdleSeconds` are entirely unverified. Assert the log fires only once across repeated calls while playback stays active, and that it re-arms after `hidIdleSeconds` drops below the threshold.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| /// The gate-facing wrapper mirrors the pure policy and logs once per episode; its | ||
| /// idle arithmetic must match the policy exactly. | ||
| func testDetectorEffectiveIdleMatchesPolicy() { |
There was a problem hiding this comment.
P3: The new test's doc comment claims it verifies the wrapper 'logs once per episode,' but the test only asserts the returned idle values (0 and 90). The once-per-episode logging and the didLogExemption reset path that were folded into effectiveIdleSeconds are entirely unverified. Assert the log fires only once across repeated calls while playback stays active, and that it re-arms after hidIdleSeconds drops below the threshold.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Tests/MediaPlaybackIdleExemptionTests.swift, line 24:
<comment>The new test's doc comment claims it verifies the wrapper 'logs once per episode,' but the test only asserts the returned idle values (0 and 90). The once-per-episode logging and the `didLogExemption` reset path that were folded into `effectiveIdleSeconds` are entirely unverified. Assert the log fires only once across repeated calls while playback stays active, and that it re-arms after `hidIdleSeconds` drops below the threshold.</comment>
<file context>
@@ -19,6 +19,15 @@ final class MediaPlaybackIdleExemptionTests: XCTestCase {
+ /// The gate-facing wrapper mirrors the pure policy and logs once per episode; its
+ /// idle arithmetic must match the policy exactly.
+ func testDetectorEffectiveIdleMatchesPolicy() {
+ let playing = MediaPlaybackDetector(cacheTTL: 10) { true }
+ XCTAssertEqual(playing.effectiveIdleSeconds(hidIdleSeconds: 3600, threshold: 60), 0)
</file context>
|
Merging past the same two known-flaky checks as #11528/#11556 tonight ('TERM case never launched detached app', 'workflow test-install fixture') — they fail identically on every diff regardless of content. All other checks green; behavior re-verified live on the rebuilt bundle (05:01:29 exemption transition with 45min real HID idle). This PR restores Release Eligibility on main (see #11564) so the beta train can cut. |
…ackDetector Moves the effective-idle computation and once-per-episode log out of ProactiveAssistantsPlugin (1779 -> 1767 lines) into the detector, where the policy and cache already live. Restores the plugin below its pre-#11556 line count so the Release Eligibility lane — which re-runs the line-count ratchet on main commits WITHOUT the merged PR's body exception (issue Behavior identical, re-verified live on the rebuilt omi-notch bundle: 05:01:29 'CaptureGate: HID-idle but media playback active — capture continues' with the user genuinely HID-idle 45 min and a real PreventUserIdleDisplaySleep assertion held. MediaPlaybackIdleExemptionTests 4/4 (adds the wrapper-matches-policy test).
… uses the no-changelog-needed label
8272839 to
07939ad
Compare
What
Unblocks the desktop beta train. Every
desktop_auto_releaserun since 06:38Z fails because Release Eligibility re-runs the line-count ratchet on main commits without the merged PR's body exception (filed as #11564) — so #11553's and #11556's legitimate, PR-lane-approved exceptions poison eligibility on their merge commits and no candidate can cut.This folds #11556's 18 gate-site lines out of
ProactiveAssistantsPlugin.swift(1779 → 1767) intoMediaPlaybackDetector, where the exemption policy and cache already live. A shrinking commit passes the ratchet statelessly, so eligibility on this commit (and descendants) goes green and the hourly train cuts again.Behavior is identical:
effectiveIdleSeconds(hidIdleSeconds:threshold:)on the detector wraps the same pure policy and keeps the once-per-episode log.Product invariants
None matched (path-based check: none).
Verification
05:01:29 CaptureGate: HID-idle but media playback active — capture continueswith the user genuinely HID-idle 45 min and a realPreventUserIdleDisplaySleepassertion held (screenshot in worktree).MediaPlaybackIdleExemptionTests4/4 — addstestDetectorEffectiveIdleMatchesPolicyproving the gate-facing wrapper mirrors the pure policy.