Public: anyone can read this; the crew can change it.

A green change's card on the asks page says "its tests passed" every time, not "its check passed" when another run sorts first #14407

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The look card on /asks now always picks the same run to describe. When a pull's preview deploy (the build of the pull that runs its declared tests) and its check are both green on the same commit, the card says "its tests passed", even if the check finished in the same millisecond.

Notes

shipped production is serving it deploy bbac9a7

opened this

The look card on /asks now always picks the same run to describe. When a pull's preview deploy (the build of the pull that runs its declared tests) and its check are both green on the same commit, the card says "its tests passed", even if the check finished in the same millisecond.

Cause: the card took its run from latestRunsForIssues, which picks by MAX(id). In the full suite the test's running server queued and finished a green check on the new pull after the test's deploy run. That check got the larger id, so the card read "its check passed".

Change:

  • greenRunsAt in src/core/runs.ts reads a pull's green check and deploy runs at one commit, newest first by created_at and then id, so ties always come back in the same order.
  • speakingRun in src/web/studio/decisions.ts picks, from those runs, the one whose summary ends with the "its tests passed" tail. Failing that it takes the newest green run, and failing that the run the card was found with. The card's sentence is built from that run.
  • Only the wording comes from the chosen run. Which pulls get a card, and their "since" time and stale-green handling, still use the original run.

Tests: a new test in test/asks.test.ts makes a green deploy (with the tests tail) and a green check on the same commit. It gives them the same created_at, with the check's id larger. It fails without the fix and passes with it. test/asks.test.ts --rerun-each 20 passes (160 of 160). bun x tsc --noEmit, the gate and the design lint are clean.

The changed-files test selector named 3,075 files because src/core/runs.ts changed, too broad to run here. I ran the 15 test files that mention the decisions module, /asks or look: cards instead (123 pass); the forge's check runs the rest.

Left out: latestRunsForIssues still picks by MAX(id) for every other screen. Only this card's wording reads by the new order.

Try it: open /asks with a green agent pull whose preview deploy passed its tests. The card reads "… and the check is green (its tests passed)" even when a check went green beside it.

🤖 Generated with Claude Code

Closes #14406

2 earlier comments
commented

The look card on /asks now always picks the same run to describe. When a pull's preview deploy (the build of the pull that runs its declared tests) and its check are both green on the same commit, the card says "its tests passed", even if the check finished in the same millisecond.

Cause: the card took its run from latestRunsForIssues, which picks by MAX(id). In the full suite the test's running server queued and finished a green check on the new pull after the test's deploy run. That check got the larger id, so the card read "its check passed".

Change:

  • greenRunsAt in src/core/runs.ts reads a pull's green check and deploy runs at one commit, newest first by created_at and then id, so ties always come back in the same order.
  • speakingRun in src/web/studio/decisions.ts picks, from those runs, the one whose summary ends with the "its tests passed" tail. Failing that it takes the newest green run, and failing that the run the card was found with. The card's sentence is built from that run.
  • Only the wording comes from the chosen run. Which pulls get a card, and their "since" time and stale-green handling, still use the original run.

Tests: a new test in test/asks.test.ts makes a green deploy (with the tests tail) and a green check on the same commit. It gives them the same created_at, with the check's id larger. It fails without the fix and passes with it. test/asks.test.ts --rerun-each 20 passes (160 of 160). bun x tsc --noEmit, the gate and the design lint are clean.

The changed-files test selector named 3,075 files because src/core/runs.ts changed, too broad to run here. I ran the 15 test files that mention the decisions module, /asks or look: cards instead (123 pass); the forge's check runs the rest.

Left out: latestRunsForIssues still picks by MAX(id) for every other screen. Only this card's wording reads by the new order.

Try it: open /asks with a green agent pull whose preview deploy passed its tests. The card reads "… and the check is green (its tests passed)" even when a check went green beside it.

🤖 Generated with Claude Code

commented

<!-- look-pages e6b95b8c50f9 --> Look pages for e6b95b8, from the gate:

  • look pages (inferred): this pull changes src/web/studio/decisions.ts; the forge pictures / (src/web/studio/decisions.ts), /docs (src/web/studio/decisions.ts), /explore (src/web/studio/decisions.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The look card on /asks now always picks the same run to describe. When a pull's preview deploy and its check are both green on the same commit, the card says "its tests passed", even if the check finished in the same millisecond.

Cause: the card took its run from latestRunsForIssues, which picks by MAX(id). In the full suite the test's running server queued and finished a green check on the new pull after the test's deploy run. That check got the larger id, so the card read "its check passed".

Change:

  • greenRunsAt in src/core/runs.ts reads, in one query for any set of pulls, each pull's green check and deploy runs at its head commit. They come back newest first by created_at and then id, so ties always come back in the same order.
  • decisionsFor in src/web/studio/decisions.ts makes that read once for all look cards, and only when there is at least one.
  • speakingRun picks the run whose summary ends with the "its tests passed" tail. Failing that it takes the newest green run, and failing that the run the card was found with.
  • Only the wording comes from the chosen run. Which pulls get a card, and their "since" time and stale-green handling, still use the original run.

Check fix: the first push read the runs once per card, so the home page ran 60 statements for four rounds of open pulls against 57 for one. test/asks-counts.test.ts caught it. With the single grouped read the count stays the same, and that test passes. The four other failures in the check log are in test/llms-budget.test.ts, test/keeper-measures.test.ts and test/stuck-pile.test.ts. The forge found those same tests red on main and did not count them against this pull.

Tests: a new test in test/asks.test.ts makes a green deploy (with the tests tail) and a green check on the same commit, with the same created_at and the check's id larger. It fails without the fix and passes with it. test/asks.test.ts --rerun-each 20 passes (160 of 160). The 21 test files that mention the decisions module, /asks or look cards also pass, including test/asks-counts.test.ts (154 tests). bun x tsc --noEmit and the gate are clean. The design lint ran clean before the first push and was not run again; this push changed no page or style.

Left out: latestRunsForIssues still picks by MAX(id) for every other screen. Only this card's wording reads by the new order.

Try it: open /asks with a green agent pull whose preview deploy passed its tests. The card reads "… and the check is green (its tests passed)" even when a check went green beside it.

🤖 Generated with Claude Code

Approved

Approved. The card now picks its run by a total order, and a green run whose summary carries the tests tail wins. No markup or style changed, so the design principles are not touched, and the single grouped read keeps the asks-counts budget. test/asks.test.ts passes with --rerun-each 20 here (140 of 140). Two things I would do next: (1) greenRunsAt reads every green check/deploy row of each pull and filters by commit in JS; add commit_oid to the query or cap per pull so a long-lived pull does not grow the read. (2) latestRunsForIssues still picks by MAX(id) on other screens; give them the same order so no other card can read differently.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs