You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Request]: Declarative validation for JSON request bodies and path parameter patterns #254
ai-firstReduces friction for AI agents authoring URLCode projectsenhancementNew feature or requestimportantHigh-priority work selected for near-term focus
Tried: validate the JSON body (title 1-200 chars string, optional description, boolean completed) and the path id. Expected: declare it in YAML. Got: only JSON syntax, media type and size are declarative. Body rules (~25 lines) and the id format check live in code; path parameter schemas accept minLength/maxLength but no pattern/format, so a UUID check is hand-written. Suggestion: a JSON Schema subset for request.body returning a structured 400/422, and pattern/format on parameter schemas. Evidence: an A/B benchmark on URLCode 0.4.1 with Sonnet 5 agents building the same Todo app from the repo docs. Run 1 (benchmark Agent B, no authoring skill, no browser check) and run 2 (session "Todo application with URLCode", authoring skill loaded, tightened prompt) hit this independently. n=1 each; single small app, so treat frequency as anecdotal. The Agent A control (no URLCode) needed 2 shell calls and 0 dependencies for the same app. Not verified: interaction with sandboxed routes' snapshot/limits.
Decision: build both pieces now: a declarative JSON-Schema subset for request.body (structured 400/422 on failure) and pattern/format on parameter schemas.
Guardrails for the implementer:
Parameter format comes from a small fixed allowlist (uuid first); no author-supplied regex needed for it.
Free-form pattern runs author regexes on every request in the host process, so ReDoS applies. Require a length cap on both pattern and input, and a linear-time or pre-checked regex. Reject patterns that fail the check at validation time, before activation.
Parameter schemas are compiled with Ajv in src/router.ts; reuse that path rather than adding a second validator.
Not verified: interaction with sandboxed routes' snapshot and limits (as the issue notes). Cover it with a test before landing. Update the specification and npm run docs:reference, with an executable example, in the same PR. This is a prerequisite for the store extension in #253.
Progress: PR #306 opened (draft): request.body.schema (422 on failure), parameter format: uuid and a restricted pattern, with docs and examples/body-validation. Sandboxed-route and real-Worker behavior are not verified.
ai-firstReduces friction for AI agents authoring URLCode projectsenhancementNew feature or requestimportantHigh-priority work selected for near-term focus
Activity
Record recommendation for declarative body validation and parameter p…
Record recommendation for declarative body validation and parameter p…
jimhoyd commentedon Sep 20, 2026
Decision: build both pieces now: a declarative JSON-Schema subset for
request.body(structured 400/422 on failure) andpattern/formaton parameter schemas.Guardrails for the implementer:
formatcomes from a small fixed allowlist (uuidfirst); no author-supplied regex needed for it.patternruns author regexes on every request in the host process, so ReDoS applies. Require a length cap on both pattern and input, and a linear-time or pre-checked regex. Reject patterns that fail the check at validation time, before activation.src/router.ts; reuse that path rather than adding a second validator.Not verified: interaction with sandboxed routes' snapshot and limits (as the issue notes). Cover it with a test before landing. Update the specification and
npm run docs:reference, with an executable example, in the same PR. This is a prerequisite for the store extension in #253.Record decisions for eight benchmark-driven authoring requests (#297)
jimhoyd commentedon Sep 20, 2026
Progress: implementation started by an agent against the maintainer decision on this issue; a PR will be linked here when it opens.
jimhoyd commentedon Sep 20, 2026
Progress: PR #306 opened (draft):
request.body.schema(422 on failure), parameterformat: uuidand a restrictedpattern, with docs andexamples/body-validation. Sandboxed-route and real-Worker behavior are not verified.Add request.body.schema and parameter format/pattern (refs #254)
Mark #254 decided, in review (#306)
jimhoyd commentedon Sep 20, 2026
Progress: taking over draft PR #306 to finish it.
Add request.body.schema and parameter format/pattern (refs #254)
Mark #254 decided, in review (#306)
Close #254 gaps: ReDoS, limit and sandbox tests; register uuid format…
Add the operator-installed store extension and init --with store (refs …
Add the operator-installed store extension and init --with store (refs …