Skip to content

feat(http): add zstd decompression support#10920

Merged
jasonsaayman merged 2 commits into
v1.xfrom
fix/move-use-zstd-flag-to-transitional
May 20, 2026
Merged

feat(http): add zstd decompression support#10920
jasonsaayman merged 2 commits into
v1.xfrom
fix/move-use-zstd-flag-to-transitional

Conversation

@jasonsaayman

@jasonsaayman jasonsaayman commented May 20, 2026

Copy link
Copy Markdown
Member

Summary

Adds Node HTTP adapter support for zstd-compressed responses while keeping zstd out of the default Accept-Encoding header unless explicitly enabled through transitional config.

Linked issue

Changes

  • Add capability-checked zstd decompression in the Node HTTP adapter.
  • Add transitional.advertiseZstdAcceptEncoding to opt into advertising zstd support.
  • Update TypeScript declarations, validation, unit coverage, and pre-release notes for the new transitional option.
  • Add OpenSpec agent workflow files and repo guidance for future spec-driven changes.

Checklist

  • Tests added or updated (or N/A with reason)
  • Docs / types updated if public API changed (index.d.ts and index.d.cts)
  • No breaking changes (or called out explicitly above)

Summary by cubic

Adds zstd (Zstandard) decompression to the Node HTTP adapter and gates zstd advertising behind a new transitional flag. Defaults unchanged; we only include zstd in Accept-Encoding when transitional.advertiseZstdAcceptEncoding is true.

Description

  • Summary of changes

    • Add capability-checked zstd decompression in the Node HTTP adapter.
    • Introduce transitional.advertiseZstdAcceptEncoding; remove the old advertiseZstd request option.
    • Validate the new flag in Axios; default to false in defaults/transitional.js.
    • Use own-property check on transitional before reading the flag for security hardening.
    • Update types (index.d.ts/index.d.cts), merge rules, and pre-release notes.
  • Reasoning

    • Keep behavior opt-in and predictable; ensure secure handling of transitional flags.
  • Additional context

    • Applies to axios Node adapter; browsers are unaffected.

Docs

  • Update /docs/ and README.md to document transitional.advertiseZstdAcceptEncoding, Node-only support, and decompression-bomb guidance.
  • Update advanced request config examples to use the new transitional flag.

Testing

  • Updated unit test to enable transitional.advertiseZstdAcceptEncoding and assert zstd is included in Accept-Encoding when supported.
  • Optional: add an integration test to verify end-to-end zstd decompression.

Semantic version impact

  • Minor: new opt-in feature with no default behavior changes; the removed advertiseZstd option was not part of a released API.

Written for commit ecc59c7. Summary will update on new commits. Review in cubic

@jasonsaayman jasonsaayman self-assigned this May 20, 2026
@jasonsaayman jasonsaayman added priority::medium A medium priority commit::feat The PR is related to a feature labels May 20, 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.

1 issue found across 8 files

Confidence score: 3/5

  • There is a concrete regression risk in lib/adapters/http.js: switching advertiseZstdAcceptEncoding to direct property access can read inherited prototype values, which may incorrectly advertise zstd on requests.
  • Because this is a medium-severity (6/10) issue with high confidence (9/10) and user-visible request behavior impact, the merge risk is moderate rather than minimal.
  • Pay close attention to lib/adapters/http.js - restore an own-property check for advertiseZstdAcceptEncoding to prevent prototype-derived opt-in behavior.

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

Re-trigger cubic

Comment thread lib/adapters/http.js
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@jasonsaayman jasonsaayman merged commit 1337845 into v1.x May 20, 2026
43 of 44 checks passed
@jasonsaayman jasonsaayman deleted the fix/move-use-zstd-flag-to-transitional branch May 20, 2026 16:30
jasonsaayman added a commit that referenced this pull request May 28, 2026
* fix(http): move zstd advertising flag to transitional

* sec: add has own prop to the transitional

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::feat The PR is related to a feature priority::medium A medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant