Add step_timeline: per-run step waterfall + bottleneck steps#413
Merged
Conversation
The action profiler aggregates timings by step name across runs, which
can't explain why one specific run was slow. Turn a single run's ordered
steps into a waterfall (each step's offset, duration and share of the
total) with the bottleneck step and a parallelism ratio, and rank the
dominant steps. A step is any {name, duration, start?} dict; explicit
start times place overlapping steps on an absolute timeline. Pure
stdlib.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 32 |
| Duplication | 0 |
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.
|
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.



Why
The action profiler aggregates timings by step name across many runs — great for "which action is slow on average", useless for "why was this run slow". A single run is an ordered timeline: step A ran, then B, then C, and one of them dominated.
step_timelineturns one run's steps into a waterfall and ranks the bottleneck steps.build_timeline— each step's offset / duration /pctshare +total(wall-clock span),busy(summed step time),bottleneck, andparallelism(= busy/total;> 1when steps overlap)critical_steps— thetopsteps that dominate the run, longest firstFourth and final HIGH item of the test-robustness lane.
Design
{name, duration, start?}dict. With explicitstarttimes, overlapping/parallel steps land on an absolute timeline (parallelism surfaces); without, steps lay out back-to-back. Pure stdlib, radon-clean.__all__→AC_build_timeline/AC_critical_steps→ read-onlyac_*MCP tools → Script Builder (Testing). Qt-free verified;pytest.approxthroughout (no float==).Tests
test/unit_test/headless/test_step_timeline_batch.py— sequential waterfall offsets + bottleneck,pctshare, an overlapping run reportingparallelism1.5, rankedcritical_stepswith pct +top, empty run, and the executor paths + 5-layer wiring. 35 passed across the whole test-robustness lane (failure_signature / run_diff / flake_cluster / step_timeline).