Skip to content

[Bug]: Authoring review recommends unsupported per-method route split for one path #842

Closed

Description

@jimhoyd

Runtime revision and environment

Source snapshot of main a996f0d88394e83be9cca17f9793b10c50aabf1c; Node 26.10.0, macOS, local read-only authoring review. Discovered during the ecosystem audit in #841.

Minimal reproduction

Synthetic project:

version: '1'
routes:
  /items:
    methods: [GET, POST]
    function: f.mjs

f.mjs:

export default function(request) {
  switch (request.method) {
    case 'GET': return Response.json({items: []});
    case 'POST': return Response.json({created: true}, {status: 201});
    default: return new Response(null, {status: 405});
  }
}

Invoke reviewProject(projectDirectory) from packages/core/src/review.ts. This invocation was actually run; the handler was inspected, not served.

Expected: do not call this a behavior-preserving native alternative. Both methods must keep /items, and the implemented contract permits one function/export per path. docs/SPECIFICATION.md explicitly directs authors to branch on request.method for several methods on one path; per-method function maps are unsupported and duplicate route keys are rejected.

Actual: a method-dispatch observation classified as native-alternative recommends one route per method without preserving the path constraint. An agent following it can attempt unsupported YAML or change the public API.

Relevant output

{
  "category": "native-alternative",
  "signal": "method-dispatch",
  "routes": ["/items"],
  "confidence": "medium",
  "capability": "methods",
  "note": "Native routing already dispatches by method; declare one route per method instead of branching on request.method. See get_capability(\"methods\")."
}

Source: packages/core/src/review.ts:238-243; the existing test/review.test.ts test titled "review flags hand-written request.method branching as a native-alternative to per-method routes" asserts this classification for a GET/POST /items handler. Fix the advice/classification and regression so an alternative requires equivalent supported semantics, rather than teaching agents that custom routing code is always removable. No runtime route behavior change is requested.

Searched all issue states for method-dispatch and one route per method; #428 introduced review, and #821 concerns denial envelopes. No dedicated issue for this contradiction was found.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions