Commit e1f577c
authored
refactor(stage-gate): use format_gate_rates instead of duplicating it (#1432)
Third review round on #1340. `format_gate_rates` had no production caller —
only its own unit tests — while `evolution_metrics.format_health` rendered the
same data inline in a different shape. Two renderings of one thing, one of them
dead, in a repo whose integration skill runs an explicit dead-code check on
every PR.
`format_gate_rates` now emits exactly what the health line body needs and
`format_health` calls it, so the shape lives next to the data that defines it.
Lazily imported for the same reason `compute_health` imports the module lazily:
the evolution package is not always available, and the health line must still
render without it.
The output is byte-identical to before — verified end to end rather than by
reading:
healthy ...effort_budget=3.0 gate[local_triage]=refine 50%/restart 0% (n=4) | healthy
-> check_health: 0 alerts
mis-tuned ...gate[local_triage]=refine 0%/restart 75% (n=4) | HIGH_STAGE_RESTART_RATE:local_triage=75%
-> check_health: 1 alert
Added a test asserting the rendered segment contains no `|`, since the health
line's flags must remain the last pipe-separated segment for
`evolution_watchdog.check_health` — that constraint was previously only implied
by a comment.
52 passing in test_stage_gate.py + test_evolution_metrics.py; ruff clean.
Refs #13401 parent 15858f8 commit e1f577c
3 files changed
Lines changed: 38 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
294 | 304 | | |
295 | 305 | | |
296 | | - | |
297 | | - | |
298 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
299 | 309 | | |
300 | | - | |
301 | | - | |
| 310 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| |||
0 commit comments