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

A file edit's refusal words live in one module, src/actions/edit_words.ts, and the contents route reads them from there #5547

Merged opened this

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

Merged

`editMessage` moves out of `src/http/api.ts` into a new module, `src/actions/edit_words.ts`, with no change to its body. It is still one exported function that takes a kind string and returns a sentence. The MCP `write_file` tool can now import the same refusal words that `POST …/contents` uses instead of copying them. In `api.ts` the function is removed and one import is added; nothing else in th…

shipped production is serving it deploy bbd5a0b

opened this

editMessage moves out of src/http/api.ts into a new module, src/actions/edit_words.ts, with no change to its body. It is still one exported function that takes a kind string and returns a sentence. The MCP write_file tool can now import the same refusal words that POST …/contents uses instead of copying them. In api.ts the function is removed and one import is added; nothing else in the file changes, so the two call sites (editError and the pull_failed reply) are untouched.

One departure from the issue: the issue names test/edit-words.test.ts for the new test, but that file already exists. It holds an unrelated suite about editing an issue's or pull's title and body. I kept it as it was and put the new test in test/edit-refusal-words.test.ts. It checks the exact sentence for each kind (protected_branch, file_too_large, commit_too_large, branch_moved, land_refused, pull_failed) and that an unknown or empty kind gets the default sentence.

Checked:

  • The new test passes: 7 tests.
  • Every test file that mentions /contents passes unchanged: 36 files, 500 pass, 1 skipped, 0 fail.
  • The existing test/edit-words.test.ts passes.
  • bun x tsc --noEmit is clean.

Left out on purpose: nothing in write_file or the MCP layer changes here. Moving the words is the whole of this pull.

To look at: git diff main -- src/http/api.ts shows only the removed function and the added import.

🤖 Generated with Claude Code

Closes #5544

commented

editMessage moves out of src/http/api.ts into a new module, src/actions/edit_words.ts, with no change to its body. It is still one exported function that takes a kind string and returns a sentence. The MCP write_file tool can now import the same refusal words that POST …/contents uses instead of copying them. In api.ts the function is removed and one import is added; nothing else in the file changes, so the two call sites (editError and the pull_failed reply) are untouched.

One departure from the issue: the issue names test/edit-words.test.ts for the new test, but that file already exists. It holds an unrelated suite about editing an issue's or pull's title and body. I kept it as it was and put the new test in test/edit-refusal-words.test.ts. It checks the exact sentence for each kind (protected_branch, file_too_large, commit_too_large, branch_moved, land_refused, pull_failed) and that an unknown or empty kind gets the default sentence.

Checked:

  • The new test passes: 7 tests.
  • Every test file that mentions /contents passes unchanged: 36 files, 500 pass, 1 skipped, 0 fail.
  • The existing test/edit-words.test.ts passes.
  • bun x tsc --noEmit is clean.

Left out on purpose: nothing in write_file or the MCP layer changes here. Moving the words is the whole of this pull.

To look at: git diff main -- src/http/api.ts shows only the removed function and the added import.

🤖 Generated with Claude Code

Approved

Clean, pure move. The body of editMessage in src/actions/edit_words.ts is identical to the base src/http/api.ts:1007-1024, api.ts loses only the function and gains one import, and both call sites (editError, the pull_failed reply) keep their behaviour. No new input, output, auth or write surface, so the security list and the terminal door have nothing new to gate; no dependency added. The test pins every kind's exact sentence plus the default, and would fail on any drift of the words. Naming the test test/edit-refusal-words.test.ts instead of the issue's test/edit-words.test.ts is right: that name is already taken by an unrelated suite, and the pull says so. Preview is up (/ answers 200). This unblocks the MCP write_file door importing the same words rather than copying them (#5504).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs