Commit aafc245
committed
fix(control-ui): clear sticky chat UI on code:4001 revocation closes
Address codex P2 review on #72522: the previous reset condition only
fired when the close carried a structured detail code via
isAuthFailureDetailCode. Server-initiated revocation paths (shared-auth
rotation, device removal, session revocation) close active sockets with
code 4001 + a reason string, and the browser client forwards only
{code, reason} for post-hello closes (error is set only for the pending
connect error). Without classifying these directly, cached Control UI
content survived explicit revocation until the next reconnect outcome.
Add isAuthRevocationClose() that matches code 4001 + a lowercased reason
substring against an allowlist (gateway auth changed/rotated/revoked,
shared auth changed/rotated/revoked, device removed/revoked, session
revoked, pairing revoked). Wire it into onClose so hasEverConnected is
also dropped on these code-only revocation closes, preserving the
existing transient-infra and structured-error paths.
Tests cover all 8 revocation reasons (parametrized), plus two defensive
cases: (a) a non-revocation 4001 reason stays sticky, (b) a non-4001
close that happens to mention 'device removed' in its transient reason
stays sticky.
61 tests pass (was 51; +10 = 8 it.each + 2 single).1 parent 6221173 commit aafc245
2 files changed
Lines changed: 123 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
512 | 583 | | |
513 | 584 | | |
514 | 585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
106 | 146 | | |
107 | 147 | | |
108 | 148 | | |
| |||
534 | 574 | | |
535 | 575 | | |
536 | 576 | | |
537 | | - | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
538 | 587 | | |
539 | 588 | | |
| 589 | + | |
| 590 | + | |
540 | 591 | | |
541 | 592 | | |
542 | 593 | | |
| |||
0 commit comments