Skip to content

feat(network-config): add Node response streaming config#300

Merged
Zeryther merged 3 commits into
mainfrom
feat/network-config-response-streaming
May 18, 2026
Merged

feat(network-config): add Node response streaming config#300
Zeryther merged 3 commits into
mainfrom
feat/network-config-response-streaming

Conversation

@Zeryther

@Zeryther Zeryther commented May 18, 2026

Copy link
Copy Markdown
Member

Summary

  • add explicit v4 function response streaming config for Node functions
  • default Node and Vercel Build Output functions to response streaming while preserving opt-out metadata
  • add a network-config changeset and clean up strict test typing

Testing

  • pnpm format:fix
  • pnpm lint
  • pnpm typecheck --filter @gigadrive/network-config
  • pnpm vitest run packages/network-config/

Summary by CodeRabbit

  • New Features

    • Added explicit response streaming configuration for Node functions in deployment settings
    • Node functions now enable response streaming by default (can be disabled if needed)
  • Improvements

    • Made environment variable configuration optional
    • Enhanced streaming detection for Vercel Build Output functions with improved response streaming support

Review Change Stack

@vercel

vercel Bot commented May 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sdk-harmony Ready Ready Preview, Comment May 18, 2026 1:42am

Request Review

@changeset-bot

changeset-bot Bot commented May 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0fbcc5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@gigadrive/network-config Patch
gigadrive Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Zeryther has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 26 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 52bc6d67-6e04-496f-a641-042d13606894

📥 Commits

Reviewing files that changed from the base of the PR and between d4ac36f and f0fbcc5.

📒 Files selected for processing (6)
  • .changeset/streaming-node-config.md
  • packages/network-config/src/services/v4-config-parser.test.ts
  • packages/network-config/src/services/v4-config-parser.ts
  • packages/network-config/src/v4/index.ts
  • packages/network-config/src/v4/schema.json
  • packages/network-config/src/v4/schema.ts
📝 Walkthrough

Walkthrough

This PR introduces explicit response streaming configuration for Node functions and Vercel Build Output functions. New streaming?: boolean property is added to function settings, with Node runtimes streaming by default. The V4 and Vercel parsers detect streaming configuration and route streaming-enabled functions to SERVERLESS_FUNCTION_STREAMING. Tests verify streaming defaults, explicit disable/enable, and route handler selection.

Changes

Response Streaming Configuration & Detection

Layer / File(s) Summary
Schema and type definitions
packages/network-config/src/v4/schema.json, packages/network-config/src/v4/schema.ts, packages/network-config/src/v4/index.ts
streaming?: boolean property added to function schema and ConfigV4FunctionSettings. ConfigV4.env made optional. Documentation notes Node runtimes stream by default when streaming is omitted.
V4ConfigParser streaming detection and routing
packages/network-config/src/services/v4-config-parser.ts
New runtimeStreamsByDefault helper computes streaming default from runtime. resolveRouteHandler accepts entrypoints and returns SERVERLESS_FUNCTION_STREAMING when destination matches a streaming-enabled entrypoint. Routes forwarded through mapRoute with entrypoint context, and settings construction applies streaming defaults and safely handles include/exclude files.
Vercel parser streaming detection
packages/network-config/src/services/vercel-build-output-parser.ts
Streaming detection checks supportsResponseStreaming or experimentalResponseStreaming flags from Vercel config with Node runtime fallback requirement; removes prior bun- inference.
Test infrastructure and assertion helpers
packages/network-config/src/services/v4-config-parser.test.ts
Introduces requireAssets, requireAssetPaths, requireEntrypoint, requireRoute helpers for safe normalized field access. structuredClone prevents in-place mutations in parser tests.
V4ConfigParser test coverage
packages/network-config/src/services/v4-config-parser.test.ts
New test cases verify Node function default streaming, explicit disable/enable, and corresponding SERVERLESS_FUNCTION_STREAMING route handlers. Package and asset assertions refactored to use helper functions.
Vercel, validator, and v4 parse tests
packages/network-config/src/services/vercel-build-output-parser.test.ts, packages/network-config/src/services/schema-validator.test.ts, packages/network-config/src/v4/parse.test.ts
Vercel parser tests verify Node default streaming and opt-out behavior. Schema validator test adds null safety. V4 parse tests use safer type casts and new undefined assertion for unmapped functions.
Build configuration and release notes
packages/network-config/tsconfig.json, tsconfig.base.json, .changeset/streaming-node-config.md
TypeScript compiler rootDir set in package config, deprecation ignore setting added to base config. Changesets entry documents streaming feature for Node and Vercel Build Output functions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Gigadrive/sdk#298: Both PRs modify network-config packaging/entrypoint metadata pipeline to preserve includeFiles/excludeFiles in normalized entrypoints, with overlapping changes to settings construction and test fixtures.

Poem

A streaming path through nodes so fine,
Functions flow with handlers divine,
Default true for Node's own race,
Config, tests, and schema in place!
🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(network-config): add Node response streaming config' directly and clearly describes the main change: adding response streaming configuration for Node functions in the network-config package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/network-config-response-streaming

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.changeset/streaming-node-config.md (1)

5-5: 💤 Low value

Consider expanding the changeset description to include default behavior.

The current description is concise but could be more informative for users reading the changelog. Consider mentioning that Node functions stream by default and can opt out.

📝 Suggested enhancement
-Add explicit response streaming configuration for Node functions and Vercel Build Output functions.
+Add explicit response streaming configuration for Node functions and Vercel Build Output functions. Node functions now stream by default with optional opt-out via the `streaming` property.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/streaming-node-config.md at line 5, Update the changeset
description to state the default behavior: mention that Node functions (and
Vercel Build Output functions) stream responses by default and that projects can
opt out (describe the opt-out configuration or flag name if applicable). Edit
the sentence "Add explicit response streaming configuration for Node functions
and Vercel Build Output functions." to include the default (streaming on) and a
short note on how to disable it, referencing "Node functions" and "Vercel Build
Output functions" so readers immediately know the default and opt-out path.
packages/network-config/src/services/v4-config-parser.ts (1)

161-166: ⚡ Quick win

Derive streaming from a single resolved runtime value.

runtime and streaming defaults are computed separately; consolidating them avoids future drift if runtime defaults change.

