Persist 'last run per repo' so dashboard isn't red during quiet periods #9
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
javascript
needs-verification
question
wontfix
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/diagrams#9
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
diagrams#6 fixed the visual bug — "no recent runs" no longer renders as green, it goes red (broken). Working as intended.
But the underlying reason the dashboard goes red most of the time is that packages/routes/ci.js prunes runs older than 2h on every webhook event. Practical effect: outside an active cascade window, every repo shows "No recent runs" and the node goes red. The dashboard is effectively "is something happening RIGHT NOW", not "are we in a healthy state".
Problem
Red when nothing is wrong is false-alarm noise. The dashboard loses its signal — users learn to ignore it because red is the steady state during business-as-usual quiet periods.
Proposed fix
Add a persistent
lastRunmap (keyed by repo) that stores only the latest workflow run per repo, never pruned. Webhook events update it. Backfill on cold start seeds it.Schema (additive, in-memory alongside existing Maps):
runsMap stays as-is for the "currently in-flight" semantics (still 2h pruned, drives cascade-active edges and in-progress badges).lastRunsis new and keeps indefinitely. Only the most recent run per repo.workflow_runupdates both.Frontend change
CIFztView.tsx#checkGrammar + CIApiContainerView.tsx#checkApiGrammar — instead of checking
reposWithRuns(from the 2h-pruned map), checkreposWithLastRuns(from the new persistent map). The demote-to-broken logic becomes "no run has ever been observed for this repo" rather than "no run in last 2h" — that's the signal we actually want.The existing
runsMap still drivesactivestate for in-flight cascades (amber edges).Side benefit
lastRunsalso unblocks diagrams#7 (producer amber bleed) — that fix needs "is this specific node actively running" which is aruns-Map question, while node color for healthy/broken useslastRuns. Two Maps, two semantics, clean separation.Cold start
backfillFromGitHub()already fetches the 5 most recent main-branch runs per repo. Extend it to populatelastRunsfrom the single most recent run regardless of branch (or keep main-only if preferred). One extra API call per repo on first SSE connection.Persistence
In-memory only is fine for v1 (matches existing Maps). If the API restarts,
lastRunsre-hydrates from the next cold-start backfill. If we later want survival across restarts, back it with Cosmos DB — same pattern as existing route-package versions.Where
lastRunsMap, update webhook handler to write it, include ininit/status/versionsSSE snapshotslastRunsalongsiderunslastRunsfor "has any run ever happened" checkAcceptance
Dashboard reads green during quiet periods (last known good state) instead of red, unless a version mismatch or genuinely-never-ran repo is present. Red retains meaning: something is actually wrong.
Correction
Re-reading packages/routes/ci.js:469-482, the 2h prune does keep the latest run per repo, so the premise of this issue (dashboard goes red during quiet periods) is wrong.
The actual cause of repos showing 'No recent runs' turns out to be narrower: backfill hardcodes
?branch=mainat line 267, andllm-explorerusesmasteras its default branch. So its runs are silently filtered out during cold-start backfill, and unless/until a webhook arrives, the API has zero runs for it.Narrower fix
Remove the
branch=mainfilter entirely (or make it default-branch-aware):Tradeoff: without the filter, noisy PR branches could theoretically crowd out the most recent main-branch run in the 5-result window. In practice, for this ecosystem, PRs are rare and mostly Dependabot (already filtered in-code). Safe to drop.
Alternative: use the GitHub API's
repos/:owner/:repoto discover each repo'sdefault_branch, then pass that. One extra API call per repo on cold start. Cleanest but more code.Persistent
lastRunsmapStill worth considering as a separate enhancement — it survives API restarts and makes 'has this repo ever run' a cheap lookup rather than dependent on the prune logic being correct — but it's a nice-to-have, not the fix for the immediate llm-explorer symptom.