Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/research/windows314-lifetime-replay/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Preserve the generated receipt and raw Windows captures, including CRLF.
REPLAY.json -text -whitespace
*.txt -text -whitespace
152 changes: 152 additions & 0 deletions docs/research/windows314-lifetime-replay/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Windows Python 3.14 lifetime-control replay

The six existing native Windows lifetime controls from
[PR #4683](https://github.com/CrocSwap/integer-mult-bounds/pull/4683) pass on
**CPython 3.14.9 x64, Windows 11 build 26300**, both normally and with the outer
unittest interpreter optimized. This supplies the specific Python 3.14 execution
evidence requested in that PR's **Open next questions** and
[Discussion #1472](https://github.com/CrocSwap/integer-mult-bounds/discussions/1472#discussioncomment-19126709).
The implementation and tests are unchanged. This is additional environment
coverage of existing controls, not independent test design or human review.

## Result and exact scope

Canonical main at execution:
`624de9dc66858af0945e5f8a0942488d62280d43`, priority revision 7.
The runs were serial on 2026-10-22, from 23:24:13 to 23:24:48 UTC.

| Invocation | Outcome | Unittest duration | Whole invocation |
|---|---|---:|---:|
| Normal outer interpreter, `-B -W error` | 6 passed, no skips | 17.350 s | 17.821106 s |
| Optimized outer interpreter, `-O -B -W error` | 6 passed, no skips | 16.817 s | 17.370000 s |

These are execution durations, not a speedup comparison. Each invocation had
a 120-second external timeout; the existing fixtures retain their own shorter
readiness, execution and cleanup bounds.

The six controls cover:

1. A failed unittest's child and grandchild stop, with failure/output preserved.
2. Inherited capture pipes do not turn successful completion into a timeout.
3. Joined work retains successful completion and literal output.
4. A successful unittest's child and grandchild stop.
5. A real module timeout remains a failure and stops the owned tree.
6. Removing the Windows supervisor is detected for both successful and failed
modules: the same retained-handle assertion observes surviving solvers.

The observer opens native process handles while all three fixture processes
are alive at a readiness barrier. It checks those identities before teardown
releases or independently stops the fixtures. This avoids mistaking a reused
PID or eventual emergency self-exit for successful cleanup.

`-O` and `-W error` apply to the outer unittest interpreter. They are **not**
claims that every descendant executes with those options. The existing test
launches its CLI without `-O`, and the production runner removes inherited
`PYTHONOPTIMIZE` before executing test modules. That assertion-preserving
policy and the isolated supervisor/gate arguments remain unchanged.

## Evidence and reproduction

[REPLAY.json](REPLAY.json) records exact commands, platform/build, GIL status,
runtime package/executable/DLL SHA-256 hashes, four consumed repository source
SHA-256 and Git blob identities, log hashes, environment handling and times.
All four source files matched committed main before execution and remained
byte-identical after both runs. Raw captures are
[normal stderr](normal.stderr.txt) and [optimized stderr](optimized.stderr.txt);
both stdout captures are empty and retained. The directory's attributes preserve
their exact Windows line endings. Unittest prints its success summary on stderr.

The workspace-local interpreter was the CPython team's
[NuGet `python` 3.14.9 x64 package](https://www.nuget.org/packages/python/3.14.9),
used via its `tools/python.exe`; no system interpreter or PATH was changed.
The [Python Windows documentation](https://docs.python.org/3.14/using/windows.html#the-nuget-org-packages)
describes this distribution for build/CI use. The exact downloaded package
SHA-256 is
`7cd9d07aec975212344dc6f7e45019378cf6775dd564181e269010a1eddaaec7`.

From the repository root, set `py314` to that package's executable and run:

```powershell
$py314 = 'C:\path\to\python.3.14.9\tools\python.exe'
& $py314 -B -W error -m unittest discover -s tests -p test_isolated_test_windows_exit.py -v
& $py314 -O -B -W error -m unittest discover -s tests -p test_isolated_test_windows_exit.py -v
```

The recorded launches removed `PYTHONOPTIMIZE`, `PYTHONPATH`, `PYTHONHOME`,
`PYTHONPYCACHEPREFIX` and `PYTHONWARNINGS` from each child environment and set
`PYTHONDONTWRITEBYTECODE=1`. The remaining environment was inherited; the
receipt does not claim a hermetic machine image. Use a fresh source checkout
with the recorded hashes. Runtime and timing strings need not match on another
machine; all six tests must execute and pass, including the mutant rejection.

This replays current main, rather than claiming the complete old PR tree is
identical. #4683's head was
`02d43658b948db1922a23369b1fa2ba9bc4f8f58`. Its full
`scripts/research_package.py` blob differs from current main; a separate
`ast.dump(..., include_attributes=False)` comparison found its
`run_windows_command` definition and `_WINDOWS_GATE` assignment identical to
the tested main versions. This comparison is limited to those two nodes and
is not a whole-runner review.

## Task, coordination and attribution

The live handoff was selected before retrieving the `portable-replay` card
(nonce `2941c600bffe1f98f2667f09cc9ccd1c`, scope key
`91a9a2afec282c926282`). Scope is **refined** to the named interpreter gap,
within the card's interpreter/version variation. The advance claim is
[here](https://github.com/CrocSwap/integer-mult-bounds/discussions/1472#discussioncomment-19134438).

Entry overlap covered 424 open PR bodies and 3,949 Discussion records, with
complete reported remote pagination. The closest related open work,
[PR #4779](https://github.com/CrocSwap/integer-mult-bounds/pull/4779), changes
the POSIX inherited-pipe boundary; it does not perform this Windows six-control
Python 3.14 replay. #2452's Python 3.14 Windows observer concerns the earlier
registered-runner live-leader timeout case. Neither is a substitute for this
isolated-module exited-leader handoff.

At the final checkpoint, canonical main was unchanged (fetch completed at
2026-10-22T23:28:46Z); the guidance, selected record and four consumed sources
had no upstream delta. Refreshed overlap covered 425 open PRs at 23:30:09Z and
3,957 Discussion records at 23:31:36Z, with complete reported pagination.
The local scan covered 5,570 of 6,319 tracked note paths; 749 remained omitted
after bounding sparse materialization. Relevant scripts, tests and lifecycle
notes were read directly. The two additional local Python 3.14 hits concerned
different scientific replay packages. Arbitrary diffs, omitted notes,
historical versions and unpublished work remain coverage limitations; these
searches do not establish novelty.

The prescribed current selected-baseline orientation stopped at sparse-omitted
`certificates/checkpoints/frontier4359.json`. That metadata check is not part of
these four source files; no selected-baseline pass or mathematical replay is
claimed.

Credit Mihir Srivastava / #4683 for the Windows caller repair and six controls;
Nick Petalas / #2906 for the POSIX exit-cleanup result and ready-tree fixtures;
ywz65 / #2469 for gated Job Object ownership, #2625 for cancellation and #2579
for completion receipts; Paul Romeo / #1484 for the earlier observer/handoff;
Aaron Wang/navinor, woklerx, Douglas Colkitt, Tekalign and retained contributors.
Prepared for Mihir Srivastava (@mihir-s-05) with substantial OpenAI Codex
assistance, one agent. Apache-2.0. The same account authored #4683; this is not
a claim of independent authorship.

## Open next questions and limitations

This closes only the requested six-control execution gap for this one standard,
GIL-enabled CPython 3.14.9 x64 distribution and Windows build. Other 3.14 patch
versions, free-threaded Python, ARM64, different Windows policies, all other test
modules and hosted Windows CI were not exercised. No native implementation was
changed, and no new test or broader regression coverage is claimed.

The useful remaining lifetime question is abrupt supervisor death **before**
Job Object assignment. A bounded first step is a fault-injected pause at that
boundary, with a retained handle observing the unassigned gate waiter's exit
and an explicit assertion that workload execution never starts. The gate's
existing 30-second wait limits that experiment, but these six tests do not
observe that early-startup window. External launch mechanisms and hostile
containment also remain outside the ordinary-subprocess contract.

Proof-relevant child work must still be joined and its failure propagated;
cleanup does not validate unfinished work. Historical source-pin failures,
selected cold replay, native/all-size mathematical obligations and the full
multiplication theorem were not audited. The selected conditional
`kappa = 60403/20000000` is unchanged.
116 changes: 116 additions & 0 deletions docs/research/windows314-lifetime-replay/REPLAY.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"schema": "windows314-isolated-lifetime-replay/v1",
"base_commit": "624de9dc66858af0945e5f8a0942488d62280d43",
"priority_revision": 7,
"started_at": "2026-10-22T23:24:13.534233+00:00",
"runtime": {
"version": "3.14.9 (tags/v3.14.9:ead82c0, Oct 21 2026, 06:26:14) [MSC v.1944 64 bit (AMD64)]",
"implementation": "CPython",
"platform": "Windows-11-10.0.26300-SP0",
"pointer_bits": 64,
"gil_enabled": true,
"nuget_url": "https://api.nuget.org/v3-flatcontainer/python/3.14.9/python.3.14.9.nupkg",
"nuget_sha256": "7cd9d07aec975212344dc6f7e45019378cf6775dd564181e269010a1eddaaec7",
"python_exe_sha256": "e67f33a86fc64a07798a136af126f38a8e0d3c0a25787c635fb1678c2b66b12a",
"python_dll_sha256": "6a0abe3e09cf7896c54b5b065c9a268f6545d3ca93437f7e55b9f8258bf0bc18"
},
"sources": {
"scripts/run_isolated_tests.py": {
"sha256": "c2ba0ce2b58e3870f6963d4f0ef7f5053ad59d9257efe0eff94e8ef0e00f4313",
"git_blob": "3a89bbecc3f378dc4e378000b1cad19349a52ab7"
},
"scripts/research_package.py": {
"sha256": "b63018ac0e30259569f1490219844ce2ae67331c5c8b2213868eb643033990b6",
"git_blob": "bbafc9011173a7e57bb6379beee73a5a2d824645"
},
"tests/test_isolated_test_windows_exit.py": {
"sha256": "125aa2689e3018f9e6b4c47b7ac8b31ff754abf79b496d0bff7aa4aeedfd4e62",
"git_blob": "43e1aa06ead32fe025e97be3f7557b24fb1ee666"
},
"tests/test_isolated_test_exit_cleanup.py": {
"sha256": "267c8d94c1b5f07520e3254100599225f73943c6205bcb901fc1c6975658872d",
"git_blob": "15315645e68445080969b039f5de3d26c93ead83"
}
},
"runs": [
{
"mode": "normal",
"argv": [
"<CPython-3.14.9-x64>",
"-B",
"-W",
"error",
"-m",
"unittest",
"discover",
"-s",
"tests",
"-p",
"test_isolated_test_windows_exit.py",
"-v"
],
"cwd": "repository root",
"returncode": 0,
"wall_seconds": 17.821106,
"timeout_seconds": 120,
"stdout": {
"path": "normal.stdout.txt",
"bytes": 0,
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"stderr": {
"path": "normal.stderr.txt",
"bytes": 1130,
"sha256": "fd010862c9a1863049c57f7e673701c44366fc2fe2bb3965dc18ee19c3cd606c"
}
},
{
"mode": "optimized",
"argv": [
"<CPython-3.14.9-x64>",
"-O",
"-B",
"-W",
"error",
"-m",
"unittest",
"discover",
"-s",
"tests",
"-p",
"test_isolated_test_windows_exit.py",
"-v"
],
"cwd": "repository root",
"returncode": 0,
"wall_seconds": 17.37,
"timeout_seconds": 120,
"stdout": {
"path": "optimized.stdout.txt",
"bytes": 0,
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"stderr": {
"path": "optimized.stderr.txt",
"bytes": 1130,
"sha256": "ed32793b3fdc1eaacb1014bcb2709530822465bcb08653e86ff2198632fea784"
}
}
],
"scope": "Existing six native Windows lifetime controls only; -O applies to the outer unittest interpreter. Existing child commands and runner assertion-preserving policy are unchanged.",
"environment_policy": {
"removed": [
"PYTHONOPTIMIZE",
"PYTHONPATH",
"PYTHONHOME",
"PYTHONPYCACHEPREFIX",
"PYTHONWARNINGS"
],
"set": {
"PYTHONDONTWRITEBYTECODE": "1"
},
"otherwise": "inherited; not a complete environment capture"
},
"source_bytes_unchanged_after_runs": true,
"finished_at": "2026-10-22T23:24:48.925027+00:00"
}
11 changes: 11 additions & 0 deletions docs/research/windows314-lifetime-replay/normal.stderr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
test_failure_stops_exited_modules_child_and_grandchild (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_failure_stops_exited_modules_child_and_grandchild) ... ok
test_inherited_capture_pipes_do_not_turn_success_into_timeout (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_inherited_capture_pipes_do_not_turn_success_into_timeout) ... ok
test_joined_completion_preserves_success_and_output (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_joined_completion_preserves_success_and_output) ... ok
test_success_stops_exited_modules_child_and_grandchild (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_success_stops_exited_modules_child_and_grandchild) ... ok
test_timeout_stops_the_owned_tree_and_keeps_failure (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_timeout_stops_the_owned_tree_and_keeps_failure) ... ok
test_ungated_launch_mutant_is_detected (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_ungated_launch_mutant_is_detected) ... ok

----------------------------------------------------------------------
Ran 6 tests in 17.350s

OK
Empty file.
11 changes: 11 additions & 0 deletions docs/research/windows314-lifetime-replay/optimized.stderr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
test_failure_stops_exited_modules_child_and_grandchild (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_failure_stops_exited_modules_child_and_grandchild) ... ok
test_inherited_capture_pipes_do_not_turn_success_into_timeout (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_inherited_capture_pipes_do_not_turn_success_into_timeout) ... ok
test_joined_completion_preserves_success_and_output (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_joined_completion_preserves_success_and_output) ... ok
test_success_stops_exited_modules_child_and_grandchild (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_success_stops_exited_modules_child_and_grandchild) ... ok
test_timeout_stops_the_owned_tree_and_keeps_failure (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_timeout_stops_the_owned_tree_and_keeps_failure) ... ok
test_ungated_launch_mutant_is_detected (test_isolated_test_windows_exit.WindowsExitCleanupTests.test_ungated_launch_mutant_is_detected) ... ok

----------------------------------------------------------------------
Ran 6 tests in 16.817s

OK
Empty file.