wave2-polish: CPU unit tests, clippy fixes, and CI for the Rust host crate#1
Merged
Conversation
Conservative polish pass on the Rust host crate and project hygiene. No experiment logic, algorithms, or reported numbers were changed. - Add 9 CPU-only unit tests for the FHRR / Cube-Memory reference primitives in cube-memory-host (cpu.rs): complex multiply/conjugate, bind/unbind round-trip identity, bind commutativity, unitize unit modulus, superpose unit modulus, cleanup self-query exactness, and retrieve softmax convexity. These run on stable Rust with no GPU and pin the ground truth the GPU parity tests compare against. - Fix all clippy warnings in cube-memory-host (lib + tests): field_reassign_with_default, cloned_ref_to_slice_refs, manual div_ceil in parity.rs, and an index-loop rewrite in retrieve(); add a scoped allow for the intentional many-arg test harness run_pair(). Behaviour is unchanged. - Add .github/workflows/ci.yml: a Rust job (build + clippy -D warnings + cpu unit tests on stable) and a Python lint job (compileall + ruff). The rust-gpu nightly shader build and the GPU parity tests are documented as out of scope (no GPU / fragile nightly on hosted CI). - README: correct the shaders run instructions (CPU --lib tests vs GPU parity tests) and the CI line under Limitations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
Independent verification — VERDICT: solid, ready to mergeReviewed the full diff (296+/12-, 5 files) and reproduced every load-bearing claim on stable Rust 1.95.0 / Python 3.11. No regressions, no overclaims found. Confirmed locally
Correctness review
Notes (non-blocking)
All UNVERIFIED items in the PR body (rust-gpu shader build, GPU parity run) are honestly flagged and out of scope. Verification done by an independent reviewer agent. |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Conservative polish pass on cube-memory (research/experiment code backing a published negative-result paper). No experiment logic, algorithms, or reported numbers were changed. Scope was limited to tests for pure reference functions, lint fixes, CI, and doc accuracy.
Changes
Tests (new)
shaders/cube-memory-host/src/cpu.rs:cmulmatches manual complex multiply;cconjnegates the imaginary part.bindthenunbindis identity for unit phasors (the core FHRR property);bindis commutative.unitizeproduces unit modulus (incl. zero-vector eps safety);superposeoutput is unit modulus.cleanupsnaps a self-query back to the exact codebook entry.retrieveoutput is a convex combination of the gathered value rows / approaches a dominant slot.tests/parity.rscompares against.Lint / clippy
cube-memory-host(lib + tests), behaviour unchanged:field_reassign_with_default→ struct-literal init ofwgpu::Limits(gpu.rs).cloned_ref_to_slice_refs→std::slice::from_ref(gpu.rs).div_ceil→u32::div_ceil(4 sites inparity.rs).iter_mut().enumerate()incube_memory_retrieve(cpu.rs).#[allow(clippy::too_many_arguments)]on the intentional test-onlyrun_pairharness, with rationale.cargo clippy -p cube-memory-host --all-targets -- -D warningsis now clean.CI (new)
.github/workflows/ci.yml:clippy -D warnings+cargo test --lib(the new CPU tests) on the stable toolchain.compileallsyntax check +rufflint (non-blocking).Docs
--libtests from the GPU parity tests, and updated the "no CI" line under Limitations.Verified vs UNVERIFIED (honest)
Verified locally (stable Rust 1.95, this machine):
cargo build -p cube-memory-host— passes.cargo clippy -p cube-memory-host --all-targets -- -D warnings— clean.cargo test -p cube-memory-host --lib— 9 passed, 0 failed.python3 -m compileallover all 43 Python files — passes (syntax only).yaml.safe_load).UNVERIFIED (could not run here):
cube-memory-shader{,-builder}) — requires the pinned nightlynightly-2026-04-11withrust-src/rustc-dev/llvm-tools, not installed on this machine. Not touched.tests/parity.rs— require a Vulkan adapter and the prebuilt.spv. Not run.rufflint —ruffis not installed locally, so the Python lint job's output is unverified (it is non-blocking in CI by design).Not done / TODO
pyproject.toml/ pinnedrequirements.txt) added — the scripts have no single entry point and pull models from local paths; packaging them risks implying a usable library, which the README explicitly disclaims. Left as-is intentionally.rustfmtdrift ingpu.rs/parity.rs(wider line width than default) was left untouched to keep the diff minimal; only newly added code is rustfmt-clean.🤖 Generated with Claude Code