Commit 8301386
fix(portal): root-cause the fork-seam S1 timeout — make S1 deterministic + fast (#19)
The `fork-seam` CI job (both ponder versions) was failing on every branch,
including main: `portal-shell.test.ts > S1` timed out (15s, then 30s after a
timeout bump) while the other 139 tests passed. Bumping the timeout only made
it fail slower — the test genuinely takes seconds and blows past any headroom
under full-suite CPU contention.
Root cause: S1's mock served one block (HTTP 200) for EVERY request with
fromBlock < 3M, so the client re-requested one block at a time across each
500k-wide chunk — ~45k sequential round-trips per chunk, 47,037 requests total.
The per-fetch row-accounting logic under test was correct; the mock was
pathological.
Fix: the mock now serves EXACTLY one block per chunk, at the chunk boundary,
and 204s a continuation request past it so the stream terminates. Requests drop
47,037 -> 8; S1 runtime 6.9s -> 0.33s.
To keep S1's "no orphans" coverage (the original slow version caught the missing
`token.freed` guard precisely because read-ahead chunks were still in flight at
eviction time), the read-ahead chunk responses are delayed 150ms so they remain
in flight when the far-ahead interval evicts and frees their tokens — recreating
that race deterministically. Mutation-verified: dropping the eviction free OR
the `token.freed` guard both fail S1; clean passes. Full Portal suite 140/140.
Co-authored-by: claude-ovh-ops <noreply@anthropic.com>1 parent 94b804b commit 8301386
1 file changed
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
668 | 671 | | |
669 | 672 | | |
670 | 673 | | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
671 | 677 | | |
672 | 678 | | |
673 | 679 | | |
| |||
680 | 686 | | |
681 | 687 | | |
682 | 688 | | |
683 | | - | |
684 | | - | |
685 | | - | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
686 | 697 | | |
687 | | - | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
688 | 709 | | |
689 | 710 | | |
690 | 711 | | |
| |||
727 | 748 | | |
728 | 749 | | |
729 | 750 | | |
| 751 | + | |
730 | 752 | | |
731 | 753 | | |
0 commit comments