Skip to content

test(inference,#1275): regression test for no-CPU-fallback alpha contract#1282

Merged
joelteply merged 1 commit into
canaryfrom
test/no-cpu-fallback-contract-1275
May 15, 2026
Merged

test(inference,#1275): regression test for no-CPU-fallback alpha contract#1282
joelteply merged 1 commit into
canaryfrom
test/no-cpu-fallback-contract-1275

Conversation

@joelteply
Copy link
Copy Markdown
Contributor

Summary

Add tests/no_cpu_fallback_contract.rs — three forbidden-strings ratchets that fail the build if a future PR weakens the no-CPU-fallback alpha contract:

  1. select_best_device_panics_loudly_on_no_gpu — asserts inference/model.rs::select_best_device keeps the `panic!("No GPU device available for inference. CPU fallback is disabled.")` loud-fail and tries CUDA + Metal before panicking.
  2. ort_providers_documents_no_cpu_fallback_contract — asserts ort_providers.rs keeps the "CPU fallback is forbidden" comment that documents the rule from source.
  3. llamacpp_adapter_uses_loud_fail_for_no_local_model — asserts LlamaCppAdapter uses the typed NoLocalModelLoadable error (shipped in docs(vdd): record RTX Qwen2.5-Omni result #1093 / lane A PR-2) rather than a silent skip.

Why

Without a regression test, the no-CPU-fallback contract is invariant by inspection only. A test makes it invariant by construction; future PRs that want to reintroduce a fallback (the audit at #1262 found three separate dead-code remnants of past attempts) hit the test rather than ship.

Pattern: same forbidden-strings ratchet shape as lane F PR-2 (#1129 — TS persona forbidden-strings), applied to the Rust inference layer. A test failure points the future-PR-author at the exact contract they're about to weaken.

Audit context

Final PR (4 of 4) for #1262 (silent CPU model fallbacks audit). Closes acceptance criterion #3 of #1262 ("regression test per fallback path").

Sibling PRs:

Audit: #1262 (comment)
Lane: alpha flywheel #1272 lane 6.

Test plan

  • cargo test --features metal --test no_cpu_fallback_contract — 3 passed, 0 failed
  • Precommit (TypeScript + browser ping): PASSED

🤖 Generated with Claude Code

…ract

Add `tests/no_cpu_fallback_contract.rs` — three forbidden-strings
ratchets that fail the build if a future PR weakens the
no-CPU-fallback contract:

1. `select_best_device_panics_loudly_on_no_gpu` — asserts
   `inference/model.rs::select_best_device` keeps the
   `panic!("No GPU device available for inference. CPU fallback is
   disabled.")` loud-fail and tries CUDA + Metal before panicking.

2. `ort_providers_documents_no_cpu_fallback_contract` — asserts
   `ort_providers.rs` keeps the "CPU fallback is forbidden" comment
   that documents the rule from source.

3. `llamacpp_adapter_uses_loud_fail_for_no_local_model` — asserts
   `LlamaCppAdapter` uses the typed `NoLocalModelLoadable` error
   (shipped in #1093 / lane A PR-2) rather than a silent skip.

Pattern: same forbidden-strings ratchet shape as lane F PR-2 (#1129
TS persona forbidden-strings), applied to the Rust inference layer.
A test failure points the future-PR-author at the exact contract
they're about to weaken.

Closes the acceptance criterion #3 of #1262 ("regression test per
fallback path"). Final PR (4 of 4) for the silent CPU fallback audit.

Verified:
- cargo test --features metal --test no_cpu_fallback_contract:
  3 passed, 0 failed

Lane: alpha flywheel #1272 lane 6.
Audit: #1262 (comment)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joelteply joelteply merged commit 3449de0 into canary May 15, 2026
3 checks passed
@joelteply joelteply deleted the test/no-cpu-fallback-contract-1275 branch May 15, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant