Activity feed: gate titles and UTC label
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: sonnet Assistant-Process: 295952@bnt-lap001 Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477
This commit is contained in:
parent
b75d159ddd
commit
a6ee6a0a6e
4 changed files with 27 additions and 4 deletions
|
|
@ -11,6 +11,19 @@ def _step_title(run, sid: str) -> str:
|
|||
return sid
|
||||
|
||||
|
||||
def _gate_title(run, gid: str) -> str:
|
||||
try:
|
||||
return run.pack.data and next(g["title"] for st in _all_stages(run.pack.data["stages"]) for g in st.get("gates", []) if g["id"] == gid)
|
||||
except (StopIteration, KeyError):
|
||||
return gid
|
||||
|
||||
|
||||
def _all_stages(stages):
|
||||
for st in stages:
|
||||
yield st
|
||||
yield from _all_stages(st.get("stages", []))
|
||||
|
||||
|
||||
def events_for(pack, pack_index: int | None) -> list[dict]:
|
||||
out = []
|
||||
for rid in R.list_runs(pack):
|
||||
|
|
@ -34,9 +47,9 @@ def events_for(pack, pack_index: int | None) -> list[dict]:
|
|||
for gid, gs in d.get("gates", {}).items():
|
||||
when = max([r["at"] for r in gs.get("results", {}).values()] or [""])
|
||||
if gs["state"] in ("passed", "failed") and when:
|
||||
ev(when, f"gate “{gid}” {gs['state']}")
|
||||
ev(when, f"gate “{_gate_title(run, gid)}” {gs['state']}")
|
||||
if gs["state"] == "waived":
|
||||
ev(gs["waiver"]["at"], f"waived gate “{gid}”: {gs['waiver']['reason']}")
|
||||
ev(gs["waiver"]["at"], f"waived gate “{_gate_title(run, gid)}”: {gs['waiver']['reason']}")
|
||||
for dv in d.get("deviations", []):
|
||||
if dv["kind"] in ("override", "changed-after-use"):
|
||||
ev(dv["at"], f"{dv['kind'].replace('-', ' ')}: {dv['item']} ({dv['reason']})", dv.get("who", who))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue