Repository navigation
test(contract): widen no_cpu_fallback_contract to cover Candle-side paths - #1341
Merged
Merged
Conversation
This was referenced May 16, 2026
joelteply
pushed a commit
that referenced
this pull request
May 16, 2026
…ning; navigate to MODULE-CATALOG queue Second refresh of ALPHA-GAP Immediate Next Actions to reflect work landed since #1316 merged. Six items closed; navigation into MODULE-CATALOG queue made explicit. Closed: #6 contract widening (#1341), #8 GRID-INFERENCE-ROUTING PR-1 (#1315), CBAR-PIECE-5 end-to-end (#1331/#1333/#1335/#1338), PIECE-8 inference-grpc hardcoded-clamps (#1340), doc family architecture surface (#1324/#1327/#1332/#1336/#1337 open; #1316/#1317/#1320/#1329 merged). Item #9 reorganized to point at MODULE-CATALOG's 'Next Modules To Build' queue (audit-recorder → threat-detector → working-set-manager → demand-aligned-recall → substrate-governor). Adds closeout summary section listing what's done, what's open (5 architecture-doc PRs ready for review + 2 airc PRs), and what's queued (5 modules with dependency state + LoC + acceptance criteria in MODULE-CATALOG). Doc-driven development cycle is working: doc spec → implementing agent picks up → ships PR → next spec referenced.
joelteply
added a commit
that referenced
this pull request
May 16, 2026
…ning; navigate to MODULE-CATALOG queue (#1342) Second refresh of ALPHA-GAP Immediate Next Actions to reflect work landed since #1316 merged. Six items closed; navigation into MODULE-CATALOG queue made explicit. Closed: #6 contract widening (#1341), #8 GRID-INFERENCE-ROUTING PR-1 (#1315), CBAR-PIECE-5 end-to-end (#1331/#1333/#1335/#1338), PIECE-8 inference-grpc hardcoded-clamps (#1340), doc family architecture surface (#1324/#1327/#1332/#1336/#1337 open; #1316/#1317/#1320/#1329 merged). Item #9 reorganized to point at MODULE-CATALOG's 'Next Modules To Build' queue (audit-recorder → threat-detector → working-set-manager → demand-aligned-recall → substrate-governor). Adds closeout summary section listing what's done, what's open (5 architecture-doc PRs ready for review + 2 airc PRs), and what's queued (5 modules with dependency state + LoC + acceptance criteria in MODULE-CATALOG). Doc-driven development cycle is working: doc spec → implementing agent picks up → ships PR → next spec referenced. Co-authored-by: Test <[email protected]>
This was referenced May 16, 2026
joelteply
added a commit
that referenced
this pull request
May 16, 2026
…ierarchy + paging (#1346) PR-1 of working-set-manager (MODULE-CATALOG §VII + GENOME-FOUNDRY- SENTINEL Parts 2/3/4). Pure data + serde + ts-rs exports. No traits, no I/O, no async, no wiring — those land in PR-2/PR-3. Mirrors the slice shape that worked for CBAR-PIECE-2 PR-1 (#1321) + PIECE-5 PR-1 (#1331): ship the data shape first, hang behaviors on it incrementally. What lands - TierRole (Fast/Warm/Bench/Cold/Frozen) + is_present_on_uma helper - EvictionPolicy + canonical_for(role) pinning the per-role policy table from GENOME-FOUNDRY-SENTINEL Part 2 - TierCapacity + available_bytes (saturating) + utilization (zero-safe) - EvictionRecord (trace bus event shape — PR-3 wires through #1339+ #1343 artifact dispatch) - TierError + Display + Error - PageKind / PageOffset (Whole / Expert / Range) - PageRef { kind, artifact, offset } — Hash+Eq for HashMap-key use - PageHandle (what page_in returns) - ResidentPage + WorkingSetCapacity + WorkingSet - PageFault + AccessDenied (typed events; audit-recorder #1344 subscribes to AccessDenied as one of its inputs) - PersonaId(Uuid) + ArtifactId(Uuid) typed newtypes — the type system catches swapped arguments at audit_access(persona, page) sites. Wire is transparent (UUID string). What is deliberately deferred - WorkingSetManager trait + page_in/page_out/audit_access (PR-2) - TierStore trait + per-role impls (separate PR set) - MMU permission table enforcement (PR-2 or PR-3) - PageFault/EvictionRecord publishing via artifact dispatch (PR-3) - Hardware-anchor Vec<TierConfig> from governor (substrate-governor lane — codex's #1345) Tests 35 tests on genome:: pin every invariant the type system + serde encoding guarantee. 35/35 pass. No regressions across other 2467 lib tests. Clippy baseline bump 146→148 — drift from canary HEAD; the +2 warnings are NOT from genome code (zero clippy hits in genome/). They land via codex's recent #1340/#1341/#1344/#1345 merges that didn't bump the file. Bumping here so the ratchet stays meaningful for the NEXT PR to gate against. Co-authored-by: Test <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1316 ALPHA-GAP finding #5: the existing
no_cpu_fallback_contract.rsasserted the no-CPU-fallback rule only at the llama.cpp + ORT layers. The Candle / inference-grpc / orpheus / residency-gate paths shipped their own no-CPU-fallback guarantees in PRs #1312, #1314, #1331, #1335, #1338 — but the contract test didn't enforce them. A future regression could silently re-add a CPU fallback to any of those paths without breaking this gate.This PR closes the hole with six new source-grep assertions.
What ships
Six new tests in
no_cpu_fallback_contract.rs:inference_grpc_select_best_device_hard_fails_on_no_gpu— pinsinference-grpc/src/model.rscontains "no CPU fallback" phrase ANDselect_best_devicereturnsResult<Device, ...>(not bareDevice, which would let someone silently re-addDevice::Cpuas the Ok variant). Catches regression of fix(gpu): inference-grpc hard-fail on no-GPU (companion to #1312) #1314.orpheus_tts_select_device_hard_fails_on_no_metal— pinsorpheus.rsselect_devicereturnsResult<Device, TTSError>. Catches regression of fix(audio/tts): orpheus must fail-closed on no-Metal, no CPU fallback #1312.residency_gate_emits_no_gpu_block_reason— pinsresidency.rsdefinesBlockReason::NoGpuBackendOnNodeANDBlockReason::PartialGpuSplit. Both load-bearing for the gate's typed refusal contract. Removal would leave the gate unable to express "no GPU" or "GPU exists but model spills to CPU."enforcement_module_exists_and_composes_the_three_layers— pinsenforcement.rsexportspub fn enforce_residencyAND composes all three layers (probe_hardware_profile+read_qwen_model_metadata+check_residency_gate). Without the composition, every adapter re-invents it and invariably misses a layer.llamacpp_adapter_wires_residency_gate_at_load_time— pinsllamacpp_adapter.rscallsenforce_residency. This is what makes the gate ACTUALLY fire in production. Removal would leave the gate as a callable function nobody calls.hw_probe_does_not_introduce_cpu_fallback— pinshw_probe.rsdocuments the never-panic contract AND exposesbuild_hardware_profileas apub fn. Panic-in-probe crashes the supervisor; private-pure-fn means tests can't mock hardware.Pattern
Same forbidden-strings ratchet as the existing assertions (
LlamaCppConfig 'n_gpu_layers: -1',ort_providers 'CPU fallback is forbidden',LlamaCppAdapter 'NoLocalModelLoadable'). Source-only inspection — fast, deterministic, no runtime cost. The asserted strings are documentation-as-contract: removing them is the regression signal.Test plan
9 passing (3 pre-existing + 6 new) on
cargo test --test no_cpu_fallback_contract --features metal,accelerate.Why this matters
Without these assertions, the four Rust paths that already enforce no-CPU-fallback (inference-grpc, orpheus, residency gate, adapter wiring) could be silently reverted by a single PR that "fixes a compile error" or "simplifies a return type." The forbidden-strings ratchet catches that class of regression at test-time instead of at "1 tok/s on a 5090" production-incident-time.
This is the cheap follow-up to PIECE-5's whole stack — gate the rule at type-checking time, not just at runtime.