Skip to content

fix(vig-utils): key check dedup recency on startedAt - #1542

Merged
c-vigo merged 3 commits into
devfrom
bugfix/1539-gh-issues-dedup-startedat
Aug 17, 2026
Merged

c-vigo merged 3 commits into
devfrom
bugfix/1539-gh-issues-dedup-startedat

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements #1539 (follow-up to #1537): _dedupe_status_checks — feeding the just gh-issues PR table — keyed recency on completedAt, which is null while a re-run is in flight, so the table showed the superseded FAILURE during exactly the window someone is watching a re-run.

The recency key is now a helper mirroring the release gates' jq expression: startedAt or createdAt or "" (the createdAt arm covers StatusContexts, which have no startedAt; completedAt is deliberately absent — a completed CheckRun always has startedAt, so it would only reintroduce the skew). Grouping key, tie-breaking (>=, last wins), insertion order, and output shape unchanged; the #176-era no-timestamps behavior (last in list wins) is preserved and still pinned.

Display-only fix — no gate behavior changes.

Found during implementation, deliberately out of scope

Two more latent StatusContext gaps in the same file, the display-table analogues of #1538: grouping uses name only (all commit statuses would collapse into one "?" bucket; gates use .name // .context), and _format_ci_status classifies on conclusion only (a red commit status would render pending). Latent today — zero StatusContext entries across the last 40 devkit PRs. Follow-up candidates.

Test plan

New TestDedupeStatusChecks (6 tests): in-progress re-run beats older completed FAILURE (TDD red: 3 failed pre-fix), newer SUCCESS beats older FAILURE, distinct names untouched, order-independence, StatusContext createdAt fallback, and an end-to-end pin that the CI cell renders ⏳ 0/1 rather than ✗ 0/1. packages/vig-utils/tests: 529 passed; prek run --all-files exit 0 (verified independently of the implementation run).

Closes #1539

c-vigo added 3 commits August 17, 2026 14:32
Two runs of the same check name where the newer one is still in flight:
the deduped result must surface the live rerun, not the FAILURE it
supersedes. Adds regression pins for a completed rerun, distinct names,
input-order independence and the StatusContext createdAt fallback.

Refs: #1539
The gh-issues PR table kept the latest run of each check name by
completedAt, which is null while a rerun is in flight: the live run
ranked as the oldest of its name and the FAILURE it supersedes won the
CI cell during exactly the window someone watches a rerun. Key on
startedAt with a createdAt fallback for StatusContexts, mirroring the
release-workflow CI-green gates fixed in #1537.

Refs: #1539
@c-vigo
c-vigo merged commit d0cbf22 into dev Aug 17, 2026
12 checks passed
@c-vigo
c-vigo deleted the bugfix/1539-gh-issues-dedup-startedat branch August 17, 2026 12:49
c-vigo added a commit that referenced this pull request Aug 18, 2026
## Summary

Implements #1544 (combined follow-up from #1542, the display-table
analogue of the #1538/#1541 gate fix): the `just gh-issues` PR table was
blind to StatusContexts in two ways — `_dedupe_status_checks` grouped on
`name` only (every commit status collapsed into one `"?"` bucket, only
the newest surviving), and `_format_ci_status` classified on
`conclusion` only (a red commit status rendered pending, a green one
never counted as passed).

Two helpers in the style of #1542's `_started`, each mirroring the
gates' jq exactly:

- `_check_key` = `name or context or "?"` — dedup grouping and the red
cell's failed-names list both use it, so a failing commit status is now
also *named* in the cell (bonus fix: the old `c.get("name", "?")`
returned `None` for present-but-null names).
- `_verdict` = `conclusion or state or ""` — pass/fail tallies classify
on it; pending stays the remainder, so PENDING/EXPECTED/in-flight all
fall through with no new branch, and skipped/neutral/cancelled CheckRuns
render exactly as before.

Same-keyed grouping matches the gates including tie behavior (Python
`>=` keeps the later element, as jq's `max_by` returns the last maximal
element). One #1542 fixture corrected to a realistic node shape
(StatusContexts carry `context`, never `name`); its behavioral pin is
unchanged.

Display-only — no gate behavior changes.

## Test plan

Two new dedup tests (distinct StatusContexts stay separate; same-keyed
StatusContext/CheckRun grouping matching #1541's gate test) and a new
`TestFormatCiStatusCommitStatuses` class (FAILURE/ERROR render failed,
SUCCESS counts passed, PENDING/EXPECTED render pending, red status beats
green checks). TDD red: 6 failed pre-fix (e.g. a `state: FAILURE`
context rendering `⏳ 0/1` yellow); the PENDING/EXPECTED cases and all
pre-existing CheckRun-only tests were green throughout as regression
pins. `packages/vig-utils/tests`: 537 passed; `prek run --all-files`
exit 0 (verified independently of the implementation run).

Closes #1544
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant