Keep dev-watch polling after launch

This commit is contained in:
Meta Vens 2026-05-09 00:10:24 +01:00
commit e0760ea5d2
5 changed files with 35 additions and 32 deletions

View file

@ -186,16 +186,15 @@ function Invoke-Reload {
$arguments += "-Headless"
}
$process = Start-Process `
-FilePath "powershell" `
-ArgumentList $arguments `
-WorkingDirectory $repoRoot `
-Wait `
-PassThru `
-NoNewWindow
if ($process.ExitCode -ne 0) {
throw "dev-reload failed with exit code $($process.ExitCode)."
Push-Location $repoRoot
try {
& powershell @arguments
if ($LASTEXITCODE -ne 0) {
throw "dev-reload failed with exit code $LASTEXITCODE."
}
}
finally {
Pop-Location
}
}
@ -213,11 +212,7 @@ function Get-OwnedProcessState {
}
}
function Test-OwnedProcessRunning {
if ($NoInitialLaunch) {
return $true
}
function Test-RecordedProcessRunning {
$state = Get-OwnedProcessState
if (-not $state -or -not $state.pid -or -not $state.slot) {
return $false
@ -240,6 +235,14 @@ function Test-OwnedProcessRunning {
return [bool]($commandLine -and $commandLine -like "*$recordedPath*")
}
function Test-OwnedProcessRunning {
if ($NoInitialLaunch) {
return $true
}
return Test-RecordedProcessRunning
}
function Invoke-Reopen {
param([string]$reason)
@ -258,16 +261,15 @@ function Invoke-Reopen {
"-RetainSlots", "$RetainSlots"
)
$process = Start-Process `
-FilePath "powershell" `
-ArgumentList $arguments `
-WorkingDirectory $repoRoot `
-Wait `
-PassThru `
-NoNewWindow
if ($process.ExitCode -ne 0) {
throw "dev-reload -Reopen failed with exit code $($process.ExitCode)."
Push-Location $repoRoot
try {
& powershell @arguments
if ($LASTEXITCODE -ne 0) {
throw "dev-reload -Reopen failed with exit code $LASTEXITCODE."
}
}
finally {
Pop-Location
}
}
@ -297,12 +299,7 @@ function Invoke-LiveReload {
function Wait-LiveReloadAcknowledged {
param([string]$liveAssemblyPath)
if ($NoInitialLaunch) {
Write-WatchLog "Live reload acknowledgement skipped: -NoInitialLaunch does not own a running process."
return
}
if (-not (Test-OwnedProcessRunning)) {
if (-not (Test-RecordedProcessRunning)) {
throw "live reload pointer was updated, but no script-owned process is running to load it."
}

View file

@ -39,7 +39,7 @@ public sealed class AquariumRuntime : IAquariumRuntime
Console.WriteLine($"Grid center: {gridFrame.Center}, radius: {gridFrame.Radius:0.00}");
Console.WriteLine($"CultCache: {stateStore.CachePath}");
Console.WriteLine($"CultNet hello: {stateStore.Hello.RuntimeKind} / {stateStore.Hello.DisplayName}");
Console.WriteLine("Vortice D3D11 is present as the host shell; Aquarium owns the invariants.");
Console.WriteLine("Vortice D3D11 is present as the host shell; Aquarium owns the invariants. Live reload probe armed.");
}
public void Update(float deltaSeconds, InputState input)

View file

@ -34,3 +34,4 @@
{"area":"renderer/taa","lesson":"TAA Gate 3L disables projection jitter in the live frame by scaling Halton jitter to zero. Visible judder on Self/planet surfaces means the resolver is not yet hiding sample offsets; jitter should stay disabled until opaque and Grid paths both prove stable.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/D3D11Renderer.cs","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
{"area":"renderer/taa","lesson":"Removed the abandoned unjittered Grid retrace after projection jitter was disabled. The retrace was a temporary splint that solved the Grid surface twice; with live jitter at zero, Grid analytic final color can reconstruct from the existing current hit without adding renderer Jenga.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
{"area":"dev-loop/reload","lesson":"Live runtime reload must be end-to-end acknowledged. dev-watch now treats live-current.txt as a request, not success: after building a live slot and updating the pointer, it waits for the running host stdout to report the exact live DLL path or marks the reload failed. Visible dev windows can use dev-watch -ReopenWhenClosed to reopen the last good slot without rebuilding after the window is closed.","files":["scripts/dev-watch.ps1","README.md","state/map.yaml","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-watch.ps1 -NoInitialLaunch -Once -IntervalMilliseconds 10 -DebounceMilliseconds 10 -RetainSlots 4",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
{"area":"dev-loop/reload","lesson":"dev-watch was not reaching its poll loop because Start-Process -Wait around dev-reload could remain attached to the long-lived launched Aquarium process after initial launch. The watcher now invokes dev-reload synchronously, leaving app process ownership inside dev-reload, and a live-only Aquarium.Engine.Live cosmetic change produced a live slot plus host acknowledgement without rebuilding the host.","files":["scripts/dev-watch.ps1","src/Aquarium.Engine.Live/AquariumRuntime.cs","state/memory.json","state/scratch.md"],"verification":["watch.log: Live reload requested, pointer updated, and acknowledged for artifacts/dev-reload/live-slots/20260509-000855-c3f6310c/Aquarium.Engine.Live.dll","latest.out.log: Live reload probe armed and Live runtime reload applied"],"ts":"2026-05-09"}

View file

@ -76,6 +76,7 @@
"The current live document is epiphany.aquarium.live_state, stored through CultLib MessagePack backing. Direct runs can use --cache or AQUARIUM_CULTCACHE_PATH.",
"dev-reload builds disposable apphost slots so a running window does not lock normal build output. dev-watch hot reloads shaders and live runtime DLLs while preserving the last good process. Host/core/content changes, scripts, and src/Aquarium.Engine/Assets must rebuild and restart the apphost on demand. dev-watch must also relaunch if its recorded script-owned process is no longer running. For visible windows, dev-watch -ReopenWhenClosed reopens the last good visible slot without rebuilding.",
"Live runtime reload is not successful just because dev-watch wrote live-current.txt. The watcher must see the host acknowledge the exact live DLL path in stdout, or treat the update as failed and keep the previous runtime/process alive.",
"dev-watch must not use Start-Process -Wait to run dev-reload while dev-reload launches the long-lived Aquarium app. On Windows that can leave the watcher stuck after initial launch, never reaching the poll loop. Invoke the reload script synchronously and let dev-reload own the detached app process.",
"Shader reload failure must keep the previous good shader objects bound. Live-runtime reload failure must keep the previous runtime alive. Rehydrate from CultCache before claiming reload survival."
],
"salvage_without_baggage": [

View file

@ -100,3 +100,7 @@ prototype integrated along the camera ray before surface composition.
to acknowledge the exact new live DLL path before declaring success. A pointer
write alone is not proof. `dev-watch.ps1 -ReopenWhenClosed` reopens the last
visible slot without rebuilding when the window has been closed.
- Dev watcher failure found in practice: `Start-Process -Wait` around
`dev-reload.ps1` could block after the app launched, leaving the watcher stuck
at initial launch and never polling. The watcher now invokes dev-reload
synchronously and leaves long-lived process ownership inside dev-reload.