fix: prevent build watch from redeploying old builds on restart - #137
Merged
biersoeckli merged 1 commit intoSep 24, 2026
Conversation
biersoeckli
marked this pull request as ready for review
September 24, 2026 12:19
biersoeckli
added this pull request to stack #139
September 24, 2026 12:19
biersoeckli
force-pushed
the
fix/build-watch-redeploy-on-restart
branch
from
September 24, 2026 12:20
9fc2294 to
b4abd23
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When QuickStack restarts, the build watch redeploys old successful builds.
Root cause
k8s.Watch.watch(path, {}, ...)is started without aresourceVersion. Per the Kubernetes API, an unsetresourceVersionuses "Get State and Start at Most Recent": the watch begins with syntheticADDEDevents for every existing build Job.handleJobEventonly checks the in-memoryprocessedJobsset, which is empty after a process restart. Every replayedSUCCEEDEDjob therefore triggershandleSucceeded->createDeployment. Jobs are replayed in list order (effectively alphabetical by job name), so among several successful builds the older one can be processed last and overwrite the deployment. This is issue #100.A previous
scanExistingJobsguard was removed in 8bd76dc, leaving the watch replay unguarded.Fix
V1: seed
processedJobswith existing terminal jobs before the watch starts.seedProcessedJobs()lists jobs and marksSUCCEEDED/FAILEDas processed. Running/pending jobs stay unseeded so they still deploy when they finish.ADDEDevents for old builds are now ignored.handleJobEventalso ignoresDELETEDevents, so cleaning up finished jobs cannot trigger a deployment.Tests
ADDEDafter startup is not redeployed.DELETEDevents are ignored even when the job shows as succeeded.Verified locally: unit tests pass, ESLint clean,
tsc --noEmit --project tsconfig.server.jsonclean.