Repository navigation
Contain a temp-scan failure to the directory that raised it, and refuse a partial scan - #11217
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Heads up: the vendor-name part of this landed on Already on Worth knowing if you rebase: The compiler-watch work here ( Apologies for the collision - I was triaging main-reds from the CI side and did not check the full open-PR list before opening #11222. |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…create
windows-no-compiler-ci has been red on main since this afternoon, and not because anything
compiled. The positive control died inside the detector itself:
Get-ChildItem : The system cannot find the file specified
+ CategoryInfo : NotSpecified: (:) [Get-ChildItem], Win32Exception
Get-StudioTempArtifacts listed each temp root with one recursive Get-ChildItem. A temp root is
shared with everything else running on the machine, so a directory can be removed or stop being
openable partway through the walk, and the Windows provider raises a Win32Exception for it.
-ErrorAction SilentlyContinue does not cover that: it governs non-terminating errors, and the
step sets $ErrorActionPreference = 'Stop', so the whole job went red while the installer under
test had done nothing at all.
The walk is by hand now, one directory at a time, so an unreadable directory costs that
directory and nothing else and the rest of the subtree is still reported. Reparse points are
not followed, which a recursive listing would have done.
The new tests drive the walk rather than reading it, since the question is what happens when
enumeration throws. The control that proves the old shape really does end the run is Windows
only and says why: the POSIX provider reports an unreadable directory as an ordinary
non-terminating error, which -ErrorAction SilentlyContinue does suppress, so on Linux that
control would assert something untrue. It runs in the parity matrix, which covers
windows-latest.
Three corrections to the walk added in the previous commit. The POSIX permission test ran on the windows-latest parity row, where os.geteuid does not exist and chmod sets the read-only attribute rather than making a directory unopenable, so it could only fail there and would not have denied anything if it had run. It is marked POSIX-only, and the Windows half of the same question is the ACL-based control beside it. The walk collected every path it met and the caller selected the six interesting extensions afterwards, using += on a PowerShell array, which allocates and copies on every append. A temp root can hold an extracted toolchain or a package cache, and this sweep runs before and after every measured action. The patterns are matched during traversal now, and both the results and the pending list are generic lists. The ceiling stopped the walk silently. A truncated snapshot is indistinguishable from a clean one to the caller, and this listing is exactly what stands in when the watcher cannot attach, so stopping short turns a missed artifact into a clean verdict. It raises instead, which declares the measurement void, and the ceiling is 200000 rather than 20000 so an ordinary busy runner never reaches it. Driven by re-declaring the shipped function with a smaller limit, so the test runs the real body rather than a retyped one.
The parity job runs the deliberate unreadable-directory and traversal-limit cases and nothing else does, and neither the scanner nor its test file was in that workflow's path filters, so a PR touching only the scanner would have regressed the new error handling with nothing red. The no-compiler workflow already triggered on the scanner and now triggers on the tests too, since their Windows-only ACL control can only run on a Windows runner. Both the pull_request and the push lists, in both workflows.
The offline idempotency case went red across the PR backlog this evening with
unsloth 2026.9.5 -> 2026.9.6 available, updating...
The version check is not behind the test's proxy: Invoke-RestMethod ignores HTTPS_PROXY, so on
Windows it reaches PyPI and answers for real. When it answers that a newer release exists, the
offline rule's precondition, that PyPI is unreachable, never held, and the pass is supposed to
start. The row asserted only the other two outcomes, so it went red for every branch in the repo
for the hours between a release landing and the pin here moving.
That third outcome is accepted now. It is not a weakening: the two assertions after it are the
teeth and they hold in all three cases, that nothing got through the proxy and that nothing on
disk moved.
The Windows control asserted that the shape this replaced ends the run, and it would have passed while proving the opposite. The CI failure is a race: a directory in the shared temp root disappears partway through a recursive enumeration and the provider raises a Win32Exception, which -ErrorAction SilentlyContinue does not suppress because it governs non-terminating errors. An ACL denial is not that. A directory the caller cannot open is an ordinary non-terminating access-denied error, which that parameter does suppress, so the control reached its SURVIVED line. A POSIX chmod is the same story, which is why the first version of it failed here. Reproducing the race means deleting directories under a live walk and hoping the timing lands, which is a flaky test rather than a control, so what is pinned is the shape: enumeration is per-directory and wrapped, and no recursive listing is left in the file. The reason is written where the control used to be rather than left as an absence.
a55cf56 to
230c826
Compare
…void The catch that contained an enumeration failure to one directory made the two snapshots incomparable. $left is "in the final listing and not in the baseline", so a directory unread at baseline and readable afterwards handed every file that was already sitting in it to $left, and an action that compiled nothing was reported as having compiled. Unread in the final sweep hides the reverse: a real artifact that never reaches $left at all. The walk now records which directories it could not read, after retrying each one once, and a directory that no longer exists is not counted: it cannot contribute a file to a later listing of itself, and that is the ordinary temp race this change exists to survive. Paths under a still-unreadable directory are withheld from $left and written to <name>-unread-dirs.txt, and when no file watcher is attached to the root containing one, the listing is the only evidence there is and the run throws rather than reporting a hole as a clean result. Same call as the traversal cap, for the same reason. Test-StudioPathUnder accepts both separators. DirectorySeparatorChar is '/' under pwsh on Linux, where these tests run, so pinning to it compared every Windows-shaped path false and the withholding would have done nothing.
Test-StudioPathUnder only matched separator-prefixed descendants, so it answered false for equal paths while its own synopsis said the directory itself counts. That mattered in one place and it is the place this change exists for. A temp ROOT can be the directory that fails to enumerate, and the root is also exactly what Start-StudioTempWatch attaches to, so the coverage check asked whether an unread root was at or under a watched root and got back false. The run then threw "no file watcher is attached", which is the temp-scan failure this PR contains, put back one layer up and on a machine where the watcher was in fact attached. The equality case is checked before the descendant prefixes. The sibling rule is unchanged: C:\t\ab is still not under C:\t\a, since withholding a sibling would drop real evidence.
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf61e642b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| try { $entries = @(Get-ChildItem -LiteralPath $dir -Force -ErrorAction Stop) } | ||
| catch { $unread.Add($dir); continue } |
There was a problem hiding this comment.
Recheck disappearance after the retry
If the first enumeration fails, Test-Path succeeds, and the directory disappears before the retry, the inner catch unconditionally records it as unread even though it is now gone. When the watcher could not attach to that root—a supported fallback in this script—the later coverage check throws and voids the measurement for the same ordinary temp-directory deletion race this change is intended to tolerate. Recheck existence in the inner catch before adding the directory to $unread.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct. Fixed in 79e3f5cde.
The window between the Test-Path and the retry is the deletion race itself, so staging the check outside it and not inside meant the one timing this change exists to tolerate was the one that could still void a run. Existence is now rechecked in the inner catch, and only a directory that is still there is recorded as unread.
Sabotage, against the restored file:
drop the inner existence recheck -> test_a_directory_deleted_during_the_retry_is_not_recorded_as_unread FAILED
restored -> 15 passed, 11 skipped
| $covered = @($watchedRoots | Where-Object { Test-StudioPathUnder -Path $dir -Directory $_ }) | ||
| if ($covered.Count -eq 0) { |
There was a problem hiding this comment.
Reject unread scans covered only by an unhealthy watcher
When a FileSystemWatcher overflows or otherwise raises an error, its handle remains in $watchedRoots, so this check still treats every unread directory below it as safely covered. The script already notes that buffer overflow drops events, and because no watcher Error event is registered, a compiler artifact can be absent from the unread snapshot and also missing from $transient, producing a clean result. Track watcher errors and declare the measurement void when an unread directory is covered only by a failed or overflowed watcher.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and this is the worst of the failure modes on this PR so far: it is the only combination that turns a real compile into a pass rather than a false alarm. Fixed in 79e3f5cde.
The script already knew the hazard and only half-handled it. Start-StudioTempWatch enlarges the buffer with the comment "an overflow drops events silently, which here reads as a clean run", but nothing was subscribed to Error, so an overflow was not observable at all and the handle stayed in the list indistinguishable from a healthy one. My coverage check then read it as cover, withheld the unread directories beneath that root, and an artifact could be absent from $transient and from the listing at the same time.
Now: Register-ObjectEvent -EventName Error alongside Created, drained in Stop-StudioTempWatch which returns Paths and FailedRoots, and those roots are filtered out when $watchedRoots is built, so an unread directory under them hits the throw instead of the withhold.
Any Error at all condemns the root, deliberately. The event carries the exception, not the list of creations it dropped, so a watcher that raised once cannot say what it missed and there is no partial credit to give it.
The overflow itself is not forced in a test: it needs a Windows host and thousands of creations to land reliably, and a control that usually fails to overflow would pass while proving nothing. The wiring is asserted on the shipped source, and the $watchedRoots filter is executed as read from the file.
Sabotage, against the restored file:
stop excluding failed watcher roots -> test_a_failed_watcher_root_is_dropped_from_the_coverage_set FAILED
remove the Error subscription -> test_the_error_subscription_exists_and_condemns_its_root FAILED
restored -> 15 passed, 11 skipped
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf61e642b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # A directory that no longer exists is not a gap. It cannot contribute a file to | ||
| # a later listing of itself, and re-reading a path that raised for any other | ||
| # reason is how a transient lock gets a second chance. | ||
| if (Test-Path -LiteralPath $dir) { |
There was a problem hiding this comment.
Preserve inaccessible directories as unread
When an ACL denies both enumeration and metadata probing, Test-Path can return false for an existing directory, so this branch treats the directory as vanished and never adds it to Unread. If permissions differ between snapshots, pre-existing artifacts can consequently appear new; if the directory stays inaccessible and its root has no watcher, the coverage guard is skipped entirely and the artifact detector can report an incomplete scan as clean. A failed existence probe must not be treated as proof that the directory was deleted.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and measuring it turned up something worse than the report. Fixed in 6f7900ca4.
Under pwsh with $ErrorActionPreference = 'Stop':
missing directory -> ItemNotFoundException, Test-Path returns $false
denied directory -> Test-Path THROWS "Access to the path ... is denied"
So the probe does not merely mis-answer the ACL case, it can raise from inside the catch that was meant to contain the failure. And the consequence is the one shape this file exists to prevent: a directory dropped silently out of the comparison, which either turns pre-existing files into evidence on the other side or hides a real artifact where the root has no watcher and the coverage guard never runs.
It also means my previous fix made this worse rather than better, since it added a second Test-Path probe rather than removing the first.
Test-StudioPathIsGone now walks the exception chain for ItemNotFoundException, DirectoryNotFoundException and FileNotFoundException, and is applied to the first failure and the retry alike. There is no Test-Path left in the walk, pinned by a row that strips comments before looking so the prose explaining this cannot satisfy it.
It fails safe deliberately: anything not positively identified as a missing path is treated as still present and recorded as unread. Over-reporting a gap costs a withheld path or a voided run; under-reporting one drops the directory, which is unrecoverable.
Sabotage, each against the restored file, in both directions so that neither "always gone" nor "never gone" can pass:
classify denied as gone (this bug) -> unreadable_directory_is_reported_and_not_just_skipped FAILED
inaccessible_directory_is_recorded_not_mistaken_... FAILED
classifier_answers_both_cases FAILED
never gone (fail-always) -> directory_that_vanished_is_not_reported_as_unread FAILED
missing_directory_is_still_not_recorded_as_unread FAILED
classifier_answers_both_cases FAILED
drop the retry classification -> walk_classifies_the_error_and_never_probes_with_test_path FAILED
restored -> 18 passed, 11 skipped
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf61e642b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ($covered.Count -eq 0) { | ||
| throw ("the temp sweep could not read $dir, and no file watcher is attached " + | ||
| "to the root containing it. The listing is the only evidence here and " + | ||
| "it is incomplete, so this run cannot say whether a compiler ran.") |
There was a problem hiding this comment.
Preserve action failures before rejecting an uncovered scan
When $Action throws and the final sweep also finds an unread directory without a watcher, this new throw runs before the captured $failure is written to *-error.txt or rethrown. The step consequently reports only the scanner problem and loses the installer's actual failure and its promised evidence; defer this rejection until after failure evidence is persisted, and preserve or aggregate the original exception.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct. Fixed in 125aa6dc6.
Confirmed by the offsets rather than by reading intent: the throw was at line 719, the evidence write at 747-753 and if ($failure) { throw $failure } after it, so the void fired before both. On a run where the installer died AND the final sweep hit an unreadable directory with nothing watching its root, the caller got a scanner complaint instead of the failure it was measuring, and the <name>-error.txt this function promises was never written.
The uncovered directories are collected into $uncovered now, and the raise happens at the very end in this order:
- evidence written, including
<name>-unread-dirs.txt if ($failure) { throw $failure }- the thing under measurement- the incomplete-scan throw
An incomplete sweep is worth failing on. It is not worth failing on instead of what the caller was actually measuring, and $uncovered reaches the evidence either way.
Ordering is the entire claim, so the tests assert offsets taken from the shipped function rather than from a copy, and a second row pins that the coverage loop collects rather than raises, since a throw inside that loop is what put the rejection ahead of the evidence in the first place and is easy to reintroduce while editing it.
Sabotage, each against the restored file:
throw inside the loop again -> coverage_check_no_longer_throws_from_inside_the_loop FAILED
void before rethrowing $failure -> action_failure_is_persisted_and_rethrown_before_the_scan_... FAILED
restored -> 20 passed, 11 skipped
Separately, the Windows staging run that completed between rounds found a real defect in this PR's own tests: the two rows asserting the void message did a plain substring match, and on Windows a throw reaches the caller through PowerShell's error formatter, which wraps at terminal width, interleaves ANSI codes and gutters each continuation line, so the sentence is never contiguous. Fixed in 843197a3e; those rows now strip colour codes, then the gutter, then collapse whitespace.
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…11280) * Recheck existence inside the retry, and stop a failed watcher counting as cover Two ways the previous version still reported a clean run over a hole. The deletion race can land INSIDE the retry window. The first read fails, Test-Path says the directory is there, and it is gone by the time the retry runs; the inner catch then recorded it as unread, and an unread directory under an unwatched root voids the measurement. That is the ordinary temp deletion this change exists to tolerate, so existence is rechecked in the inner catch too. A FileSystemWatcher that overflows its buffer raises Error and drops the creations it could not queue, and its handle stays in the list looking exactly like a working one. The coverage check therefore counted an overflowed watcher as covering its root and withheld the unread directories beneath it, so an artifact could be missing from the live stream AND from the listing at once, which is the only combination that turns a real compile into a pass. The Error event is now subscribed, drained in Stop-StudioTempWatch as FailedRoots, and those roots are excluded when $watchedRoots is built. Any Error at all condemns the root: the event carries the exception, not the list of creations it dropped, so a watcher that raised once cannot say what it missed. * Classify the enumeration error instead of probing the path Test-Path cannot tell a deleted directory from an unreadable one, so using it to decide meant an ACL-denied directory was called deleted and dropped silently out of the comparison. Pre-existing files under it then read as new in the other snapshot, and where its root had no watcher the coverage guard was skipped entirely, so an incomplete scan could report clean. Measured under pwsh with $ErrorActionPreference = 'Stop': missing directory -> ItemNotFoundException, Test-Path returns $false denied directory -> Test-Path THROWS 'Access to the path ... is denied' which is worse than it first looks: the probe could raise from inside the catch that was meant to contain the failure. Test-StudioPathIsGone walks the exception chain for ItemNotFoundException, DirectoryNotFoundException and FileNotFoundException, and is used for the first failure and the retry alike. It fails safe: anything not positively identified as a missing path is reported as still present, so the directory is recorded as unread. Over-reporting a gap costs a withheld path or a voided run; under-reporting one drops a directory out of the comparison, which is the defect this file exists to prevent. * Match the raised message however PowerShell chose to wrap it Windows staging caught this and nothing else could: the two rows asserting the void message did a plain substring match, and on Windows a throw reaches the caller through PowerShell's error formatter, which wraps at terminal width, interleaves ANSI colour codes and gutters each continuation line: ...so this run cannot | say whether a compiler ran. so the sentence is never contiguous. Linux pwsh does not wrap that way, which is why both rows passed everywhere they could be run locally while failing on the one platform this script actually executes on. Colour codes, then the gutter, then whitespace collapsed. The gutter is the part worth naming: stripping ANSI alone leaves a '|' in the middle of the sentence and the match keeps failing for a new reason, which is what happened on the first attempt at this fix. * Raise the incomplete-scan verdict last, not over the action's own failure The void-the-run throw sat before the evidence write and before the captured action failure was rethrown. So an installer that genuinely died, on a run where the final sweep also hit an unreadable directory with nothing watching its root, was reported as a scanner problem and never produced the <name>-error.txt this function promises. The uncovered directories are collected into $uncovered now and raised at the very end: evidence first, then the action's own failure, then the incomplete scan. An incomplete sweep is worth failing on; it is not worth failing on INSTEAD of the thing being measured. $uncovered reaches the evidence either way through <name>-unread-dirs.txt. Ordering is the whole claim, so the tests assert offsets taken from the shipped function, and pin that the coverage loop collects rather than raises. * Say what Windows actually covers in the temp-scan tests A skip reason claimed the Windows half of the denial question was "the ACL-based control below". There is no such control and there never was, so the file promised a guarantee it did not provide. Three rows here are POSIX-only and skip on Windows, and nothing replaces them: on a Windows runner the denial behaviour of this walk is not exercised. That is now stated, along with why an ACL control is not being guessed at from a Linux host - the failure worth catching is a control that denies nothing and passes, which is what happened when an ACL denial was first tried as a stand-in for the race. The eight platform-neutral rows do run on Windows and do drive the real PowerShell. The DirectorySeparatorChar bug is the class they catch, which is why they are written against Windows-shaped literals. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Void the measurement when a watcher raised, not only its coverage Excluding a failed watcher's root from $watchedRoots changes the verdict only when $unread also holds something beneath that root. With two otherwise clean sweeps, $uncovered is empty and the run is accepted. That is the wrong way round for this detector. The live half exists for artifacts that never reach the listing at all: CodeDom deletes its intermediate directory once the assembly is loaded, so a compile can be invisible to the before/after diff and present only as events. An overflow drops those silently, so two clean scans plus a failed watcher is the exact shape of a missed compile, with nothing unreadable for the coverage check to catch. A non-empty $watchFailedRoots is now an incomplete measurement in its own right. Both reasons are collected into $incomplete and raised in one throw, so the caller is told everything wrong with the sweep at once rather than fixing one and meeting the other. Still after the action's own failure is rethrown, and recorded as <name>-watch-failures.txt either way. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…se a partial scan (unslothai#11217) * Stop the no-compiler detector failing on a temp directory it did not create windows-no-compiler-ci has been red on main since this afternoon, and not because anything compiled. The positive control died inside the detector itself: Get-ChildItem : The system cannot find the file specified + CategoryInfo : NotSpecified: (:) [Get-ChildItem], Win32Exception Get-StudioTempArtifacts listed each temp root with one recursive Get-ChildItem. A temp root is shared with everything else running on the machine, so a directory can be removed or stop being openable partway through the walk, and the Windows provider raises a Win32Exception for it. -ErrorAction SilentlyContinue does not cover that: it governs non-terminating errors, and the step sets $ErrorActionPreference = 'Stop', so the whole job went red while the installer under test had done nothing at all. The walk is by hand now, one directory at a time, so an unreadable directory costs that directory and nothing else and the rest of the subtree is still reported. Reparse points are not followed, which a recursive listing would have done. The new tests drive the walk rather than reading it, since the question is what happens when enumeration throws. The control that proves the old shape really does end the run is Windows only and says why: the POSIX provider reports an unreadable directory as an ordinary non-terminating error, which -ErrorAction SilentlyContinue does suppress, so on Linux that control would assert something untrue. It runs in the parity matrix, which covers windows-latest. * Filter the temp scan as it walks, and refuse to report a partial one Three corrections to the walk added in the previous commit. The POSIX permission test ran on the windows-latest parity row, where os.geteuid does not exist and chmod sets the read-only attribute rather than making a directory unopenable, so it could only fail there and would not have denied anything if it had run. It is marked POSIX-only, and the Windows half of the same question is the ACL-based control beside it. The walk collected every path it met and the caller selected the six interesting extensions afterwards, using += on a PowerShell array, which allocates and copies on every append. A temp root can hold an extracted toolchain or a package cache, and this sweep runs before and after every measured action. The patterns are matched during traversal now, and both the results and the pending list are generic lists. The ceiling stopped the walk silently. A truncated snapshot is indistinguishable from a clean one to the caller, and this listing is exactly what stands in when the watcher cannot attach, so stopping short turns a missed artifact into a clean verdict. It raises instead, which declares the measurement void, and the ceiling is 200000 rather than 20000 so an ordinary busy runner never reaches it. Driven by re-declaring the shipped function with a smaller limit, so the test runs the real body rather than a retyped one. * Trigger both lanes when the temp scanner or its tests change The parity job runs the deliberate unreadable-directory and traversal-limit cases and nothing else does, and neither the scanner nor its test file was in that workflow's path filters, so a PR touching only the scanner would have regressed the new error handling with nothing red. The no-compiler workflow already triggered on the scanner and now triggers on the tests too, since their Windows-only ACL control can only run on a Windows runner. Both the pull_request and the push lists, in both workflows. * Apply the repo's kwarg spacing to the new test * Let the offline update row survive a release landing on PyPI The offline idempotency case went red across the PR backlog this evening with unsloth 2026.9.5 -> 2026.9.6 available, updating... The version check is not behind the test's proxy: Invoke-RestMethod ignores HTTPS_PROXY, so on Windows it reaches PyPI and answers for real. When it answers that a newer release exists, the offline rule's precondition, that PyPI is unreachable, never held, and the pass is supposed to start. The row asserted only the other two outcomes, so it went red for every branch in the repo for the hours between a release landing and the pin here moving. That third outcome is accepted now. It is not a weakening: the two assertions after it are the teeth and they hold in all three cases, that nothing got through the proxy and that nothing on disk moved. * Drop a control that could not fire, and say why there is none The Windows control asserted that the shape this replaced ends the run, and it would have passed while proving the opposite. The CI failure is a race: a directory in the shared temp root disappears partway through a recursive enumeration and the provider raises a Win32Exception, which -ErrorAction SilentlyContinue does not suppress because it governs non-terminating errors. An ACL denial is not that. A directory the caller cannot open is an ordinary non-terminating access-denied error, which that parameter does suppress, so the control reached its SURVIVED line. A POSIX chmod is the same story, which is why the first version of it failed here. Reproducing the race means deleting directories under a live walk and hoping the timing lands, which is a flaky test rather than a control, so what is pinned is the shape: enumeration is per-directory and wrapped, and no recursive listing is left in the file. The reason is written where the control used to be rather than left as an absence. * Carry the unread directories into the comparison, or declare the run void The catch that contained an enumeration failure to one directory made the two snapshots incomparable. $left is "in the final listing and not in the baseline", so a directory unread at baseline and readable afterwards handed every file that was already sitting in it to $left, and an action that compiled nothing was reported as having compiled. Unread in the final sweep hides the reverse: a real artifact that never reaches $left at all. The walk now records which directories it could not read, after retrying each one once, and a directory that no longer exists is not counted: it cannot contribute a file to a later listing of itself, and that is the ordinary temp race this change exists to survive. Paths under a still-unreadable directory are withheld from $left and written to <name>-unread-dirs.txt, and when no file watcher is attached to the root containing one, the listing is the only evidence there is and the run throws rather than reporting a hole as a clean result. Same call as the traversal cap, for the same reason. Test-StudioPathUnder accepts both separators. DirectorySeparatorChar is '/' under pwsh on Linux, where these tests run, so pinning to it compared every Windows-shaped path false and the withholding would have done nothing. * Count a watched root as covering itself Test-StudioPathUnder only matched separator-prefixed descendants, so it answered false for equal paths while its own synopsis said the directory itself counts. That mattered in one place and it is the place this change exists for. A temp ROOT can be the directory that fails to enumerate, and the root is also exactly what Start-StudioTempWatch attaches to, so the coverage check asked whether an unread root was at or under a watched root and got back false. The run then threw "no file watcher is attached", which is the temp-scan failure this PR contains, put back one layer up and on a machine where the watcher was in fact attached. The equality case is checked before the descendant prefixes. The sibling rule is unchanged: C:\t\ab is still not under C:\t\a, since withholding a sibling would drop real evidence. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…merged (unslothai#11280) * Recheck existence inside the retry, and stop a failed watcher counting as cover Two ways the previous version still reported a clean run over a hole. The deletion race can land INSIDE the retry window. The first read fails, Test-Path says the directory is there, and it is gone by the time the retry runs; the inner catch then recorded it as unread, and an unread directory under an unwatched root voids the measurement. That is the ordinary temp deletion this change exists to tolerate, so existence is rechecked in the inner catch too. A FileSystemWatcher that overflows its buffer raises Error and drops the creations it could not queue, and its handle stays in the list looking exactly like a working one. The coverage check therefore counted an overflowed watcher as covering its root and withheld the unread directories beneath it, so an artifact could be missing from the live stream AND from the listing at once, which is the only combination that turns a real compile into a pass. The Error event is now subscribed, drained in Stop-StudioTempWatch as FailedRoots, and those roots are excluded when $watchedRoots is built. Any Error at all condemns the root: the event carries the exception, not the list of creations it dropped, so a watcher that raised once cannot say what it missed. * Classify the enumeration error instead of probing the path Test-Path cannot tell a deleted directory from an unreadable one, so using it to decide meant an ACL-denied directory was called deleted and dropped silently out of the comparison. Pre-existing files under it then read as new in the other snapshot, and where its root had no watcher the coverage guard was skipped entirely, so an incomplete scan could report clean. Measured under pwsh with $ErrorActionPreference = 'Stop': missing directory -> ItemNotFoundException, Test-Path returns $false denied directory -> Test-Path THROWS 'Access to the path ... is denied' which is worse than it first looks: the probe could raise from inside the catch that was meant to contain the failure. Test-StudioPathIsGone walks the exception chain for ItemNotFoundException, DirectoryNotFoundException and FileNotFoundException, and is used for the first failure and the retry alike. It fails safe: anything not positively identified as a missing path is reported as still present, so the directory is recorded as unread. Over-reporting a gap costs a withheld path or a voided run; under-reporting one drops a directory out of the comparison, which is the defect this file exists to prevent. * Match the raised message however PowerShell chose to wrap it Windows staging caught this and nothing else could: the two rows asserting the void message did a plain substring match, and on Windows a throw reaches the caller through PowerShell's error formatter, which wraps at terminal width, interleaves ANSI colour codes and gutters each continuation line: ...so this run cannot | say whether a compiler ran. so the sentence is never contiguous. Linux pwsh does not wrap that way, which is why both rows passed everywhere they could be run locally while failing on the one platform this script actually executes on. Colour codes, then the gutter, then whitespace collapsed. The gutter is the part worth naming: stripping ANSI alone leaves a '|' in the middle of the sentence and the match keeps failing for a new reason, which is what happened on the first attempt at this fix. * Raise the incomplete-scan verdict last, not over the action's own failure The void-the-run throw sat before the evidence write and before the captured action failure was rethrown. So an installer that genuinely died, on a run where the final sweep also hit an unreadable directory with nothing watching its root, was reported as a scanner problem and never produced the <name>-error.txt this function promises. The uncovered directories are collected into $uncovered now and raised at the very end: evidence first, then the action's own failure, then the incomplete scan. An incomplete sweep is worth failing on; it is not worth failing on INSTEAD of the thing being measured. $uncovered reaches the evidence either way through <name>-unread-dirs.txt. Ordering is the whole claim, so the tests assert offsets taken from the shipped function, and pin that the coverage loop collects rather than raises. * Say what Windows actually covers in the temp-scan tests A skip reason claimed the Windows half of the denial question was "the ACL-based control below". There is no such control and there never was, so the file promised a guarantee it did not provide. Three rows here are POSIX-only and skip on Windows, and nothing replaces them: on a Windows runner the denial behaviour of this walk is not exercised. That is now stated, along with why an ACL control is not being guessed at from a Linux host - the failure worth catching is a control that denies nothing and passes, which is what happened when an ACL denial was first tried as a stand-in for the race. The eight platform-neutral rows do run on Windows and do drive the real PowerShell. The DirectorySeparatorChar bug is the class they catch, which is why they are written against Windows-shaped literals. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Void the measurement when a watcher raised, not only its coverage Excluding a failed watcher's root from $watchedRoots changes the verdict only when $unread also holds something beneath that root. With two otherwise clean sweeps, $uncovered is empty and the run is accepted. That is the wrong way round for this detector. The live half exists for artifacts that never reach the listing at all: CodeDom deletes its intermediate directory once the assembly is loaded, so a compile can be invisible to the before/after diff and present only as events. An overflow drops those silently, so two clean scans plus a failed watcher is the exact shape of a missed compile, with nothing unreadable for the coverage check to catch. A non-empty $watchFailedRoots is now an incomplete measurement in its own right. Both reasons are collected into $incomplete and raised in one throw, so the caller is told everything wrong with the sweep at once rather than fixing one and meeting the other. Still after the action's own failure is rethrown, and recorded as <name>-watch-failures.txt either way. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary
The no-compiler detector's temp scan can fail the job for a reason that has nothing to do with the installer under test, and can also report a clean result it did not actually finish measuring. This fixes both, and wires the tests into the two lanes that can run them.
Rebased onto current
main. This PR previously also carried a comment change toinstall.ps1andstudio/setup.ps1that moved a vendor name out of the shipped scripts. That landed separately onmain, in a better form than the one here (it also records why the names are not repeated, and that nothing below hard-codes a product), so that commit has been dropped rather than rebased. What is left is the temp-scan work, which is why the title has changed.1. One unreadable directory failed the whole step
Get-StudioTempArtifactswalked each temp root withGet-ChildItem -Recurse. A temp root is shared with everything else on the machine, so a directory can vanish or become unopenable partway through the walk. The provider then raises aWin32Exception, and-ErrorAction SilentlyContinuedoes not suppress it: that parameter governs non-terminating errors, and the caller sets$ErrorActionPreference = 'Stop'. Observed on hosted runners asraised from inside the positive control, which failed the job while the installer had done nothing wrong.
Get-StudioTempSubtreenow walks a directory at a time, so an unreadable directory costs that directory and nothing else, and the rest of the subtree is still reported. Reparse points are not followed: a junction into an ancestor would otherwise walk forever, and a compile does not write through one.2. A scan that did not finish read as a clean one
The walk is bounded at 200000 directories, and reaching that bound
throws rather than breaking. This listing is exactly what stands in when the watcher cannot attach, so a silent stop would turn a missed artifact into a clean verdict. Declaring the measurement void is the safe direction; reporting a truncated snapshot as a complete one is not.3. Filtering moved into the walk
The patterns are applied as the tree is walked rather than by the caller afterwards, and the accumulators are
List[string]rather than PowerShell arrays. A temp root can hold an extracted toolchain or a package cache, and this sweep runs before and after every measured action, so+=on an array is quadratic in the number of entries on a path that runs twice per action.4. The tests reach a runner that can run them
tests/python/test_compiler_watch_temp_scan.pyis new. Its unreadable-directory and traversal-limit cases live in the cross-platform parity job and only there; the no-compiler workflow runs the scanner's positive control but never creates those conditions. Both the script and the test file are now in the path filters for both lanes, so a PR touching only the scanner cannot regress this error handling with nothing red.5. An offline row that went red on a schedule
test_the_desktop_update_path_keeps_a_verified_install_offlineaccepted two outcomes. It needs to accept three, because the version check is not behind the proxy:Invoke-RestMethodignoresHTTPS_PROXY, so on Windows it reaches PyPI and answers for real. If PyPI reports a newer release, the offline rule's precondition never held and the upgrade pass is supposed to start.That is not a weakening. It is what happens to every branch in the repo for the hours between a release landing on PyPI and the pin here moving. The teeth are the two assertions that follow, and they hold in all three cases: nothing got through the proxy (
run.connections == run.refused), and nothing on disk moved (diff(before, snapshot(install)) == []).Verification
The ACL-based unreadable-directory control is Windows-only by nature, so the Windows lanes are the ones that prove this. Cross-platform staging CI is run on this branch for that reason and the result is reported below.