Skip to content

fix(devframe): return complete dev server handles for SSE - #484

Draft
SaKaNa-Y wants to merge 1 commit into
devframes:mainfrom
SaKaNa-Y:fix/dev-server-sse-handle
Draft

SaKaNa-Y wants to merge 1 commit into
devframes:mainfrom
SaKaNa-Y:fix/dev-server-sse-handle

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Summary

createDevServer(def, { ws: false }) opens its HTTP listener, then throws while assembling the return value. Callers receive no handle to close it. With default transports, startup succeeds, but handle.connectionMeta() omits the active SSE endpoint. A client that uses that descriptor and selects SSE rejects the connection.

Keep a server handle and the shared RPC group when WebSocket is disabled. Return the instance's complete connection metadata while preserving the transport's JSON encoding hints.

createDevServer
  shared HTTP server → handle with or without WebSocket
  connectionMeta() → instance endpoints + existing JSON encoding hints

Evidence

  • Before: the new transport suite failed four cases: SSE-only startup, two metadata cases, and startup with both RPC transports disabled.
  • After: real SSE and WebSocket calls through returned metadata pass. Tests cover registry removal, port reuse after close, nested mounts, a renamed SSE route, and strict JSON argument handling.
  • Repository checks: pnpm lint, pnpm knip, pnpm test --run, pnpm typecheck, and pnpm build pass. The test suite reports 1,841 passed and 14 skipped.

Merge Danger

Door: two-way. The patch changes runtime behavior without a data migration or public type change.

Blast Radius: transport. The shared HTTP binding also serves first-party adapters. Acceptance ran on Node; browser, Bun, and Deno journeys were not rerun.

Keep the shared HTTP handle and RPC group when WebSocket is disabled. Return instance connection metadata while retaining transport JSON encoding hints.

Cover SSE-only startup and disposal, returned-descriptor RPC over both transports, nested and renamed routes, and transport-disabled controls.
@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

@SaKaNa-Y is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

👁️‍🗨️ Review this pull request with grouped, summarized diffs at:
👉 https://pulls.review/gh/devframes/devframe/484?from=github-actions[bot]

raw result

💭 analyzed by vercel-ai-gateway/anthropic/claude-sonnet-5
🕰️ 2026-11-05 07:26 UTC
🔗 head c87d01c
🤖 automated by pulls.review

{
  "headSha": "c87d01c7257e75573d7d8b704996969b77931f37",
  "result": {
    "overallSummary": "Fixes `createDevServer` so it returns a complete, closable handle (HTTP server, rpcGroup, ws) even when WebSocket is disabled, and ensures `connectionMeta()` reflects the instance's actual endpoints (e.g. the active SSE route) rather than omitting them, which previously caused SSE-only clients to be rejected. A new test suite exercises the various transport combinations end-to-end.",
    "groups": [
      {
        "key": "dev-server-handle-fix",
        "label": "Dev server handle fix",
        "summary": "Ensures `createDevServer` always returns a usable handle (server, ws, rpcGroup) even when WebSocket is disabled, and that `connectionMeta()` reports the instance's full endpoint metadata (including SSE) merged with existing JSON encoding hints.",
        "category": "core",
        "filePaths": [
          "packages/devframe/src/adapters/dev.ts",
          "packages/devframe/src/node/instance-shell.ts"
        ],
        "critical": true,
        "lineNotes": [
          {
            "path": "packages/devframe/src/adapters/dev.ts",
            "side": "additions",
            "line": 234,
            "text": "connectionMeta now merges the transport's encoding hints with the devframe instance's connection metadata, so SSE/WS endpoints are no longer dropped."
          },
          {
            "path": "packages/devframe/src/node/instance-shell.ts",
            "side": "additions",
            "line": 812,
            "text": "Shared-server tier is now also used when WS is explicitly disabled (`wsDisabled`), not just when a native runtime can't rebind upgrades, so a handle and rpcGroup are always produced."
          }
        ]
      },
      {
        "key": "transport-tests",
        "label": "Dev transport tests",
        "summary": "New test suite covering SSE-only startup, dual-transport metadata (including nested/custom routes), WS-only operation, both-disabled startup, registry cleanup, port release after close, and strict JSON argument handling.",
        "category": "tests",
        "filePaths": [
          "packages/devframe/src/adapters/__tests__/dev-transports.test.ts"
        ],
        "fileNotes": [
          {
            "path": "packages/devframe/src/adapters/__tests__/dev-transports.test.ts",
            "text": "These tests were failing before the fix (SSE-only startup, metadata cases, both-transports-disabled) and now pass against the corrected handle/metadata behavior."
          }
        ]
      }
    ],
    "schemaVersion": 1,
    "source": "llm",
    "generatedAt": "2026-11-05T07:26:09.103Z",
    "model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
    "locale": "en"
  }
}

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant