Skip to content

Fix superseded PR check rollups - #1348

Merged
ymichael merged 2 commits into
mainfrom
fix/pr-check-rollup
Aug 11, 2026
Merged

Fix superseded PR check rollups#1348
ymichael merged 2 commits into
mainfrom
fix/pr-check-rollup

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Summary

  • preserve GitHub check timestamps through the host-daemon contract
  • collapse check runs by name using the newest timestamp before calculating the PR rollup
  • bump the host-daemon protocol for the wire-contract change
  • cover non-chronological GitHub rollup ordering with a regression test

Testing

  • pnpm exec turbo run test --filter=@bb/host-workspace --filter=@bb/host-daemon-contract --filter=@bb/server --force
  • pnpm exec turbo run typecheck --filter=@bb/domain --filter=@bb/host-workspace --filter=@bb/host-daemon-contract --filter=@bb/host-daemon --filter=@bb/server
  • live sanity check against PR Add provider-neutral shared skill roots #1271: 19 raw runs collapse to 9 passing checks with 0 failures
  • git diff --check

Closes #1256

@SawyerHood

Copy link
Copy Markdown
Collaborator

🚨 SLOP COP 🚨 · review

I am the SlopCop. I am reviewing this change now.

I will check security, code quality, performance, architecture, tests, and the end-to-end behavior.

candidate: GitHostPullRequestCheck,
current: GitHostPullRequestCheck,
): boolean {
if (candidate.startedAt === null) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — A queued rerun can stay hidden behind an older completed run.

GitHub defines CheckRun.startedAt as nullable. This branch makes a null candidate lose to every dated run. The gh JSON can also represent a missing time as year 0001, which has the same result. I reproduced an older successful run plus a newer queued run. The rollup returned passing with pendingCount: 0. Equal timestamps also depend on the input order.

Please preserve a creation time or a stable run identifier. Add tests for null, zero, and equal timestamps in both input orders.

): ThreadPullRequestChecks {
const latestChecksByName = new Map<string, GitHostPullRequestCheck>();
for (const check of rawChecks) {
const current = latestChecksByName.get(check.name);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Name-only grouping can combine independent checks.

A visible check name is not a stable producer identity. Separate workflows or check producers can use the same name. A later success can then replace an independent failure. The host currently removes the check kind and producer identity before this map receives the data.

Please preserve a stable workflow or producer identity. Group with that identity and the check name. Keep ambiguous checks separate when the identity is absent.

@ymichael
ymichael merged commit f597776 into main Aug 11, 2026
10 checks passed
@ymichael
ymichael deleted the fix/pr-check-rollup branch August 11, 2026 23:08

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

ELI5

GitHub can send several attempts for one check. This change keeps the newest attempt before it reports the result.

Two edge cases can still hide a pending or failed check. The app can then show a green result when it should not.

Findings

  • High: A queued rerun can lose to an older completed run. GitHub permits a null startedAt value. The comparator always keeps the older dated run. A direct test returned passing with pendingCount: 0. Equal timestamps also depend on the array order.

  • High: The map uses only the visible check name. Separate workflows or producers can use the same name. A later success can replace an independent failure. Preserve a stable producer identity and keep ambiguous checks separate.

  • Medium: The GitHub plugin has a second check-rollup implementation. It still counts all superseded rows. Move the common GitHub normalization and selection into one internal module. Keep the product attention policy in the server.

I left inline comments for both high-severity findings.

Snapshot note

The requested SHA omitted regenerated plugin SDK declarations. That snapshot failed the generated-output CI check. Commit a53b8c5 fixes this item at the current PR head.

Security and performance

I found no command injection, path escape, authorization bypass, or data exposure. GitHub still enforces merge authorization and branch protection.

The new map uses linear time over bounded check data. I found no material performance problem.

Validation

  • The exact SHA passed the full server, host-workspace, and host-daemon-contract test suites.
  • The server suite passed 1,433 tests.
  • The three changed test files passed 69 tests.
  • Five affected package type checks passed.
  • git diff --check passed.
  • A direct test confirmed the null-time and equal-time defects.
  • Dev-browser verified the public GitHub pull request workflow.
  • The live product route reached the daemon, but that daemon did not have gh.

The pull request advanced during this review. The code findings remain fixed to fdef28c83cc80b33af29864b2f9d78303ec1f547.

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.

PR attention rollup counts superseded check runs as failures

2 participants