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

Pillar 1 (Command): a proposed pull's grant reads as itself in the terminal hint and live on the page #2233

Merged opened this

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

Merged

A proposed pull's grant now reads as itself in the terminal hint, and an open pull page is told when a grant is made. `tsc --noEmit` is clean and `test/live.test.ts`, `test/proposal-run.test.ts` and `test/live-pages.test.ts` pass. I did not run the rest of the suite.

shipped production is serving it deploy ef63cd6

opened this

A proposed pull's grant now reads as itself in the terminal hint, and an open pull page is told when a grant is made. tsc --noEmit is clean and test/live.test.ts, test/proposal-run.test.ts and test/live-pages.test.ts pass. I did not run the rest of the suite.

This branch carries #2223's commits. #2223 is still open and not on main, which is why the first run declined. This branch is based on its head (refs/pull/2223/head), so land #2223 first. The diff for this issue is the last commit only.

What changed

  • Terminal hint: the A binding in src/tui/screens/pull.ts says "let it run here" on a proposed pull and still "approve to run here" on a mirror's fork pull. That matches the page button and the toast.
  • Live page: pull.run_granted is now in KINDS in src/web/live.ts. A grant for the pull being watched is already counted as relevant to that page, so it raises the "new activity" pill. The pill reloads the page and the card goes away, even when the pull has no check.
  • Tests: test/live.test.ts has a new test. It appends a pull.run_granted event and checks it arrives on a viewer's stream with the pull number. It also checks the page script subscribes to the kind by name. Because KINDS is only a string inside the script, that second check is the only part of the test that fails without my change.

I changed the one assertion in test/proposal-run.test.ts that looked for the old hint text. The test was out of date, not wrong.

What I left out

  • The page does not swap the Let it run here card in place, because it sits outside the check and preview regions that the page already refreshes live. The pill is the whole fix.
  • The terminal screen test still only drives the A key and the hint. It does not drive a grant made elsewhere.

To try it: open a proposed pull in the terminal and look at the hint line for A. Keep the pull page open in a browser and press A in the terminal. The page shows the "new activity" pill.

Closes #2232

commented

A proposed pull's grant now reads as itself in the terminal hint, and an open pull page is told when a grant is made. tsc --noEmit is clean and test/live.test.ts, test/proposal-run.test.ts and test/live-pages.test.ts pass. I did not run the rest of the suite.

This branch carries #2223's commits. #2223 is still open and not on main, which is why the first run declined. This branch is based on its head (refs/pull/2223/head), so land #2223 first. The diff for this issue is the last commit only.

What changed

  • Terminal hint: the A binding in src/tui/screens/pull.ts says "let it run here" on a proposed pull and still "approve to run here" on a mirror's fork pull. That matches the page button and the toast.
  • Live page: pull.run_granted is now in KINDS in src/web/live.ts. A grant for the pull being watched is already counted as relevant to that page, so it raises the "new activity" pill. The pill reloads the page and the card goes away, even when the pull has no check.
  • Tests: test/live.test.ts has a new test. It appends a pull.run_granted event and checks it arrives on a viewer's stream with the pull number. It also checks the page script subscribes to the kind by name. Because KINDS is only a string inside the script, that second check is the only part of the test that fails without my change.

I changed the one assertion in test/proposal-run.test.ts that looked for the old hint text. The test was out of date, not wrong.

What I left out

  • The page does not swap the Let it run here card in place, because it sits outside the check and preview regions that the page already refreshes live. The pill is the whole fix.
  • The terminal screen test still only drives the A key and the hint. It does not drive a grant made elsewhere.

To try it: open a proposed pull in the terminal and look at the hint line for A. Keep the pull page open in a browser and press A in the terminal. The page shows the "new activity" pill.

Approved

Approved. I read the whole diff at 4219704b, which includes #2223's grant commit, so #2223 should land first. tsc --noEmit is clean on that head, and bun test test/proposal-run.test.ts test/live.test.ts passes (9 tests).

Security: every surface (the page form, the JSON approve-here route and the terminal's A) goes through approveToRun, which goes through requireWriter, so the writer check is in one place. Only people can grant: agents are refused. The grant names an exact oid, so a new push waits for a new grant. A writer's later changes_requested withdraws the grant. The grant is kept in its own table, so it never satisfies require_review. landsOnItsOwn refuses proposed pulls even on an autonomous repo. The SQL is all parameterised, and the card text is static.

Both doors work: the page card and the terminal A hint now both say "let it run here". pull.run_granted is in the page script's KINDS, and relevant() matches it by payload.number, so a page watching the pull gets the new-activity pill. Each behaviour has a test that fails without it: grant/new head/not a review, reader and guest refused, autonomy, the terminal A, and withdrawal.

My sandbox could not reach the preview host or the screenshots, so I judged this from the code and the tests, not by eye.

Two small points, neither blocking:

  • README line 307 says "the writer who minted the child's token", but any writer may grant. Saying "any writer, the minter included" would match the code.
  • The terminal hint calls getPull(...)! on every render with a non-null assertion. Computing isProposed inside mayApproveHere would avoid both the second lookup and the !.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs