test(desktop): isolate FloatingBar notification owner authority - #12259
Merged
undivisible merged 1 commit intoAug 27, 2026
Merged
Conversation
Same defect BasedHardware#12192 fixes in RewindCaptureExclusionGenerationTests, in a suite that issue BasedHardware#12039 did not name. Both owner-seeding tests wrote auth_userId directly: defaults.set(owner, forKey: DefaultsKey.authUserId.rawValue) Runtime owner authorization is process-wide and fails closed on exactly that write: RuntimeOwnerIdentity.swift:51 calls revokeUnexpectedOwnerMismatch() once the authority has bootstrapped a different owner, and stays revoked without a real transition. So the result depended on whether an owner-bound suite ran first. Both tests now establish their owner through RuntimeOwnerAuthorityTestFixture, which crosses the same serialized transition boundary production uses, and restore in tearDown rather than a defer -- a defer cannot await, and more importantly a failed assertion must not leave the process-wide authority revoked for whatever runs next. Adopting the fixture also enrolls this suite in the runner's derived owner-isolation cluster, since swift-test-suites.sh greps for that symbol. Verified the guard does the work rather than assuming it. Same command, same three owner-bound suites, only the fix differing: before: Executed 28 tests, with 1 failure FloatingBarNotificationPreviewPolicyTests.swift:218: error: XCTAssertEqual failed: ("rejectedOwnerChange") is not equal to ("suppressed") after: Executed 28 tests, with 0 failures In isolation the suite passed both before and after (19/19), which is why the flake read as nondeterministic. Failure-Class: FC-hand-listed-test-isolation-membership
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Collaborator
|
Verified against the current head — this checks out cleanly, and the root-cause diagnosis is accurate.
The before/after run transcript in the description (1 failure → 0 failures across the three owner-bound suites) is a credible verification of the guard doing the work. Thanks for tracing this through the guard mechanism rather than just pinning more keys — it pairs nicely with #12192 for the Rewind suite. Leaving for human maintainer review before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
11 tasks
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.
What changed and why
The same defect #12192 fixes in
RewindCaptureExclusionGenerationTests, in a suite #12039 does not name. I found it while checking whether the other suites in that issue shared a root cause — three of them don't, this one does.Both owner-seeding tests wrote
auth_userIddirectly:Runtime owner authorization is process-wide and deliberately fails closed on exactly that write —
RuntimeOwnerIdentity.swift:51:Once any earlier owner-bound suite has bootstrapped a different owner, the raw write revokes the authority and it stays revoked without a real
beginTransition/endTransitionpair. So the outcome depended on which suite ran first.Both tests now establish their owner through
RuntimeOwnerAuthorityTestFixture, crossing the same serialized transition boundary production uses. Restore happens intearDownrather than adefer— adefercan'tawait, and more importantly a failed assertion must not leave the process-wide authority revoked for whatever runs next, which is the contamination this is fixing. Adopting the fixture also enrolls the suite in the runner's derived owner-isolation cluster, sinceswift-test-suites.shgreps for that symbol.How it was verified
I checked the guard actually does the work rather than assuming it. Identical command, same three owner-bound suites, only the fix differing:
In isolation the suite passes both before and after (19/19) — which is exactly why the flake read as nondeterministic and why running it alone never reproduced it.
xcrun swift build -c debug --package-path Desktopclean.Worth noting the symptom is not where I first expected it. I predicted
XCTUnwrap(RuntimeOwnerIdentity.currentOwnerId())would throw on a nil owner; it doesn't —currentOwnerId()returns fine and the revocation surfaces later at the delivery gate asrejectedOwnerChange. Same root cause, different surfacing point, and therejectedOwnerChangepayload is precisely the "production error payload that looks like a real defect" the failure class describes.This is test-harness isolation only; no production code is touched and there is no user-facing path to exercise.
Product invariants affected
none
Relationship to the other #12039 suites
ChatTranscriptGestureHarnessTests,KernelTurnRecordedProjectionTests, andSuggestedTasksStoreTestshave noauthUserIdwrites and don't use the fixture, so they flake for some other reason. This PR does not address them and I have not diagnosed them.Failure-Class: FC-hand-listed-test-isolation-membership