Skip to content

[Request]: Per-method function bindings and auto-declared path parameters in the long form #255

Closed

Description

@jimhoyd

Tried: map GET/POST/PUT/PATCH/DELETE on /api/todos/{id} to distinct logic.
Expected: per-method handlers, and path parameters auto-declared regardless of form.
Got: one function per route; both runs branch on request.method inside the function and split by path with named exports. Using export: forces the long form, where the path id parameter and args must be re-declared by hand (the short form auto-binds them). Nothing in the docs states this trade-off.
Suggestion: methods: {GET: {function: ...}, POST: {...}}, and auto-declare/auto-bind path parameters in the long form (or document the rule next to export:).
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.

Activity

  1. added
    enhancement
    on Sep 20, 2026
  2. added
    needs-decision
    ai-first
    on Sep 20, 2026
  3. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Decision: keep the long form explicit and defer per-method bindings.

    • The rule (only the short form auto-declares {param} path parameters and args) is now documented in the specification (Document long-form function binding; record per-method bindings decision (refs #255) #275).
    • Auto-adding args to the long form would change hashes, audit output and revision-pinned grants for existing projects, and an omitted args may be deliberate.
    • If the friction persists, add an opt-in (function: {source, export, autoArgs: true}) or accept export: in the short form (function: {source: x.mjs, export: get}), so auto-binding is kept.
    • methods: {GET: {function}, POST: {function}} is a separate decision; revisit it with evidence beyond the one Todo app (n=1 per run).
  4. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Long-form binding rule documented in #275. Decision recorded: keep the long form explicit (no auto-added args/parameters). A per-method methods: map is not planned; reopen if benchmark evidence shows repeated friction.

  5. removed
    needs-decision
    on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-firstenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions