Repository navigation
fix(test): gate the loading-side pinned Muse Glimmer guard on MLXCEL_REQUIRE_PINNED_CHECKPOINTS - #1180
Conversation
…REQUIRE_PINNED_CHECKPOINTS PR #1173 introduced MLXCEL_REQUIRE_PINNED_CHECKPOINTS=1 to turn the vision-side pinned Muse Glimmer contract test's graceful skip into a hard failure, so a half-downloaded or corrupted checkpoint cannot silently disable the only coverage that exists on the machine that owns it. The loading-side sibling, pinned_weight_index_classifies_each_source_weight_once, still used the original unconditional skip on an absent index, leaving the protection only half applied. The gate logic (env_lock-guarded read of the variable, dropped before the assertion, strict equality on "1") is now extracted into a shared helper at src/test_support/pinned_checkpoint.rs, declared from src/test_support/mod.rs alongside the existing env_lock module. Both pinned guards call this one implementation instead of each holding a private copy; the helper takes the caller's test name as a parameter so each call site still names itself in its skip or failure message. The availability versus contract boundary from PR #1173 is preserved: this only ever turns a skip into a failure, and pinned_weight_index_classifies_each_source_weight_once still panics unchanged when read_muse_weight_inventory_from_index returns Err, since that is a genuine contract violation rather than an availability problem. docs/environment-variables.md gains a table row for the variable in the existing "Test and CI variables" section, stating explicitly that only the exact string "1" enables it, unlike the document's usual truthy-parsing convention. The accompanying prose covers deliverable 4 from the issue comment: this is a test-only gate meant for a machine that owns the pinned checkpoint, how to enable it for one run or export it persistently, and its second use of turning an ambiguous "ok" into positive evidence that the checkpoint was actually read, which is how acceptance criterion 2 of issue #1161 was proven. Verified on a machine with the pinned checkpoint present: both narrow test targets pass in full, including the two pinned guards, which read the real 60 GB checkpoint and validate their contracts. The skip and gated-failure paths were exercised by running the compiled test binary from a temp directory with no models/ present, both with the variable unset (both guards skip, naming themselves) and with MLXCEL_REQUIRE_PINNED_CHECKPOINTS=1 (both guards fail, naming themselves, exit 101). Closes #1177
… table The entry arrived as a second table in the same section, introduced by a sentence explaining why its formatting differed. That is commentary about the document rather than about the variable, and the section's own precedent already shows rich detail belongs in the Purpose cell: the MLXCEL_ALLOW_PARALLEL_CUDA_TESTS and MLXCEL_ALLOW_CONCURRENT_GPU_TESTS rows both carry several sentences there. Folds the row into the existing table with the value and default semantics stated inline, and drops the bridging sentence. The four prose paragraphs that follow are unchanged.
Implementation Review SummaryIntent
Findings addressed
Remaining items
Verification
|
The paragraph said a partially materialized checkpoint made the availability pre-check panic. There was no availability pre-check before #1173; that PR created it, and the panic came from unwrapping the reads directly. Restates what actually changed: unwraps became a pre-check that skips with a named reason while contract violations stay failures.
The paragraph claimed there was no availability pre-check before PR #1173. There was one, just a narrower one: PR #1157 (`92d6d4c8`) replaced the vision-side test's `assert!(index_path.exists(), ...)` with a silent skip and added the same index-absent skip to `pinned_weight_index_classifies_each_source_weight_once`. Issue #1161 records this as well, both in its third acceptance criterion and in its note that #1157 "added the index-absent guard". As written the paragraph implied every partially materialized state was loud before #1173, which overstates what that PR gave up and therefore what the gate buys back. An absent index already skipped quietly under #1157. Restates the sequence accurately: #1157 made the index-absent case quiet, #1173 made the index-present-but-incomplete case quiet by replacing the unwraps past that guard, and `MLXCEL_REQUIRE_PINNED_CHECKPOINTS=1` restores the loudness for both. Documentation only; no code, test, or gate behavior changes.
Security and performance reviewReviewed at Environment handling under Rust 2024Sound.
Can the gate hide a failureNo. Its only effect when set is to panic; when unset it is byte-for-byte the prior
SurfaceNot widened beyond the test binary. Documentation (LOW, fixed)The advice to export the variable persistently is safe: nothing outside the test files reads it, no code enumerates The last paragraph was inaccurate. It said there was no availability pre-check before PR #1173. PR #1157 ( PerformanceNil. The lock is taken only on the skip or failure path, held for exactly one |
Bilingual report covering the shared pinned-checkpoint gate: why the gate had to move into test_support rather than be copied, why the loading-side panic on a classification error stays a panic, and why documenting when to enable the variable was half the deliverable given it was set nowhere in the tree. Records the two-step correction the pre-#1173 paragraph needed, since the #1157 and #1173 sequence is easy to state wrongly.
…REQUIRE_PINNED_CHECKPOINTS (lablup#1180) ## Summary Extends the pinned-checkpoint gate PR lablup#1173 introduced to the loading-side sibling test, shares the gate logic between both call sites instead of duplicating it, and documents the variable including when and how to actually turn it on, per the scope the issue's comment added. ## What changed `src/test_support/pinned_checkpoint.rs` (new) holds a single `skip_or_fail_pinned_checkpoint(test_name, reason)` helper, declared from `src/test_support/mod.rs` alongside the existing `env_lock` module; it reads `MLXCEL_REQUIRE_PINNED_CHECKPOINTS` under `crate::test_support::env_lock::env_lock()`, drops the guard before asserting, and treats only the exact value `1` as enabling. `src/vision/encoders/muse_glimmer_fusion_pinned_tests.rs` drops its private copy of the gate and calls the shared helper at both of its call sites, passing its own test name so the skip message is byte-identical to before and the failure message still names that test. `src/loading/vlm_muse_glimmer_tests.rs` routes `pinned_weight_index_classifies_each_source_weight_once`'s previously unconditional skip through the same shared helper, so it now fails rather than skips when the gate is on and the pinned index is absent; the existing `panic!` on `read_muse_weight_inventory_from_index` returning `Err` is untouched, since that is a genuine contract violation rather than an availability problem. `docs/environment-variables.md` adds a row for `MLXCEL_REQUIRE_PINNED_CHECKPOINTS` to the existing "Test and CI variables" table, whose `Variable | Purpose` shape carries the value and default semantics inline, stating that only the exact string `1` enables it, plus prose covering that it is test-only, that it belongs on a machine that owns the pinned checkpoint, a single-run invocation example and a persistent-export suggestion, and its role in turning an ambiguous `ok` into positive evidence that the checkpoint was actually read (how acceptance criterion 2 of lablup#1161 was proven). ## Test plan - [x] `cargo check --lib --tests` - [x] `cargo clippy --lib --tests -- -D warnings` - [x] `cargo test --lib vision::encoders::muse_glimmer_fusion` (23 passed, real pinned checkpoint present) - [x] `cargo test --lib loading::vlm::muse_glimmer::` (14 passed, real pinned checkpoint present) - [x] Compiled test binary run from a temp directory with no `models/`, variable unset: both pinned guards skip, each still naming itself - [x] Compiled test binary run from a temp directory with no `models/`, `MLXCEL_REQUIRE_PINNED_CHECKPOINTS=1`: both pinned guards fail, each still naming itself, exit 101 Closes lablup#1177
Summary
Extends the pinned-checkpoint gate PR #1173 introduced to the loading-side sibling test, shares the gate logic between both call sites instead of duplicating it, and documents the variable including when and how to actually turn it on, per the scope the issue's comment added.
What changed
src/test_support/pinned_checkpoint.rs(new) holds a singleskip_or_fail_pinned_checkpoint(test_name, reason)helper, declared fromsrc/test_support/mod.rsalongside the existingenv_lockmodule; it readsMLXCEL_REQUIRE_PINNED_CHECKPOINTSundercrate::test_support::env_lock::env_lock(), drops the guard before asserting, and treats only the exact value1as enabling.src/vision/encoders/muse_glimmer_fusion_pinned_tests.rsdrops its private copy of the gate and calls the shared helper at both of its call sites, passing its own test name so the skip message is byte-identical to before and the failure message still names that test.src/loading/vlm_muse_glimmer_tests.rsroutespinned_weight_index_classifies_each_source_weight_once's previously unconditional skip through the same shared helper, so it now fails rather than skips when the gate is on and the pinned index is absent; the existingpanic!onread_muse_weight_inventory_from_indexreturningErris untouched, since that is a genuine contract violation rather than an availability problem.docs/environment-variables.mdadds a row forMLXCEL_REQUIRE_PINNED_CHECKPOINTSto the existing "Test and CI variables" table, whoseVariable | Purposeshape carries the value and default semantics inline, stating that only the exact string1enables it, plus prose covering that it is test-only, that it belongs on a machine that owns the pinned checkpoint, a single-run invocation example and a persistent-export suggestion, and its role in turning an ambiguousokinto positive evidence that the checkpoint was actually read (how acceptance criterion 2 of #1161 was proven).Test plan
cargo check --lib --testscargo clippy --lib --tests -- -D warningscargo test --lib vision::encoders::muse_glimmer_fusion(23 passed, real pinned checkpoint present)cargo test --lib loading::vlm::muse_glimmer::(14 passed, real pinned checkpoint present)models/, variable unset: both pinned guards skip, each still naming itselfmodels/,MLXCEL_REQUIRE_PINNED_CHECKPOINTS=1: both pinned guards fail, each still naming itself, exit 101Closes #1177