Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bb0a012
fix(ai): Resolve issue #2053 - Make Windows cleanup-controller protoc…
Sep 1, 2026
a72c081
feat(ai): Implemented the three follow-up fixes:
Sep 1, 2026
331085d
feat(ai): Corrected only the parser failure in [test-installed-window…
Sep 1, 2026
2d8532d
feat(ai): Implemented the ultrafix in [test-installed-windows-app-sup…
Sep 1, 2026
25e00ef
feat(ai): Implemented the deterministic timeout-fixture correction in…
Sep 1, 2026
16a980f
feat(ai): Implemented the narrow fixture correction in [test-installe…
Sep 1, 2026
db7f411
feat(ai): Implemented the narrow post-startup protocol correction on …
Sep 2, 2026
0c200e4
feat(ai): Implemented the follow-up on head `db7f411449338f5b0b7de2e4…
Sep 2, 2026
1c88c0d
feat(ai): Implemented the follow-up on exact head `0c200e4d52591ef867…
Sep 2, 2026
44d7af7
feat(ai): Implemented the follow-up changes without committing.
Sep 2, 2026
4eeba66
feat(ai): Implemented the narrow follow-up on head `44d7af7`.
Sep 2, 2026
8aa76a9
feat(ai): Implemented the narrow test-producer fix in [test-installed…
Sep 2, 2026
44d2ee1
feat(ai): Implemented the follow-up changes on head `8aa76a918d0ac5e7…
Sep 2, 2026
753f45e
feat(ai): Implemented the narrow follow-up on head `44d2ee1b1e34a459f…
Sep 2, 2026
3be32b7
feat(ai): Implemented the narrow attribution split on head `753f45e90…
Sep 2, 2026
3e38e7d
feat(ai): Implemented the narrow contract correction on head `3be32b7…
Sep 2, 2026
3f29aec
feat(ai): Implemented the follow-up on head `3e38e7d946ff482194bc8b68…
Sep 2, 2026
5ae780c
feat(ai): Implemented the timing-only correction on PR #2057 without …
Sep 2, 2026
7e8851a
feat(ai): Implemented the attribution-only RESOURCE_COLLISION split o…
Sep 2, 2026
260908b
feat(ai): Implemented the RESOURCE_COLLISION follow-up on exact head …
Sep 2, 2026
ce10c08
feat(ai): Implemented the follow-up on head `260908b8d310a474769398ba…
Sep 2, 2026
bb3cc0d
feat(ai): Implemented the requested attribution-only follow-up on hea…
Sep 2, 2026
15cff46
feat(ai): Implemented the HKCU fixture-only boundary on head `bb3cc0d…
Sep 2, 2026
e0eee3f
feat(ai): Applied only the requested `package-lock.json` qs metadata …
Sep 2, 2026
8a4b0d3
feat(ai): Implemented the follow-up changes without committing.
Sep 2, 2026
4ee06b6
feat(ai): Applied the lockfile-only `fast-uri` correction on the requ…
Sep 2, 2026
5fcb54e
feat(ai): Implemented the queued fixture-only correction on exact hea…
Sep 2, 2026
30edcce
feat(ai): Implemented the two requested follow-up gaps without touchi…
Sep 2, 2026
4af5b06
feat(ai): Implemented the narrow semantic attribution fix on head `30…
Sep 2, 2026
54dddc8
feat(ai): Implemented the two requested fixture-only follow-ups on ex…
Sep 2, 2026
b911a90
feat(ai): Implemented the follow-up fixture fix on exact head `54dddc…
Sep 2, 2026
7b8dcfc
feat(ai): Implemented the attribution-only split on exact head `b911a…
Sep 2, 2026
fd333cc
feat(ai): Implemented the narrow fixture-only writable-handle correct…
Sep 2, 2026
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
26 changes: 22 additions & 4 deletions .github/workflows/desktop-release-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ jobs:
if: matrix.platform == 'win32'
shell: pwsh
run: |
& apps/desktop/scripts/test-installed-windows-app-supervisor.ps1 `
-Architecture '${{ matrix.arch }}'
$supervisorHost = (Get-Process -Id $PID -ErrorAction Stop).Path
& $supervisorHost -NoLogo -NoProfile -NonInteractive `
-File apps/desktop/scripts/test-installed-windows-app-supervisor.ps1 `
-Architecture '${{ matrix.arch }}' 6>&1 |
Tee-Object -Variable supervisorOutput
$supervisorExitCode = if ($null -eq $LASTEXITCODE) { 0 } else { $LASTEXITCODE }
if ($supervisorExitCode -ne 0) { exit $supervisorExitCode }
$supervisorLines = @($supervisorOutput | ForEach-Object { [string]$_ })
if ($supervisorLines -notcontains 'PROPR_WINDOWS_SUPERVISOR_TESTS:${{ matrix.arch }}:PASSED') {
throw 'installed-app supervisor final success marker was not observed'
}

- name: Audit committed dependency resolution
shell: bash
Expand Down Expand Up @@ -450,8 +459,17 @@ jobs:
if: matrix.platform == 'win32'
shell: pwsh
run: |
& apps/desktop/scripts/test-installed-windows-app-supervisor.ps1 `
-Architecture '${{ matrix.arch }}'
$supervisorHost = (Get-Process -Id $PID -ErrorAction Stop).Path
& $supervisorHost -NoLogo -NoProfile -NonInteractive `
-File apps/desktop/scripts/test-installed-windows-app-supervisor.ps1 `
-Architecture '${{ matrix.arch }}' 6>&1 |
Tee-Object -Variable supervisorOutput
$supervisorExitCode = if ($null -eq $LASTEXITCODE) { 0 } else { $LASTEXITCODE }
if ($supervisorExitCode -ne 0) { exit $supervisorExitCode }
$supervisorLines = @($supervisorOutput | ForEach-Object { [string]$_ })
if ($supervisorLines -notcontains 'PROPR_WINDOWS_SUPERVISOR_TESTS:${{ matrix.arch }}:PASSED') {
throw 'installed-app supervisor final success marker was not observed'
}

- name: Audit committed dependency resolution
shell: bash
Expand Down
36 changes: 22 additions & 14 deletions apps/desktop/scripts/cleanup-installed-windows-app.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ if ($FixtureEarlyInitializationChild) {
$fixtureChild = [Diagnostics.Process]::new()
$fixtureChild.StartInfo = $fixtureChildStartInfo
if (!$fixtureChild.Start()) { exit 1 }
if ($PID -le 0 -or $fixtureChild.Id -le 0) { exit 1 }
$fixtureStatePath = Join-Path $fixtureEarlyRoot 'workflow-cleanup-early-processes.json'
$fixtureStateTemporaryPath = "$fixtureStatePath.$PID.new"
$fixtureStateBytes = [Text.Encoding]::ASCII.GetBytes((
[ordered]@{ WorkerPid = $PID; DescendantPid = $fixtureChild.Id } |
[ordered]@{
WorkerPid = [int]$PID
DescendantPid = [int]$fixtureChild.Id
} |
ConvertTo-Json -Compress
))
$fixtureStateStream = [IO.FileStream]::new(
Expand Down Expand Up @@ -1567,9 +1571,10 @@ try {
throw 'registry manifest scope is invalid'
}
if (!(Test-Path -LiteralPath $path)) { continue }
if ([string](Get-ItemPropertyValue -LiteralPath $path -Name $ownerRegistryValue `
-ErrorAction Stop) -cne [string]$record.Token) {
throw 'registry manifest token is invalid'
$currentOwnerToken = Get-ItemPropertyValue -LiteralPath $path `
-Name $ownerRegistryValue -ErrorAction SilentlyContinue
if ([string]$currentOwnerToken -cne [string]$record.Token) {
$cleanupFailed = $true
}
} else {
$expectedPath = if ($kind -eq 'PROTOCOL') {
Expand Down Expand Up @@ -1708,16 +1713,6 @@ try {
Assert-MsiRolledBackCleanBaseline $manifest
}
}
$ownershipPromoted = $false
foreach ($record in @($manifest.Users)) {
if (Resolve-ProvisionalOwnedUser $record) { $ownershipPromoted = $true }
if (Promote-UncapturedOwnedProfiles $record $manifest) {
$ownershipPromoted = $true
}
}
if ($ownershipPromoted) {
Write-DurableOwnershipManifest $manifestPath $manifest
}
foreach ($record in @($manifest.RegistryValues)) {
if (!$record.Owned) { continue }
$current = Get-RegistryValueSnapshot ([string]$record.Path) ([string]$record.Name)
Expand All @@ -1734,6 +1729,19 @@ try {
if ([string]$manifest.MsiTransactionState -ceq 'COMMITTED') {
Assert-MsiManagedFileSystemAuthority $manifest
}
if ($cleanupFailed) {
throw 'owned resource authority collision'
}
$ownershipPromoted = $false
foreach ($record in @($manifest.Users)) {
if (Resolve-ProvisionalOwnedUser $record) { $ownershipPromoted = $true }
if (Promote-UncapturedOwnedProfiles $record $manifest) {
$ownershipPromoted = $true
}
}
if ($ownershipPromoted) {
Write-DurableOwnershipManifest $manifestPath $manifest
}
if ($allowAuthenticatedMsiUninstall -and !$cleanupFailed) {
$msiExitCode = 1618
for ($attempt = 0; $attempt -lt 12 -and $msiExitCode -eq 1618; $attempt += 1) {
Expand Down
159 changes: 141 additions & 18 deletions apps/desktop/scripts/run-installed-windows-app-workflow-cleanup-body.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ param(
[object]$CleanupTimeoutMilliseconds = 4 * 60 * 1000,
[object]$TerminationTimeoutMilliseconds = 30 * 1000,
[object]$FixtureRoot,
[switch]$FixtureEarlyInitializationChild
[switch]$FixtureEarlyInitializationChild,
[switch]$FixtureResultEmissionFailure
)

enum WorkflowCleanupControllerPhase {
Expand Down Expand Up @@ -46,12 +47,90 @@ $validatedManifestPath = $null
[WorkflowCleanupControllerPhase]$controllerPhase = 'INITIALIZATION'
[WorkflowCleanupControllerLine]$controllerLine = 'TYPE_LOAD'
$cleanupTreeZeroVerified = $false
$protocolState = @{ TerminalRecordWritten = $false }

function Write-FixedResult([ValidateSet('COMPLETE','FAILED','TIMED_OUT')][string]$Result) {
[Console]::Out.WriteLine("PROPR_WINDOWS_INSTALLED_SMOKE:WORKFLOW_CLEANUP:$Result")
function Write-StartupRecord {
[Console]::Out.WriteLine(
'PROPR_WINDOWS_INSTALLED_SMOKE:WORKFLOW_CLEANUP:STATUS:{0}:EXIT_CODE:{1}' -f `
$script:fixedStatus, $script:fixedExitCode)
'PROPR_WINDOWS_INSTALLED_SMOKE:WORKFLOW_CLEANUP:STARTUP:READY')
[Console]::Out.Flush()
}

function Get-FixedResultRecord(
[ValidateSet('COMPLETE','FAILED','TIMED_OUT')][string]$Result,
[string]$Status,
[int]$ExitCode
) {
$fixedFailureStatuses = @(
'CONTROLLER_FAILURE','TERMINATION_FAILURE',
'ACTIVE_PROCESS_AFTER_ROOT_EXIT','PROCESS_FINALIZATION_TIMEOUT',
'PROCESS_FINALIZATION_FAILURE','STREAM_DRAIN_TIMEOUT',
'STREAM_DRAIN_FAILURE','RESOURCE_FINALIZATION_FAILURE',
'AUTHORITY_FINALIZATION_FAILURE','STARTUP_FAILURE'
)
$controllerFailureStatus = $Status -cmatch (
'^CONTROLLER_(INITIALIZATION|PARAMETER_VALIDATION|PATH_VALIDATION|' +
'PROCESS_START|PROCESS_WAIT|PROCESS_FINALIZATION|STREAM_FINALIZATION|' +
'RESOURCE_FINALIZATION|AUTHORITY_FINALIZATION|RESULT_EMISSION)_' +
'(TYPE_LOAD|PARAMETERS|PATHS|START|WAIT|TERMINATE|DRAIN|DISPOSE|' +
'AUTHORITY|EMIT)_(AUTHENTICATION|CLOSE|INVALID_ARGUMENT|INVALID_DATA|' +
'INVALID_OPERATION|LIMIT|NOT_ENABLED|NOT_FOUND|OPEN|STOPPED|' +
'PERMISSION|READ|BUSY|UNAVAILABLE|SECURITY|WRITE|UNCLASSIFIED)$')
$valid = switch -CaseSensitive ($Status) {
'EMPTY_OR_CLEANED' {
$Result -ceq 'COMPLETE' -and $ExitCode -eq 0
break
}
'MANIFEST_VALIDATION_FAILURE' {
$Result -ceq 'FAILED' -and $ExitCode -eq 20
break
}
'OWNED_RESOURCE_CLEANUP_FAILURE' {
$Result -ceq 'FAILED' -and $ExitCode -eq 21
break
}
{ $_ -cin @('CHILD_STDOUT','CHILD_STDOUT_LIMIT') } {
$Result -ceq 'FAILED' -and $ExitCode -eq 122
break
}
{ $_ -cin @('CHILD_STDERR','CHILD_STDERR_LIMIT') } {
$Result -ceq 'FAILED' -and $ExitCode -eq 123
break
}
'TIMEOUT' {
$Result -ceq 'TIMED_OUT' -and $ExitCode -eq 124
break
}
default {
$Result -ceq 'FAILED' -and $ExitCode -eq 125 -and
($Status -cin $fixedFailureStatuses -or $controllerFailureStatus)
}
}
if (!$valid) {
throw [InvalidOperationException]::new('fixed controller result is inconsistent')
}
return ('PROPR_WINDOWS_INSTALLED_SMOKE:WORKFLOW_CLEANUP:TERMINAL:RESULT:' +
$Result + ':STATUS:' + $Status + ':EXIT_CODE:' +
$ExitCode.ToString([Globalization.CultureInfo]::InvariantCulture))
}

function Write-FixedResult(
[ValidateSet('COMPLETE','FAILED','TIMED_OUT')][string]$Result,
[string]$Status,
[int]$ExitCode,
[hashtable]$ProtocolState,
[bool]$InjectEmissionFailure = $false
) {
if ($ProtocolState.TerminalRecordWritten) {
throw [InvalidOperationException]::new('terminal record was already emitted')
}
$record = Get-FixedResultRecord $Result $Status $ExitCode
if ($InjectEmissionFailure) {
throw [InvalidOperationException]::new('fixed result-emission fixture')
}
[Console]::Out.WriteLine($record)
# WriteLine completed one newline-terminated record. Mark it before Flush so
# a later flush exception cannot cause a duplicate fallback record.
$ProtocolState.TerminalRecordWritten = $true
[Console]::Out.Flush()
}

Expand Down Expand Up @@ -318,6 +397,12 @@ public sealed class ProPRWorkflowCleanupOutputDrain : IDisposable
}
'@

# Reaching this boundary proves that the whole body parsed and its fixed native
# types loaded. Publish and flush the startup record before parameter or path
# validation can begin; the terminal record is emitted only after all process,
# stream, resource, and authority finalization has completed.
Write-StartupRecord

try {
$controllerPhase = 'PARAMETER_VALIDATION'
$controllerLine = 'PARAMETERS'
Expand Down Expand Up @@ -346,6 +431,9 @@ $ExpectedRunId = [string]$ExpectedRunId
$FixtureRoot = if ($null -eq $FixtureRoot) { $null } else { [string]$FixtureRoot }
$CleanupTimeoutMilliseconds = $cleanupTimeout
$TerminationTimeoutMilliseconds = $terminationTimeout
if ($FixtureResultEmissionFailure -and !$FixtureRoot) {
throw 'result-emission fixture requires a fixture scope'
}

$controllerPhase = 'PATH_VALIDATION'
$controllerLine = 'PATHS'
Expand Down Expand Up @@ -409,6 +497,22 @@ $TerminationTimeoutMilliseconds = $terminationTimeout
$outputDrain = [ProPRWorkflowCleanupOutputDrain]::new()
$outputDrain.Start($cleanupProcess)
[void]$cleanupReadyEvent.Set()
if ($FixtureEarlyInitializationChild) {
$controllerPhase = 'PROCESS_WAIT'
$controllerLine = 'WAIT'
# This fixture's timeout covers cleanup of the published early tree, not
# native host cold-start time before the PID state exists.
$fixtureEarlyStatePath = Join-Path `
$FixtureRoot 'workflow-cleanup-early-processes.json'
$fixtureEarlyStateWatch = [Diagnostics.Stopwatch]::StartNew()
while (![IO.File]::Exists($fixtureEarlyStatePath)) {
if ($cleanupProcess.HasExited) { break }
if ($fixtureEarlyStateWatch.ElapsedMilliseconds -ge 15000) {
throw 'early initialization fixture did not publish process state'
}
[Threading.Thread]::Sleep(25)
}
}
} catch {
try {
$cleanupTreeZeroVerified = $cleanupJob.TerminateAndWait(
Expand Down Expand Up @@ -442,7 +546,8 @@ $TerminationTimeoutMilliseconds = $terminationTimeout
$fixedExitCode = 125
}
} else {
$cleanupTreeZeroVerified = $cleanupJob.HasNoActiveProcesses()
$cleanupTreeZeroVerified = $cleanupJob.WaitForNoActiveProcesses(
$TerminationTimeoutMilliseconds)
if (!$cleanupTreeZeroVerified) {
try {
$cleanupTreeZeroVerified = $cleanupJob.TerminateAndWait(
Expand Down Expand Up @@ -526,28 +631,46 @@ foreach ($resource in @($outputDrain, $cleanupJob, $cleanupProcess, $cleanupRead
}
}

if ($fixedResult -ceq 'COMPLETE' -and $cleanupTreeZeroVerified -and
$validatedManifestPath) {
try {
$controllerPhase = 'AUTHORITY_FINALIZATION'
$controllerLine = 'AUTHORITY'
foreach ($path in @("$validatedManifestPath.new", $validatedManifestPath)) {
if ([IO.File]::Exists($path)) { [IO.File]::Delete($path) }
}
} catch {
if ($fixedResult -ceq 'COMPLETE') {
$controllerPhase = 'AUTHORITY_FINALIZATION'
$controllerLine = 'AUTHORITY'
if (!$cleanupTreeZeroVerified -or !$validatedManifestPath) {
$fixedResult = 'FAILED'
$fixedStatus = 'AUTHORITY_FINALIZATION_FAILURE'
$fixedExitCode = 125
} else {
try {
foreach ($path in @("$validatedManifestPath.new", $validatedManifestPath)) {
if ([IO.File]::Exists($path)) { [IO.File]::Delete($path) }
}
} catch {
$fixedResult = 'FAILED'
$fixedStatus = 'AUTHORITY_FINALIZATION_FAILURE'
$fixedExitCode = 125
}
}
}

try {
$controllerPhase = 'RESULT_EMISSION'
$controllerLine = 'EMIT'
Write-FixedResult $fixedResult
Write-FixedResult $fixedResult $fixedStatus $fixedExitCode $protocolState `
([bool]$FixtureResultEmissionFailure)
} catch {
Set-CaughtControllerFailure $_
exit 125
if (!$protocolState.TerminalRecordWritten) {
$fixedResult = 'FAILED'
$fixedStatus = 'CONTROLLER_RESULT_EMISSION_EMIT_UNCLASSIFIED'
$fixedExitCode = 125
try {
[Console]::Out.WriteLine(
('PROPR_WINDOWS_INSTALLED_SMOKE:WORKFLOW_CLEANUP:TERMINAL:' +
'RESULT:FAILED:' +
'STATUS:CONTROLLER_RESULT_EMISSION_EMIT_UNCLASSIFIED:' +
'EXIT_CODE:125'))
$protocolState.TerminalRecordWritten = $true
[Console]::Out.Flush()
} catch {}
}
}

exit $fixedExitCode
Loading
Loading