Skip to content

test(ktuner): pin rollback keep-previous invariant#1338

Open
jfeng18 wants to merge 1 commit into
alibaba:mainfrom
jfeng18:test/ktuner-rollback-merge
Open

test(ktuner): pin rollback keep-previous invariant#1338
jfeng18 wants to merge 1 commit into
alibaba:mainfrom
jfeng18:test/ktuner-rollback-merge

Conversation

@jfeng18

@jfeng18 jfeng18 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

What

Extract merge_entries from merge_rollback as a pure (no-I/O) fn with zero behavior change, and pin the rollback keep-previous invariant with a discriminating test: across repeated tune/fix/import runs the ORIGINAL pre-ktuner value must survive so rollback restores pristine state.

Why discriminating

A merge that clobbered previous on re-tune would silently make rollback restore to a post-tune value instead of the pristine one. The test fails if and_modify also sets previous (mutation-verified).

Testing

  • Done (ktuner crate, toolchain 1.89): cargo fmt --check, clippy --all-targets -- -D warnings, cargo test (192 pass).

Note

Slimmed from an earlier version: dropped the is_metric_degraded extraction and its test. That covered the benchmark degradation direction, but verify_and_report / auto_rollback_on_degradation have zero callers in the shipped CLI (ktuner tune verifies via static eval.score()), so testing them hardened dead code. Kept only the live rollback-merge coverage.

@jfeng18 jfeng18 requested a review from casparant as a code owner July 4, 2026 15:05
@github-actions github-actions Bot added the scope:chore !component && !other scope stuff label Jul 4, 2026
The rollback-merge keep-previous rule was an untested pure decision
path in the tuner: across repeated tune/fix/import runs the ORIGINAL
pre-ktuner value must survive so rollback restores pristine state.

Extract merge_entries as a pure (no-I/O) fn with no behavior change,
covered by a discriminating test — a merge that clobbered previous on
re-tune fails the assert.
@jfeng18 jfeng18 force-pushed the test/ktuner-rollback-merge branch from 4fc026b to 4f21d77 Compare July 5, 2026 09:00
@jfeng18 jfeng18 changed the title test(ktuner): pin tuner decision-logic invariants test(ktuner): pin rollback keep-previous invariant Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:ktuner scope:chore !component && !other scope stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants