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

A fork can be severed from its upstream by its owner in one confirmed action that keeps all history #14550

Merged opened this

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

Merged

The MCP fork tool now has an action: "sever". That was the one gap in this issue; the page, the receipt and the tree row were already on main. I ran test/fork-sever.test.ts, test/mcp-size.test.ts and the two MCP-doc tests, and they pass.

Notes

shipped production is serving it deploy 4ec2c16

opened this

The MCP fork tool now has an action: "sever". That was the one gap in this issue; the page, the receipt and the tree row were already on main. I ran test/fork-sever.test.ts, test/mcp-size.test.ts and the two MCP-doc tests, and they pass. tsc and the gate are clean. I did not run the full suite.

What was already on main

  • #11404 and #13453 gave the fork's Danger zone a confirm page and a plan saying what stops and what stays.
  • Together they cover the page confirm, the cleared parent link, the tree's "severed" row and the history receipt.
  • The detach MCP tool was already there.

What changed

  • fork tool: { repo, action: "sever", dryRun? } calls the detach tool's own code, so the plan sentence and the refusals are the same words as the page. dryRun is true unless you send false, and the real call needs an admin token. A read-only token can ask for the plan. It adds an action, not a tool, and test/mcp-size.test.ts still passes with no ceiling raised.
  • Docs: docs/MCP.md documents the new action.
  • Test: test/fork-sever.test.ts now plans through the MCP action and checks the words. It then severs and checks that the parent link is cleared, the tree row reads "severed", and the former parent's offers and visible-forks lists no longer contain the fork.

Not done

  • The page button still reads "Detach from parent", not "Sever from upstream". Renaming it would touch confirm-detach and danger-language tests that pin that label, and the page already uses severing words in its plan and receipt.
  • I did not add a second page for the same action.
  • I did not check that the receipt line appears in the fork's own feed. It is the existing repo.detached event, and I did not test that path.

Try it: call the MCP fork tool with { repo: "you/fork", action: "sever" } for the plan, then add dryRun: false with an admin token to sever it.

Closes #14482

Show 1 earlier items

7 earlier comments · 1 event
commented

I fixed both gate failures and pushed. The gate now passes locally with no output, and tsc is clean. The four tests in test/fork-sever.test.ts pass. The forge's check has not run on this push yet.

  • as never casts: the MCP sever test no longer builds a fake context. It starts the real server, mints an admin token, and calls fork with action: "sever" over /mcp. It still checks the plan words, that the parent link is cleared, the "severed" tree row, and that the former parent's offers no longer list the fork.
  • "both doors" rule: I did not add a terminal change. The terminal can already detach a fork from its parent, from the "Detach from parent" entry in the about screen. The MCP action reuses the same plan, so the commit message carries a "No door:" line saying so.

The page, receipt and tree row were already on main, so this pull is only the MCP fork action, its docs line and the test. The page button still reads "Detach from parent", not "Sever from upstream", because renaming it would break tests that pin that label.

To try it, call the MCP fork tool on a fork you own with { repo, action: "sever" } for the plan. Add dryRun: false and an admin token to do it.

commented

I merged main into this branch and pushed. The branch should merge cleanly again.

The only conflict was in src/http/mcp/tools/fork.ts, in the fork tool's doc string and its action enum. main had added a withdraw action and a withdrawn receipt state. This branch had added sever. I kept both: the enum is now offer | receipt | withdraw | sever. The doc text covers withdraw and sever together, and the receipt states include withdrawn.

  • Tests: The five test files I ran cover the MCP door, the MCP tools, the doc-names-every-argument check and the sever/withdraw tests. All 229 tests pass. I did not run the whole suite; the forge runs the full check on the push.
  • Other checks: bun x tsc --noEmit is clean. bun scripts/gate.ts --fix printed nothing and left nothing to commit.
  • Test selection: scripts/fast.ts named a very large list of test files. I stopped that run and picked the five files above myself instead. It is still running in the background and I did not check its result.
Changes requested — before the latest push

The MCP fork action sever is sound: it reuses detach, keeps the admin-token gate for the real call, and readsWhen lets a read-only token ask for the plan only. Two things miss the issue.

  1. Box 1 says the owner taps "Sever from upstream" on the fork settings. The page still says "Detach from parent". Rename the button and its confirm page to "Sever from upstream", and update the confirm-detach and danger-language tests that pin the old label. A test that pins a wrong label is a test that was wrong; say so in the pull.
  2. Box 2 wants a receipt line in the fork feed. The new test does not assert it. Assert in test/fork-sever.test.ts that the repo.detached event is written for the MCP path, so the claim is covered.

Smaller: in docs/MCP.md the new sentence sits between the token-free-tools paragraph and the offer paragraph, which breaks that flow. Move it next to the other fork actions. Also confirm the terminal about-screen entry uses the same "Sever from upstream" words after the rename.

commented

All three review points are addressed and pushed to #14550 (59ecd5fb5). tsc, the gate and design-lint are clean. I ran six test files covering the sever, detach and MCP door paths, and all 23 tests pass. I did not run the full suite; the forge runs it on the push.

  • Label: "Detach from parent" is now "Sever from upstream" in four places: the Danger zone button and heading in src/web/pages/detach.ts, the confirm page verb in src/web/pages/search.ts, the terminal about-screen confirm title and its x key binding (now "sever from upstream"), and docs/features/detach.md. The about-screen confirm button still reads "Detach". I left it because the title now carries the new words.
  • Tests that were wrong: confirm-detach, danger-language, fork-detach and tui-about-detach pinned the old label, so I changed them to the new one. The behaviour they check is unchanged.
  • Receipt line: the MCP sever test in test/fork-sever.test.ts now asserts that exactly one repo.detached event is written for the fork.
  • Docs: the fork sever sentence in docs/MCP.md moved out of the token-free-tools paragraph to sit after the offer paragraph.

The "detach from it" link on an archived parent's quiet line in src/web/pages/following.ts still says "detach". The review didn't name it, so I left it; say if you want it renamed too.

commented

<!-- look-pages 59ecd5fb53d5 --> Look pages for 59ecd5f, from the gate:

  • look pages (none): this pull changes src/web/pages/detach.ts, src/web/pages/search.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I pushed a fix for the one failure this pull caused, /llms.txt stays under its byte budget. The other four named failures I did not fix: one is red on main too, and three I did not diagnose (see below).

Fix: the fork tool's doc string had grown with the sever text, which pushed the signed-in /llms.txt to 80,638 bytes against its 80,500 ceiling. I trimmed the wording in src/http/mcp/tools/fork.ts and left the offer, receipt, withdraw and sever actions and their arguments intact. I did not raise the budget.

Tests: six files covering llms-budget, the MCP doc and door checks, and fork-sever pass (219 tests), and tsc is clean.

Left alone:

  • Index test: docs-link ("the index is four sections…") also fails on main at 5a01a25, so it isn't this pull's. It still fails when I run it here.
  • Not diagnosed: I did not look into the "findings are stored under its run" test (it took 30 s in the check), the "an old unclaimed child is flagged" test (1.0 s) or the archive test. I ran the forges and archive ones once after the fix and they passed here. The findings test I did not run.

Look pages: gate.ts says it could not infer a look page for the detach.ts and search.ts changes, and that the pull needs a "Looks: <path>" or "No look: <why>" line. I did not add one. The reviewer decides.

commented

The "Looks:" line you asked for is in the description below. I changed no code this round and pushed nothing, because the gate wants that line in the pull text.

What changed: A fork's owner can sever it from its upstream in one confirmed action that keeps all history. The control is now called "Sever from upstream" everywhere it appears. That covers the Settings › Danger zone button and heading, the confirm page, and the terminal about-screen, both its x key binding and its confirm title. The MCP fork tool gained action: "sever". It reuses detach: dryRun (the default) returns the plan in the page's words, and dryRun: false needs an admin token. A read-only token can ask for the plan only. The repo.detached receipt line is now asserted for the MCP path in test/fork-sever.test.ts. docs/MCP.md has the sever note beside the other fork actions. I trimmed the fork tool's doc so /llms.txt stays within its byte budget.

Tests that were wrong: confirm-detach, danger-language, fork-detach and tui-about-detach pinned the old "Detach from parent" label. I updated them to the new label. The behaviour they check is unchanged.

Left out:

  • The "detach from it" link on an archived parent's quiet line (src/web/pages/following.ts) still says "detach".
  • The about-screen confirm button still reads "Detach".
  • test/docs-link.test.ts is red on main too and is not this pull's.

Looks: /settings/danger — the fork settings Danger zone, where the "Sever from upstream" button and heading live. The confirm page is /<owner>/<repo>/settings/detach. The gate could not trace the route for /settings/security/controls, which is not a page this pull touches.

[
  {"go": "/<owner>/<fork>/settings/danger", "look": "The Danger zone section headed Sever from upstream, with a button of the same name", "expect": "No 'Detach from parent' wording anywhere on the page", "ask": "Does the section read clearly for a fork you own?"},
  {"go": "/<owner>/<fork>/settings/detach", "look": "The confirm page after pressing Sever from upstream", "expect": "Title 'Sever <owner>/<fork> from its parent?' is not required; the verb reads Sever from upstream and the text says what stays and what stops"}
]

Try it: Open a fork you own, go to Settings › Danger zone, and press Sever from upstream. Over MCP, call fork with { repo, action: "sever" } for the plan, then dryRun: false with an admin token. Run bun test test/fork-sever.test.ts test/confirm-detach.test.ts test/danger-language.test.ts.

commented

<!-- look-pages 967212fe2e1e --> Look pages for 967212f, from the gate:

  • look pages (none): this pull changes src/web/pages/detach.ts, src/web/pages/search.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

A fork's owner can sever it from its upstream in one confirmed action that keeps all history. This push only adds the look-pages statement the gate asked for. No code changed.

  • Look pages: the gate couldn't infer a page for src/web/pages/detach.ts and src/web/pages/search.ts. It was tracing /settings/security/controls, which is the nearest page in app.looks but is the security-controls page, unrelated to either file. I added an empty commit with a No look: line saying why. The sever confirm page and the search hit render per repository, and no page in app.looks reaches a repository's settings.
  • Checks: bun scripts/gate.ts ran clean before the push. I did not re-run tsc or the tests, since nothing but the commit message changed.
  • To try it: open a fork's settings, choose Sever from upstream, confirm, and the repo.detached receipt appears.
Approved

Approved. The earlier asks are met: the label reads Sever from upstream on the Danger zone, the confirm page and the terminal (x key and title). The MCP sever path asserts the repo.detached receipt, and the docs line sits beside the other fork actions. The MCP sever action reuses the detach tool, so the admin-token and admin-of-repo checks and the plan words are the same as the page. A read-only token can only get the plan. No new dependency, and the README is untouched.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs