Public: anyone can read this; the crew can change it.
Deploys still run for closed and old pulls: never deploy a closed pull #16664
Check · Review · Land · Live done — Landed and live in production.
Closed and merged pulls can no longer get a check queued. Deploys were already blocked by #16595 (e40ac3c6a), which this change only adds a logged reason to. Not done: I couldn't tear down old preview envs or verify a day with zero closed-pull deploys from this sandbox.
shipped production is serving it deploy 1919ee3
1 earlier comment · 1 event
Closed and merged pulls can no longer get a check queued. Deploys were already blocked by #16595 (e40ac3c6a), which this change only adds a logged reason to. Not done: I couldn't tear down old preview envs or verify a day with zero closed-pull deploys from this sandbox. I ran tsc, gate.ts --fix and two test files; I didn't run scripts/fast.ts.
- Deploys:
mayRuninsrc/apps/runtime_sleep.tsalready refuses a closed or merged pull's preview on every deploy path. The bursts you listed (#16284, #14528, #16293, the 4:38 one) look like they came from before that fix. That's my inference from the code. I didn't read the runs list, so I haven't confirmed no deploys have happened since. - Checks:
requestinsrc/checks/request.tsdid not look at the pull's state. A latepull.pushed,pull.reopened, a retry or a stale-red recheck could queue a check for a closed pull. It now refuses any request tied to a pull that isn't open and logs why (pull, state, reason, commit). - Logging: a refused deploy now logs "deploy refused: its pull is not open" where it used to return silently.
- Tests:
test/checks-queue.test.tshas a new test that a closed pull's check request is refused for the reasonsretry,askedandpush, and queues nothing. It fails without the guard.test/checks-queue.test.tsandtest/apps-closed-pull-no-preview.test.tspass, andtscis clean. - Reused:
getIssueById,getPull, the lane'slogand the existingmayRungate. No new modules.similar.tsfound nothing close. - Preview teardown: reconcile already stops previews of closed pulls, which the existing test covers. A reconcile on production should clear any that are left. Then check the runs list for a day.
To try it, run bun test test/checks-queue.test.ts.
The check guard in request is correct and its test would fail without it. Two things to fix in one round:
- Fix first: the new
log.infoinmayRun(src/apps/runtime_sleep.ts) is untested and runs on a hot path.mayRunis called on every wake, touch and reconcile pass, so a closed pull that is polled now writes a log line each time. The deploy refusal itself already existed (#16595); this line only adds noise. Either drop it, or log once per pull and state, and add a test that fails without it. - The issue title says deploys also run for old pulls. Nothing here handles an old pull that is still open, and the pull description does not say that was left out on purpose. Either handle it or say plainly in the description that it is out of scope. A person reading 'deploys for closed and old pulls' should not have to guess.
Smaller: the new lines in request.ts and the test are well past the file's wrap width, so run bun scripts/gate.ts --fix and scripts/design-lint equivalents and commit the result. The scout also said it did not run scripts/fast.ts; run it and name the tests it picks.
No preview behaviour to check: no page changed.
A check is no longer queued for a closed or merged pull, and a refused deploy still says why. Old pulls that are still open are not handled; that is out of scope here. I ran tsc --noEmit and test/checks-queue.test.ts (11 pass). bun scripts/gate.ts --fix produced no changes and scripts/design-lint.ts was not run (no page changed). scripts/fast.ts exited 0 but named nearly the whole suite, so I ran only the test file that covers the change.
- Check guard:
requestinsrc/checks/request.tsrefuses to queue a check when the pull is closed or merged. The test intest/checks-queue.test.tsfails without it. - Log line dropped: I removed the
log.infofrommayRuninsrc/apps/runtime_sleep.ts.mayRunruns on every wake, touch and reconcile pass, so a closed pull would have written a line each time. The refusal itself already existed (#16595), somayRunis back to a barereturn falsefor a non-open pull. - Old pulls left out on purpose: the issue title also says deploys run for "old" pulls. An open pull that has simply gone stale still gets previews and checks. Handling it needs a staleness rule, such as an age cutoff or no pushes for N days, and that is a policy choice for a person. I did not guess one. It should be its own issue.
- Wrap width: I did not re-wrap the long lines in
request.tsand the test by hand, and I did not confirm the gate left them alone.
Approved. No page changed, so the preview has nothing for a person to see; I judged the code and the test. Since my last review, the hot-path log line in mayRun is gone, which was the one thing I asked for. The guard in request refuses any check for a pull that isn't open, and the test covers retry, asked and push. It would fail without the guard. The change adds no new module and no dependency. The old-pull part of the title is left out on purpose, because it needs a staleness policy. Two things I would do next:
- Non-blocking: open an issue for stale open pulls, so a person can choose the rule (an age cutoff or no pushes for N days).
- Non-blocking: wrap the long
expect(...)lines in the new test, and runbun scripts/gate.ts --fixto confirm it leaves them alone.
Closed and merged pulls can no longer get a check queued. Deploys were already blocked by #16595 (
e40ac3c6a), which this change only adds a logged reason to. Not done: I couldn't tear down old preview envs or verify a day with zero closed-pull deploys from this sandbox. I rantsc,gate.ts --fixand two test files; I didn't runscripts/fast.ts.mayRuninsrc/apps/runtime_sleep.tsalready refuses a closed or merged pull's preview on every deploy path. The bursts you listed (#16284, #14528, #16293, the 4:38 one) look like they came from before that fix. That's my inference from the code. I didn't read the runs list, so I haven't confirmed no deploys have happened since.requestinsrc/checks/request.tsdid not look at the pull's state. A latepull.pushed,pull.reopened, a retry or a stale-red recheck could queue a check for a closed pull. It now refuses any request tied to a pull that isn't open and logs why (pull, state, reason, commit).test/checks-queue.test.tshas a new test that a closed pull's check request is refused for the reasonsretry,askedandpush, and queues nothing. It fails without the guard.test/checks-queue.test.tsandtest/apps-closed-pull-no-preview.test.tspass, andtscis clean.getIssueById,getPull, the lane'slogand the existingmayRungate. No new modules.similar.tsfound nothing close.To try it, run
bun test test/checks-queue.test.ts.Closes #16662