GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||
GeezerVison is showing github.com — mcpx: validate accepted form answers against requestedSchema at the broker (#1954) by dezren39 · Pull Request #2646 · developing-today/code Conversation
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: a9cc5f4e47
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if err := schema.ValidateJSON(a.Content); err != nil { | ||
| return fmt.Errorf("accepted content does not match the requested schema: %w", err) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Apply schema defaults before validating broker answers
When a required property has a schema default, an answer that omits it is now rejected even though this was previously supported. For example, accepting {} against a schema requiring name with default "John Doe" fails here. In the daemon path, elicitViaBroker waits for the broker answer before returning to Client.answer, which applies defaults in internal/mcpclient/modern.go; this new check prevents that normalization from running. The existing omitted-field-with-default-validates test in internal/mcpclient/elicitation_schema_test.go explicitly preserves this behavior. Apply the same defaults before broker validation while preserving explicitly supplied values.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in f5f591c: Broker.Respond now validates the accepted content after filling missing top-level fields from the requested schema's defaults (new withSchemaDefaults helper in pkgs/mcpx/internal/elicit/elicit.go, mirroring mcpclient's applyDefaults). Validation-only — the recorded answer stays as given, since the daemon path applies defaults again at relay. An explicitly supplied wrong-typed value is still refused. Covered by TestRespondAppliesSchemaDefaultsBeforeValidation.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if err := schema.ValidateJSON(a.Content); err != nil { | ||
| return fmt.Errorf("accepted content does not match the requested schema: %w", err) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Correct recipe JSON schemas before enforcing them
For a recipe with a missing json or array placeholder, this check now rejects previously usable array answers such as {"items":[1,2]}. In the daemon recipe path, consumer.go builds the question using recipes.FormSchema, whose jsonType maps every TypeJSON placeholder to "object". However, recipes.go explicitly defines TypeJSON to include arrays and arbitrary JSON values, and its renderer accepts those values unchanged. Before this commit those answers reached resolveRecipe and rendered successfully; now they are refused and the recipe remains blocked awaiting an answer. Update the generated recipe schemas to represent the supported JSON values when introducing this enforcement.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in f5f591c: recipes.FormSchema no longer declares a type for TypeJSON placeholders (jsonType returns "" and the field is emitted without a "type" key) — TypeJSON accepts any JSON value and the renderer passes it through untouched, so generated schemas now represent that. Covered by TestFormSchemaJSONPlaceholderAcceptsAnyJSONValue, which compiles the generated schema with schemaval and verifies both array ({"items":[1,2]}) and object answers validate.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Program-tending check-in (tracking: #1352) — this PR has had no activity since 2026-10-30T11:30Z (~7.2 days), so it gets the 7-day owner check-in. What it's waiting on: a merge decision. The head (a9cc5f4, 1 commit, 2 files, for #1954) reports no CI checks beyond a skipping CodeRabbit pass — no test run exists on this head to judge it by. Next concrete step: rebase/re-run so CI produces a signal on the current head, then merge or close as superseded if the #1954 validation landed another way. — program-tending, 2026-11-06 run |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…roker (#1954) Criterion 2 of #1954: Broker.Respond recorded accepted answers from the CLI, dashboard and daemon routes without checking them against the question's requestedSchema, so the waiter relayed unchecked content upstream (the mcpclient path already validated answers mcpx relays as a client). Respond now compiles r.Schema with schemaval and refuses a mismatching accept with the failing paths; the question stays pending for a corrected answer. An uncompilable schema is the asker's defect: the answer is recorded unvalidated, mirroring the mcpclient rule. Decline/cancel, URL/sample modes and schema-less questions are untouched. Criterion 1 (terminal-row pruning) was already on main via #1677 (pruneTerminal on Open, defaults.ElicitRetention*, prune_test.go) -- no change needed there; this PR says so on #1954.
…kes any JSON value Codex review on #2646: (1) Broker.Respond now validates an accepted form answer after filling missing fields from the requested schema defaults (validation-only; the recorded answer stays as given), mirroring mcpclient applyDefaults. (2) recipes.FormSchema no longer declares type object for TypeJSON placeholders, so array answers the renderer accepts are not refused. Also fixes the validate_test.go module import path left over from the dezren39/mcpx rename. Tests: new TestRespondAppliesSchemaDefaultsBeforeValidation and TestFormSchemaJSONPlaceholderAcceptsAnyJSONValue.
a9cc5f4 to
f5f591c
Compare
|
🤖 Agent note · shepherding (task 13361, lane code-a)
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
🤖 Agent note · done
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: f5f591cd9a
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if err := schema.ValidateJSON(withSchemaDefaults(r.Schema, a.Content)); err != nil { | ||
| return fmt.Errorf("accepted content does not match the requested schema: %w", err) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Preserve recipe coercion for numeric and boolean answers
When a recipe asks for a missing numeric or boolean placeholder, answers supplied through the CLI's supported key=value form now fail this validation: internal/cli/elicit.go encodes every value as a string, so count=3 becomes {"count":"3"}. Previously, elicitPlaceholders passed that answer to the recipe renderer, which explicitly accepts numeric strings and boolean strings; TestRenderValidatesTypedPlaceholderValues preserves both behaviors. The generated recipe schema instead requires native JSON numbers or booleans, so these previously usable answers are rejected and the recipe stays pending. Normalize recipe answers using the renderer's supported coercions before enforcing their schema, or otherwise preserve this input path.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.