Skip to content

Commit baf3771

Browse files
committed
P-022 Stage 3: fix the own-check.ps1 output regression the cutover introduced
The qualification round found a real defect in a product surface, which is what a qualification round is for. 30 of 31 jobs were green; the one failure was own-check.ps1's exit-code tiers, reporting "expected OWN001 in the annotated output" over output that visibly CONTAINED OWN001. It was not a harness fault. PowerShell's call operator routes a child's stdout through its PIPELINE, and that is what makes $out = & ./scripts/own-check.ps1 -Format github -Paths src capture anything at all. The Python branch uses the call operator. The Rust branch spawned a process that inherited the console handle and so bypassed the pipeline entirely. While Python was the default nobody noticed; the moment Rust became the default, every caller capturing or piping this script silently got NOTHING -- and because the text still appeared on screen, it looked fine. The in-code comment asserted the opposite, and that is where the error lived: it said an inherited handle leaves the child's output "live, exactly as the call operator's did". The first half is true and the second half is false. MEASURED both ways on one tree, and it is not Windows-specific -- it reproduces on Linux pwsh; the Windows job is simply the only place own-check.ps1 is exercised with output capture: before -Engine python captured 1 line with OWN001 -Engine rust captured 0 lines after both capture 1 line with OWN001, and the captured arrays are IDENTICAL The candidate's streams are now redirected and replayed by the caller: stdout to the pipeline, stderr to the error stream, decoded as UTF-8 with NO BOM -- a byte order mark in front of a SARIF document or a workflow command is not a decoding detail, it is corrupt output -- and both pipes drained CONCURRENTLY, because reading one to the end and then the other deadlocks as soon as the child fills the pipe nobody is reading, which for a large SARIF log is not hypothetical. Nothing else moved: exit tiers still 1 with -FailOnFinding and 0 without, SARIF still 1413 bytes from either engine with no BOM and one result, and the four Stage-1 ps1 controls still pass. Recorded as a CLOSURE, not as a known difference: an accidental behaviour change beyond the engine is what #262's guardrails forbid, so it is repaired rather than declared. Also recorded from the same run, measured and not predicted: * rollback-windows PASS -- all four states distinct on both surfaces; * cancellation-windows PASS, and the disposition vindicates refusing to invent 130. Both engines on Windows EXIT with code 3221225786 (0xC000013A, STATUS_CONTROL_C_EXIT); both on Linux DIE BY SIGNAL 2 and have no exit code at all. Neither platform is 130, and a universal contract would have been wrong on both; * CANCEL-TRACEBACK is now known to be LINUX-ONLY. Python prints a 1478-byte KeyboardInterrupt traceback there and nothing on Windows, where the default CTRL_BREAK handler terminates the process before Python's handler runs. A single-platform measurement would have got this wrong in either direction. No OWED rows remain in the decision packet. One item is knowingly left red, and named rather than worked around: p022-stage1-windows's P07 mutates this very function back to the call operator, so re-anchoring it to the new lines invalidates the committed result -- which can only be re-recorded on a Windows runner. The workflow prints that result in full for exactly this purpose, so it is taken from the next run rather than guessed at here. Until then the checkpoint gate correctly says so. Refs #262 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01376o4syzCem5aQ6NssxwX2
1 parent f69f098 commit baf3771

5 files changed

Lines changed: 99 additions & 29 deletions

File tree

