hpc: docstring the randomized_signature tests, bench, and e2e pipeline tests - #295
Merged
Merged
Conversation
CodeRabbit's docstring-coverage check on PR #294 reported 61.76% against an 80% threshold, scoped to the functions touched by that diff (34 functions across 3 files). The gap was entirely in test and bench code: the three public functions and the four private SIMD/validation helpers were already documented, but the SplitMix64 methods, the two test helpers, ten of the eleven test bodies, and eight of the nine bench functions were not. Adds /// docs to all of them. Where a test already carried an explanatory inline // block (zero_increment, sub_epsilon, custom_activation), the prose is promoted to the docstring rather than duplicated, so each rationale is stated once. The docs record why each test discriminates, not just what it calls — the lane-boundary widths that catch a mishandled remainder loop, why the constant-path test is weak without its supra-epsilon pair, and why the bench's path wobble keeps every increment clear of the 1e-15 skip so both implementations do the full O(T*d*k^2) of work being compared. No behavioural change; comments only. Both files now measure 100% documented. The seven remaining undocumented functions in src/hpc/mod.rs are pre-existing pipeline tests that the #294 diff never touched, so they were outside the check's scope and are left alone. Verified: cargo fmt --check clean; cargo clippy --release --lib --tests --example randomized_signature_bench -- -D warnings clean; cargo test --release --lib 2270 passed / 0 failed; doctests 3 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WkNBjHc2e3zuyz9i8qJEv
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_308a3853-c390-41ba-bacd-f479a4f43237) |
Completes the docstring sweep started in the previous commit. These seven `e2e_tests` functions were outside CodeRabbit's diff-scoped coverage check on PR #294 (the #294 diff only added a `pub mod` line to this file, so they counted as untouched), but they were the remaining undocumented functions in the crate's hpc module surface. Each doc names what the pipeline stage chain establishes and why the test discriminates, rather than restating the call sequence: - fingerprint_to_node_to_seal: the seal half is the discriminating one — Wisdom against its own root, Staunen after one further encounter. - cascade_search: the query IS database[0], so an exact self-hit at Hamming 0 is the falsifiable minimum. - clam_knn: one-hot data makes every non-self distance uniform (16 bits), so the ranking has a single unambiguous winner; root().cardinality == n is the coverage check that !nodes.is_empty() would miss. - causality_decomposition: three channels with mixed signs, so a decomposition applying one direction uniformly matches at most 2 of 3. - bnn_inference: both poles pin the whole affine match-count-to-score map; either alone would admit a wrong scale or offset. - blackboard_arena: asserts a present AND an absent key, so `contains` cannot pass by always returning true. - full_e2e: pins that the stages compose on one node pair, where the others each pin a single stage. No behavioural change; comments only. The whole crate now measures 100% documented across these three files (42/42 functions). Verified: cargo fmt --check clean; cargo clippy --release --lib --tests --example randomized_signature_bench -- -D warnings clean; cargo test --release --lib 2270 passed / 0 failed; the 7 tests themselves confirmed running and green under the default `hpc-extras` feature. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WkNBjHc2e3zuyz9i8qJEv
AdaWorldAPI
marked this pull request as ready for review
September 3, 2026 12:16
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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 the docstring-coverage gap CodeRabbit flagged on #294, then finishes the job. Comments only — no behavioural change, in two commits.
The check reported 61.76% against an 80% threshold, scoped to functions touched by that diff (34 functions across 3 files). Tracing it: the gap was entirely in test and bench code.
randomized_signature_{step,sweep,sweep_with})///+# Panics+ example)dot_simd,axpy_simd,step_into,check_shapes)scalar_reference,projectionsSplitMix64::{next_u64, uniform, normal}wiggly_path,assert_matches_reference#[test]bodiese2e_testspipeline tests inhpc/mod.rsAll are documented now. The three files measure 100% (42/42 functions).
Because the check is diff-scoped, the crate's public surface was never the problem —
CLAUDE.md's hard rule ("All public APIs need///doc comments with examples") was already satisfied, andrustdoc'smissing_docslint never fired because every undocumented item is private or#[cfg(test)].Commit 1 —
randomized_signature.rs+ the benchWhere a test already carried an explanatory inline
//block —zero_increment_path_leaves_state_at_zero,sub_epsilon_increment_is_skipped_but_supra_epsilon_is_not,custom_activation_is_the_one_applied— the prose is promoted into the docstring rather than duplicated, so each rationale is stated once. (That is why a comments-only diff shows deletions.)The docs record why each test discriminates, not just what it calls:
parity_across_state_widths— the widths straddle theF64x8lane boundary both ways (1, 7under;8, 16, 64exact;9, 33one past); a kernel that only walked whole lanes would pass atk = 8and fail atk = 9.zero_increment_path_leaves_state_at_zero— documented as weak on its own (drop the skip and it still passes, sincedx = 0scales the axpy to nothing); the guard is falsifiable only via its paired supra-epsilon half.custom_activation_is_the_one_applied— the second half assertstanhgives a different answer on the same inputs, so it cannot pass by the two activations happening to agree.path(bench) — the wobble keeps every increment clear of the1e-15skip, so both implementations do the fullO(T·d·k²)of work being compared. A timing-correctness property, not realism.Commit 2 — the seven
e2e_testsinhpc/mod.rsThese were outside the #294 check's scope: that diff only added a
pub modline to this file, so its tests counted as untouched. They were nonetheless the remaining undocumented functions in the hpc module surface, so they are covered here rather than left as a known gap.fingerprint_to_node_to_seal— the seal half is the discriminating one:Wisdomagainst its own root,Staunenafter one furtherencounter.cascade_search— the query isdatabase[0], so an exact self-hit at Hamming 0 is the falsifiable minimum.clam_knn— the one-hot layout makes every non-self XOR exactly two set bytes (16 bits, uniform), leaving the self-match as the single unambiguous winner;root().cardinality == nis the coverage check that!nodes.is_empty()would miss.causality_decomposition— three channels with mixed signs, so a decomposition applying one direction uniformly matches at most 2 of 3.bnn_inference— both poles pin the whole affine match-count→score map; either alone would admit a wrong scale or offset.blackboard_arena— asserts a present and an absent key, socontainscannot pass by always returningtrue.full_e2e— pins that the stages compose on one node pair, where the other six each pin a single stage.Test plan
cargo fmt -- --check— clean, whole repocargo clippy --release --lib --tests --example randomized_signature_bench -- -D warnings— cleancargo test --release --lib— 2270 passed, 0 failed, 30 ignoredcargo test --release --lib hpc::e2e_tests— 7 passed (confirmed these run under the defaulthpc-extrasfeature, rather than assumed)cargo test --release --doc randomized_signature— 3 passedNote for reviewers
This PR is a draft, and CodeRabbit does not auto-review drafts — so the coverage figure above is verified by a strict
///scan, not yet by the bot that raised it. CodeRabbit's heuristic counts something looser than a leading///(it scored 21/34 where a strict scan finds 10), so the strict superset was fixed, which necessarily contains whatever it flagged. Marking ready for review, or a@coderabbitai reviewcomment, would confirm it — at the cost of one review against an org allowance that was already at its spending cap.🤖 Generated with Claude Code
https://claude.ai/code/session_016WkNBjHc2e3zuyz9i8qJEv