Commit b4d18db
fix(server): fix register_lazy+resolve disabled-state inconsistencies
Two correctness issues found in pre-PR review:
1. register_lazy(await_first_validation=True) + validator returns False:
the platform was being written to _platforms even though the tenant
is disabled, and the factory was left in _factories. Mirrors the
resolve() cold-path: on validator failure, discard the platform and
clear the factory so the disabled tenant behaves consistently
regardless of how it reached that state.
2. resolve() docstring claimed it returns None when validator returns
False — only true for the lazy cold-path. The fast-path (eager or
previously-resolved lazy) returns TenantResolution(health="disabled").
Rewritten to make the contract unambiguous and to warn against
gating solely on result is None.
Also adds:
- Class docstring: do-not-use-as-SubdomainTenantRouter warning (same
resolve(host) signature, incompatible return type)
- recheck() docstring: lazy-pending and lazy-disabled caveats (recheck
on pending-lazy advances health without building the platform; recheck
on factory-disabled is insufficient — re-register is required)
- Test: register_lazy + await_first_validation + validator=False must
not cache platform and must not retry factory on subsequent resolve()
https://claude.ai/code/session_01DRv6qahN7Jjt3Q4oxGBXkd1 parent d02ee30 commit b4d18db
2 files changed
Lines changed: 67 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
| |||
364 | 370 | | |
365 | 371 | | |
366 | 372 | | |
| 373 | + | |
367 | 374 | | |
368 | | - | |
369 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
370 | 385 | | |
371 | 386 | | |
372 | 387 | | |
| |||
402 | 417 | | |
403 | 418 | | |
404 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
405 | 435 | | |
406 | 436 | | |
407 | 437 | | |
| |||
492 | 522 | | |
493 | 523 | | |
494 | 524 | | |
495 | | - | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
496 | 528 | | |
497 | | - | |
498 | | - | |
499 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
500 | 534 | | |
501 | | - | |
502 | | - | |
| 535 | + | |
| 536 | + | |
503 | 537 | | |
504 | 538 | | |
505 | 539 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
697 | 722 | | |
698 | 723 | | |
699 | 724 | | |
| |||
0 commit comments