Skip to content

test(layered-path): pin k-prefix stability for solve_k_best - #182

Merged
PhysShell merged 1 commit into
mainfrom
claude/griff-task-erqa7z
Aug 17, 2026
Merged

test(layered-path): pin k-prefix stability for solve_k_best#182
PhysShell merged 1 commit into
mainfrom
claude/griff-task-erqa7z

Conversation

@PhysShell

Copy link
Copy Markdown
Owner

Test-only. One test file, no production code. S7 Slice C's acceptance
(7d0c0cb) is not reopened — this pins a contract that was specified and left
unasserted after closure.

The property

A caller that shows three alternatives and then asks for five must not watch the
first three renumber themselves:

for a fixed problem and min_distance:
  solve_k_best(k = i).paths == prefix(solve_k_best(k = N).paths, i)   for every i ≤ N

The accepted engine already satisfies it — neither the enumeration order nor the
greedy diversity filter reads k — so this is a characterization test, not
a red→green fix. Nothing was broken on purpose to manufacture a red phase.

It was specified, though: the still-draft deterministic-search proposal (#176)
asks for it in as many words — "requesting more results never changes the
prefix already returned"
. "True by construction" is exactly the kind of claim
that quietly stops holding one refactor later without anything failing.

What is compared

Per rank, not merely per path list:

  • the ordinal vector;
  • total_cost.to_bits();
  • the full Debug rendering, which carries every step and edge with its axes,
    rationale entries, weights and provenance.

f64 renders in shortest round-trip form, so a cost differing in a single bit
renders differently — "the same path" cannot quietly become "the same indices,
differently computed".

Swept over all 120 width vectors for 1–4 layers over widths 1–3, every
min_distance, and every k below the widest request, with an anti-vacuity
floor on the number of ranks actually compared.

exhausted is deliberately excluded from the compared prefix: it describes the
search, not the paths, and a request for fewer alternatives can legitimately
stop before the space runs out.

Verification

  • cargo test --workspace — 1454 passed, 0 failed (1453 before, +1)
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --all --check — clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01TvcPGrQsgY4HqzmdDcRqvu


Generated by Claude Code

A caller that shows three alternatives and then asks for five must not watch
the first three renumber themselves. The accepted engine already satisfies
this — neither the enumeration order nor the greedy diversity filter reads
`k` — so this is a **characterization test**, not a red→green fix: no
production code changes, and the acceptance given at `7d0c0cb` is not
reopened.

The property was specified and left unasserted. The deterministic-search
proposal (#176, still a draft) asks for it in as many words — "requesting more
results never changes the prefix already returned" — and "true by construction"
is exactly the kind of claim that quietly stops holding one refactor later
without anything failing.

Compared per rank, not merely per path list: ordinals, `total_cost` bits, and
the full `Debug` rendering, which carries every step and edge with its axes,
rationale entries, weights and provenance. `f64` renders in shortest
round-trip form, so a cost differing in one bit renders differently — "the same
path" cannot quietly become "the same indices, differently computed".

Swept over all 120 width vectors for 1–4 layers over widths 1–3, every
`min_distance`, and every `k` below the widest request, with an anti-vacuity
floor on the number of ranks actually compared.

`exhausted` is deliberately excluded from the compared prefix: it describes the
*search*, not the paths, and a request for fewer alternatives can legitimately
stop before the space runs out.

Verification: `cargo test --workspace` 1454 passed / 0 failed (1453 before, +1);
clippy `--workspace --all-targets -D warnings` clean; `cargo fmt --all --check`
clean. The diff touches one test file and no production code.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TvcPGrQsgY4HqzmdDcRqvu
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e577f922-4f5a-46d8-8f5e-f50da04d395e


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@PhysShell
PhysShell merged commit 6188cc2 into main Aug 17, 2026
16 checks passed
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.

2 participants