Commit 2f27ed9
committed
refactor(state-machine): proof-carrying Connected state + revocation bus skeleton (Phase 0)
Phase 0 of the Proof-Carrying Connected refactor (plan:
~/.claude/plans/iterative-roaming-aho.md). Zero behavior change — this ship
only adds the type-level scaffolding so later phases can land incrementally.
What ships here:
* New `state_machine::verifier` module defining:
- `ConnectedProof` struct (crate-private constructors `mint()` and
`forced()`). Code outside `state_machine::verifier` cannot mint one.
- `EvidenceKinds` bitflags (UI_SNAPSHOT, WINDOW_INVENTORY, EVENT_STREAM,
TCP_PROBE, SUPERVISOR_ALIVE, FORCED).
- `RevocationSource` enum with per-source `debounce()`, `next_state()`,
and `tag()`. JvmDied/ReloginDialog/SessionConflict fire immediately;
ErrorDialog/WindowClassMorphed debounce 500ms; LoginFormVisible 1s;
DisconnectedLabelStable 2s.
- `RevocationTracker` with per-tag first-seen timestamps, `observe()`
returning Some once debounce elapses, `clear()` / `clear_all()`.
- `VerificationFailure` enum for Phase 2.
- 10 unit tests covering tracker debounce semantics.
* `State::Connected` → `State::Connected(ConnectedProof)`:
- `Display` impl ignores the proof payload, preserving the external
JSON contract (`"state":"Connected"`).
- `State::from_name("Connected")` now produces a `forced` sentinel
proof flagged with `EvidenceKinds::FORCED` for SETSTATE override.
- Call-site updates: `matches!(state, State::Connected(_))` replaces
`== State::Connected` in every semantic "is this Connected?" check
(queries.rs, mod.rs:222/225/260/478, types.rs client_advisory).
- The 3 current promotion sites (mod.rs:1157/1456/1593) pass a forced
sentinel — these will route through `try_enter_connected()` in
Phase 2.
* `StateMachine` now owns a `RevocationTracker` field; `clear_all()` is
called in `apply_transition()` whenever we leave the Connected family,
so stale debounce timers from a prior session don't leak across.
Tests: 141 pass (was 131). Clippy clean. No production behavior change yet —
zion should still reach and hold Connected exactly as before. Phase 1 wires
the revocation tracker into do_connected for source-tagged demotion.1 parent 65a99ca commit 2f27ed9
5 files changed
Lines changed: 526 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
219 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
220 | 225 | | |
221 | 226 | | |
222 | | - | |
| 227 | + | |
223 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
224 | 232 | | |
225 | 233 | | |
226 | 234 | | |
| |||
254 | 262 | | |
255 | 263 | | |
256 | 264 | | |
257 | | - | |
| 265 | + | |
258 | 266 | | |
259 | 267 | | |
260 | 268 | | |
| |||
475 | 483 | | |
476 | 484 | | |
477 | 485 | | |
478 | | - | |
| 486 | + | |
479 | 487 | | |
480 | 488 | | |
481 | 489 | | |
| |||
1146 | 1154 | | |
1147 | 1155 | | |
1148 | 1156 | | |
1149 | | - | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1150 | 1161 | | |
1151 | 1162 | | |
1152 | 1163 | | |
| |||
1445 | 1456 | | |
1446 | 1457 | | |
1447 | 1458 | | |
1448 | | - | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
1449 | 1463 | | |
1450 | 1464 | | |
1451 | 1465 | | |
| |||
1582 | 1596 | | |
1583 | 1597 | | |
1584 | 1598 | | |
1585 | | - | |
| 1599 | + | |
| 1600 | + | |
1586 | 1601 | | |
1587 | 1602 | | |
1588 | 1603 | | |
| |||
2452 | 2467 | | |
2453 | 2468 | | |
2454 | 2469 | | |
2455 | | - | |
| 2470 | + | |
2456 | 2471 | | |
2457 | 2472 | | |
2458 | 2473 | | |
| |||
2495 | 2510 | | |
2496 | 2511 | | |
2497 | 2512 | | |
2498 | | - | |
2499 | | - | |
2500 | | - | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
2501 | 2517 | | |
2502 | 2518 | | |
2503 | 2519 | | |
| |||
2516 | 2532 | | |
2517 | 2533 | | |
2518 | 2534 | | |
2519 | | - | |
| 2535 | + | |
2520 | 2536 | | |
2521 | 2537 | | |
2522 | 2538 | | |
| |||
2525 | 2541 | | |
2526 | 2542 | | |
2527 | 2543 | | |
2528 | | - | |
2529 | | - | |
2530 | | - | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
2531 | 2549 | | |
2532 | 2550 | | |
2533 | 2551 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
56 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
57 | 65 | | |
58 | 66 | | |
59 | 67 | | |
| |||
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
85 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
| |||
96 | 108 | | |
97 | 109 | | |
98 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
99 | 115 | | |
100 | 116 | | |
101 | 117 | | |
| |||
237 | 253 | | |
238 | 254 | | |
239 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
240 | 262 | | |
241 | 263 | | |
242 | 264 | | |
| |||
282 | 304 | | |
283 | 305 | | |
284 | 306 | | |
| 307 | + | |
285 | 308 | | |
286 | 309 | | |
287 | 310 | | |
| |||
311 | 334 | | |
312 | 335 | | |
313 | 336 | | |
314 | | - | |
| 337 | + | |
315 | 338 | | |
316 | 339 | | |
317 | 340 | | |
| |||
337 | 360 | | |
338 | 361 | | |
339 | 362 | | |
340 | | - | |
| 363 | + | |
| 364 | + | |
341 | 365 | | |
342 | 366 | | |
343 | 367 | | |
| |||
406 | 430 | | |
407 | 431 | | |
408 | 432 | | |
409 | | - | |
| 433 | + | |
| 434 | + | |
410 | 435 | | |
411 | 436 | | |
412 | 437 | | |
413 | 438 | | |
414 | | - | |
| 439 | + | |
415 | 440 | | |
416 | 441 | | |
417 | 442 | | |
| |||
421 | 446 | | |
422 | 447 | | |
423 | 448 | | |
424 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
425 | 454 | | |
426 | 455 | | |
427 | 456 | | |
| |||
0 commit comments