review: pin the driver flip and correct the applyMobileDisplayMode contract

- Tighten the held-branch driver assertion to the exact post-release state so
  it pins releaseDesktopTakeBack's flip rather than merely "not mobile".
- applyMobileDisplayMode's doc claimed reclaimTerminalForDesktop gates its
  transitions on the returned convergence flag. No branch does after this
  change; say so, so the gate is not reinstated.

Hooks skipped (machine load); oxfmt --check and oxlint verified clean manually.
This commit is contained in:
Brennan Benson
2026-08-19 16:53:42 -07:00
parent 2fa54fdeb6
commit d3e7159379
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -16771,8 +16771,10 @@ export class OrcaRuntimeService {
// Returns the post-condition "no fit-override remains held" (#7588): `true`
// when it cleared a held override OR nothing was held to begin with, `false`
// only when a restore was attempted and the resize failed (override rolled
// back, still held). reclaimTerminalForDesktop gates its driver/mode
// transitions on this; other callers ignore it.
// back, still held). Informational for every caller today —
// reclaimTerminalForDesktop deliberately does NOT gate on it, because an
// explicit take-back must drop the lock even when the resize cannot
// converge. Do not reinstate a convergence gate there.
async applyMobileDisplayMode(ptyId: string): Promise<boolean> {
const mode = this.getMobileDisplayMode(ptyId)
const inner = this.mobileSubscribers.get(ptyId)
@@ -545,7 +545,7 @@ describe('remote desktop viewer width driver', () => {
await expect(runtime.reclaimTerminalForDesktop('pty-1')).resolves.toBe(true)
expect(runtime.getTerminalFitOverride('pty-1')).toBeNull()
expect(runtime.getDriver('pty-1').kind).not.toBe('mobile')
expect(runtime.getDriver('pty-1')).toEqual({ kind: 'desktop' })
expect(fitOverrideEvents.slice(notifierBefore).some((e) => e.mode === 'desktop-fit')).toBe(true)
// A second click must not be needed, and must stay idempotent.
await expect(runtime.reclaimTerminalForDesktop('pty-1')).resolves.toBe(false)