‎docs/evidence/p022-stage1-windows.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@
101101
{
102102
"id": "P07",
103103
"rule": "the-candidate-is-spawned-not-opened",
104-
"description": "own-check.ps1 goes back to invoking the candidate with the call operator — 'PowerShell runs it either way, why the ceremony?'. It does not run it: it asks the platform to OPEN it, so a file the loader cannot start is handed to a desktop handler (notepad on Windows, xdg-open on Linux), the run exits 0 with empty streams, and Owen reports a clean finding-free analysis of nothing",
104+
"description": "own-check.ps1 goes back to invoking the candidate with the call operator -- 'PowerShell runs it either way, why the ceremony?'. It does not run it: it asks the platform to OPEN it, so a file the loader cannot start is handed to a desktop handler (notepad on Windows, xdg-open on Linux), the run exits 0 with empty streams, and own-check.ps1 reports a clean finding-free scan having analysed nothing. Re-anchored at #262 Stage 3, when this function grew stream redirection: the candidate's output has to reach PowerShell's PIPELINE or a caller capturing this script gets nothing, so the spawn now returns a result object. The defect the mutant describes is unchanged -- only the lines it replaces moved.",
105105
"target": "scripts/own-check.ps1",
106-
"pattern": " \\$psi\\.UseShellExecute = \\$false\n \\$proc = \\[System\\.Diagnostics\\.Process\\]::Start\\(\\$psi\\)\n \\$proc\\.WaitForExit\\(\\)\n return \\$proc\\.ExitCode",
107-
"replacement": " & $FilePath @ArgumentList\n return $LASTEXITCODE",
106+
"pattern": " \\$psi\\.UseShellExecute = \\$false\n \\$psi\\.RedirectStandardOutput = \\$true",
107+
"replacement": " $out = & $FilePath @ArgumentList\n return [pscustomobject]@{ ExitCode = $LASTEXITCODE; StdOut = ($out -join \"`n\"); StdErr = \"\" }\n $psi.UseShellExecute = $false\n $psi.RedirectStandardOutput = $true",
108108
"expected_catchers": [
109109
"ps1::ps1-not-started-is-2"
110110
]

‎docs/evidence/p022-stage3-cutover.json‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@
9393
"id": "cancellation-windows",
9494
"question": "the same, natively on Windows",
9595
"platform": "windows",
96-
"label": "DEFERRED EVIDENCE",
97-
"method": "the same control on windows-latest, which sends CTRL_BREAK_EVENT (a parent cannot deliver Ctrl-C to a specific child group there) and records what it finds",
98-
"result": "OWED — measured by CI. 130 is NOT invented, and the Linux disposition is NOT carried across"
96+
"label": "MEASURED OBSERVATION",
97+
"method": "tests/test_stage3_cancellation.py on windows-latest, CI job 105482499346 at f69f098, sending CTRL_BREAK_EVENT to a child process group; https://github.com/PhysShell/Own.NET/actions/runs/35307467735",
98+
"result": "PASS, and the disposition is NOTHING like the Linux one, which is why #262 forbade inventing a universal 130. Both engines interrupted while genuinely running: python reference CTRL_BREAK_EVENT -> EXITED with code 3221225786 (0xC000013A, STATUS_CONTROL_C_EXIT), stdout 0b, stderr 0b; rust own-cli the same, 3221225786, stdout 0b, stderr 0b. On Linux both DIE BY SIGNAL 2 and have no exit code at all. Neither platform is 130. Invariants held on both: terminated, never a verdict code (0/1), no ok line, no findings summary"
9999
},
100100
{
101101
"id": "rollback-linux",
@@ -109,9 +109,9 @@
109109
"id": "rollback-windows",
110110
"question": "the same, natively on Windows",
111111
"platform": "windows",
112-
"label": "DEFERRED EVIDENCE",
113-
"method": "the same control on windows-latest",
114-
"result": "OWED — measured by CI"
112+
"label": "MEASURED OBSERVATION",
113+
"method": "tests/test_stage3_rollback.py on windows-latest, CI job 105482499346 at f69f098; https://github.com/PhysShell/Own.NET/actions/runs/35307467735",
114+
"result": "PASS. All four states held on both runnable surfaces (own-check.sh under git-bash, and owen): default=Rust; explicit python agrees on the verdict; broken candidate with nothing asked -> exit 2 denying a fallback in as many words; broken candidate with python asked -> python runs anyway"
115115
},
116116
{
117117
"id": "stage1-controls",
@@ -169,8 +169,8 @@
169169
},
170170
{
171171
"id": "CANCEL-TRACEBACK",
172-
"status": "NEW, measured",
173-
"summary": "On Linux an interrupted Python reference prints a KeyboardInterrupt traceback (1478 bytes measured) while the Rust core prints nothing. After the cutover a cancelled run therefore stops printing a stack trace. User-visible, caused by the cutover, and recorded rather than fixed: Stage 3 changes the default engine, not the reference."
172+
"status": "NEW, measured, and LINUX-ONLY",
173+
"summary": "On LINUX an interrupted Python reference prints a KeyboardInterrupt traceback (1478 bytes measured) while the Rust core prints nothing, so a cancelled run stops printing a stack trace after the cutover. On WINDOWS neither engine prints anything (stderr 0b for both): the default CTRL_BREAK handler terminates the process before Python's handler runs. Measured on each platform rather than carried across -- the difference exists on one of them and not the other, which a single-platform measurement would have got wrong in either direction. User-visible, caused by the cutover, recorded rather than fixed: Stage 3 changes the default engine, not the reference."
174174
},
175175
{
176176
"id": "ACTION-BUILD",
@@ -198,6 +198,11 @@
198198
"id": "V3",
199199
"was": "#262 V3: oversized integral version values",
200200
"now": "Already closed at #261; VERIFIED not reopened by the parse_int hook the V2 fix installs, at both signs."
201+
},
202+
{
203+
"id": "PS1-CAPTURE",
204+
"was": "a REGRESSION the cutover introduced in the own-check.ps1 surface, found by the qualification round: PowerShell's call operator routes a child's stdout through its PIPELINE, which is what makes `$out = & ./scripts/own-check.ps1 ...` capture anything. The Python branch uses the call operator; the Rust branch spawned a process that inherited the console handle and so bypassed the pipeline. While Python was the default nobody noticed. The moment Rust became the default, every caller capturing or piping this script's output silently got NOTHING -- the text still appeared on screen, so it looked fine",
205+
"now": "CLOSED. The candidate's streams are redirected and replayed by the caller: stdout to the pipeline, stderr to the error stream, decoded as UTF-8 with no BOM and both pipes drained concurrently so a large SARIF log cannot deadlock. MEASURED after: both engines capture the same single OWN001 line and the captured arrays are IDENTICAL; exit tiers unchanged (1 with -FailOnFinding, 0 without); SARIF is 1413 bytes from either engine, no BOM, parses, one result. Not a declared difference -- an accidental behaviour change beyond the engine, which #262's guardrails forbid, so it was repaired rather than recorded"
201206
}
202207
],
203208
"observation": {
@@ -217,6 +222,11 @@
217222
"sha": "b590bf46e9f1c4cbf6bb28978c81afea5ffa1af2",
218223
"result": "7 job failures, every one a real consequence of the cutover, all diagnosed and fixed",
219224
"url": "https://github.com/PhysShell/Own.NET/actions/runs/35302954263"
225+
},
226+
"qualification_run": {
227+
"sha": "f69f0988a14e00c0925a68b9fddd101aff7b3ebe",
228+
"url": "https://github.com/PhysShell/Own.NET/actions/runs/35307467735",
229+
"result": "30/31 jobs green. The single failure was own-check.ps1's exit-code tiers, which caught the PS1-CAPTURE regression above -- a real defect in the product surface, not a harness fault. Reproduced locally on pwsh (it is not Windows-specific; the Windows job is simply the only place own-check.ps1 is exercised with output capture), fixed, and re-qualified."
220230
}
221231
}
222232
}

‎docs/generated/p022-stage1-mutations.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Definition: `docs/evidence/p022-stage1-1.json` (sha256 `076165178704095f…`, 21
5151

5252
Campaign `p022-stage1-windows` — #262 Stage 1 — the surfaces whose contract only Windows can be asked about. `scripts/own-check.ps1` was driven by a CI smoke step but was absent from the adversarial control set, which is why three of its engine-contract defects survived a 16/16 campaign on the other surfaces: a campaign can only prove what some control observes. Beside it sits the Windows half of `scripts/own-check.sh`'s locator classifier, which the Linux campaign cannot reach at all — a drive-rooted path is absolute only where Windows resolves it, and a mutant of that arm is invisible on Linux whatever the runner reports. It also carries the spawn seam itself: a candidate must be STARTED, never handed to the platform to open, and the two desktop handlers that proved this — notepad and xdg-open — are why the seam was unreachable on either platform until it was fixed. Every mutation here is a plausible MISREADING rather than a syntactic accident.
5353

54-
Definition: `docs/evidence/p022-stage1-windows.json` (sha256 `6dbfa6054f6447bb…`, 9 mutations). Replay on a clean tree with `python scripts/mutate_campaign.py --campaign docs/evidence/p022-stage1-windows.json --run`; the recorded run is raw outcomes and provenance, the counts below are derived from it.
54+
Definition: `docs/evidence/p022-stage1-windows.json` (sha256 `656c5e69e4ec0167…`, 9 mutations). Replay on a clean tree with `python scripts/mutate_campaign.py --campaign docs/evidence/p022-stage1-windows.json --run`; the recorded run is raw outcomes and provenance, the counts below are derived from it.
5555

5656
| measure | value |
5757
|--------------------------------------------------|---|
@@ -66,6 +66,10 @@ Definition: `docs/evidence/p022-stage1-windows.json` (sha256 `6dbfa6054f6447bb
6666
| caught without every expected catcher | none |
6767
| honesty control `M00` (unmutated tree must pass) | survived — as required |
6868

69+
**This run is not evidence:**
70+
71+
- the recorded result was taken over a different campaign definition (sha256 or campaign name differs) — re-run the campaign
72+
6973
| id | rule | mutation | outcome | caught by |
7074
|---|---|---|---|---|
7175
| P01 | ps1-locator-must-be-absolute | own-check.ps1 accepts a relative OWEN_RUST_CORE — Test-Path says the file is there, which is true and not the question D3 asks | caught | `ps1::ps1-absolute-locator` |
@@ -74,6 +78,6 @@ Definition: `docs/evidence/p022-stage1-windows.json` (sha256 `6dbfa6054f6447bb
7478
| P04 | ps1-failure-evidence-survives | own-check.ps1 deletes the reproduction directory it just named — cleanup reads as tidiness, and the message that pointed at it is left describing something that no longer exists | caught | `ps1::ps1-failure-evidence` |
7579
| P05 | absolute-locator-is-accepted | the shell's drive-rooted arm stops matching — this is the defect that actually shipped: `[/\]` escapes the closing bracket, so the set is unterminated and matches NEITHER `C:/` nor `C:\`, and every correct Windows locator was refused as 'not absolute' while every Linux control stayed green | caught | `shapes::locator-shapes` |
7680
| P06 | absolute-locator-is-accepted | own-check.ps1's absoluteness test is inverted — the over-rejection direction on this surface: every fully qualified locator is refused as 'not absolute' and every relative one is admitted, which no assertion that only feeds it a relative path can see | caught | `ps1::ps1-absolute-locator`<br>`ps1::ps1-agreement-replays`<br>`ps1::ps1-failure-evidence`<br>`ps1::ps1-not-started-is-2` |
77-
| P07 | the-candidate-is-spawned-not-opened | own-check.ps1 goes back to invoking the candidate with the call operator — 'PowerShell runs it either way, why the ceremony?'. It does not run it: it asks the platform to OPEN it, so a file the loader cannot start is handed to a desktop handler (notepad on Windows, xdg-open on Linux), the run exits 0 with empty streams, and Owen reports a clean finding-free analysis of nothing | caught | `ps1::ps1-not-started-is-2` |
81+
| P07 | the-candidate-is-spawned-not-opened | own-check.ps1 goes back to invoking the candidate with the call operator -- 'PowerShell runs it either way, why the ceremony?'. It does not run it: it asks the platform to OPEN it, so a file the loader cannot start is handed to a desktop handler (notepad on Windows, xdg-open on Linux), the run exits 0 with empty streams, and own-check.ps1 reports a clean finding-free scan having analysed nothing. Re-anchored at #262 Stage 3, when this function grew stream redirection: the candidate's output has to reach PowerShell's PIPELINE or a caller capturing this script gets nothing, so the spawn now returns a result object. The defect the mutant describes is unchanged -- only the lines it replaces moved. | caught | `ps1::ps1-not-started-is-2` |
7882
| P08 | ps1-agreement-replays-raw-bytes | own-check.ps1 drops the STDERR half of the agreement replay while leaving stdout byte-faithful — 'stderr is diagnostics, the result is stdout', which is how the original defect was written in the first place. It is the twin of P03 and exists because a single mutation that broke both streams could be killed by the stdout assertion alone: with this one, the stderr assertion is the only thing standing between the mutant and a green run | caught | `ps1::ps1-agreement-replays` |
7983
| P09 | the-locator-is-a-preflight | own-check.ps1 checks that the .NET toolchain answers before it validates the locator — 'fail on the missing tool first', which plenty of CLIs do. The rejection it then produces is still correct in every observable way: exit 2, the absolute requirement named, no verdict. What it loses is the POSITION: a decision reachable from one environment variable now happens behind an external process, and on the real path that process is a Roslyn extraction over the caller's whole tree. Nothing in this control caught that until it began counting child processes | caught | `ps1::ps1-absolute-locator` |

0 commit comments

Comments
 (0)