Skip to content

Plan 330: free-threaded CPython 3.14t support (Beta) - #9

Open
dbowm91 wants to merge 10 commits into
mainfrom
feat/auto-20261128-fb4f0bec
Open

dbowm91 wants to merge 10 commits into
mainfrom
feat/auto-20261128-fb4f0bec

Conversation

@dbowm91

@dbowm91 dbowm91 commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Merges feat/auto-20261116-7cc8b1dc (tip 6e3003f) onto main as an additive cp314-cp314t wheel family for free-threaded CPython 3.14t on Linux x86_64 (glibc), macOS arm64, and Windows x86_64 — at Beta.

The extension already advertised Py_MOD_GIL_NOT_USED before this merge: PyO3 ≥ 0.28 makes free-threading opt-out, so the bare #[pymodule] at crates/eggserve-python/src/lib.rs ran GIL-free from a source build while the docs said free-threaded was unsupported, and Plan 267's "loads GIL-required by default" rationale was inverted. This lands the explicit declaration, the CI lane, the tests, the validators, and the corrected documentation.

Tier: Beta, not Stable

The branch tip promotes the family to Stable. This PR reverses only that promotion:

  • the three soak records (334-soak-{1,2,3}.json) name no commit, wheel filename, or host, and all three were taken on one macOS arm64 machine;
  • the branch's own Plan 327 states "wheel filenames are the authority" and "no partial promotion", so its own standard is not met.

The classifier is Free Threading :: 2 - Beta, EXPECTED_FREE_THREADING_TIER = 2, and every touched doc says Beta. Milestone 332 owns the per-target evidence and the promotion decision.

Renumbering

main already assigns 326 to the public-bind acknowledgment milestone and 327 to the TLS substrate corrective, so the branch records are renumbered 326 → 333 and 327 → 334: implementation plans, closure records, the soak records and their JSON plan field, and every cross-reference in docs, scripts, workflows, the Python crate, the wheel matrix, the skill, and the Plan 267 pointer. git grep -nE '32(6|7)-free-threaded' returns nothing; the existing 326/327 records are untouched.

Content

  • explicit #[pymodule(gil_used = false)] declaration;
  • crates/eggserve-python/tests/test_free_threaded.py — 8 tests, skipped on GIL builds, including a fresh-interpreter -X gil=0 assertion that the GIL stays disabled after import;
  • tunnel recv contention guard (typed error instead of a misleading closed state);
  • python-free-threaded CI lane, free-threaded compile check, family-aware wheel-matrix and release validators, three -ft matrix entries;
  • docs: toolchain-support, python-packaging, release-contract, release-process, library-capability-matrix, python-api, python-http-server-compatibility, SECURITY, CHANGELOG, and the agent skill;
  • plans: 330 (adoption, closed with a closure record), 331 (concurrency hardening), 332 (contention evidence and promotion).

Gates

Gate Result
check-crate-topology.py pass
wheel-matrix.py validate / self-test pass
check-release-wheel-set.py --self-test pass
check-release-workflow.py / --self-test pass
check-python-release-metadata.py pass at tier 2
metadata gate with classifier mutated to Stable fails as designed (restored)
cargo fmt --all -- --check pass
free-threaded compile check (3.14t) pass, Py_GIL_DISABLED asserted
cargo clippy --lib -- -D warnings (excluded crate) pass
PYTHON=<3.14t> test-python-wheel.sh 864 tests, OK, 123.9 s
PYTHON=<3.14> test-python-wheel.sh 864 tests, OK (skipped=8), 122.3 s

The GIL lane skips exactly the eight free-threaded tests.

Not run / not proven

  • ./scripts/verify.sh fast was not run end-to-end. It invokes cargo check/clippy --manifest-path crates/eggserve-python/Cargo.toml, which cannot build from a worktree nested under the outer checkout ("current package believes it's in a workspace when it's not"). Its constituent gates were run individually. Workspace-member clippy and tests were not run locally because no workspace crate is touched: git diff --name-only origin/main..HEAD -- crates | grep -v eggserve-python is empty.
  • The declaration guard is proven for the tier half (mutation) but not for the attribute half: removing gil_used = false was not mutated. That half rests on the -X gil=0 assertion test in the free-threaded lane.
  • The Python-crate gates and both wheel suites ran from a git archive export of 87bbb52 with a temporary empty [workspace] table appended (not committed); maturin 1.14.1 was provisioned in a throwaway venv because the shipped 3.14t interpreter has no maturin module.

Commits

  • e30427d — Plans 330-332 plus registry and roadmap records.
  • 87bbb52 — merge of 6e3003f; three conflicts resolved (CHANGELOG.md, plans/registry.md, plans/subsystems/python-facade-roadmap.md).
  • 43fb5e2 — Plan 330 closure record and status; registry next number is 335.
  • e7a0a46 — restores branch roadmap sections dropped by the --ours resolution (§8 concurrency semantics, §9 3.14t CI lane, §10 risk bullets).

No publication, no version bump, no tag.

CI Test added 10 commits November 23, 2026 22:15
Add a Beta cp314-cp314t wheel family for Linux x86_64 (glibc), macOS
arm64, and Windows x86_64 while keeping cp311-abi3 unchanged.

- declare #[pymodule(gil_used = false)] explicitly
- add the tunnel recv contention guard and one-shot bridge docs
- add tests/test_free_threaded.py (8 tests, skipped on GIL builds)
- make the wheel matrix, release-set validator, metadata gate, and
  release workflow family-aware (13 required pairs on 10 platform tags)
- add the python-free-threaded CI lane and compile gate
- document the Beta tier, classifier, and support boundaries

Local evidence: the cp314-cp314t wheel builds and the full 861-test
suite passes on CPython 3.14.5t (macOS arm64); the GIL wheel stays
cp311-abi3 with 861 tests passing (skipped=8); clippy, fmt, and every
packaging gate pass.

Plan 326 is conditionally closed: the named conditions are a green
python-free-threaded CI run and a three-target release aggregate.
Plan 327 (registered in this commit) obtains both, adds the soak
substitute for TSan, and makes the Beta/Stable decision.

Plans: 326, 327
Add scripts/soak-python-free-threaded.py as the documented substitute for a
TSan-instrumented CPython (no such interpreter is available, and Rust-only
TSan would not observe Python callback state). It drives the public
lowlevel surface on loopback across two server phases with concurrent
buffered POSTs, streamed responses with byte verification, one-shot body
and iterator races, tunnel recv contention, and client disconnects during
a slow stream, then writes one JSON record per run.

Three recorded runs on CPython 3.14.5t (macOS arm64), 400+ requests,
8 workers, 8 callbacks, 120 s each: 84769, 80411, and 82748 HTTP requests
with zero failures, 582/576/579 tunnel cycles, 592/585/590 disconnects,
handler peak exactly 8 (the permit bound), one thread at exit, and the GIL
still disabled. The script exits non-zero on any unexpected error, content
mismatch, invariant violation, GIL re-enable, or budget shortfall.

Records: plans/closure/python-facade/327-soak-{1,2,3}.json
The release metadata gate hard-coded the Beta classifier. Replace that with
one expected-tier constant, accept exactly one Free Threading classifier,
and require it to match the declared tier exactly when cp314t is a required
matrix family (and be absent otherwise). The new --self-test exercises both
the Beta and Stable configurations plus the mismatch, missing, duplicate,
and absent-family cases, so a promotion cannot leave pyproject, the docs,
and the gate out of sync.

Current declaration stays tier 2 (Beta); WP-E of Plan 327 flips the constant
together with pyproject and the docs if all promotion criteria hold.
Both macos-14 arm64 release jobs were cancelled one second after
assignment with runner_id 0, twice (attempts 1 and 2 of release run
45281528704), while the CI platform-compile macos-latest lane provisioned
in 45 s. Move the two arm64 matrix targets and the post-publish macOS
smoke to macos-latest. The platform tag stays pinned by
MACOSX_DEPLOYMENT_TARGET 11.0 and the matrix platform_tag, so no support
claim changes.

Manual platform-qualification.yml still targets macos-14; it is outside
this plan and is recorded as a residual finding.
Close Plan 326 now that both named conditions are observed: CI run
45277923657 is green with the python-free-threaded job (CPython 3.14.10t,
861 tests, GIL stays disabled), and release run 45283657891
(publish_target: none) reached a green 13-pair aggregate containing the
three cp314t wheels, with abi-proof 5/5 on CPython 3.11-3.15.

Record the Plan 327 promotion-gate evaluation: all four criteria are met.
Retain the Beta classifier because the plan makes promotion conditional on
the owner confirming that a no-publish aggregate satisfies the gate's
release leg, and that confirmation is not recorded. The closure enumerates
the exact two-file functional change plus the doc statements needed to flip
the tier once confirmed.

Also update the registry and roadmap: rows 326/327 closed, both milestone
statuses updated, next number stays 328.
The owner confirmed that a publish_target: none release aggregate satisfies
Plan 326's release leg, and all four gate criteria are met: the 13-pair
aggregate is green with the three cp314t wheels, abi-proof is 5/5 on
CPython 3.11-3.15, the contention soak passes three zero-error runs, and the
Plan 326 closure carries no medium-or-higher finding.

Promote the advertised tier on the same three targets only:

- pyproject classifier: Free Threading :: 3 - Stable
- metadata gate: EXPECTED_FREE_THREADING_TIER = 3 (exactly one classifier at
  the declared tier; --self-test covers both configurations)
- tier statements updated across toolchain-support, python-api,
  python-http-server-compatibility, python-packaging, release-contract,
  release-process, library-capability-matrix, SECURITY, CHANGELOG, and the
  eggserve-dev skill bullet
- Plan 327 closure and registry/roadmap record the confirmed decision

No runtime, API, dependency, wheel-tag, or platform change; the wheel set is
identical to the qualified aggregate.
The 2026-11-28 audit found the extension already advertises
Py_MOD_GIL_NOT_USED. PyO3 >= 0.28 makes free-threading opt-out, so the
bare #[pymodule] at crates/eggserve-python/src/lib.rs:1670 runs GIL-free
from a source build on free-threaded CPython while the support contract
says free-threaded is unsupported. CPython 3.14.5t confirmed it: the GIL
stayed disabled across "import eggserve._native" and "import eggserve",
the built cp314-cp314t wheel installed, and the 856-test suite passed.
The cp311-abi3 wheel is rejected by the same interpreter, so only source
builds reach 3.14t users today. Plan 267's "loads GIL-required by
default" rationale is inverted.

Merge research on the adjacent branch feat/auto-20261116-7cc8b1dc (tip
6e3003f, merge base 4949a77, six commits, 40 files, 4530 insertions):
git merge-tree conflicts only in CHANGELOG.md and plans/registry.md, and
the branch's plan numbers 326/327 collide with main's public-bind and TLS
milestones. Its three soak records carry no commit SHA, wheel filename,
or host, and all come from one macOS arm64 interpreter, so the branch's
own "wheel filenames are the authority" standard does not hold for the
Stable promotion it lands.

Three records, no product change:

- 330 adopts the branch as a Beta cp314-cp314t family, renumbers its
  records to 333/334 during merge resolution, and reverses only the
  Stable flip.
- 331 hardens the concurrency contracts the audit found: the BodySource
  take/restore lost read, the request-body bridge restore shape,
  BodyChunkIterator and facade close/serve regressions, and
  AsyncServer.track() loop affinity.
- 332 owns per-target contention evidence and the only Beta-to-Stable
  decision.

The registry moves its next number to 333 and reserves 333/334, and the
python-facade roadmap gains the status, known gap, dependency graph, and
milestone sections. Implementation plans 000-003 are untouched.
… support (Beta)

Lands the six-commit free-threaded branch (ab418f8..6e3003f) on main as an
additive cp314-cp314t wheel family for CPython 3.14t on Linux x86_64 glibc,
macOS arm64, and Windows x86_64: the explicit
#[pymodule(gil_used = false)] declaration, the python-free-threaded CI lane,
the free-threaded concurrency tests, family-aware wheel-matrix and release
validators, the tunnel recv contention guard, and the corrected docs.

Three conflicts, all resolved by keeping both sides:

- CHANGELOG.md: main's "Plans 320-329" header is kept and widened to 334;
  the branch's free-threaded entry stays.
- plans/registry.md: main's 320-329 rows are kept; the branch's Python
  facade rows and its 326/327 implementation rows are renumbered.
- plans/subsystems/python-facade-roadmap.md: the branch's milestone and
  status sections are renumbered and merged with the 330-332 milestones the
  plan-set commit added. That third conflict is local, not branch drift:
  the pre-merge merge-tree run against origin/main showed only the first
  two.

Plan numbers are renumbered because main already assigns 326 to the
public-bind acknowledgment milestone and 327 to the TLS substrate
corrective. 326 -> 333 and 327 -> 334, including the implementation plans,
the closure records, the three soak records and their "plan" field, and
every cross-reference in docs, scripts, workflows, tests, and the skill. The
existing 326/327 records are untouched.

The family lands as Beta, not Stable. The branch's final commit promoted it
on the strength of three soak records that name no commit, wheel filename,
or host and were all taken on one macOS arm64 host, so the claim is not
reproducible from the record and does not meet the branch's own "wheel
filenames are the authority" standard. The classifier is
"Free Threading :: 2 - Beta", EXPECTED_FREE_THREADING_TIER is 2, and every
touched doc says Beta. Milestones 333/334 keep an amendment block recording
the renumbering and the reversal; Milestone 332 owns the per-target
evidence and any promotion.

The GIL cp311-abi3 family, the HTTP/TLS/runtime surfaces, the CLI, and every
default are unchanged. No publication and no version bump.
Adds the closure record for the merge of feat/auto-20261116-7cc8b1dc at
87bbb52 and marks 330 closed in the registry and the python-facade roadmap.
The registry's next number is 335; 333/334 stay the renumbered branch
records.

The closure records what actually ran: the seven Python static validators,
cargo fmt, the free-threaded compile check (Py_GIL_DISABLED asserted), clippy
on the excluded Python crate, and both wheel suites from a git-archive export
of the merge commit -- 864 tests OK on CPython 3.14t (123.9 s) and 864 tests
OK with exactly the eight free-threaded tests skipped on the GIL lane
(122.3 s). The metadata gate rejects a Stable classifier by mutation and
passes at Beta.

It also records five deviations: the third merge conflict (roadmap) that the
pre-merge merge-tree run did not predict, the nested-worktree Cargo limit,
verify.sh fast not run end-to-end because it invokes the same excluded-crate
manifest path, maturin 1.14.1 provisioned in a throwaway venv, and the
wheel-tag half of the declaration guard left to check-release-wheel-set.py
instead of duplicating a second tag authority.

docs/release-process.md now separates the two tier vocabularies: matrix
tier = "required" is a release-aggregation property, not the user support
tier.

No product behavior change; documentation and records only.
…ropped

Resolving plans/subsystems/python-facade-roadmap.md with the pre-merge
version also discarded the branch's edits outside the conflict hunks. A
comparison of every line the branch added (git diff --unified=0 origin/main
6e3003f) against the merged file, with the 326->333 / 327->334 renumbering
applied, found three missing blocks and one missing paragraph:

- section 8: the free-threaded concurrency semantics -- max_python_callbacks
  and the Plan 322 producer budget bound parallel execution, the bridge's
  Rust state stays behind Mutex and atomics, handler thread-safety is the
  caller's responsibility, and timeouts still cannot interrupt Python code;
- section 9: the separate 3.14t CI lane (Py_GIL_DISABLED compile, cp314-cp314t
  wheel build and install, GIL-disabled assertion, suite plus
  test_free_threaded.py);
- section 10: the three risk bullets (parallel handlers sharing mutable
  Python state, no TSan or adversarial soak in routine CI, free-threaded
  interpreters absent from the ARMv7/Windows-arm64/musl lanes).

All four are restored verbatim. The registry was checked the same way and
lost nothing beyond intentionally superseded rows.

Documentation only; no code, gate, or tier change.

This branch has not been deployed

No deployments
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