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

A setting's out-of-range refusal and an app's members refusal live in one module, and the API and MCP read them from there #5577

opened this

Merged 37d 21h ago, live in production

Two refusal sentences now live in one module, and the API and MCP doors both read them from it: "that value is outside what this setting takes" "the people an app names are its writers' to choose" The new module is src/actions/settingwords.ts, which exports both as a const object, SETTINGWORDS (outOfRange and appMember…

Notes

opened this

Two refusal sentences now live in one module, and the API and MCP doors both read them from it:

  • "that value is outside what this setting takes"
  • "the people an app names are its writers' to choose"

The new module is src/actions/setting_words.ts, which exports both as a const object, SETTING_WORDS (outOfRange and appMembersForbidden).

What moved

  • src/http/api.ts: the members refusal in membersAnswer and the capacity PUT refusal now use SETTING_WORDS.
  • src/http/mcp.ts: the app_members tool's forbidden answer and the capacity tool's out-of-range answer now use SETTING_WORDS. Each edit touches only the literal's own line, plus one import line next to the app_members import, so it should merge cleanly with parallel MCP work.
  • limits is not touched. Neither sentence appears there: its out-of-range answer passes on changed.error.message from the action, so there was nothing to move.

The wording is unchanged. A search of src/ now finds each sentence only in the module.

Test test/setting-words.test.ts triggers each refusal through each door:

  • Out of range: PUT /api/v1/admin/capacity/checks.concurrency with value: "0" returns 422, and the MCP capacity tool with dryRun: false refuses the same value.
  • Members: a non-writer with an admin-scope token asks for GET /api/v1/repos/alice/garden/app/members and gets 403, and the MCP app_members tool refuses them too.

In every case the message must match the module's sentence. A third test scans src/*/.ts and fails if any file other than the module types either sentence. That catches a door that copies the words back in unchanged, which the per-door checks alone would not.

Checked before pushing: test/setting-words.test.ts, test/capacity.test.ts, test/app-members.test.ts and test/limits.test.ts all pass unchanged (28 tests), and bun x tsc --noEmit is clean. I did not run the full suite; the forge's check does that on this push.

🤖 Generated with Claude Code

Closes #5563

3 earlier comments
commented

Two refusal sentences now live in one module, and the API and MCP doors both read them from it:

  • "that value is outside what this setting takes"
  • "the people an app names are its writers' to choose"

The new module is src/actions/setting_words.ts, which exports both as a const object, SETTING_WORDS (outOfRange and appMembersForbidden).

What moved

  • src/http/api.ts: the members refusal in membersAnswer and the capacity PUT refusal now use SETTING_WORDS.
  • src/http/mcp.ts: the app_members tool's forbidden answer and the capacity tool's out-of-range answer now use SETTING_WORDS. Each edit touches only the literal's own line, plus one import line next to the app_members import, so it should merge cleanly with parallel MCP work.
  • limits is not touched. Neither sentence appears there: its out-of-range answer passes on changed.error.message from the action, so there was nothing to move.

The wording is unchanged. A search of src/ now finds each sentence only in the module.

Test test/setting-words.test.ts triggers each refusal through each door:

  • Out of range: PUT /api/v1/admin/capacity/checks.concurrency with value: "0" returns 422, and the MCP capacity tool with dryRun: false refuses the same value.
  • Members: a non-writer with an admin-scope token asks for GET /api/v1/repos/alice/garden/app/members and gets 403, and the MCP app_members tool refuses them too.

In every case the message must match the module's sentence. A third test scans src/*/.ts and fails if any file other than the module types either sentence. That catches a door that copies the words back in unchanged, which the per-door checks alone would not.

Checked before pushing: test/setting-words.test.ts, test/capacity.test.ts, test/app-members.test.ts and test/limits.test.ts all pass unchanged (28 tests), and bun x tsc --noEmit is clean. I did not run the full suite; the forge's check does that on this push.

🤖 Generated with Claude Code

commented

A setting's out-of-range refusal and an app's members refusal are now written once, in src/actions/setting_words.ts. The REST API (src/http/api.ts) and the MCP tools (src/http/mcp.ts) both read them from there instead of each typing its own copy. Behaviour doesn't change: each door gives the same sentence it gave before.

test/setting-words.test.ts checks that each door answers with the module's sentence. It also checks that no other file under src/ types that sentence out again, so a new copy fails the test.

This includes a merge of main. The only conflict was the import block in src/http/api.ts: main added SPEND_WORDS from src/actions/spend_words.ts on the same line where this branch adds SETTING_WORDS. Both imports are kept.

After the merge, the type check passes. The setting, spend and member tests also pass: 18 files, 0 failures, 1 skipped.

To try it, ask the API or MCP to set a setting outside its allowed range: both answer with the sentence from setting_words.ts.

🤖 Generated with Claude Code

commented

Steward: this pull is approved but no longer merges into main. #5932 split src/http/mcp.ts into one file per tool, and several other shared files moved. Bring it up to date with main: merge main and resolve keeping this pull's intent. If it adds or changes an MCP tool, move that into its own file in the new layout and regenerate the docs. Then let the check run. If the change is already on main, say so and close the pull.

commented

The out-of-range refusal for a capacity setting and the refusal for an app's members now come from one module, src/actions/setting_words.ts, which holds them as plain data. The API and the MCP tools read them from there and no longer type the sentences out themselves. The words stay exactly the same.

This update merges main, where #5932 split src/http/mcp.ts into one file per tool:

  • The pull's change is now in the new per-tool files: src/http/mcp/tools/app_members.ts and src/http/mcp/tools/capacity.ts read SETTING_WORDS. mcp.ts is main's version unchanged.
  • In src/http/api.ts, the SETTING_WORDS import sits next to main's new ADMIN_WORDS import.
  • No MCP tool is added and no tool's interface changes, so the generated docs did not need regenerating.

The type check passes. test/setting-words.test.ts, test/capacity.test.ts and test/app-members.test.ts ran 22 pass, 1 fail. The failure is in test/capacity.test.ts ("reported: the Capacity page says it once, as a note; vitals do not"). It expected no admin notes and got "Disk is nearly full: 9% free.", which reflects this machine's disk; this pull changes no capacity behaviour. The test that checks no other file under src/ types the sentences still guards the new per-tool layout.

Left alone on purpose: the Capacity page's sentence-cased invalid_value and the OpenAPI description. They are different strings and the issue covers only the API and MCP.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs