refactor!: v4 breaking changes, perf improvements, and cleanup#564
Merged
John-David Dalton (jdalton) merged 1 commit intomainfrom Apr 7, 2026
Merged
Conversation
Breaking changes:
- HTTP client returns HttpResponse instead of IncomingMessage
- Unified file-upload onto httpRequest() transport
- Removed getHttpModule, getResponse, getErrorResponseBody,
createRequestBodyForJson, getSupportedScanFiles, PromiseQueue
- Trimmed public API surface — removed internal helpers from exports
- Replaced http2-wrapper type with native node:http2
- Removed @socketregistry/packageurl-js and http2-wrapper deps
Performance:
- Cached reqOptionsWithHooks — eliminates 60+ object spreads per session
- NDJSON linear scan replaces .split('\n') in 4 locations
- queryToSearchParams avoids double URLSearchParams instantiation
- sanitizeHeaders deferred behind if guards (9 locations)
- batchPackageStream generator queue uses Map for O(1) operations
- reshapeArtifactForPublicPolicy: Set-based allowedActions, single-pass reduce
Bug fixes:
- Fix streamFullScan using MAX_STREAM_SIZE (100MB) for buffered responses
- Add missing maxResponseSize to createUploadRequest
This was referenced Apr 7, 2026
Bill Li (billxinli)
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All v4 breaking changes, performance optimizations, and cleanup — without version bump or changelog, to allow independent review.
Breaking Changes
HttpResponsefrom@socketsecurity/lib/http-requestinstead ofIncomingMessagenode:http/getResponse()tohttpRequest()getHttpModule,getResponse,getErrorResponseBody,createRequestBodyForJson,getSupportedScanFiles(),PromiseQueue@socketregistry/packageurl-js(unused),http2-wrapper(replaced by nativenode:http2)Performance
reqOptionsWithHooks— eliminates 60+ object spreads per session.split('\n')→ single-pass linear scan (4 locations)queryToSearchParams: avoid doubleURLSearchParamsinstantiationsanitizeHeaders: deferred behindifguards (9 locations)batchPackageStream:findIndex+splice→Mapfor O(1) operationsreshapeArtifactForPublicPolicy:Set-basedallowedActions, single-passreduceBug Fixes
streamFullScanusingMAX_STREAM_SIZE(100MB) for buffered responses — now usesMAX_RESPONSE_SIZE(10MB)maxResponseSizetocreateUploadRequestStats
Test plan
pnpm buildpassespnpm test— 565 tests pass