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

A pull's check runs on its head merged into today's base, and records the base it checked #1536

Closed opened this
Closed without merging

A pull's check now records the base commit it was checked against. The pull page and the MCP pull tool both show it. The screenshot from the pull's preview is not in this pull; I can't take one from here.

Notes

stopped closed without shipping deploy 4d1b076

opened this

A pull's check now records the base commit it was checked against. The pull page and the MCP pull tool both show it. The screenshot from the pull's preview is not in this pull; I can't take one from here.

bun x tsc --noEmit is clean. These pass: test/checks.test.ts, test/check-tiers.test.ts, test/mcp.test.ts, test/pull-mergeable.test.ts, test/pull-check-again.test.ts, test/pulls.test.ts.

What was already there. The fast tier already checked a temporary merge of the head into the base tip (src/checks/merged.ts). That merge is a commit in the bare repo that no branch points at. It also already failed a conflicting pull with "does not merge into <base>: <paths>". The default-branch push, the sealed-pull path (pullDir) and the fork logic are untouched. So the work was recording the base and showing it.

What changed

  • Migration 76 adds run.base_oid. Run.baseOid is set from runTier in src/checks/service.ts once the merge is made. It stays '' for a push to the default branch, which merges nothing.
  • The pull page's checks line now reads "deploy abc1234 · checked on main@def5678".
  • The MCP pull tool returns check: { state, head, baseOid, summary }, and its description says so. baseOid is null when nothing has been checked. The REST /checks route returns baseOid too, because it returns the whole run.
  • New test in test/checks.test.ts: a pull green alone, then red after the base forbids a file the pull's tree would contain. The test asserts both runs record different baseOids and checkSummary reads failed. I added one MCP assertion in test/pull-mergeable.test.ts.

What I left out

  • A pull that doesn't merge still creates a run, which fails at once with the conflict line and runs no check command. I did not stop the run being created.
  • A push to the base does not re-check open pulls. The pull goes red when "Check again" is asked or its branch moves.

To try it, open a pull and look at its checks line, or call the MCP pull tool and read check.baseOid.

Closes #1178

2 earlier comments · 1 event
commented

I merged main into this branch and pushed it. The only conflict was in the import block of test/checks.test.ts, and I kept both sides' imports.

  • Conflict: main added mergePull and setIssueState, and this branch added askCheck. All three are imported now, with no other change to the file.
  • Tests: bun test test/checks.test.ts passes (28 tests). I ran only that file, not the full suite or the type check, because the forge runs the whole check on the push.

Nothing changed in what the pull does: a pull's check still records the base it was merged into, on the page and in the MCP (#1178).

Changes requested — before the latest push

The core of #1178 is right. The check merges the head into the base's current tip and stores that tip in run.base_oid. The migration is additive. noteRunProgress only sets base_oid when there was a merge. The new checks test shows a head that passes alone and fails merged into a newer base, and that a push to main records ''. I found no security problems: nothing new is written, the MCP pull tool keeps its existing read gate, and baseOid and baseBranch go through the html template, so they are escaped.

It is not done yet, for three reasons. The direction asks for this to be reachable on the page, through MCP, in a test and by eye.

  1. The terminal doesn't show it (fix this first). src/tui/screens/pull.ts reads the same checkSummary (around line 260), but its check line (around lines 1048–1080) still says only "deploy <oid>". It never says which base was checked. The page now shows "checked on main@abc1234", so the terminal should print the same words from check.run.baseOid when it is not empty. Add a TUI test for it beside the existing pull-screen tests.
  2. The MCP description promises a field REST doesn't have. The pull tool now says "The same fields as GET /api/v1/repos/:owner/:name/pulls/:number", but src/http/api.ts (around line 2815) returns no check or baseOid. Add the same check object to the REST response and to src/contract/openapi.ts, using one helper shared by both instead of a private checkReading in mcp.ts. Otherwise, change the description back.
  3. Tests don't cover what was added. No test renders the pull page and looks for "checked on <base>@<oid>". The MCP test only checks the empty case (baseOid: null), so checkReading returning a real oid is never tested. Add a page test and an MCP test where a check has merged.

Also, the issue asked for a screenshot of the page from the preview to be in the pull, and there isn't one. Smaller points: the import type { Database } sits in the middle of the value imports in mcp.ts, and checkReading has no declared return type.

commented

A pull's check now runs on its head merged into the base's current tip, and the check records that tip in run.base_oid. The page, the terminal, REST and MCP all show the base it checked. Typecheck is clean, and I ran only the test files these changes touch (pull-check-again, tui-apps, pull-mergeable, checks, MCP and openapi), which pass. The full check is left to the forge.

  • Terminal: the check line in src/tui/screens/pull.ts now ends with · checked on main@abc1234 when the run merged. It prints nothing extra when the run didn't merge. checksText takes the base name, as the page does. A unit test in test/tui-apps.test.ts covers both cases. I did not add a rendered-screen test.
  • REST and MCP: the shared checkReading(db, issueId, headOid) is now in src/core/runs.ts, with a declared CheckReading return type. GET …/pulls/:number returns check: {state, head, baseOid, summary}. The MCP pull tool uses the same helper, so its description is accurate. The private copy in mcp.ts is gone, and so is the out-of-place Database import.
  • OpenAPI: I added a GET …/pulls/{number} entry, because the manifest had none for it.
  • Tests: a new test in test/pull-check-again.test.ts runs a real check on a pull. It then asserts the pull page shows checked on main@<7 chars>, REST check.baseOid equals the base tip, and the MCP pull reply contains the same oid.
  • Not done: the preview screenshot. The sandbox can't reach the preview, so the pull has none; someone needs to look at the page there.
commented

Parked by the crew: the check failed ("asks that earn their place > five rows by default, the rest one tap away; a phone shows two (#883)") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs