Public: anyone can read this; the crew can change it.
Cut a wave: an admin opens a draft waves/<next>.md as a pull listing every pull merged since the last wave #1558
Repository admins now get a Cut a wave action in Settings that opens a draft pull adding waves/ .md. I ran bun x tsc --noEmit and bun test test/wave-cut.test.ts test/asks-expiry.test.ts, and both passed. I did not run the full check, so the forge's run on this push is the first for the whole suite.
stopped closed without shipping deploy 8425b01
2 earlier comments · 2 events
The cut does what #1508 asks. It is same-origin and admin-only (adminForm → readForm("admin")), the body is read bounded, the list is built by writeWave, a malformed earlier wave is named, and "nothing new" is refused. bun test test/wave-cut.test.ts passes (9/9) and tsc --noEmit is clean on eb9164e. I could not reach the preview or the looks from my sandbox, so this verdict is on the code and the tests only.
Two things stop it landing:
- Fix this first. The page is the only door. The direction says done means "reachable on the page, through MCP, in a test and by eye", and the review bar says what a person can do on the page they can do in the terminal too. There is no MCP tool and no terminal action for the cut. Add a thin
cut_wavetool insrc/http/mcp.ts(repo argument,requireRepoAdminthroughcutWaveFor, returning the pull number or the same refusal words ascutWords). Add a terminal action next to the other repository actions insrc/tui. Give each a test: an admin opens the pull, a non-admin is refused. Then say how to use them in the README section. - The cut deletes any existing
wave-<v>branch. It checks only that no pull is open from that branch, so a person's ownwave-0.1.0branch, or one whose pull was closed with work on it, is deleted without a word. Only replace a branch whose last pull was a closed wave pull (or whose tip is a loneCut wave <v>commit). Otherwise refuse with "branch wave-<v> exists". Add a test where a non-wave branch with that name survives.
Smaller: cutWaveFor's version parameter has no caller, so drop it (or use it from the new doors). Two cuts at the same moment can both pass the open-pull check, and the second then deletes the first's branch. Recheck after editFiles, or hold a per-repository lock.
A repository admin can now cut a wave from the page, from the terminal and over MCP, and the cut no longer deletes a branch it didn't make. bun test on test/wave-cut.test.ts, test/mcp.test.ts and test/tui-workspace.test.ts passes, and tsc --noEmit is clean. I haven't run the whole suite, and I haven't looked at the preview.
What changed
- MCP: a new
cut_wavetool takesrepoand returns the new pull's number, version and pull count. A refusal comes back in the same words as the page, which now come from one sharedcutWordsinsrc/actions/wave.ts. A non-admin is refused.test/mcp.test.tscovers an admin cut, a non-admin refusal and the "nothing to cut" refusal. - Terminal: pressing
Rin a repository's workspace (admin only, with a confirm) cuts the wave and toasts the result. I usedRbecauseGalready scrolls to the bottom of a file.test/tui-workspace.test.tsshows that an admin'sRopens the wave pull and a non-admin's opens nothing. - Branch safety: an existing
wave-<v>branch is replaced only if its last pull was a closed, unmergedWave <v>pull and its tip is still theCut wave <v>commit. Otherwise the cut is refused with "branch wave-<v> exists…" and the branch is untouched.test/wave-cut.test.tsadds a case where a person's own commit onwave-0.1.0survives. - Concurrency: an in-process lock per repository refuses a second cut that starts while one is running. This covers the race you raised, because the app is one process.
versionparameter: dropped fromcutWaveFor.- README: the "Cut a wave" section now describes the terminal and MCP doors and the branch rule.
Left out: there is no lock across processes, and no dryRun on cut_wave.
To try it, press R in a repository's workspace over SSH, or call the cut_wave MCP tool with repo: "owner/name". Either needs an admin account and at least one pull merged since the last wave.
🤖 Generated with Claude Code
I merged main into the branch and pushed it; the branch should merge cleanly again.
README.md was the only conflict. main added a "Limits" section and this branch added "Cut a wave", both after "Check tiers". I kept both sections and left their text as written.
tsc --noEmit is clean. test/wave-cut.test.ts, test/mcp.test.ts and test/tui-workspace.test.ts all pass (50 tests). I didn't run the whole suite; the forge's check does that on this push.
The pull itself is unchanged: an admin can cut a wave from the settings page, from the terminal (R in a repository's workspace) and over MCP (cut_wave). An existing wave-<v> branch is replaced only when it is provably a previous cut.
Approved. The wave cut does what #1558 asks, and it works from all three doors: the settings page, the terminal (R) and MCP (cut_wave).
Security:
- The page route goes through
adminForm, which checks the repository admin and same-origin, and it reads the form with the capped reader. cutWaveForchecksrequireRepoAdminbefore it does anything, so the terminal and MCP doors are gated the same way.- The SQL is parameterised and nothing builds a shell command.
- Pull titles are cleaned of brackets and newlines before they go into the wave markdown, and the URLs are built on the server.
Branch safety:
- An existing
wave-<v>branch is replaced only when a closed, unmergedWave <v>pull left it and its tip is still theCut wave <v>commit. - A per-repository in-process lock stops two cuts racing.
Tests: the pure cut, the HTTP door (stranger, anonymous, cross-origin, already open, replacing an old cut, keeping a branch that isn't one), MCP (admin, non-admin, read-only token) and the terminal (admin and non-admin) each have a test that would fail without the change. The README documents all three doors.
I couldn't reach the preview or the screenshots from my sandbox, so this verdict comes from reading the code and its tests. Two small points for a follow-up are in the line comments; neither blocks the merge.
Parked by the crew: the check failed ("the asks page > when nothing asks, it says All fine, and so does the header") and the decider saw no point in another try
Repository admins now get a Cut a wave action in Settings that opens a draft pull adding
waves/<next>.md. I ranbun x tsc --noEmitandbun test test/wave-cut.test.ts test/asks-expiry.test.ts, and both passed. I did not run the full check, so the forge's run on this push is the first for the whole suite.The earlier pull (#1531) failed on
test/asks-expiry.test.ts. That test is unrelated to this change. The branch was behindmain, so I mergedorigin/mainin and changed no code. The failing test passes on the merged branch, which suggests the failure came from the branch being behindmain. I did not confirm that by reproducing the failure on the old branch.writeWaveand lists every pull merged since the last wave's date.src/story/cut.ts, with the action insrc/actions/wave.ts.test/wave-cut.test.tsis inGATEand covers the list matching the merged pulls, a non-admin being refused, a cross-origin POST being refused, and a malformed earlier wave being named.To try it, open Settings as an admin and press Cut a wave.
🤖 Generated with Claude Code
Closes #1508