Skip to content

fix: test nonthrowing connection ownership before optimized HTTP consumption - #20

Closed
ThorFuchs wants to merge 5 commits into
mainfrom
fix/macos-release-connection-consume
Closed

ThorFuchs wants to merge 5 commits into
mainfrom
fix/macos-release-connection-consume

Conversation

@ThorFuchs

@ThorFuchs ThorFuchs commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

HTTP #13 — optimized ARM64 linker fix with strict admission preserved (v3)

Head: 2c4f9e540f879c1d6c88fbb294b965da38c0a066. Draft until exact-head release matrix passes. Upstream SwiftNIO early-EOF issue #12 remains independent.

Reproduced baseline

  • main at 104386cb2aef...: optimized ARM64 SwiftConformanceServer fails to link nonexported NIOHTTPServer.Connection.HTTPProtocol metadata, while root library compilation succeeds.
  • PR fix: test nonthrowing connection ownership before optimized HTTP consumption #20 v1 (2d5ee5c) fixed both optimized fixture links, but removed the strict connection-cap admission and failed nativeHTTPConnectionCeilingRejectsOvershootAndRecovers in debug/release, plus an optimized stalled-writer test.
  • v2 (998dc450) restored the connection cap but attempted to capture a ~Copyable Connection in an escaping Task closure, rejected by Swift 6.4 compiler. Do not restore that closure.

Current v3

  • Keep the original strict reservation check, now nonthrowing: connect(limit:) returns UUID? and rejects cancelled/stopped/over-limit connections.
  • On rejection, cancel the current per-connection NIO task via withUnsafeCurrentTask { $0?.cancel() }, then transfer the move-only Connection directly to the upstream default handler. No escaping capture, no early throw or locally generated destructor. The upstream task owns its socket.
  • On accepted requests, keep the existing handler, registration/disconnect accounting, and NIO maxConnections backpressure.
  • No changes to SwiftNIO, test masking, compiler flags or release timeouts.

Exact-commit qualification

  • Scripts/test.sh on macOS 27 passed the SDK tests at the current v3 head (CI 45058598247).
  • Official server/client referee scripts on exact SHA.
  • Optimized ARM64 server/client fixture links and release-mode tests pass.
  • Linux optimized release compile pass.
  • Correct immediate EOF on refused connection, zero handler effects, bounded shutdown, stalled writer cancellation.
  • Combined qualification with published swift-http-server 0.5.0 from PR #21, after both isolated investigations.

Do not merge before CI passes. Public SDK and early-EOF issue #12 unaffected.

ThorFuchs added a commit that referenced this pull request Nov 22, 2026
Use exact 0.5.0 tag, align both SwiftPM resolution pins and enforce audited source revision in release graph gate. Document independently from PR #20 ownership experiment.
@ThorFuchs
ThorFuchs marked this pull request as ready for review November 23, 2026 18:30
ThorFuchs added a commit that referenced this pull request Nov 25, 2026
…28)

H1 — official SwiftNIO release integration and Studio-only CI.

Requires SwiftNIO 2.105.2+; root/fixture locks select official tag b003027fc38b649a43e9aad77c3d4e4a2c5b6997 containing apple/swift-nio#3783. Remove three known-issue scopes without altering assertions or deadlines. No runtime changes, fork or unrelated pin drift. Core remains d892bd34add1ad067ae6f286bd74c824486d8c07.

H1.3 qualification receipt (2026-11-25):
- Native full run at 9c1f78e: 13/13 stages, 245/245 cumulative Swift tests, 4/4 referee runs, 812/812 recorded checkout comparisons.
- CI #64 at PR head 576ff38, tested merge 018ab8f, base d2e4cb5: 3/3 jobs PASS on Studio native Debug, optimized Release, and Linux ARM64 optimized compile/link. Both native fixtures linked; all three unmasked disconnect cases passed in both modes, server 37/37 required + 13/13 extensions and client 37/37 (25 OAuth) each mode.
- No hosted runner or GitHub artifact uploads; local native evidence retained. Linux is ARM64 compile-only; AMD64 and runtime qualification remain separate.

CI: https://github.com/ThorFuchs/Swift-MCP-Server-HTTP/actions/runs/45604079743
Reviewed receipt: #28 (comment)
Native receipt: Docs/Release/H1_SWIFTNIO_RELEASE_QUALIFICATION.md

Refs #12 and #27. H2/#20, #21, #25, #14 and final RC1 gates remain open. No claim of complete raw referee coverage or native AMD64 qualification.

Copy link
Copy Markdown
Owner Author

H2.1 — Source/qualification reassessment (2026-11-25)

Disposition: REDUNDANT PR; no new production changes recommended. GitHub reports zero changed files for this PR at head c5bdda890993d925e434129619c518aeeec2f15e. The compare from its previous base d2e4cb5a07b4f2453ccd8106d799ca548470c202 also has zero changed files. This is not an inference from a green CI result: PR #23 explicitly includes the v3 admission correction and was squash-merged on 2026-11-23 as 7287b61910e7. That commit is an ancestor of current main.

Direct Git blob and source comparisons of Sources/MCPHTTP/HTTPTransport.swift at v3 2c4f9e540f879c1d6c88fbb294b965da38c0a066, #20 head, #23 squash, pre-H1 main, and current main 2cbedd510b15f510c24373ea45ca4fc9cf754cbe all yield the same blob 1561da03862e2ccf19264ecba2acd101e70d3eac.

The nonthrowing strict reservation, rejection via cancellation of the current NIO connection child, and transfer of the move-only connection to the upstream handler are already present. Retain them; do not revert to the pre-v3 throwing path or v1 relaxed ceiling. H1 did not merge #20 separately, but did qualify its already-integrated code. This corrects the misleading earlier H1 interpretation that the ownership change was absent.

H1 CI #64, same tree as integrated H1 for the relevant files, passed both optimized executable links and macOS Debug/Release SDK/referees; the native connection-ceiling, finite/live stalled-writer, active-provider shutdown, idle keepalive shutdown and three disconnect cases passed in both modes. Release finite: returned=1/cancelled=0; live: returned=0/cancelled=1. The earlier finite-provider cancellation assertion was a different contract (see #23). This does not prove the original linker fault was solely caused/fixed by SwiftNIO, or qualify removal of the existing ownership code. No fresh test runs were launched for this read-only source and existing-evidence review.

Recommendation: close #20 unmerged as superseded by #23; preserve its branch/history. No rebase, merge, or new code needed. #13 remains open for the independent official swift-http-server dependency and release/platform gates; #22 host/toolchain causal investigation and #25 head/static writes remain distinct. This reassessment does not itself close issues or authorize RC1.

Copy link
Copy Markdown
Owner Author

H2.1 final disposition: superseded by merged #23 (7287b61). Maintainer authorized closure without merge. Zero changed files; already-qualified v3 transport remains in main. Preserve the branch and history; no revert, rebase or cherry-pick. #13, #21, #22 and #25 remain independent. See H2.1 review above.

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.

1 participant