♻️ Proposed refactor
-      entrypoints.push({
+      const runtime = settings.runtime ?? 'node-20';
+      const streaming = settings.streaming ?? runtimeStreamsByDefault(runtime);
+
+      entrypoints.push({
         path: file,
-        runtime: settings.runtime ?? 'node-20',
+        runtime,
         memory: settings.memory ?? 128,
         maxDuration: settings.max_duration ?? 30,
         schedule: func.schedule,
         symlinks: func.symlinks,
-        streaming: settings.streaming ?? runtimeStreamsByDefault(settings.runtime),
+        streaming,
         package:
           settings.includeFiles != null || settings.excludeFiles != null
             ? {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/network-config/src/services/v4-config-parser.ts` around lines 161 -
166, Compute a single resolved runtime value and use it for both the runtime
field and to derive streaming so the defaults stay consistent: create a local
constant (e.g., resolvedRuntime = settings.runtime ?? 'node-20') and replace
occurrences that use settings.runtime when calling runtimeStreamsByDefault with
that constant; keep settings.streaming override semantics (streaming:
settings.streaming ?? runtimeStreamsByDefault(resolvedRuntime)) and set runtime:
resolvedRuntime (or runtime: settings.runtime ?? 'node-20') so both fields rely
on the same resolved value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/network-config/tsconfig.json`:
- Line 5: The tsconfig.json contains a rootDir set to "../.." which causes
TypeScript to emit a nested repository structure; to fix it, open the package's
tsconfig.json and either remove the "rootDir" property entirely or change it to
"rootDir": "." so the compiler uses the package root (matching other packages)
and outputs files to the expected dist/... layout.

In `@tsconfig.base.json`:
- Line 7: Remove the obsolete "ignoreDeprecations": "5.0" setting from
tsconfig.base.json; locate the JSON property named ignoreDeprecations and delete
that key/value pair so the file no longer contains the deprecated compiler
option.

---

Nitpick comments:
In @.changeset/streaming-node-config.md:
- Line 5: Update the changeset description to state the default behavior:
mention that Node functions (and Vercel Build Output functions) stream responses
by default and that projects can opt out (describe the opt-out configuration or
flag name if applicable). Edit the sentence "Add explicit response streaming
configuration for Node functions and Vercel Build Output functions." to include
the default (streaming on) and a short note on how to disable it, referencing
"Node functions" and "Vercel Build Output functions" so readers immediately know
the default and opt-out path.

In `@packages/network-config/src/services/v4-config-parser.ts`:
- Around line 161-166: Compute a single resolved runtime value and use it for
both the runtime field and to derive streaming so the defaults stay consistent:
create a local constant (e.g., resolvedRuntime = settings.runtime ?? 'node-20')
and replace occurrences that use settings.runtime when calling
runtimeStreamsByDefault with that constant; keep settings.streaming override
semantics (streaming: settings.streaming ??
runtimeStreamsByDefault(resolvedRuntime)) and set runtime: resolvedRuntime (or
runtime: settings.runtime ?? 'node-20') so both fields rely on the same resolved
value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a00e0a1b-5de1-49e4-896b-c270bdf7363c

📥 Commits

Reviewing files that changed from the base of the PR and between e08028e and d4ac36f.

📒 Files selected for processing (13)
  • .changeset/streaming-node-config.md
  • packages/network-config/src/detection/frameworks/nestjs.test.ts
  • packages/network-config/src/services/schema-validator.test.ts
  • packages/network-config/src/services/v4-config-parser.test.ts
  • packages/network-config/src/services/v4-config-parser.ts
  • packages/network-config/src/services/vercel-build-output-parser.test.ts
  • packages/network-config/src/services/vercel-build-output-parser.ts
  • packages/network-config/src/v4/index.ts
  • packages/network-config/src/v4/parse.test.ts
  • packages/network-config/src/v4/schema.json
  • packages/network-config/src/v4/schema.ts
  • packages/network-config/tsconfig.json
  • tsconfig.base.json

Comment thread packages/network-config/tsconfig.json Outdated
Comment thread tsconfig.base.json Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4ac36f6f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/network-config/src/services/v4-config-parser.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

const pattern = normalizedDestination.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/\\\$\d+/g, '[^/]+');

P2 Badge Allow capture substitutions to span nested paths

The new matcher treats every $1 substitution as [^/]+, so it only matches a single path segment. When a route uses a catch-all capture such as source: '/pages/(.*)' with destination: '/pages/$1.tsx' and the function glob resolves nested entrypoints like pages/blog/post.tsx, this check fails and the route is emitted as SERVERLESS_FUNCTION even though the matched Node entrypoint has streaming: true. That loses response streaming for nested dynamic routes that the destination is meant to target.


const runtimeStreamsByDefault = (runtime: ConfigV4FunctionSettings['runtime'] | undefined): boolean =>
runtime == null || runtime.startsWith('node-');

P2 Badge Preserve Bun functions' default streaming

When a v4 function uses runtime: 'bun-1' and omits the new streaming field, this default now evaluates to false, whereas the parser previously marked Bun functions as streaming by default and the framework defaults still document Bun servers as streaming-capable. Existing Bun configs therefore silently switch their entrypoint and any matching route back to non-streaming unless users add an explicit streaming: true.


const entrypoint = entrypoints.find((item) => destinationMatchesEntrypoint(destination, item.path));
return entrypoint?.streaming === true ? 'SERVERLESS_FUNCTION_STREAMING' : 'SERVERLESS_FUNCTION';

P2 Badge Avoid using one matching entrypoint for dynamic route type

For substituted destinations that can resolve to more than one entrypoint, find picks whichever matching file appears first and uses only that file's streaming flag for the whole route. In a config with a broad Node glob plus an exact streaming: false override such as pages/admin.tsx, a route like /pages/$1.tsx is still emitted as SERVERLESS_FUNCTION_STREAMING if another page was discovered first, so requests that substitute to the non-streaming entrypoint get the wrong handler type.


const pattern = normalizedDestination.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/\\\$\d+/g, '[^/]+');

P2 Badge Match named capture substitutions in destinations

The v4 schema documents that named capture groups from route requirements can be used in destination, but this replacement only recognizes numeric $1-style captures. A route such as destination: 'sites/$tenant/index.js' that is backed by a streaming Node function resolved from sites/acme/index.js therefore won't match any entrypoint here and will be emitted as SERVERLESS_FUNCTION, disabling streaming for those named-capture rewrites.


const runtime = settings.runtime ?? 'node-20';
const streaming = settings.streaming ?? runtimeStreamsByDefault(runtime);

P2 Badge Apply later streaming overrides to matched files

This computes the new streaming flag from the settings of the current pattern rather than from the concrete matched file, so a later, more-specific glob opt-out is ignored once a broader glob has already added the entrypoint. For example, with pages/*.tsx defaulting to Node streaming and a later pages/admin.* rule setting streaming: false, pages/admin.tsx is added during the broad pass with streaming still enabled and the later rule is skipped because the entrypoint already exists.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Zeryther Zeryther merged commit 4b730aa into main May 18, 2026
13 checks passed
@Zeryther Zeryther deleted the feat/network-config-response-streaming branch May 18, 2026 01:45
@github-actions github-actions Bot mentioned this pull request May 18, 2026
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