Skip to content

fix(sni-connect): add shared request admission queue - #81

Merged
huhuanming merged 7 commits into
mainfrom
codex/sni-request-admission
Aug 25, 2026
Merged

fix(sni-connect): add shared request admission queue#81
huhuanming merged 7 commits into
mainfrom
codex/sni-request-admission

Conversation

@huhuanming

@huhuanming huhuanming commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add requestId, per-runtime cancellation APIs, and debug snapshots to the public SNI JS/native API
  • add process-shared Android and iOS admission control with global 64, pair 16, and pending 256 limits
  • queue requests within a wall-clock deadline, canonicalize IP pairs, and make pending/active cancellation race-safe
  • cover admission, cancellation, overflow, timeout, canonical IP, snapshot IDs, and queue draining in native tests
  • bump all 35 publishable workspaces to 3.0.81 and document the release in CHANGELOG.md

Why

The app-monorepo currently carries these SNI request-queue and cancellation behaviors as a package patch. Moving them into the maintained package source removes that patch dependency and ensures main/background React Native runtimes share capacity while retaining cancellation ownership per runtime.

Impact

  • requests beyond active capacity are queued instead of immediately rejected
  • total request timeout includes queue wait; transports receive only the remaining timeout
  • duplicate request IDs cancel the older request without allowing stale callbacks to unregister the replacement
  • public-IP, SNI/TLS hostname, direct-connect, no-redirect, HTTP/1.1, and existing size/timeout validation boundaries remain intact
  • app-monorepo can upgrade to @onekeyfe/react-native-sni-connect@3.0.81 and remove the downstream patch

Validation

  • corepack yarn install --immutable ? passed
  • corepack yarn workspace @onekeyfe/react-native-sni-connect prepare ? passed
  • corepack yarn workspace @onekeyfe/react-native-sni-connect typecheck ? passed
  • corepack yarn workspace @onekeyfe/react-native-sni-connect test --runInBand ? passed (6/6)
  • corepack yarn workspace @onekeyfe/react-native-sni-connect test:android ? passed (19/19)
  • macOS/iOS VM swift test ? passed (20/20)
  • iOS Simulator XCTest ? passed (20/20)
  • New Architecture CocoaPods/example Simulator Debug build ? passed (BUILD SUCCEEDED)
  • Legacy Architecture ? not validated: React Native 0.83 forces New Architecture even when the temporary Pod configuration requests RCT_NEW_ARCH_ENABLED=0
  • git diff --check ? passed

The iOS runtime harness does not cover real-network cancelAllRequests, response-body cancellation, cross-runtime ownership, or duplicate-ID replacement; those paths were source-reviewed and compiled under New Architecture.

Publishing

  • Initial workflow run published @onekeyfe/react-native-sni-connect@3.0.81.
  • Full-workspace workflow run published the other 34 packages at 3.0.81.
  • The full-workspace run is red only because the already-published SNI 3.0.81 was rejected as a duplicate; its log contains 34 successful publishes and no other npm error.
  • Registry metadata independently verifies all 35 publishable packages have latest=3.0.81.

@huhuanming
huhuanming marked this pull request as ready for review August 3, 2026 15:46
Comment thread native-modules/react-native-sni-connect/ios/SniConnectClient.swift
Comment thread native-modules/react-native-sni-connect/ios/SniConnectClient.swift
Comment thread native-modules/react-native-sni-connect/ios/SniConnectClient.swift
Comment thread CHANGELOG.md Outdated
@socket-security

socket-security Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​react-native-mmkv@​4.2.0 ⏵ 4.3.2100 +110074 +192 +4100
Updatednpm/​nitrogen@​0.35.2 ⏵ 0.36.593 +31008396100
Updatednpm/​react-native-nitro-modules@​0.35.2 ⏵ 0.36.5100100100 +196 +2100

View full report

Comment thread native-modules/react-native-sni-connect/ios/SniConnectClient.swift Outdated
@huhuanming
huhuanming merged commit ee19473 into main Aug 25, 2026
4 checks passed
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.

3 participants