Skip to content

Refuse and hide signup settings nothing reads in the MCP tools - #353

Merged
richshaw merged 1 commit into
mainfrom
claude/eager-feynman-um80wv
Oct 3, 2026
Merged

richshaw merged 1 commit into
mainfrom
claude/eager-feynman-um80wv

Conversation

@richshaw

@richshaw richshaw commented Oct 3, 2026

Copy link
Copy Markdown
Owner

What this changes

update_signup accepted four settings that nothing in the app reads, stored them, and reported success:

  • requireEmail: the sign-up form and commitToSlot always require an email.
  • allowNotes: the notes box always shows.
  • showWhoSignedUp: the public page shows how full each slot is and never who signed up, whatever this says.
  • confirmationMessage: nothing prints it, on the success screen or in the confirmation email.

These now join maxCommitmentsPerParticipant in a single UNREAD_SETTINGS list in src/mcp/tools/signups-read.ts. That one list drives both sides:

  • Writes: SparseSettingsSchema omits every key in the list and stays .strict(), so a client that sends one gets invalid_input on settings and nothing is stored. The confirmationMessage nullable extension is gone.
  • Reads: settingsOut hides the same keys from the settings that get_signup, create_signup and update_signup return. Every stored row carries these keys, because createSignup fills in the schema defaults, so before this change every get_signup reported showWhoSignedUp: true. Names are never public, so that value was wrong.

The update_signup description no longer says to clear confirmationMessage with null. It now says there is no setting to limit spots per person, make the email address optional, turn off notes, list who signed up on the public page, or add a confirmation message. It says what the tool does, and the registry.test.ts wording check passes. instructions.ts doesn't mention settings, so it's unchanged.

Re-checked before changing anything

A fresh grep of src/ (leaving out tests, src/schemas/signups.ts and the MCP tool) still finds no reader for any of the four. Issue #347 (optional email) is still open with no linked PR, so requireEmail is still unread.

One correction to the original report: the public page does not show participants' names. It only gets per-slot counts (committedBySlot) plus the visitor's own sign-ups from their cookie. So the risk with showWhoSignedUp was the other way round. An assistant asked to show who signed up would have reported success while names stayed hidden. It was still a setting that did nothing, and the read side was reporting a false true.

Other places that take settings

  • create_signup: not affected. Its input is FullDraftSchema, which has no settings object, only groupBy, and persistDraft passes nothing else through.
  • REST POST /api/signups and PATCH /api/signups/[id]: not changed. They parse with the full SignupSettingsSchema and still accept these keys. They are cookie-only (the browser's own backend), and the builder round-trips the whole settings object: the build page parses it with SignupSettingsSchema.parse, which fills in the defaults, and useBuildState sends it all back on every group-by or reminder save. Refusing the keys there would break those saves. Fixing REST properly means taking the keys out of SignupSettingsSchema first (see below).

Should the keys leave SignupSettingsSchema?

I left them in, as asked. Neither check clearly calls for removal:

  • knip looks at exports, not at keys inside an object.
  • The "no speculative schema" rule is about DB columns, and settings is a column the app reads.

Still, I think they should go in a follow-up. Removing them looks low-risk. Zod objects drop unknown keys when parsing, so the build page would stop carrying them and the next builder save would drop them from the row. The fixtures in BuildWysiwyg.test.tsx and useBuildState.test.ts would need trimming. One catch: once removed, the REST routes would silently drop these keys rather than refuse them, unless the REST settings schema is also made strict.

Small note

updateSignup's mergeSettings path still turns null into "clear this key", but update_signup can no longer send a null setting, because none of the settings it accepts can be null. I left that service code alone. It's harmless, and it'll be needed again if an optional setting comes back.

Tests

  • signups-write.test.ts: the sparse-merge test uses settings that are still accepted and checks that the stored requireEmail is hidden from the result. A new parameterised test covers each unread key (with both a value and a null for confirmationMessage). For each one it checks that the key is missing from the advertised schema and description, that sending it returns invalid_input on settings, and that the service is never called. I confirmed these tests fail against the old code.
  • read.test.ts: get_signup hides all five keys from a stored row.
  • tools.db.test.ts: the old set-then-clear test for confirmationMessage now only covers closesAt. Each unread key is refused against Postgres and the stored settings stay byte-for-byte the same. The defaults stored for these keys are not shown.

Run locally:

  • pnpm lint && pnpm typecheck && pnpm knip && pnpm test: clean, 982 unit tests passed
  • pnpm test:db: 352 tests passed

🤖 Generated with Claude Code

https://claude.ai/code/session_012abFzQcchqTLVqcPV5fvof


Generated by Claude Code

update_signup accepted requireEmail, allowNotes, showWhoSignedUp and
confirmationMessage, and stored them, but nothing reads any of them: every
sign-up asks for an email, the notes box always shows, the public page shows
how full each slot is and never who signed up, and no screen or email prints
a confirmation message. An assistant could report a change that never
happened, and get_signup read back values participants never meet (every row
reported showWhoSignedUp: true while names are never public).

These join maxCommitmentsPerParticipant in one UNREAD_SETTINGS list.
update_signup's strict settings schema omits them, so a client that sends one
gets invalid_input, and get_signup, create_signup and update_signup hide them
from the settings they return. The update_signup description says these
things have no setting instead of telling the model to clear
confirmationMessage with null.

create_signup takes no settings beyond groupBy, so it needs no change. The
keys stay in SignupSettingsSchema: stored rows and the browser builder still
carry them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012abFzQcchqTLVqcPV5fvof

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The shared filtering and strict validation are consistent across read and write tools with adequate unit and database coverage.

Review effort: Balanced
Findings: None

What changed in this PR

This PR prevents MCP tools from accepting or returning signup settings that the application does not implement.

Changes:

  • Centralizes unread settings in UNREAD_SETTINGS.
  • Strictly rejects unsupported settings in update_signup.
  • Filters unsupported settings from MCP responses and expands coverage.
File Description
src/​mcp/​tools/​signups-write.ts Rejects unsupported settings and clarifies tool behavior.
src/​mcp/​tools/​signups-write.test.ts Tests schema omission, rejection, and response filtering.
src/​mcp/​tools/​signups-read.ts Defines and filters the shared unread-settings list.
src/​mcp/​tools/​read.test.ts Verifies unread settings are hidden.
src/​mcp/​tools.db.test.ts Verifies rejection and storage integrity with Postgres.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@richshaw
richshaw merged commit cae379f into main Oct 3, 2026
6 checks passed
@richshaw
richshaw deleted the claude/eager-feynman-um80wv branch October 3, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants