Skip to content

test(apr-cpu-vs-gpu-output-parity-v1): add WGPU_FALLBACK_LOG_PREFIX + drift-prevention tests#1435

Merged
noahgift merged 2 commits into
mainfrom
feat/wgpu-fallback-tag-drift-prevention
May 3, 2026
Merged

test(apr-cpu-vs-gpu-output-parity-v1): add WGPU_FALLBACK_LOG_PREFIX + drift-prevention tests#1435
noahgift merged 2 commits into
mainfrom
feat/wgpu-fallback-tag-drift-prevention

Conversation

@noahgift

@noahgift noahgift commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Closes the contract drift between v1.2.0's prediction and the actual code: FALSIFY-CPU-GPU-005 said the wgpu rejection log should emit [apr-cpu-vs-gpu-output-parity-v1] wgpu path rejected symmetric to the CUDA tag, but contract(apr-cpu-vs-gpu-output-parity-v1): v1.2.0 — FALSIFY-CPU-GPU-005 wgpu visibility + parity-gate entry #1430 only made existing [GH-559]/Backend: logs unconditional.
  • Adds pub(crate) const WGPU_FALLBACK_LOG_PREFIX and emits it on wgpu init failure.
  • 3 new unit tests: per-backend prefix validation + symmetry guard (cuda_and_wgpu_fallback_log_prefixes_share_contract_tag).
  • No contract version bump — v1.2.0 already specifies this tag; this PR closes the implementation gap.

Five Whys

  1. Why was this gap in v1.2.0? PR contract(apr-cpu-vs-gpu-output-parity-v1): v1.2.0 — FALSIFY-CPU-GPU-005 wgpu visibility + parity-gate entry #1430 conflated "make existing log visible" (done) with "add contract-tagged rejection log" (deferred).
  2. Why catch it now? --features hub is healthy across fix(aprender-train): bind quantize_to_gguf_bytes match result so --features hub builds #1432-fix(aprender-train): account for GGUF tensor-data alignment padding in test helpers #1434, the test surface is reliable.
  3. Why the symmetry test? Locks in [CONTRACT_ID] <backend> path rejected shape uniformly so grep recipes work.
  4. Why keep [GH-559]? Runbook continuity — humans tracking that issue tag shouldn't lose it.
  5. Why no version bump? Code catching up to existing v1.2.0 prediction, no semantic change.

Test plan

  • cargo test -p aprender-serve --features cuda --lib --release fallback_log_prefix → 3/3 pass
  • cargo fmt --all -- --check → no diff in touched file
  • Live smoke after release rebuild: apr run on a host without Vulkan should now stderr-emit both tags on stderr without --verbose

🤖 Generated with Claude Code

… drift-prevention tests

Closes the contract drift between v1.2.0's prediction and the actual code:
contract `apr-cpu-vs-gpu-output-parity-v1` v1.2.0 (PR #1430) said the wgpu
rejection log should emit `[apr-cpu-vs-gpu-output-parity-v1] wgpu path
rejected, attempting fallback: ...` symmetric to the CUDA tag, but #1430
only made the existing `[GH-559]`/`Backend:` logs unconditional — the
contract-tagged wgpu rejection log itself was missing.

Mirror of the FALSIFY-CPU-GPU-003 chain (#1428 visibility + #1429 drift
test) for FALSIFY-CPU-GPU-005:
- Adds `pub(crate) const WGPU_FALLBACK_LOG_PREFIX = "[apr-cpu-vs-gpu-output-parity-v1] wgpu path rejected"`
- Updates `try_apr_wgpu_inference` to emit it on `GpuDevice::new()` failure
  (alongside the existing `[GH-559]` runbook tag — both, not either)
- 3 new unit tests:
  * `wgpu_fallback_log_prefix_is_contract_tagged` (symmetric to the CUDA test)
  * `cuda_and_wgpu_fallback_log_prefixes_share_contract_tag` (symmetry guard:
    both prefixes must start with the same contract ID and end with
    "path rejected" so grep recipes work uniformly across backends)

Five Whys:
1. Why was this gap in v1.2.0? PR #1430 conflated "make existing wgpu log
   visible" (done) with "add contract-tagged rejection log" (deferred). The
   contract's prediction text wrote the second; the code shipped only the
   first.
2. Why catch it now? `--features hub` build healthy across PRs #1432-#1434
   means the test surface is reliable; this is the natural follow-up.
3. Why the symmetry test? `cuda_and_wgpu_fallback_log_prefixes_share_contract_tag`
   locks in that BOTH backends use the same `[CONTRACT_ID] <backend> path
   rejected` shape. Without it a future PR could drift one but not the
   other and grep recipes would silently skip backends.
4. Why keep `[GH-559]` alongside the new contract tag? Runbook continuity
   — humans tracking that issue tag in logs over time shouldn't lose it.
5. Why no contract version bump? v1.2.0 already specifies this tag in
   FALSIFY-CPU-GPU-005's prediction; this PR closes the implementation
   gap. Bumping again would imply a contract semantic change, which
   isn't happening — only the code catches up to the contract.

Verified locally:
- `cargo test -p aprender-serve --features cuda --lib --release fallback_log_prefix`
    → 3/3 pass (cuda + wgpu + symmetry)
- `cargo fmt --all -- --check` → no diff in touched file

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@noahgift noahgift enabled auto-merge (squash) May 3, 2026 18:59
@noahgift noahgift merged commit 8a40238 into main May 3, 2026
10 checks passed
@noahgift noahgift deleted the feat/wgpu-fallback-tag-drift-prevention branch May 3, 2026 19:52
noahgift added a commit that referenced this pull request May 3, 2026
…line distill falsifier-parity (#1437)

Canonical record of today's MODEL-2-side hygiene cycle (PRs #1432-#1436).
Pre-cycle: --features hub unbuildable (E0425 in quantize_to_gguf_bytes),
masking 11 pre-existing test failures.

Chain landed:
- #1432: bind match result; build works → 7975/7986 (11 pre-existing surfaced)
- #1433: empty-input early-return → 7977/7986 (3 contract-drift fixed)
- #1434: GGUF alignment-padding skip in 2 test helpers → 7986/7986 ✅
- #1435: WGPU_FALLBACK_LOG_PREFIX + 3 drift-prevention tests (matches v1.2.0)
- #1436: 4 hf_pipeline distill falsifier-parity tests → 7990/7990

§42 documents: what landed (table), net hub health progression, why for
MODEL-2 (parallel-impl drift-protection), Five Whys (build masked
pre-existing failures), coverage update (15+33 unchanged; parallel-impl
uplift), ship % effects (MODEL-1 87→88, MODEL-2 50→54), and
next-session pickup options (CPU-GPU-005 part b OR distill-train
precompute determinism).

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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