Repository navigation
Key request.body by HTTP method (#845, #861) - #870
Merged
Merged
Conversation
`request.body` now maps each of a route's declared methods to its own policy, so one path can take no body on GET and a required, schema-checked JSON body on POST. This matches OpenAPI, where each operation on a path has its own request body. It is the only way to write a body rule, including on a single-method route, and there is no alias for the old route-wide shape. - A key outside the route's `methods` fails at load. A method without an entry has no body policy. - GET, HEAD and DELETE entries may only set `maxBytes`, because RFC 9110 gives their content no defined meaning. `maxBytes: 0` refuses a body with 413. - Node, AWS and Vercel size the body read from the request method's policy (`requestLimit(target, method)`), and `checkRequest` applies only that method's policy. - The Cloudflare build writes one standalone validator per route and method. The artifact maps each method to its validator, and the Worker refuses to start when any method's validator is missing. - `explain`, `manifest`, the report, `get_schema`/`get_capability`, the authoring context, feature plans, readiness advisories and fixture suggestions all show the per-method shape. - review no longer gives #842's "declare one route per method" advice (`method-dispatch`). Branching on `request.method` is the specified shape for several methods on one path. SPECIFICATION.md no longer suggests splitting a path either. - The fixture runner now frames a case's body with Content-Length, so a GET body can be tested. - examples/body-validation adds a GET+POST `/requests` route. Every example, recipe, fixture and doc now uses the new shape. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
enabled auto-merge (squash)
September 28, 2026 22:13
jimhoyd
added a commit
that referenced
this pull request
Oct 1, 2026
…ion hint, shared env/secrets (#1131, #1132, #1133) (#1134) * fix(core): upgrade leaves a recorded site; add reports a record-only change (#1131) The reported failure came from a 0.6.5 `urlcode upgrade` moving a site to 0.6.6: that release's upgrade wrote no addon-files.lock.json at all, so the 0.6.6 `extensions list --strict` found every add-on unrecorded. The current upgrade already records moved add-ons inside its rollback, but an up-to-date site returned early, so re-running upgrade could never repair that state. - upgrade on an up-to-date site records each installed catalog add-on that still matches the installed core's pin and has no entry; a package npm moved off its pin is left for list --strict to report. UpgradeResult gains `recorded`, printed by the CLI. - writeFilesLock writes a temporary file and renames it into place, and a failed write is a ConfigError naming the file, so a record is never torn. - extensions|artifacts add reports `recorded` and says "Recorded the installed files of <name>" instead of "nothing to do" when only the record changed. - Tests: upgrade then list --strict passes with tarball-installed add-ons; an up-to-date unrecorded site is repaired; a mispinned one is not recorded; a record that cannot be written fails upgrade and rolls everything back; add reports the record write and "nothing to do" only for a true no-op. - docs/EXTENSIONS.md, CLI help and llms-full.txt describe it. Refs #1131 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): targeted migration hint for the route-wide request.body shape (#1132) Policy keys (required, maxBytes, contentTypes, format, schema) written directly under request.body in a route or a shared block, the shape #870 keyed by HTTP method, now fail with one legacy-request-body error before the schema runs, instead of a generic unknown-key error for the first one only. - The error is located at the first such place (file:line:column, pointer, key) and gives one instruction per route and shared block, each later one with its own line and column: the keys to move, the method keys to move them under, and a one-line before/after (key names only, never values). - A route with methods moves every key under each method that takes a body, and maxBytes alone under its GET/HEAD/DELETE. A route without methods answers GET and HEAD: maxBytes moves under both, and any other key gets the suggestion to declare methods: [POST]. A shared block uses the methods every route that uses it answers. - explainError (MCP explain_error) returns the error's own hint as its guidance, so the CLI, MCP validate and explain_error give the same text. - docs/HTTP.md gains "Moving from the route-wide body shape" with the before/after, which the hint links through docsUrl(). No alias and no rewriting. Refs #1132 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(config): shared blocks may carry env and secrets (#1133) Owner decision 2026-10-01 reverses the declined #576. A top-level shared block may declare env and secrets with the route-level shapes. A route that names it with use inherits them, merged name by name; the route's own entry wins. use is a single name, so two blocks can never conflict. Bindings are resolved into each route at load time, before hashing, so projectSha256, urlcode permissions (requested grants per route), the operator policy's per-route grants and revision pin, explain and audit all see each route's effective bindings. A block grants nothing and nothing becomes project-wide; adding a route to a block changes its requested grants and the revision, so the old pin is refused. Adds examples/shared-bindings, schema $defs envBindings/secretBindings shared by routes and shared blocks, tests, and docs (specification, bindings guide, FUNCTION-SECURITY, SECURITY, RIM-CFG-002). Refs #1133, #576 Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(package): core size budget from the merged #1131-#1133 measurement Measured on the merged branch (Node 26): 1120281 packed, 4396305 unpacked, 565 entries. Budgets: 1098 KiB packed, 4300 KiB unpacked, 570 entries. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(check): agent-facts counts only packages/ directories that hold source The #1121 workspace-package fact listed every directory under packages/, so an older checkout keeping a removed package's untracked dist/ or node_modules/ (ui, admin, forms, ...) failed check:docs and agent-facts.test.ts. A directory now counts only when it holds a package.json or core's src/. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covers #845's acceptance point that GET and POST on one declared path must be expressible and reviewable, and #861 item 5. Also closes #842: the "declare one route per method" advice is removed from review, TOOLING and SPECIFICATION.
Shape
methods. A method with no entry keeps the server limit.maxBytes(RFC 9110);maxBytes: 0refuses a body with 413. POST, PUT, PATCH and OPTIONS take the full policy.explain, the manifest, the report,get_schema,get_capability, the MCP authoring context, feature plans, readiness and fixture suggestions all show per-method rules.Evidence (macOS, Node 26), rebased on main with #865
npm run verifypasses: 1123/1123 plus every workspace suite and the proof.npm run test:packagepasses.npm run test:workerdafter a fresh build: 25/25 identical responses, including the 4 per-method GET/POST cases. Stale-dist detection is test:workerd runs stale dist/ without noticing, and cannot exercise GET-with-body #868.methods, a POST key on a default-methods route, andDELETE.required;request.methodgets no split-the-path advice.examples/body-validationadds a GET+POST/requestsroute (25/25 fixtures).Limits
Closes #842
🤖 Generated with Claude Code