ServerPack: one browser decision after the panel, pinned by scan

AfterPanel now asks ServerWebOpen.FallbackToBrowser first and opens the
browser only there; the RefusedBeforeNavigate switch arm is gone. A source
scan pins OpenInBrowser(r, done) to exactly two places (OpenWeb's browser
route and right after the guard), so a browser open added to another arm
(a spent code opened twice) fails the tests. Checked by mutation: an extra
arm gives 3, a moved call fails the guard check.

A newer Open answers the older waiting open Closed only once the engine has
queued it; a refused or throwing second open leaves the first waiting (test
added, RED against the old order). The SDK-name scan also covers the
WebPanel*Fn table slots. Trailing newlines restored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-07 17:20:38 -08:00
commit 9a2cbb59c7
3 changed files with 58 additions and 12 deletions

View file

@ -128,12 +128,11 @@ internal sealed class ServerWebPanel
/// <summary>
/// Opens <paramref name="r"/> in the panel. <paramref name="then"/> gets the answer exactly once: now
/// for a refusal, else later from Poll, Close or a newer Open. A newer Open answers the older one Closed.
/// for a refusal, else later from Poll, Close or a newer Open. A newer Open that the engine queued
/// answers the older one Closed (the engine superseded it); a refused one leaves the older one waiting.
/// </summary>
public void Open(WebOpenRequest r, long nowMs, Action<PanelResult> then)
{
Answer(Interlocked.Exchange(ref _waiting, null), PanelResult.Closed);
int code;
try
{
@ -152,7 +151,7 @@ internal sealed class ServerWebPanel
return;
}
Interlocked.Exchange(ref _handle, code);
Interlocked.Exchange(ref _waiting, new WaitingOpen(code, nowMs + PollTimeoutMs, then));
Answer(Interlocked.Exchange(ref _waiting, new WaitingOpen(code, nowMs + PollTimeoutMs, then)), PanelResult.Closed);
}
/// <summary>The tick: answers the waiting open once its state decides, or at the timeout.</summary>
@ -200,4 +199,4 @@ internal sealed class ServerWebPanel
try { then(result); }
catch (Exception) { }
}
}
}