Skip to content

fix(net): preserve TLS transport and completion ownership - #215

Merged
vincentkoc merged 18 commits into
mainfrom
claude/fix-tls-native-transport-20261019
Nov 1, 2026
Merged

vincentkoc merged 18 commits into
mainfrom
claude/fix-tls-native-transport-20261019

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Landing receipt

Merged as d9be087 onto 7b573c0. All 23 changed files have the exact qualified head blobs. The intervening five main-branch changes concern parser/transpiler code and do not overlap this PR. The full landed tree therefore differs from the source qualification tree; qualification remains exact-source evidence, not an exact merged-head rerun. Remote main ancestry was verified.

What changes

TLS wrappers over real sockets can lose pending write completion during teardown. This repairs ownership at the transport boundary: native TLS transports own read/write/shutdown/close delivery, pending writes retain their completion owner, and shutdown joins actual lower-transport completion. Generic Duplex transports remain supported. TLS and HTTP/2 attachments use identity-based removal and attachment-scoped close completion. Traced wrapper edges and bound callbacks replace the permanent startup root while preserving context, abort and transport owners.

Ciphertext completion precedes shutdown, including held close_notify writes and error/destroy completion. The resumed-session follow-up preserves the verifier callback and owner context while rechecking the resumed chain; the main branch already contains #213.

Both absent SSL-config cleanup sites in src/runtime/socket/socket_body.rs check is_some() before set(None). Live configuration destruction and StartTLS move-before-callback ownership remain intact. The opt-in, nonpublishing release dry run verifies source, WebKit, artifact and genuine Node identities and preserves per-file TLS/HTTP/2 reports. No release or consumer pin changes.

This is a partial transport/completion lifetime repair. Complete dropped-cycle collection is not claimed. Its unknown retaining owner remains tracked in #219. The original collection checkpoint and assertions remain unchanged; the experimental relocation was reverted.

Native qualification

Reviewed head: 670b23f.
Its full tree equals qualified source 510fef5 (tree 99b4a8b6b24c4ea171760ebf812ac7ca9911967c). Engine: b82bc917e99110b61c3a21202d6def7457aa194c.
Original retention fixture SHA-256: d4c04a72b89bc7d33c292a16a57c38f5da540815dc2e141adfd58c1bd9973af2.

All six canonical TLS/HTTP/2 files ran on every shipping target:

Native target Pass Existing skips Fail
Linux x64 283 8 0
Linux ARM64 283 8 0
macOS ARM64 283 8 0
Windows x64 281 10 0
macOS x64 282 8 1
Windows ARM64 280 10 1

The six-target build/qualification matrix built all targets and passed both Windows compatibility jobs. Its first four targets completed all six suites. The last two originally stopped after the first suite; macOS replay and Windows ARM64 replay now complete all six files against the exact retained production executables. Both completion regressions pass on both hosts. Every remaining suite passes; there are zero XML errors.

Those replays remain strictly red for the unchanged dropped-cycle assertion at socket-retention.test.ts:545: expected retainedAlive/droppedCollected/releasedCollected=true/true/true, observed true/false/true. No fixture weakening, skip, retry or success exception was added. The Windows-only retry repairs stale Git stat metadata with update-index --refresh before the unchanged clean-index gate; it does not stage content.

Verified replay artifacts:

  • macOS x64: 13068122421; ZIP SHA-256 133233c20b3d6dfe376bd9dc92d47cc61445ad28c8d266d203ab39e98d869e38.
  • Windows ARM64: 13068940537; ZIP SHA-256 a61a0711efe13653f0ff9340617846d67c660276cd7fea1840e24a194a134816.

ZIP identity, safe entries, CRC, all manifest records, archived controls, source/index restoration and raw reports were verified. All 291 cases per replay are accounted for.

Inherited collection failure

The unchanged fixture already fails on the published pre-PR main 191755e / b82 engine on macOS x64, Windows ARM64 and Windows x64: true/false/false in baseline run. These are assertion failures after native execution.

Before the two absent-config guards, exact source 454a78a already produces the current true/false/true result on macOS x64 and Windows ARM64 in run 40897692970. Both completion regressions pass there. Both XML ZIP digests, safe entries, embedded full commit and failure signature were independently verified. This establishes an inherited failing predicate; it does not establish an identical retaining mechanism.

The physical heap/debugger investigation and its limits stay in #219. No scanner or checkpoint workaround is included here.

Regression and review evidence

  • The pre-fix daa0f3f7 build fails all three Bun cases from premature lower-stream termination; genuine Node passes the same three cases. Restored 6206814 passes the complete six-case oracle.
  • Historical Debug+ASAN at 454a78a passes the complete retention file: 10 passes, one Windows-only skip, zero failures, 24 expectations, with an explicit 90-second test timeout. This is separate from shipping-profile results.
  • Historical broad Debug+ASAN at 6206814 records 902 passes, zero failures, three skips and one todo across 14 commands, plus 13 overlapping focused passes. These are prior-head results.
  • The absent-config runtime repair and both replay controllers received fresh independent scoped review with no actionable P0-P2 finding. Targeted syntax/format and diff checks passed.

The Mordant duplication diagnostic remains advisory and red: two generic_body_not_generic findings in Listener.rs against baseline one. The named-pipe initializer gained fields earlier in this PR; connect_finish is unchanged from the base. This is not wholly inherited. A scoped source audit verified empty native callbacks/no queued write owner, caller SSL-context snapshot and matching typed acceptance, and plain-listener rejection of TLS-context replacement. No reachable ownership defect was found; the baseline is unchanged and no unrelated socket-layout refactor is included.

Checkpoint the reviewed TLS ownership repair before integrating current main. Native transport takeover, completion custody, shutdown joins, and regression coverage are retained together. The generic TLS retention case still needs qualification; no landing claim is made.
@socket-security

Copy link
Copy Markdown

Dependency limit exceeded — report not shown.

This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report.

Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard.

Socket is always free for open source. If this is a non-commercial open source project, contact us to request a free Team account.

@autofix-troubleshooter

Copy link
Copy Markdown

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

Keep live config destruction and the StartTLS move-before-callback ordering while skipping clears of an already absent large config.
@vincentkoc
vincentkoc marked this pull request as ready for review November 1, 2026 03:37
@vincentkoc
vincentkoc merged commit d9be087 into main Nov 1, 2026
12 of 26 checks passed
@vincentkoc
vincentkoc deleted the claude/fix-tls-native-transport-20261019 branch November 1, 2026 03:37
vincentkoc added a commit that referenced this pull request Nov 1, 2026
* commit 'd9be087429c21e563bb5ac29f8a11805e64b56a3':
  fix(net): preserve TLS transport and completion ownership (#215)
  fix(parser): keep decorated private assignment targets as references (#217)

# Conflicts:
#	CHANGELOG.md
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.

2 participants