Files
orca/src
Brennan Benson d21f63e6fc fix(browser): keep cookie-import warnings readable from newer hosts (#15002)
* fix(browser): keep cookie-import warnings readable from newer hosts

The import summary is cast, not decoded, coming off the runtime RPC wire, so a
newer host can publish a warning code or undecryptable reason this build has
never seen. Both switches then matched nothing and returned undefined, which
rendered as a blank toast.warning(undefined).

#14683 replaced the absorbing default: arm with case 'unknown' to satisfy
switch-exhaustiveness-check, which forbids default: on an exhaustive switch.
Guard before each switch instead: narrow the wire value against the handled set
and route anything else to a generic message. The handled sets are keyed by the
unions themselves, so a fourth member still fails typecheck here.

* fix(browser): reject non-string cookie-import warning discriminants

Object.hasOwn coerces its key, so the membership guards admitted any value whose
toString() matched a handled variant. A host that widened reason to an array
sends ['unknown'], which passed the guard and then fell straight back out of the
switch -- the same undefined-to-toast.warning blank the guards exist to prevent.

Take unknown and check typeof first, matching isTopLevelView and isTuiAgent. The
Record membership sets still fail typecheck on a new union member.
2026-08-16 22:42:54 -07:00
..