Skip to content

Add run_diff: LCS-aligned diff of two run step-traces#411

Merged
JE-Chen merged 1 commit into
devfrom
feat/run-diff-batch
Jun 24, 2026
Merged

Add run_diff: LCS-aligned diff of two run step-traces#411
JE-Chen merged 1 commit into
devfrom
feat/run-diff-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 24, 2026

Copy link
Copy Markdown
Member

Why

A run history tells you a run failed, but not what changed from the run that passed: which step was added or dropped, which step flipped pass→fail, which step got slower. run_diff aligns the two step sequences with a longest-common-subsequence walk — so an inserted/removed step shifts the rest into place instead of mis-pairing everything — and classifies the differences:

  • added / removed — steps present in only one run
  • status_flips — an aligned step whose status changed, with the new failure's failure_signature when it carries an error
  • timing_regressions — an aligned step that got regress_factor× slower

summarize_run_diff renders a one-line summary. The second item of the test-robustness lane (consumes failure_signature from v191).

Design

  • Pure stdlib LCS DP over the step name sequences; classification helpers (_status_flip / _regression / _aligned_changes / _unmatched) keep every function under CC 10 (radon-clean). A step is any dict with a name key + optional status/duration/error.
  • 5 layers wired: core → facade __all__AC_diff_runs (returns the diff + a summary) → read-only ac_diff_runs MCP tool → Script Builder (Testing). Qt-free verified; pytest.approx for the ratio (no float ==).

Tests

test/unit_test/headless/test_run_diff_batch.py — LCS isolating an insert (no mis-pairing), status flip carrying a 12-char signature, timing regression with ratio + sub-factor non-regression, removed-step detection, identical runs → "no change", summary contents, and the executor summary path + 5-layer wiring. 18 passed with the failure_signature sibling.

A run history says a run failed but not what changed from the run that
passed. Align two step sequences with an LCS walk (so an inserted or
removed step shifts the rest into place instead of mis-pairing) and
classify the differences: added/removed steps, status flips (with the
new failure's signature), and timing regressions. summarize_run_diff
renders a one-line summary. Pure stdlib over step dicts.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 53 complexity · 0 duplication

Metric Results
Complexity 53
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 20ec65f into dev Jun 24, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/run-diff-batch branch June 24, 2026 17:45
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant