Repository navigation
fix(core): actionable authoring errors, strict request fixtures and JSON 422s - #607
Merged
Merged
Conversation
… request fixtures; JSON 422s
- Reject Express-style /users/:id route segments with the {id} + parameters fix (#583).
- Validate tests/requests.json against a new shipped schemas/requests.schema.json:
unknown keys (json, expectJson, typos) are refused with the fixture number and a hint;
malformed JSON reports line/column; a failing case prints method, path and expected vs
actual per assertion (shortened around the first difference, captured values redacted);
zero cases exit nonzero once the project has an active route, and warn on a bare
scaffold (#584).
- Configuration and CLI errors: did-you-mean for unknown keys at route level including
handler names, explicit multiple/no-handler errors, unescaped route paths, enum/const
values listed, YAML line/column, file:line:column prefixes (includes too), named missing
files/projects/imports, route-named compile errors, policy-denied bindings point at
urlcode permissions and --policy, unknown/valueless CLI options named, target refusals
list compatible targets. Error events carry code/route/file/line/column/pointer (#581).
- Routes with a JSON request.body.schema always answer 422 as JSON listing every issue and
name identifier-shaped undeclared properties (#587).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # llms-full.txt # packages/core/src/readiness.ts
# Conflicts: # llms-full.txt
# Conflicts: # llms-full.txt
The fixture schema, structured error fields and expanded docs from #581/#583/#584 push the package over the previous 2450 KiB unpacked budget. Raised to 2550 KiB, which also covers the pre-existing examples/cloudflare/dist leak (gitignored build output that still ends up in npm pack because 'examples' is listed wholesale) tracked separately as #608. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
enabled auto-merge (squash)
September 24, 2026 01:13
# Conflicts: # llms-full.txt # packages/core/src/capabilities.ts
# Conflicts: # llms-full.txt
jimhoyd
added a commit
that referenced
this pull request
Sep 24, 2026
…growth Same budget #607 raised (structured error fields, fixture schema, docs growth from several now-merged PRs; see that PR's commit for the full justification and the examples/cloudflare/dist packaging note, #608). Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
added a commit
that referenced
this pull request
Sep 24, 2026
…uard, and update stale test expectations - router.ts: the pinned-policy binding-denial messages (#602) now combine with #607's grantHint wording instead of dropping the pin-specific explanation; the pin case takes priority since it fully explains the denial on its own. - config.ts: safeFile no longer names a reference that looks like a path traversal attempt (a '..' segment), fixing a regression #607 introduced and #602 exposed (issue #610) — MCP's validate tool now surfaces the CLI's real error text (#582), which would otherwise turn an escaping function/middleware source reference into a filesystem oracle. A plain in-project typo is still named, matching #607's own authoring-errors test. - test/dev-diagnostics.test.ts, test/mcp.test.ts: two assertions predated #607's route-name and file:line:column prefixes and #581's friendlier multiple-handlers message; updated to match the now-current, improved text rather than reverting the improvement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 24, 2026
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.
Problem
The usability audit found errors that do not say what went wrong, where it is, or how to fix it (#581). It also found an Express-style route that validates but never matches (#583), request fixtures that accept unknown keys and so pass when they check nothing (#584), and JSON routes that answer 422 as plain text showing a single issue (#587).
Resulting behavior
#583: Express-style segments. A segment like
/users/:idis now refused byvalidate(and by schema-onlyvalidate_yaml), withfile:line. The message gives the fix: write{id}and declare it underparameters: [{name: id, in: path, required: true, schema: {type: string}}]. Colons inside a segment (/a:b) are still literal.#584: strict request fixtures.
schemas/requests.schema.jsonis the fixture contract. It is in the tarball through the existingschemasentry, andtest:packageconfirms it ships.json,expectJson,urland similar keys get a hint saying what to write instead; typos get a did-you-mean (expectBdy→expectBody). The error names the fixture and the step.Operation failed.urlcode testprints itsmethod, itspathas written, andfailures:{check, name, expected, actual, firstDifference}for each failed assertion. Each value is cut to about 200 characters starting just before the first difference. A value captured bystepsis printed as{{name}}, never the value itself.auditoutput is unchanged and still shows no values.urlcode testexits nonzero once the project has an active route. A project with no active routes (bareinit, the starter, urlcode-template) passes with ano-test-caseswarning, because the shipped GitHub Action runsurlcode teston the bare scaffold.test:packagecovers that flow.docs/AI-AUTHORING.md, whichdocs searchcovers, sourlcode docs search expectBodynow finds it. It is also indocs/READINESS.md, both skills and the generated starterAGENTS.md.#581: errors say what, where and how to fix. The table rows are covered as follows:
declares 2 handlers (redirect, respond); a route with none givesdeclares no handler; add exactly one of: ….redirct:) givesunknown key "redirct"; did you mean "redirect"?. These route-level checks run before the schema'soneOf, which used to report them as a missingredirect.redirect: {to: …}givesmissing required key "url"; found unknown key "to" instead (allowed keys: url, status, query).rotes:givesdid you mean "routes"?.route /a/b, redirect.status), not/routes/~1a~1b.must be one of 301, 302, 303, 307, 308). Other keywords append Ajv's schema-derived message.urlcode.yamland in included files are prefixedfile:line:column:. The position comes from the YAML node.Referenced project file is missing: "functions/x.mjs", now with the route named. A missing--projectdirectory givesProject directory not found. Nourlcode.yamlgivesNo urlcode.yaml in <dir>; run urlcode init there….Route /u/{id}: …). A placeholder error names{id}and theparametersentry to add. A static route error shows the path to write (/s/*).urlcode permissionsand--policy <file>.Unknown option --prot; did you mean --port?. An option with no value (--project,docs search --policy) says to put text that starts with-after--.context --budget 100gives the smallest workable budget.code,route,file,line,column,pointerandkeyapply. This includes errors from the config worker. Codes are listed indocs/AI-AUTHORING.md.init --withcannot succeed on 0.5.9: bundle attestation source ref is main, not the release tag #579, as agreed.#587 (422 part only): JSON 422s. A route with a JSON
request.body.schemanow always answers 422 asapplication/json, whatever theAcceptheader, and lists every issue (at most 8, capped at 4096 bytes as before). Each of the first three undeclared properties is its ownadditionalPropertiesissue. The issue names the property inpropertyonly when the name looks like an identifier (^[A-Za-z_][A-Za-z0-9_-]{0,63}$); any other name is left out. Values are still never echoed.prefersJsonnegotiation is removed.Breaking change: a client that parsed the plain-text 422 now receives JSON. This is documented in
docs/HTTP.mdanddocs/SPECIFICATION.md, in theRIM-HTTP-001card indocs/RUNTIME-IMPLEMENTATION.md, and inexamples/body-validation.docs/CLOUDFLARE.mdnow notes that the dated workerd run happened before this change.Security and compatibility notes
no-storeandnosniff). The earlier rule was that no client text appears at all; this is a deliberate relaxation, requested in [Bug]: planner and recipe search steer simple JSON endpoints to function code #587. The test that used a secret-shaped key now usesextra. It asserts that a non-identifier key such as<…>is not named, and that no values appear.urlcode testfailure output now includes response header and body excerpts from the author's own project. The docs say to keep secrets out of test responses that end up in CI logs.sandbox: trueisolation path is unchanged; only its error wording changed.Validation
npm run verify: green locally (lint, typecheck, check and check:docs, build, 785 core tests, workspace verifies).npm run test:package: green (packed install, starter and cookbook smoke).schemas/requests.schema.jsonis in the pack.test/authoring-errors.test.tscovers every row above. Existing tests were updated where message text changed.llms-full.txt, the plugin skill copy, and starterAGENTS.md(viarenderAgentsGuide).docs:referencehas no change, becauseurlcode.schema.jsonis untouched.Closes #583
Closes #584
Closes #581
Refs #587
Every row of the #581 table is addressed; bundle/transport errors belong to #579. MCP tool errors still return a generic
Operation failed validation, which is tracked in #582; the structuredcode/route/file/line/pointerfields onConfigError.detailsare available for that fix to surface. #587's planner and recipe parts are handled in a separate PR.🤖 Generated with Claude Code