Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions .claude/board/TECH_DEBT.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
## TD-SIGKER-CLIPPY-RED-ON-BASE-1 (2026-09-04) — OPEN
## TD-SIGKER-CLIPPY-RED-ON-BASE-1 (2026-09-04) — RESOLVED 2026-09-04

**`crates/sigker` does not pass `cargo clippy --all-targets -- -D warnings`, and
did not before this session's changes.** Measured by stashing the working tree
and re-running against the base commit: the failure reproduces identically.

Single site: `crates/sigker/src/signature.rs:133` — `for flat in 0..len` trips
clippy's needs_range_loop lint: the loop variable is used only to index `level`.

(Anchored on the loop header, not on the lint name. The lint name is not text
that appears at the cited line, so citing it as the anchor is exactly the decay
`citation_decay.py` exists to catch — it flagged this entry's first draft.)
> **⊘ RESOLVED 2026-09-04.** Both findings fixed; sigker now passes
> `cargo clippy --manifest-path crates/sigker/Cargo.toml --all-targets -- -D warnings`
> clean, and the CI step below was promoted from tests-only to tests+clippy so
> it cannot silently return. Two things this entry got WRONG, recorded rather
> than edited away:
>
> 1. **"Single site" was wrong — there were TWO.** `-D warnings` makes clippy
> stop at the first error, so `doc list item overindented` in
> `examples/depth_scaling.rs` was invisible behind the loop finding and only
> appeared once that one was fixed. A findings count taken from a run that
> aborted on the first error is a lower bound, never a total.
> 2. **The citation decayed the moment the fix landed** — deleting the cited
> line IS the fix, so the anchor `for flat in 0..len` went absent and
> `citation_decay.py` fired on this very entry. Re-anchored below on the
> enclosing function, which survives the change. An entry that cites the
> code it wants deleted is self-invalidating by construction.

Site: `segment_signature` in `crates/sigker/src/signature.rs:122` — the
level-fill loop used its loop variable only to index `level`, tripping
needs_range_loop. Anchored on the function name, not the loop body: a function
name survives its own body being rewritten, which is exactly the property a
citation into mutable source needs.

```rust
for flat in 0..len { // clippy: needs_range_loop
Expand All @@ -19,8 +35,7 @@ for flat in 0..len { // clippy: needs_range_loop
}
```

Proposed fix (3 lines, mechanical, deliberately NOT applied here to avoid
widening a wiring PR):
Fix, as applied:

```rust
for (flat, slot) in level.iter_mut().enumerate() {
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,20 @@ jobs:
#
# Verified locally before landing: 62 passed, 0 failed.
#
# Deliberately TESTS ONLY, on the causal-edge precedent above. A
# `clippy -D warnings` step would be red on arrival: the crate carries one
# pre-existing finding at signature.rs:133 (needs_range_loop), which
# reproduces identically on the base commit and is NOT in the
# randomized.rs this PR touches. Gating it here would fail this PR for a
# defect it did not introduce; it is recorded in TECH_DEBT
# TD-SIGKER-CLIPPY-RED-ON-BASE-1 instead, with its patch.
# TESTS + CLIPPY. This step was tests-only when first added, because the
# crate was clippy-red on arrival (TD-SIGKER-CLIPPY-RED-ON-BASE-1) and
# gating it would have failed that PR for a defect it did not introduce.
# Both findings are now fixed, so the clippy half is armed here: a lint
# fix with no gate decays back, and this crate's whole reason for being
# unlinted was that no step reached it.
#
# Verified locally before landing: 62 tests passed, clippy clean.
- name: Run sigker tests (workspace-excluded, ndarray sibling)
run: cargo test --manifest-path crates/sigker/Cargo.toml
- name: Lint sigker (workspace-excluded, so root clippy never reaches it)
run: |
cargo clippy --manifest-path crates/sigker/Cargo.toml \
--all-targets -- -D warnings
# lance-graph-callcenter UNDER `--features query` — the same blind gate as
# supervisor above, but one level subtler: the crate was not merely
# untested, it has `default = []`, so even a bare `cargo test` on it would
Expand Down
3 changes: 2 additions & 1 deletion crates/sigker/examples/depth_scaling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
//! - Truncated kernel: O(d^(2N)) per pair, materializes the signature
//! - Goursat-PDE kernel: O(T₁·T₂) per pair, NEVER materializes the signature
//! - Log-signature: O(d^(2N)) compute (still has Magnus expansion),
//! but storage is dim L_N(d) — 7-13× smaller
//! but storage is dim L_N(d) — 7-13× smaller (asymptotic, N≥8; ~2× at
//! shallow depth, per `compression_at_shallow_depth_is_far_below_the_headline`)
//!
//! Run:
//! cargo run --manifest-path crates/sigker/Cargo.toml \
Expand Down
4 changes: 2 additions & 2 deletions crates/sigker/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ fn segment_signature(delta: &[f64], depth: usize) -> Signature {
let mut level = vec![0.0; len];
// Outer-product expansion of Δ ⊗ ⋯ ⊗ Δ (k times) divided by k!
// Index mapping: flat_idx = i₁ · d^(k-1) + i₂ · d^(k-2) + … + iₖ.
for flat in 0..len {
for (flat, slot) in level.iter_mut().enumerate() {
let mut idx = flat;
let mut prod = 1.0;
for _ in 0..k {
let ax = idx % dim;
idx /= dim;
prod *= delta[ax];
}
level[flat] = prod / factorial;
*slot = prod / factorial;
}
levels.push(level);
}
Expand Down
Loading