diff --git a/app/web/main.py b/app/web/main.py index 21e5861..dee1952 100644 --- a/app/web/main.py +++ b/app/web/main.py @@ -611,6 +611,22 @@ def _run_view(run: Dict[str, Any]) -> Dict[str, Any]: } +def _mark_stale_views(views: List[Dict[str, Any]]) -> None: + """Flag runs whose emb HTML was overwritten by a newer sibling with + identical params. Prefect returns runs sorted by START_TIME_DESC, so the + first occurrence of each stem is authoritative; later ones are stale. + Mutates views in place.""" + seen: set = set() + for v in views: + stem = v["emb_file"][:-5] if v.get("emb_file") else None + if stem and stem in seen: + v["stale"] = True + else: + v["stale"] = False + if stem: + seen.add(stem) + + def _reducer_choices() -> List[Dict[str, str]]: return [ {"key": k, "label": spec["label"], "blurb": spec["blurb"]} @@ -632,6 +648,7 @@ async def index(request: Request) -> HTMLResponse: runs = await PREFECT.recent_runs(client, limit=10) dep_id = await PREFECT.deployment_id(client) views = [_run_view(r) for r in runs] + _mark_stale_views(views) return templates.TemplateResponse( request, "index.html", @@ -668,6 +685,7 @@ async def runs_partial(request: Request) -> HTMLResponse: async with httpx.AsyncClient(timeout=5.0) as client: runs = await PREFECT.recent_runs(client, limit=10) views = [_run_view(r) for r in runs] + _mark_stale_views(views) return templates.TemplateResponse( request, "_runs.html", {"runs": views} ) @@ -770,6 +788,7 @@ async def submit(request: Request) -> HTMLResponse: async with httpx.AsyncClient(timeout=5.0) as client: runs = await PREFECT.recent_runs(client, limit=10) views = [_run_view(r) for r in runs] + _mark_stale_views(views) return templates.TemplateResponse( request, "_runs.html", diff --git a/app/web/static/style.css b/app/web/static/style.css index 21acdbc..f6072ef 100644 --- a/app/web/static/style.css +++ b/app/web/static/style.css @@ -518,6 +518,15 @@ button.submit:disabled { background: var(--faint); border-color: var(--faint); c padding-left: 0.55rem; margin-left: -0.55rem; } +.runs li.run.stale { + opacity: 0.55; +} +.runs li.run.stale .stale-note { + color: var(--alarm); + font-style: italic; + font-size: 0.72rem; + margin-left: 0.3rem; +} .run .stamp { font-family: var(--mono); diff --git a/app/web/templates/_runs.html b/app/web/templates/_runs.html index bf6d426..2254f6e 100644 --- a/app/web/templates/_runs.html +++ b/app/web/templates/_runs.html @@ -7,8 +7,8 @@ {% else %}