Repository navigation
Development and Testing
The project uses SwiftPM and Swift Testing on macOS 26 with Xcode 26.6 or later and Swift 6.3.3 or later. Both manifests use Swift language mode 6. Run commands from the repository root unless a section says otherwise.
swift package resolve
swift buildThe nested package can be built independently:
cd Swift
swift package resolve
swift buildFormatting is described by .swift-format at the repository root, matching the
existing house style (four-space indentation, 160-column lines):
swift format lint --recursive --parallel Swift/Sources Swift/TestsCI runs this as a blocking gate. The tree was reformatted in one commit so that it could be one; run the in-place command above before pushing or the build fails on formatting alone.
Every target opts into Swift strict memory-safety checking. CI also treats warnings as errors and enforces complete concurrency checking plus explicit Sendable declarations. Reproduce that diagnostic build locally with:
./Swift/check-toolchain.sh
swift build \
-Xswiftc -warnings-as-errors \
-Xswiftc -strict-concurrency=complete \
-Xswiftc -require-explicit-sendableRun the complete root-package suite:
swift testUseful focused suites:
swift test --filter WebTransportHTTP3CoreTests
swift test --filter WebTransportTLSCoreTests
swift test --filter WebTransportNetworkRuntimeTests
swift test --filter WebTransportTestsTest targets and their primary scope:
| Target | Coverage |
|---|---|
WebTransportTests |
Public API, separate processes, loopback networking, stress, release artifacts, and compatibility integration. |
WebTransportNetworkRuntimeTests |
Runtime lifecycle, endpoint handling, deterministic network support, and hardening. |
WebTransportHTTP3CoreTests |
HTTP/3, QPACK, sessions, streams, datagrams, flow control, limits, and malformed input. |
WebTransportQUICCoreTests |
QUIC state, codecs, ACK/loss behavior, malformed input, and property corpora. |
WebTransportTLSCoreTests |
TLS messages, state, key schedule, trust gating, exporter behavior, and hardening. |
WebTransportCryptoAppleTests |
Initial-key derivation and packet protection. |
WebTransportUDPAppleTests |
IPv4/IPv6 loopback and cancellation behavior. |
Every parser that consumes peer bytes is driven with a mechanically generated corpus, asserting only that it returns or throws and never traps. A trap in any of them is remotely reachable, because they all run before a session exists.
swift test --filter 'peerFacingParsers|huffmanDecoder'
WEBTRANSPORT_FUZZ_ITERATIONS=20000 swift test --sanitize=address \
--filter 'peerFacingParsers|huffmanDecoder'The generator is seeded and deterministic, so a CI failure replays exactly. The suite runs a small budget on every build; a CI job runs the large one under AddressSanitizer.
swift test --sanitize=thread --skip CLIProcess --skip ReleaseArtifactsThe CLI process and release-artifact suites are excluded because they orchestrate subprocesses against wall-clock timeouts that the sanitizer's slowdown exceeds, which reports as a timeout rather than a race. The in-process runtime, protocol, and crypto tests are where shared mutable state actually lives.
./Swift/run-soak.sh 400Drives sustained connection churn and judges session construction against destruction. Resident memory is reported for context only: a freed session's pages stay with the allocator, so RSS remains elevated long after the objects are gone and cannot by itself distinguish a leak from a warm heap. Growth during churn is expected while abandoned work holds sessions for its wait window.
A session that stops making progress and then times out cannot be investigated by
adding logging. Instrumentation on the delivery path suppresses the class of
failure this project has actually hit: enabling WEBTRANSPORT_INTEROP_DEBUG took
an intermittent establishment failure from about 1% to zero in 400 connections.
Anything learned that way is a measurement of the instrument.
Observe from outside, after the process is already stuck.
# Which await is each task suspended on. This is the useful one.
swift-inspect dump-concurrency <pid>
# Thread stacks. Necessary but not sufficient — see below.
sample <pid> 2 -file /tmp/hang.txtTwo things make this work, and neither is obvious:
-
swift-inspectcannot attach to a release binary as shipped. They are ad-hoc signed, sotask_for_pidfails with(os/kern) failure 0x5. Re-sign a copy first:codesign -f -s - --entitlements debuggable.entitlements WebTransportServer
with
com.apple.security.get-task-allowset to<true/>. -
A thread sample alone will mislead you. A suspended Swift task has no OS thread stack, so a hung process shows two idle threads and nothing running, which reads as "nothing is happening" rather than "everything is parked". Only
dump-concurrencyshows the suspension points.
Capture both peers. The establishment hang was only understood by reading the two dumps together: one side had already sent a stream and moved on, while the other was still waiting for it, which is what identified the loss as delivery rather than slowness.
Failures of this class are load-dependent. Reproducing them needs a saturated
host — for i in $(seq 1 16); do yes > /dev/null & done on an otherwise idle
machine — and a machine that is busy for unrelated reasons will not give
comparable numbers between runs. Always state the load a measurement was taken
under.
swift run WebTransportClient --scenario all
swift run WebTransportServer --scenario allEach executable runs the same 40-scenario positive and negative protocol matrix. Use --list to inspect scenario names and --help for command syntax.
cd Swift
./check-api-compatibility.sh
./build-release-apple-silicon.shThe compatibility script builds an external package that imports the public products. The release script performs two clean arm64 builds, checks architecture and product selection, compares normalized binary hashes, and writes WebTransportClient, WebTransportServer, and SHA256SUMS under .build/release-artifacts/. Package tests and CI smoke-test those artifacts.
| Change | Minimum evidence |
|---|---|
| Documentation | Source/config fact check, local and Wiki link checks, rendered Markdown review. |
| Public API | Build, complete tests, API compatibility script, DocC conversion. |
| CLI | Complete tests and both conformance suites. |
| Runtime or trust | Runtime/public API/process tests plus IPv4 and IPv6 packet loopback. |
| HTTP/3, QPACK, or sessions | HTTP3Core tests and relevant conformance scenarios. |
| QUIC, TLS, crypto, or UDP | Owning target tests plus an integration path. |
| A parser reading peer bytes | The fuzz suite, plus a case covering the new shape. |
| Concurrency or task lifetime | Thread Sanitizer, plus the soak when connection state is involved. |
| Anything a peer negotiates |
./Swift/run-docker-interop.sh, since our own client agrees with us by construction. |
| Release tooling | Reproducible release build and CI review. |
| Interoperability | The appropriate runner from [[Release and Interoperability |
The interoperability row is not a formality. Every internal test exercises this implementation against itself, so a defect both sides share is invisible to all of them. Two HTTP/3 critical-stream violations survived the entire suite and 80 conformance scenarios and were caught by the first run against a browser.
Environment-sensitive checks must be reported precisely. Do not reuse old generated artifacts as evidence for a new code revision.
- Identify the owning module and read its nearest tests.
- Check public API, protocol, trust, logging, manifest, CI, and documentation effects.
- Make the smallest coherent change and cover important negative paths.
- Run focused checks, then the broader validation required by the change.
- Review the final diff for generated output, credentials, stale claims, and unrelated edits.
- Update documentation whenever setup, API, behavior, trust, workflow, or release evidence changes.