Skip to content

fix: align request handling across runtimes (v1.x) - #11242

Merged
jasonsaayman merged 9 commits into
v1.xfrom
maintenance/request-consistency-v1
Sep 27, 2026
Merged

jasonsaayman merged 9 commits into
v1.xfrom
maintenance/request-consistency-v1

Conversation

@jasonsaayman

@jasonsaayman jasonsaayman commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Align request option resolution, body size accounting, and form serialization across Node and browser adapters. Configured limits use encoded byte counts, while uploads retain their routing, contents, explicit multipart boundaries, and progress behavior.

Linked issue

N/A.

Changes

  • Count encoded stream bytes across HTTP transports and calculate multipart sizes from fields and Blob/File sizes before constructing the upload body. Honor configured env.Blob constructors, including custom runtimes without a global Blob, and keep adapter caches separate for distinct constructors. The generic multipart helper receives a boundary and Blob implementation; core selects the cryptographic random source and translates serialization failures into Axios errors.
  • Align data URL size estimates with each adapter's decoding behavior, preserve unlimited stream chunking, and verify output across rate accounting windows.
  • Normalize redirect/proxy routing and same-origin URL resolution. The HTTP adapter owns direct-agent creation, caching, and cleanup. Direct agents follow the selected protocol, preserve connection and pool-name hooks with their configured receiver, and close their pooled sockets when the configured agent is destroyed. Unsupported pool-management and TLS-session lifecycle overrides reject before dispatch, including when selecting a cached pool.
  • Merge parameters iteratively, inspect only defaults that contribute to the result, and leave depth policy to the configured serializer, including custom serializers and maxDepth: Infinity. Core owns parameter validation and its Axios error behavior. String-keyed parameters and config merges remain supported without symbol-reflection APIs. Cycle checks inspect retained fields, including reserved data properties on shallow array elements, without evaluating reserved-name accessors.
  • Preserve hidden and inherited array-like indexes, reject incomplete array-like shapes, and retain numeric form field names that cannot be array indexes.
  • Keep shared test utilities, including the bounded child-process runner, in tests/setup. Failed child runs retain captured stdout/stderr on the original error, including partial output and termination metadata. Reuse the adapter runtime-support predicate in agent tests and verify generated multipart boundaries use the supplied random source and have valid output. Record user-visible behavior in the pre-release changelog.

Compatibility notes: circular parameters reject with ERR_BAD_OPTION_VALUE; sparse or non-index numeric form fields serialize as keyed objects. On runtimes with native environment proxy support, proxy: false uses a direct pool with the configured native options, connection hook, and pool-name hook. Unsupported pool-management or TLS-session lifecycle overrides reject with ERR_BAD_OPTION_VALUE; those agents must be constructed without proxyEnv. Fetch multipart uploads needing size accounting, progress tracking, or an explicit boundary use a sized Blob with a matching boundary. Generated boundaries require a cryptographic random source. Public type signatures are unchanged.

Testing

  • npm run lint and npm run build pass on Node 24.18.0.
  • Latest multipart/core separation: 160 focused unit tests pass across Fetch, multipart body length, and parameter merging. The shared multipart suite also passes 147 checks across Chromium, Firefox, and WebKit, with three existing Node-only random-source skips.
  • Node 16.20.2: 28 parameter-merge cases pass; direct multipart checks confirm generated/explicit boundaries, exact size limits, caller error identity, and unchanged Axios error codes. The symbol-reflection test restores the builtin before any assertions; a forced failure retains its original AssertionError diagnostics.
  • Full-suite baseline at 214305bf: 1,285 unit tests and 783 browser tests passed, with three existing Node-only random-source skips.
  • Existing coverage includes custom Blob selection and cache separation, missing global Blob, upload progress, symbol-reflection fallback, custom pool keys and receiver state, unsupported lifecycle hooks, and combined active/free socket accounting.
  • Shared data URL checks compare supported whitespace processing with native Fetch and verify exact response limits across Node and all three browsers. Existing postForm, promise rejection, and inherited absolute-URL-default checks pass.
  • New generic-helper cases verify serialization using supplied dependencies without runtime random sources, generic validation failures, core error translation, and caller-supplied size errors.
  • Formatting and diff whitespace checks pass; files changed in the latest refactor parse as ES2019. Actual Node 12 runtime checks were unavailable locally.

Checklist

  • Tests added or updated.
  • Docs/types reviewed; pre-release changelog updated and no public type signature changes.
  • Compatibility changes called out above.

🏄

@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Refactors request handling across HTTP and Fetch adapters.

No outstanding finding blocks merging.

Summary

The PR aligns request handling across adapters, including multipart serialization, body-size limits, direct-agent routing, parameter merging, and form-field conversion. It also adds regression coverage and pre-release notes. The latest changes add a documentation banner, update sponsor links, refresh a workflow action, and update development dependencies.

Reviews (8) · Last reviewed commit: "Merge branch 'v1.x' into maintenance/req..."

Comment thread lib/helpers/getDirectAgent.js Resolved
Comment thread lib/utils.js Resolved
Comment thread lib/core/mergeConfig.js Resolved
@greptile-apps

This comment has been minimized.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 22 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread lib/helpers/formDataToJSON.js Resolved
Comment thread lib/helpers/formDataToBlob.js Resolved
Comment thread lib/core/mergeConfig.js Resolved
Comment thread lib/utils.js Resolved
Comment thread lib/adapters/fetch.js Resolved
Comment thread lib/adapters/http.js Resolved
Comment thread tests/setup/formBodyLengthCases.js Resolved
Comment thread lib/helpers/AxiosTransformStream.js Resolved
@jasonsaayman jasonsaayman self-assigned this Sep 21, 2026
@jasonsaayman jasonsaayman added commit::fix The PR is related to a bugfix v1x Version 1 labels Sep 21, 2026

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 24 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread tests/unit/adapters/directAgent.test.js Resolved
Comment thread lib/helpers/assertParamsAcyclic.js Resolved
Comment thread tests/setup/formBodyLengthCases.js Resolved
Comment thread lib/helpers/assertParamsAcyclic.js Resolved

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 9 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread lib/helpers/assertParamsAcyclic.js Resolved
Comment thread tests/setup/runModuleInChildProcess.js Resolved
Comment thread lib/helpers/getDirectAgent.js Resolved
@jasonsaayman

Copy link
Copy Markdown
Member Author

@cubic-dev-ai review again

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review again

@jasonsaayman I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread lib/core/assertParamsAcyclic.js Resolved
Comment thread lib/adapters/fetch.js Resolved
Comment thread tests/unit/adapters/directAgent.test.js Resolved

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 4 files (changes from recent commits).

You’re at about 96% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread lib/adapters/http.js Resolved

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 8 files (changes from recent commits).

You’re at about 98% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread tests/unit/core/paramsMerge.test.js Resolved
Comment thread lib/helpers/formDataToBlob.js Resolved
@jasonsaayman
jasonsaayman merged commit 2498c23 into v1.x Sep 27, 2026
30 checks passed
@jasonsaayman
jasonsaayman deleted the maintenance/request-consistency-v1 branch September 27, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix v1x Version 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant