Skip to content

Improve error reporting during server launch - #1390

Merged
merrymercy merged 2 commits into
mainfrom
fix-bug
Sep 11, 2024
Merged

merrymercy merged 2 commits into
mainfrom
fix-bug

Conversation

@merrymercy

Copy link
Copy Markdown
Collaborator

No description provided.

@merrymercy
merrymercy merged commit c03cece into main Sep 11, 2024
@merrymercy
merrymercy deleted the fix-bug branch September 11, 2024 11:50
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
…MainBase

test_weg2_hicache_disabled_1386.py's TheDraftKvProducerFallsWithIt (5 of the
file's 19 tests) mocked launcher.SHM_DIR to a private empty tmpdir and looked
isolated, but two of main()'s three host-facing seams silently read the real
box regardless:

1. `shm_residue_sweep(shm_dir: str = SHM_DIR)` binds that default ONCE, at
   module-import time. `main`'s call (`shm_residue_sweep(log, ns.tag, stamp,
   dry)`, no `shm_dir=` keyword) always used the ORIGINAL /dev/shm the
   function was defined against -- mock.patch.object(launcher, "SHM_DIR",
   tmp) changed the ATTRIBUTE but not what this call read. Reproduced via
   inspect.signature: the bound default stays "/dev/shm" even while the
   module attribute reads the patched path. Any live `sglang.launch_server`
   process (or residue) anywhere on the box could reach the sgl-project#1217 preflight's
   pgrep/live-holder refusal, explaining "goes red whenever a boot runs
   somewhere else" without any of these tests' own isolation ever engaging.

2. `choose_host_ledger`'s `meminfo_path`/`cgroup_root` were never threaded
   through main()'s call at all -- every dry run in this file read the REAL
   /proc/meminfo and cgroup tree. Verified empirically: with
   host_ledger.read_meminfo/read_cgroup monkeypatched to a busy-box reading
   (MemAvailable 5 GiB, cgroup current 100 GiB), this file's own model/arm
   combination raises W20 Weg2HostLedgerRefused -- a second, independent live
   dependency, on top of the SHM one, that a live boot's actual memory
   pressure could trip.

Fixed both at their one call site in main(): new MEMINFO_PATH/CGROUP_ROOT
module constants (named exactly like the existing SHM_DIR, for the identical
reason), and shm_dir=SHM_DIR / meminfo_path=MEMINFO_PATH /
cgroup_root=CGROUP_ROOT passed explicitly so the mock's fresh module-attribute
read actually reaches the call instead of the frozen default.

_HermeticMainBase now also builds and mocks a pinned quiet-box
/proc/meminfo + cgroup2 tree (this box's own real reading, 2026-09-14,
verified currently-fundable -- not an arbitrarily generous synthetic one, so
the fixture preserves rather than widens what these tests cover), reusing
the exact fake-host construction test_weg2_cushion_headroom_autoresolve_1378_stage2b.py
built for the same choose_host_ledger seam rather than a second fixture path.

New test class TheFiveTestsAboveAreActuallyHermeticNow (3 cases): a
hermetic, self-contained reproduction of each half of the live dependency --
a residue file this test process itself holds open (found via the real
/proc, no subprocess needed) for the SHM path, and a deliberately too-small
fake host for the memory path -- proving main() actually reads the mocked
values, plus a structural check on the call site's own source.

Manually verified both required danger-direction mutants: reverting
shm_dir=SHM_DIR to the bare call kills
test_a_mocked_shm_residue_with_a_live_holder_is_actually_seen; reverting
meminfo_path=MEMINFO_PATH/cgroup_root=CGROUP_ROOT kills both
test_a_too_small_mocked_host_actually_refuses_the_ladder and the structural
call-site test. Both restored, diff empty. Full file green (22 of 22,
19 original + 3 new).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
Three red tests (test_the_sn6s_record_no_longer_exceeds_the_boot_bound,
test_a_quiet_launch_still_charges_the_measured_floor,
test_the_arm_line_carries_both_currencies) all share one root cause, none of
it a shmem/anon currency mixup: `_sample()`'s synthetic fixture (line 67)
tripped two LATER, unrelated `run_origin_gib` filters that did not exist when
sgl-project#1325 was written, both correct in their own right.

1. `interleaved=True` (hardcoded). `dormant_image_sample`'s own docstring
   defines it as "sampled during a flip, the destination group RESUMING while
   this one sleeps" -- host_ledger.py's `run_origin_gib` `_mid` check (added
   by commit 5c70c2a, "[#1350e] the two measurably double-booked terms,
   corrected", 2026-09-12) excludes every such record from ever winning its
   max(): a mid-flip sample may already contain the flip ratchet's charged
   step, and using it AND charging the ratchet separately would double-count.
   The REAL sn6s record (SN6S_P_ENTRY, copied verbatim from the sidecar,
   lower in this same file) carries no `interleaved` key at all and its own
   tests (test_the_reader_reprices_the_record_already_on_disk and siblings)
   already passed -- proving `False` was always the accurate value for what
   this file's scenarios model (the launcher's un-interleaved first sleep of
   P), not a value #1350e invalidated.

2. `pids=[]` (also hardcoded). Commit 8679091 ("[sgl-project#1361 22-fix5b] absence
   of evidence is not evidence of death: the pids key must be PRESENT") taught
   `run_origin_gib` that a `pids` key PRESENT but reading 0 alive is a
   DEATH-SAMPLE -- correct for a genuinely dead line, but `[]` here was never
   claiming that; it stood in for "this test does not care about the
   RSS-based image measurement" (the fixture supplies `cg_current_bytes`
   directly for the residual calc). Fixed with a REAL, definitely-alive pid
   (this test process's own, `os.getpid()`) -- `rss_shmem_bytes` reads
   `/proc/<pid>/status`'s own `RssShmem` line, which every real process has,
   so it always answers and is never a death signal, hermetically (no
   subprocess, no /proc fixture needed).

Both commits are named in the fixture's own comment rather than adjusting the
expected values silently. host_ledger.py is UNTOUCHED by this fix -- both
`run_origin_gib` filters are independently correct and well-documented
(5c70c2a guards against double-charging the flip ratchet; 8679091 guards
against reading an omitted `pids` key as a death sample), and the defect was
entirely in the test's own two-line fixture predating both.

All 21 tests in the file green (was 18 passed / 3 failed). No mutant required
-- this is a stale-expectation fix, not a code-bug fix (the coordinator's own
decision rule for that case: fix forward with the commit named, never a
silent value adjustment).

Verified via git worktree against the pristine pre-fix tip (d6c3d19, no
edits from this branch) that the file's failures are reproducible there too,
independent of anything on feat/1378-cushion-gate-stage2 or sgl-project#1390's changes
in this same branch.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
…ect#1390's new keyword

Full-suite diff against the pristine pre-sgl-project#1390 tip (d6c3d19, throwaway
worktree) turned up exactly one new failure my two prior commits on this
branch introduced: test_weg2_fix8_image_1233.py::TestTheHonestOutcomeIsPrintedInsteadOfShrinkingATerm
-- no, TestTheShmOrphanSweep::test_the_preflight_calls_the_sweep, a
structural pin asserting the literal substring
"shm_residue_sweep(log, ns.tag, stamp, dry)" appears in main()'s source.
b6bb3bc changed that call to name shm_dir=SHM_DIR explicitly (the whole
point of sgl-project#1390: a bare call reads shm_residue_sweep's own default, bound
once at that function's def time, immune to a test's
mock.patch.object(launcher, "SHM_DIR", ...)), so the trailing ")" the old
pin's substring ended on is now ", shm_dir=SHM_DIR)" -- a legitimate,
deliberate widening of the call, not a call main() stopped making.

Widened the pin to match. Full file green but for one pre-existing,
environment-dependent failure also present on the pristine tip (same test,
same "retry() exceed maximum number of retries" symptom, confirmed via the
same throwaway-worktree comparison).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
Precision from the coordinator, not a defect: choose() already prices
whatever the box holds RIGHT NOW into every arm (cg_current_bytes -> the
origin -> the predicted peak) -- sgl-project#1390 made that seam testable, it did not
make the dry run box-independent, and should not: it is supposed to measure
the live box. What was missing is honesty about which reading a verdict was
measured against. Today a FUNDABLE measured on a quiet box and a FUNDABLE
measured under ~2.5 GiB of parallel load (the exact incident named in the
dry-run-misst-die-live-box memory note, 2026-09-13: the same argv worked to
ARM 95.18 on a quiet box and refused W97 97.67 under a parallel pytest
suite) print identically. The asymmetry: foreign load tightens the bound
(a false refusal, safe and attributable), but the dangerous case is the
reverse -- measured quiet, funded, then booted later once the box has
picked up load the dry run never saw.

Adds to host_ledger.py:
- QUIET_BASELINE_CG_CURRENT_GIB (13.10, this box, measured 2026-09-14 --
  the SAME reading test_weg2_hicache_disabled_1386.py's quiet-box fixture
  already pins, reused rather than a second number for the same fact).
- FOREIGN_LOAD_PROVISIONAL_THRESHOLD_GIB (2.5, named from the
  dry-run-misst-die-live-box incident -- a measured magnitude, not a
  guessed safety factor).
- foreign_load_now_gib(cg_current_bytes): the box's current reading minus
  the quiet baseline, floored at 0, None when unmeasured.
- choose() gains box_state_at/cg_anon_bytes/cg_shmem_bytes -- PRINT-ONLY,
  following the exact precedent xchg_bounce_prov already set ("it never
  reaches price, because nothing here changes a number"). A new
  WEG2-DRY-RUN-BOX-STATE line (always printed, funded or refused, on the
  sgl-project#1386/sgl-project#1378-established "on or off" idiom) carries the raw memavail/anon/
  shmem reading plus the computed foreign_load_now, and appends a
  PROVISIONAL clause above the threshold -- worded for BOTH verdict
  directions (a refusal may be the box, not the form; a FUNDABLE should be
  re-verified before the actual boot).

THE DECISION, stated explicitly per the order ("dein Urteil, welches von
beiden ehrlicher ist"): PROVISIONAL text, never a second refusal gate.
Crossing the threshold changes no arm's fundability. Reasons: (1) a hard
refusal keyed on instantaneous box noise would misattribute the box's
transient state to the form -- exactly what the existing memory note
already warns against; (2) any genuine danger from current foreign load is
already caught by the EXISTING peak/cushion/headroom checks, since foreign
load raises cg_current -> raises the origin -> raises the predicted peak;
a second gate on the same signal would be the sgl-project#1358 double-bookkeeping
shape one layer up; (3) PROVISIONAL preserves every fact for the reader
without new binding semantics, the same "indicator, not Freibrief" shape
sgl-project#1378 Stage 2 already established for cushion_headroom_gib.

launcher.py: choose_host_ledger captures the timestamp AT the cgroup read
it is stamping (not reconstructed later), and forwards
box_state_at/cg_anon_bytes/cg_shmem_bytes from the SAME `cg` reading
(cg_ceiling_bytes/reclaimable_bytes/cg_oom_kill already price from) --
never the earlier `_cg0` PEAK-BASELINE snapshot, which would make the line
lie about which instant the rest of the ARM line was priced against.

Tests (test_weg2_dry_run_box_state_1392.py, 16 cases, hermetic): the three
numbers always print (measured, unreadable, and on a total refusal);
foreign_load_now_gib's arithmetic (baseline, floor, delta, unmeasured);
the decision itself -- a fundable arm's identity and headroom are BYTE-
IDENTICAL under heavy simulated foreign load (structural proof the
threshold never touches `ok`), PROVISIONAL fires only strictly above the
threshold and never at/below it, and a refusal under heavy load also names
the box; the launcher's timestamp-before-read ordering and its forwarding
from the correct `cg` reading.

Manually verified the required danger-direction mutant (foreign_load_now_gib
call replaced with a hardcoded None): 3 of 16 tests go red (the two
PROVISIONAL-text tests and the structural real-call guard), confirming the
line's honesty text is load-bearing rather than decorative. Restored, diff
empty. Broader regression slice (14 files) green but for the one already-
known pre-existing "retry() exceed maximum number of retries" failure.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
…MainBase

test_weg2_hicache_disabled_1386.py's TheDraftKvProducerFallsWithIt (5 of the
file's 19 tests) mocked launcher.SHM_DIR to a private empty tmpdir and looked
isolated, but two of main()'s three host-facing seams silently read the real
box regardless:

1. `shm_residue_sweep(shm_dir: str = SHM_DIR)` binds that default ONCE, at
   module-import time. `main`'s call (`shm_residue_sweep(log, ns.tag, stamp,
   dry)`, no `shm_dir=` keyword) always used the ORIGINAL /dev/shm the
   function was defined against -- mock.patch.object(launcher, "SHM_DIR",
   tmp) changed the ATTRIBUTE but not what this call read. Reproduced via
   inspect.signature: the bound default stays "/dev/shm" even while the
   module attribute reads the patched path. Any live `sglang.launch_server`
   process (or residue) anywhere on the box could reach the sgl-project#1217 preflight's
   pgrep/live-holder refusal, explaining "goes red whenever a boot runs
   somewhere else" without any of these tests' own isolation ever engaging.

2. `choose_host_ledger`'s `meminfo_path`/`cgroup_root` were never threaded
   through main()'s call at all -- every dry run in this file read the REAL
   /proc/meminfo and cgroup tree. Verified empirically: with
   host_ledger.read_meminfo/read_cgroup monkeypatched to a busy-box reading
   (MemAvailable 5 GiB, cgroup current 100 GiB), this file's own model/arm
   combination raises W20 Weg2HostLedgerRefused -- a second, independent live
   dependency, on top of the SHM one, that a live boot's actual memory
   pressure could trip.

Fixed both at their one call site in main(): new MEMINFO_PATH/CGROUP_ROOT
module constants (named exactly like the existing SHM_DIR, for the identical
reason), and shm_dir=SHM_DIR / meminfo_path=MEMINFO_PATH /
cgroup_root=CGROUP_ROOT passed explicitly so the mock's fresh module-attribute
read actually reaches the call instead of the frozen default.

_HermeticMainBase now also builds and mocks a pinned quiet-box
/proc/meminfo + cgroup2 tree (this box's own real reading, 2026-09-14,
verified currently-fundable -- not an arbitrarily generous synthetic one, so
the fixture preserves rather than widens what these tests cover), reusing
the exact fake-host construction test_weg2_cushion_headroom_autoresolve_1378_stage2b.py
built for the same choose_host_ledger seam rather than a second fixture path.

New test class TheFiveTestsAboveAreActuallyHermeticNow (3 cases): a
hermetic, self-contained reproduction of each half of the live dependency --
a residue file this test process itself holds open (found via the real
/proc, no subprocess needed) for the SHM path, and a deliberately too-small
fake host for the memory path -- proving main() actually reads the mocked
values, plus a structural check on the call site's own source.

Manually verified both required danger-direction mutants: reverting
shm_dir=SHM_DIR to the bare call kills
test_a_mocked_shm_residue_with_a_live_holder_is_actually_seen; reverting
meminfo_path=MEMINFO_PATH/cgroup_root=CGROUP_ROOT kills both
test_a_too_small_mocked_host_actually_refuses_the_ladder and the structural
call-site test. Both restored, diff empty. Full file green (22 of 22,
19 original + 3 new).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
Three red tests (test_the_sn6s_record_no_longer_exceeds_the_boot_bound,
test_a_quiet_launch_still_charges_the_measured_floor,
test_the_arm_line_carries_both_currencies) all share one root cause, none of
it a shmem/anon currency mixup: `_sample()`'s synthetic fixture (line 67)
tripped two LATER, unrelated `run_origin_gib` filters that did not exist when
sgl-project#1325 was written, both correct in their own right.

1. `interleaved=True` (hardcoded). `dormant_image_sample`'s own docstring
   defines it as "sampled during a flip, the destination group RESUMING while
   this one sleeps" -- host_ledger.py's `run_origin_gib` `_mid` check (added
   by commit 5c70c2a, "[#1350e] the two measurably double-booked terms,
   corrected", 2026-09-12) excludes every such record from ever winning its
   max(): a mid-flip sample may already contain the flip ratchet's charged
   step, and using it AND charging the ratchet separately would double-count.
   The REAL sn6s record (SN6S_P_ENTRY, copied verbatim from the sidecar,
   lower in this same file) carries no `interleaved` key at all and its own
   tests (test_the_reader_reprices_the_record_already_on_disk and siblings)
   already passed -- proving `False` was always the accurate value for what
   this file's scenarios model (the launcher's un-interleaved first sleep of
   P), not a value #1350e invalidated.

2. `pids=[]` (also hardcoded). Commit 8679091 ("[sgl-project#1361 22-fix5b] absence
   of evidence is not evidence of death: the pids key must be PRESENT") taught
   `run_origin_gib` that a `pids` key PRESENT but reading 0 alive is a
   DEATH-SAMPLE -- correct for a genuinely dead line, but `[]` here was never
   claiming that; it stood in for "this test does not care about the
   RSS-based image measurement" (the fixture supplies `cg_current_bytes`
   directly for the residual calc). Fixed with a REAL, definitely-alive pid
   (this test process's own, `os.getpid()`) -- `rss_shmem_bytes` reads
   `/proc/<pid>/status`'s own `RssShmem` line, which every real process has,
   so it always answers and is never a death signal, hermetically (no
   subprocess, no /proc fixture needed).

Both commits are named in the fixture's own comment rather than adjusting the
expected values silently. host_ledger.py is UNTOUCHED by this fix -- both
`run_origin_gib` filters are independently correct and well-documented
(5c70c2a guards against double-charging the flip ratchet; 8679091 guards
against reading an omitted `pids` key as a death sample), and the defect was
entirely in the test's own two-line fixture predating both.

All 21 tests in the file green (was 18 passed / 3 failed). No mutant required
-- this is a stale-expectation fix, not a code-bug fix (the coordinator's own
decision rule for that case: fix forward with the commit named, never a
silent value adjustment).

Verified via git worktree against the pristine pre-fix tip (d6c3d19, no
edits from this branch) that the file's failures are reproducible there too,
independent of anything on feat/1378-cushion-gate-stage2 or sgl-project#1390's changes
in this same branch.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
…ect#1390's new keyword

Full-suite diff against the pristine pre-sgl-project#1390 tip (d6c3d19, throwaway
worktree) turned up exactly one new failure my two prior commits on this
branch introduced: test_weg2_fix8_image_1233.py::TestTheHonestOutcomeIsPrintedInsteadOfShrinkingATerm
-- no, TestTheShmOrphanSweep::test_the_preflight_calls_the_sweep, a
structural pin asserting the literal substring
"shm_residue_sweep(log, ns.tag, stamp, dry)" appears in main()'s source.
b6bb3bc changed that call to name shm_dir=SHM_DIR explicitly (the whole
point of sgl-project#1390: a bare call reads shm_residue_sweep's own default, bound
once at that function's def time, immune to a test's
mock.patch.object(launcher, "SHM_DIR", ...)), so the trailing ")" the old
pin's substring ended on is now ", shm_dir=SHM_DIR)" -- a legitimate,
deliberate widening of the call, not a call main() stopped making.

Widened the pin to match. Full file green but for one pre-existing,
environment-dependent failure also present on the pristine tip (same test,
same "retry() exceed maximum number of retries" symptom, confirmed via the
same throwaway-worktree comparison).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
Precision from the coordinator, not a defect: choose() already prices
whatever the box holds RIGHT NOW into every arm (cg_current_bytes -> the
origin -> the predicted peak) -- sgl-project#1390 made that seam testable, it did not
make the dry run box-independent, and should not: it is supposed to measure
the live box. What was missing is honesty about which reading a verdict was
measured against. Today a FUNDABLE measured on a quiet box and a FUNDABLE
measured under ~2.5 GiB of parallel load (the exact incident named in the
dry-run-misst-die-live-box memory note, 2026-09-13: the same argv worked to
ARM 95.18 on a quiet box and refused W97 97.67 under a parallel pytest
suite) print identically. The asymmetry: foreign load tightens the bound
(a false refusal, safe and attributable), but the dangerous case is the
reverse -- measured quiet, funded, then booted later once the box has
picked up load the dry run never saw.

Adds to host_ledger.py:
- QUIET_BASELINE_CG_CURRENT_GIB (13.10, this box, measured 2026-09-14 --
  the SAME reading test_weg2_hicache_disabled_1386.py's quiet-box fixture
  already pins, reused rather than a second number for the same fact).
- FOREIGN_LOAD_PROVISIONAL_THRESHOLD_GIB (2.5, named from the
  dry-run-misst-die-live-box incident -- a measured magnitude, not a
  guessed safety factor).
- foreign_load_now_gib(cg_current_bytes): the box's current reading minus
  the quiet baseline, floored at 0, None when unmeasured.
- choose() gains box_state_at/cg_anon_bytes/cg_shmem_bytes -- PRINT-ONLY,
  following the exact precedent xchg_bounce_prov already set ("it never
  reaches price, because nothing here changes a number"). A new
  WEG2-DRY-RUN-BOX-STATE line (always printed, funded or refused, on the
  sgl-project#1386/sgl-project#1378-established "on or off" idiom) carries the raw memavail/anon/
  shmem reading plus the computed foreign_load_now, and appends a
  PROVISIONAL clause above the threshold -- worded for BOTH verdict
  directions (a refusal may be the box, not the form; a FUNDABLE should be
  re-verified before the actual boot).

THE DECISION, stated explicitly per the order ("dein Urteil, welches von
beiden ehrlicher ist"): PROVISIONAL text, never a second refusal gate.
Crossing the threshold changes no arm's fundability. Reasons: (1) a hard
refusal keyed on instantaneous box noise would misattribute the box's
transient state to the form -- exactly what the existing memory note
already warns against; (2) any genuine danger from current foreign load is
already caught by the EXISTING peak/cushion/headroom checks, since foreign
load raises cg_current -> raises the origin -> raises the predicted peak;
a second gate on the same signal would be the sgl-project#1358 double-bookkeeping
shape one layer up; (3) PROVISIONAL preserves every fact for the reader
without new binding semantics, the same "indicator, not Freibrief" shape
sgl-project#1378 Stage 2 already established for cushion_headroom_gib.

launcher.py: choose_host_ledger captures the timestamp AT the cgroup read
it is stamping (not reconstructed later), and forwards
box_state_at/cg_anon_bytes/cg_shmem_bytes from the SAME `cg` reading
(cg_ceiling_bytes/reclaimable_bytes/cg_oom_kill already price from) --
never the earlier `_cg0` PEAK-BASELINE snapshot, which would make the line
lie about which instant the rest of the ARM line was priced against.

Tests (test_weg2_dry_run_box_state_1392.py, 16 cases, hermetic): the three
numbers always print (measured, unreadable, and on a total refusal);
foreign_load_now_gib's arithmetic (baseline, floor, delta, unmeasured);
the decision itself -- a fundable arm's identity and headroom are BYTE-
IDENTICAL under heavy simulated foreign load (structural proof the
threshold never touches `ok`), PROVISIONAL fires only strictly above the
threshold and never at/below it, and a refusal under heavy load also names
the box; the launcher's timestamp-before-read ordering and its forwarding
from the correct `cg` reading.

Manually verified the required danger-direction mutant (foreign_load_now_gib
call replaced with a hardcoded None): 3 of 16 tests go red (the two
PROVISIONAL-text tests and the structural real-call guard), confirming the
line's honesty text is load-bearing rather than decorative. Restored, diff
empty. Broader regression slice (14 files) green but for the one already-
known pre-existing "retry() exceed maximum number of retries" failure.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 14, 2026
…her.main(), not just choose()

Prior-art gate first, per the order: sgl-project#1392 itself was already built and on
the train (commit 5a1c3f0 / rebased to de7f875's ancestor chain,
"the dry run says WHICH box state it funded against") -- the ARM line
already carries memavail/anon/shmem plus provenance, the PROVISIONAL text
above FOREIGN_LOAD_PROVISIONAL_THRESHOLD_GIB already exists with the
directional-asymmetry reasoning the order restates almost verbatim, and no
second refusal gate was ever added. This is NOT a rebuild of that feature.

THE ONE GAP the order actually named: "Nutze die Ruhig-Box-Fixture und
_HermeticMainBase aus sgl-project#1390... Prior-Art-Gate zuerst darauf, kein Zweitbau."
The existing test file's `TheLauncherThreadsTheThreeReadingsThrough` class
only inspects `launcher.choose_host_ledger`'s SOURCE TEXT (string/AST
checks) and calls `host_ledger.choose()` directly -- never `launcher.main()`
end to end, and never through sgl-project#1390's own `_HermeticMainBase` /
`_fake_quiet_host` fixture, which exist for exactly this seam.

Closes it by importing (not reimplementing) `_HermeticMainBase`,
`_fake_quiet_host`'s pinned readings, `_main_argv` and `_NEEDS_CHECKPOINT`
from test_weg2_hicache_disabled_1386.py, the same cross-test-file reuse
convention test_weg2_band_credit_1397.py already uses for its own sibling
fixture:

1. TheRealDryRunLineOnAQuietBox: `launcher.main(['--dry-run', ...])`, the
   REAL wiring, on the pinned quiet-box reading -- the printed line says
   "not stale-suspect", never PROVISIONAL, and carries memavail=/anon=/
   shmem=.
2. A new `_fake_loaded_host` (the quiet fixture's numbers, `memory.current`
   pushed exactly QUIET_BASELINE + THRESHOLD + 1 GiB) and a matching
   `_HermeticMainBaseLoaded` harness (own setUp/tearDown -- not a subclass
   of `_HermeticMainBase` overriding setUp, which would leave two live
   mock.patch layers active): TheRealDryRunLineOnALoadedBox proves the SAME
   real `main()` run, ONLY the host reading changed, now prints PROVISIONAL
   and a real foreign_load_now figure.
3. THE REQUIRED DANGER-DIRECTION MUTANT, against the real file, not a
   planted fixture (mirroring how sgl-project#1395's mutant ran against the real
   reader): `mock.patch.object(hl, "FOREIGN_LOAD_PROVISIONAL_THRESHOLD_GIB",
   float("inf"))` around a live `main()` run on the LOADED host -- the line
   still prints a real, honest `foreign_load_now=` figure (the box IS
   loaded) but PROVISIONAL never fires, because the axis that would have
   said so was neutralised. `test_the_real_printed_line_says_PROVISIONAL`
   (a DIFFERENT, non-mutant-specific test) independently catches the same
   defect when the axis is instead removed at the SOURCE (see below),
   which is the broader, more convincing proof.

MUTANT APPLIED LIVE TO host_ledger.py ITSELF AND REVERTED (diff empty
after), exactly as ordered ("fahr ihn gegen die echte Datei"): the
`_fl_now > FOREIGN_LOAD_PROVISIONAL_THRESHOLD_GIB` condition replaced with
`False` (the foreign-load axis silently removed from the line's effect,
never from its printed number). Re-ran TheRealDryRunLineOnALoadedBox: the
loaded box's `main()` run still completes, the line still claims a verdict,
`foreign_load_now=3.50 GiB` (real, above threshold) still prints, but
"PROVISIONAL" is gone -- `test_the_real_printed_line_says_PROVISIONAL`
(the plain, non-mutant test) goes red on its own, which is the strongest
form of this proof: the feature's OWN direct test catches the mutation
without needing a dedicated mutant assertion. Reverted, diff empty,
19/19 green again.

No second launch-time guard: sgl-project#1360/sgl-project#1361's own re-read at LAUNCH is
untouched, and nothing here duplicates it -- this is dry-run-time honesty
about the reading a verdict was measured against, not a second gate.

Regression: test_weg2_dry_run_box_state_1392.py (19/19),
test_weg2_hicache_disabled_1386.py + test_weg2_dry_run_order_probe_1378.py +
test_weg2_cushion_headroom_gate_1378_stage2.py (48/48, 2 subtests) all
green. pyright: host_ledger.py untouched net (mutant reverted); the new
test file's import-resolution noise is the same reportMissingImports class
already present for every sglang.* import in this desk-venv, not a real
type error.

File boundary: host_ledger.py (touched only transiently for the live
mutant, reverted) + launcher.py (untouched this round) + own test file, as
ordered.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 24, 2026
…statt 0 anzunehmen -- ordnungsunabhaengig hinter den Lane-Tests (fnFL2 H44b)

test_a_single_budget_arm_is_unchanged verglich run_residual_gib gegen
50 - charges mit dem Abbild 0 bei 1e-6 GiB (1 KiB) Toleranz. Die Probe
misst das Abbild aber als RssShmem des eigenen pytest-Prozesses
(pids=[os.getpid()], sgl-project#1390), und residual = nonreclaim - charges - image.
Jeder vorher im selben Prozess gelaufene Test, der geteilte Abbildungen
hinterlaesst (POSIX-Semaphoren von SemSet, mmaps der Lane-Puffer), macht
das Abbild ungleich 0: gemessen 103 KiB hinter test_weg2_seq_lane_ring_h44,
16 KiB hinter test_weg2_ring_preregister_h46, 80 KiB hinter dem alten
test_weg2_sequential_transport_1378 -- die Klasse bestand also schon vor
H44; allein laeuft die Datei gruen. Der Test zieht jetzt das Abbild ab,
das die Probe selbst aufgezeichnet hat (rss_shmem_gib); die geprueften
Rechenschritte sind unveraendert.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant