Commit 3e5ee2b
fix(ci): Correct metrics snapshot comparison noise (#8246)
Two independent sources of CI noise in E2E metrics snapshot comparisons:
1. **Cassandra false-positives** — `generate_diff` appended `Metrics
excluded from A/B: N` metadata even when `unified_diff` returned empty
(identical non-excluded metrics). A varying 5xx error count across runs
made the diff file non-empty, triggering phantom "changes" with zero
actual metric differences.
2. **Baseline provenance question** — No documentation explained whether
the comparison baseline was guaranteed to come from `main`, raising
valid concerns about whether a PR could accidentally compare against
another PR's snapshot.
## Changes
### `scripts/e2e/compare_metrics.py`
- Guard exclusion-count metadata behind a non-empty diff check.
Exclusion counts are supplementary context, not metric differences; they
should never make a diff file non-empty on their own.
```python
actual_diff = '\n'.join(unified_diff(metrics1, metrics2, lineterm='', n=0))
if not actual_diff:
return '' # suppress metadata-only output
# ... append exclusion summary alongside the real diff
```
### `scripts/e2e/compare_metrics_test.py`
- Reverts test that asserted new-metric-only diffs should be silently
swallowed (the prior incorrect fix). Both new metrics in the current
snapshot and missing metrics relative to the baseline now produce a
visible diff — silencing either direction risks hiding genuine flapping.
### `.github/actions/verify-metrics-snapshot/action.yaml`
- Adds a top-level `Baseline-from-main guarantee` comment block
documenting the invariant:
- Cache **save** is gated by `github.ref_name == 'main'` — only
main-branch runs ever write under the `{artifact_key}_{run_id}` prefix.
- Cache **restore** uses prefix matching against `{artifact_key}`; since
only main ever saves under that prefix, PRs always receive the
most-recent main-branch snapshot and can never pick up another PR's
snapshot.
- The exact `key:` in the restore step intentionally never matches (main
saves with `_run_id` suffix), forcing the prefix fallback by design.
- Documents the no-baseline bootstrap case for newly-added test
configurations.
- Replaces stale/misleading step-level comments with accurate
explanations of each step's role.
<!-- START COPILOT CODING AGENT TIPS -->
---
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS
or Windows machine with [Raycast](https://gh.io/cca-raycast-docs).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>1 parent 8a4c314 commit 3e5ee2b
File tree
5 files changed
+214
-7
lines changed- .github
- actions/verify-metrics-snapshot
- workflows
- scripts/e2e
5 files changed
+214
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
4 | 30 | | |
5 | 31 | | |
6 | 32 | | |
| |||
20 | 46 | | |
21 | 47 | | |
22 | 48 | | |
23 | | - | |
24 | | - | |
| 49 | + | |
| 50 | + | |
25 | 51 | | |
26 | 52 | | |
27 | 53 | | |
28 | 54 | | |
29 | 55 | | |
30 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
31 | 60 | | |
32 | 61 | | |
33 | 62 | | |
34 | 63 | | |
35 | 64 | | |
36 | 65 | | |
37 | 66 | | |
38 | | - | |
39 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
40 | 71 | | |
41 | 72 | | |
42 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
115 | 141 | | |
116 | 142 | | |
117 | 143 | | |
| |||
120 | 146 | | |
121 | 147 | | |
122 | 148 | | |
123 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
124 | 158 | | |
125 | 159 | | |
126 | 160 | | |
127 | 161 | | |
128 | | - | |
| 162 | + | |
129 | 163 | | |
130 | 164 | | |
131 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
0 commit comments