Skip to content

Review follow-ups for 0.10.1: a late schema defect is -32603, the missing tests, the dead clause, the pattern cost - #79

Merged
HackTuah merged 1 commit into
mainfrom
fix/review-follow-ups
Oct 7, 2026
Merged

HackTuah merged 1 commit into
mainfrom
fix/review-follow-ups

Conversation

@HackTuah

Copy link
Copy Markdown
Member

Sean's non-blocking points from the 0.10.1 review, one commit:

  • A tools/call against a schema the catalog made unenforceable after startup is now -32603 naming the tool and keyword, not an "invalid arguments" tool result (the test fails on 0.10.1's server).
  • Tests: additionalProperties as a schema (kills the surviving mutant), list-form type refusal, every README keyword accepted well-formed.
  • The unreachable when key in @enforced clause and its list removed.
  • Threat model: one sentence in the arguments row on pattern cost (inside the row: no threat or status moves, so the 1.0.0 clock is unaffected).
  • CHANGELOG: the change, plus 0.10.1's nil reason now reading null.

Left for later, as the review said: compiling the schema once at startup (it touches ToolSpec, a public struct). Local gate: sixteen steps pass.

…sing tests, the dead clause, the pattern cost

From Sean MacGuire's review of 0.10.1. A tools/call against a schema the catalog made
unenforceable after startup is answered -32603 naming the tool and the keyword (it was a
tool result saying "invalid arguments", blaming the client); the new test fails on 0.10.1's
server. Tests for additionalProperties as a schema (it kills the review's surviving mutant,
the branch replaced by :ok), a list-form type refusing a value of none of its types, and every
README keyword accepted well-formed; the `when key in @enforced` clause, which no keyword could
reach, and the list it read are removed. The threat model's arguments row says what `pattern`
costs (PCRE's match limit, fail closed; 80 ms measured for the worst case a lane tried), inside
the row so no threat or status moves. CHANGELOG: the change, and 0.10.1's `nil` reason
reading `null`, recorded late. The stdio test helper says why its device is latin1.
Gate: sixteen steps pass.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
@HackTuah
HackTuah requested a review from minitru September 26, 2026 19:28
@HackTuah
HackTuah merged commit 08e294e into main Oct 7, 2026
15 checks passed

@minitru minitru left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The schema is now checked twice per call. validate_and_dispatch calls Schema.check_schema, then Schema.validate, which calls check_schema again and then compile_patterns. Every pattern is compiled three times per tools/call. It's the cost the PR defers ("compile once at startup"), but this change makes it worse first. A cheap fix is a validate variant that skips the re-check.
The -32603 text can carry an inspected Elixir term. The check_schema reason uses inspect(key) for a non-string keyword and inspect(name) for a non-string property name, and that reason now goes into the error message. The threat model's leak row says a -32603 never carries an inspected term. The comment's argument (already advertised in tools/list) holds for string keys but not for these two branches. Only a host bug triggers it, but the claim and the code disagree.
The keyword list still lives in two places. Removing @enforced was right, since the clause was unreachable. But the new "every README keyword" test hand-copies the nineteen names, so the README and the test can drift. Parsing the list out of the README would make the test match its name.
Prompts keep the old behaviour. prompt_arguments still turns a schema defect into "invalid arguments" (-32602). That schema is derived by the package, so it's probably unreachable; a one-line comment saying so would close the question.

The -32603 test is good: it uses a catalog that changes after startup, asserts both the tool name and the keyword, and cleans up the process dictionary.

@minitru minitru left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Posted here by mistake. This was the review of PR 80 and has moved there: #80 (review). It does not request changes to this PR.

@minitru minitru left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Posted here by mistake. This was the review of beam_mcp_signer PR 13 and has moved there: ScriptKittyOS/beam_mcp_signer#13 (review)

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.

2 participants