Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
Codex Review SummaryThis 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. |
fd83334 to
1f8a315
Compare
BrickerP
left a comment
There was a problem hiding this comment.
Looks correct.
Bug: _create_string_type builds x-unsupported-pattern into the str Annotated path, but any format that maps through FORMAT_TYPES (uuid, date-time, email, …) returned via _constrain_raw_string and dropped the marker — breaking the module docstring’s third degrade promise for the common format-typed case.
Fix: Keep the Field(json_schema_extra=…) on the graceful path and wrap the format-typed result with Annotated[constrained, unsupported_pattern] so the marker survives. Pattern still dropped (not enforced), warning still emitted, remaining constraints still applied.
Tests: Cover plain string, string-format (uuid), non-string format (date-time), supported pattern (no marker), and minLength still enforced after an unsupported pattern is dropped.
Optional nit: CI checks aren’t reported on this branch yet (and the issue-link gate / missing-issue-link still needs maintainer assignment per CONTRIBUTING). Logic and regression coverage look solid either way.
|
I ran this on the PR head: the two new format tests fail on main (KeyError for the missing marker) and pass here, and the marker now appears for every FORMAT_TYPES entry (date-time, date, time, duration, uuid, email, uri, json) with and without minLength/maxLength, in object properties and inside an anyOf with null. The rest of the degrade path is unchanged: a uuid with an uncompilable pattern plus minLength=36 still rejects short strings and non-UUIDs, accepts a valid UUID, and the warning is still emitted. One small regression worth a look. If you want to keep it, a small cached helper restores it. Replacing the lines 480-485 tail with @lru_cache(maxsize=1024)
def _with_pattern_marker(constrained: Any, pattern: str) -> Any:
return Annotated[
constrained, Field(json_schema_extra={"x-unsupported-pattern": pattern})
]makes repeated calls return the same object again, and the five new tests still pass. A test asserting |
|
Fixed: the format route now goes through a cached |
`_create_string_type` drops a `pattern` Pydantic cannot compile and promises to preserve it as `x-unsupported-pattern`. The marker was built into `annotated`, but a string whose `format` maps to another Python type returned through `_constrain_raw_string` instead, discarding it - so uuid, date-time, email and the other format-typed strings carried no marker. Carry the marker onto that route as well. A cached `_with_pattern_marker` helper keeps the identity guarantee `_constrain_raw_string` provides, with regressions for both routes. Fixes PrefectHQ#5729
c593bac to
8f4840e
Compare
There was a problem hiding this comment.
Automated review by the FastMCP triage reviewer bot.
The format return path now retains the dropped-pattern marker, and the cached wrapper addresses the earlier type-identity concern. No further code defect was identified in this revision.
Checks
Retained verification reports the UUID and date-time marker tests failing on the base and passing here: all six focused tests and 569 adjacent tests pass. Independent contract probes remain pending.
|
Rebased onto current |
* Revert "fix: preserve referenced schema definitions (#5588)" This reverts commit 5f1d152. * Revert "fix(server): rebuild tool argument errors instead of echoing pydantic's (#6107)" This reverts commit 8fba5f7. * Revert "Advertise the MCP Apps extension only when the server serves an app (#5062)" This reverts commit b89222b. * Revert "fix(tasks): retain results after tool removal (#5507)" This reverts commit 711575a. * Revert "fix(client): Prevent stale ClientGroup refreshes from replacing newer routes (#5543)" This reverts commit 365d5d2. * Revert "fix(prompts): honor field aliases when rendering prompts (#5836)" This reverts commit a450fd8. * Revert "Stop FastMCP callable caches from retaining dropped tools (#6147)" This reverts commit 713f247. * Revert "feat(auth): Add KeystoneTokenVerifier (#6264)" This reverts commit c33f3de. * Revert "fix(json-schema): keep x-unsupported-pattern when a format is set (#5731)" This reverts commit dc9849d. * Revert "Roll back the tool stamp when a tool registration is rejected (#5798)" This reverts commit d6566c5. * Revert "fix(server): validate cursors when pagination is disabled (#6045)" This reverts commit 4917bee. * Revert "Keep constraints on scalar schema references (#6041)" This reverts commit e5176c9.
* fix: keep additionalProperties on object schemas without a type (#6127) Fixes #6124. Co-authored-by: Alperen Keleş <19610315+alpaylan@users.noreply.github.com> (cherry picked from commit 2a8f333) * Fix hydration of mutually recursive schema types (#6394) Fixes #6135. Supersedes #6137. Co-authored-by: wozhenbang2004 <113896798+wozhenbang2004@users.noreply.github.com> Co-authored-by: Alperen Keleş <19610315+alpaylan@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 0d7bb12) * Isolate filesystem component construction failures (#6210) Fixes #6209. (cherry picked from commit f911b58) * fix(config): apply tool transforms before tag filters on single servers (#6214) Fixes #6196. Co-authored-by: arjunprabhulal <11761445+arjunprabhulal@users.noreply.github.com> (cherry picked from commit 02c121c) * fix(tools): isolate mutable defaults in transformed tool calls (#6184) Fixes #6183. (cherry picked from commit b25a1c5) * fix(openapi): make resource templates for non-identifier path parameters readable (#6187) Fixes #6150. Co-authored-by: alpaylan <19610315+alpaylan@users.noreply.github.com> (cherry picked from commit 63f5718) * Keep constraints on scalar schema references (#6041) Fixes #6042. (cherry picked from commit e5176c9) * Document that a custom httpx_client_factory owns its timeout (#5923) Fixes #5922. (cherry picked from commit c9f64de) * Stop PingMiddleware erroring when the client has no back-channel (#5901) Fixes #5900. (cherry picked from commit 044a519) * Store sessionless client log levels on the connection (#5899) Fixes #5898. (cherry picked from commit c6e0c4d) * Register templated MCPMixin resources as resource templates (#5895) Fixes #5894. (cherry picked from commit 0c9f5f7) * Send the whole body when a body $ref with siblings cannot be flattened (#5893) Fixes #5892. (cherry picked from commit cad6074) * Pass the transport to the fastmcp-remote proxy so it forwards server-initiated requests (#5885) Fixes #5884. (cherry picked from commit 285dd4c) * fix(cli): forward path, stateless and log-level to SDK MCPServer servers (#5870) Fixes #5869. (cherry picked from commit 6dcec21) * fix(client): preserve a caller-provided OAuth httpx client factory when verify is set (#5849) Fixes #5848. (cherry picked from commit b7c6568) * fix(prompts): resolve postponed annotations when rendering (#5803) Fixes #5801. Co-authored-by: BlueX888 <140241684+BlueX888@users.noreply.github.com> (cherry picked from commit 3bf92a6) * Roll back the tool stamp when a tool registration is rejected (#5798) Fixes #5797. (cherry picked from commit d6566c5) * fix(openapi): hydrate data for wrapped non-object responses with validate_output=False (#5784) Fixes #5781. Co-authored-by: BlueX888 <140241684+BlueX888@users.noreply.github.com> (cherry picked from commit 6451faa) * Carry prompt argument titles through PromptArgument and proxies (#5749) Fixes #5748. (cherry picked from commit 288485c) * Relay the client's sampling result unchanged through proxies (#5747) Fixes #5746. (cherry picked from commit 19c349f) * fix(json-schema): keep x-unsupported-pattern when a format is set (#5731) Fixes #5729. (cherry picked from commit dc9849d) * fix(tasks): let async-generator tools run as background tasks (#5730) Fixes #5728. (cherry picked from commit c66e181) * Honor Code Mode search limits after BM25 ranking (#5715) Fixes #5712. Co-authored-by: BlueX888 <140241684+BlueX888@users.noreply.github.com> (cherry picked from commit ee71391) * Keep the client timeout from capping the HTTP read timeout (#5690) Fixes #5675. (cherry picked from commit bf95d12) * fix(auth): avoid rereading failed authorization forms (#5570) Fixes #5569. Co-authored-by: JordanAfolabiLaw <252951842+JordanAfolabiLaw@users.noreply.github.com> (cherry picked from commit e9f0443) * Fix unbounded Apps dev log retention (#5549) Fixes #5548. (cherry picked from commit 0a9a482) * Bound error-stat cardinality in ErrorHandlingMiddleware (#5537) Fixes #5536. (cherry picked from commit 089ff09) * fix(auth): preserve GitHub sessions across transient verification failures (#4881) Fixes #4854. Co-authored-by: benjohngf <7750978+benjohngf@users.noreply.github.com> (cherry picked from commit 3c6fbf7) * Expect the extended read timeout in the factory timeout test (#6395) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit d8c4edf) * fix(auth): keep revocation ownership separate from user identity (#6404) Fixes #5800. Builds on #5807. Co-authored-by: BlueX888 <140241684+BlueX888@users.noreply.github.com> Co-authored-by: Luck <232011771+67-luck@users.noreply.github.com> (cherry picked from commit cdec3a9) * Authenticate and pin the schema download in the OpenAPI performance test (#6177) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit a66dd71) * Resolve deferred defaults by alias and keep unverified GitHub scopes out of the cache Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit e064736) * Revert "Roll back the tool stamp when a tool registration is rejected (#5798)" This reverts commit 36a1264. * Revert "Keep constraints on scalar schema references (#6041)" This reverts commit 1ffb3e6. * Revert "fix(json-schema): keep x-unsupported-pattern when a format is set (#5731)" This reverts commit 9da9835. --------- Co-authored-by: zgy <101915083+bfs2021@users.noreply.github.com> Co-authored-by: Alperen Keleş <19610315+alpaylan@users.noreply.github.com> Co-authored-by: wozhenbang2004 <113896798+wozhenbang2004@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: ppy <285454460@qq.com> Co-authored-by: ayush <ayushkumarsaha32@gmail.com> Co-authored-by: arjunprabhulal <11761445+arjunprabhulal@users.noreply.github.com> Co-authored-by: Priyanshu Gupta <priyanshug26005@gmail.com> Co-authored-by: Shayan Ali <shayan.ali8799@gmail.com> Co-authored-by: Asem ahmed <94972604+asasemahmed@users.noreply.github.com> Co-authored-by: 哈基米 <140241684+BlueX888@users.noreply.github.com> Co-authored-by: Luck <2115759892@qq.com> Co-authored-by: Winoren <158550716+Winoren@users.noreply.github.com> Co-authored-by: nosmile99 <147114285+nosmile99@users.noreply.github.com> Co-authored-by: Aarnav Noble <98567595+AarnavNoble@users.noreply.github.com> Co-authored-by: 一片一片 <3037678834@qq.com> Co-authored-by: Junpei Zhang <1259636180@qq.com> Co-authored-by: JordanAfolabiLaw <252951842+JordanAfolabiLaw@users.noreply.github.com> Co-authored-by: mika <spacexstarship01@outlook.com> Co-authored-by: sui-ni2 <loxri127@gmail.com> Co-authored-by: benjohngf <7750978+benjohngf@users.noreply.github.com> Co-authored-by: Luck <232011771+67-luck@users.noreply.github.com>
Fixes #5729
The problem
_create_string_typedrops apatternthat Pydantic cannot compile, warns, and promises — module docstring, point 3 — to preserve the original in the type metadata asx-unsupported-pattern. The marker was built intoannotated, but a string whoseformatmaps to another Python type returns through_constrain_raw_stringinstead, and the marker went with it:The change
The graceful path records the marker field, and the
formatroute wraps its result with it. Nothing else about either route changes: theUserWarningis still emitted, the unparseablepatternis still dropped rather than enforced, andminLength/maxLength/ a supportedpatternstill apply.Testing
tests/utilities/test_json_schema_type_unsupported_pattern.py(5 cases): the marker without a format, with a string format (uuid), with a non-string format (date-time), no marker for a supported pattern, and the other constraints still applying on the format route.Both failures are the reported
KeyError— the marker is absent — not an incidental error.