fix(updates): invalidate and sync update_status cache on deployment (#726) - #727
Open
chbndrhnns wants to merge 1 commit into
Open
fix(updates): invalidate and sync update_status cache on deployment (#726)#727chbndrhnns wants to merge 1 commit into
chbndrhnns wants to merge 1 commit into
Conversation
- Invalidate update_status cache row in deployment onSuccess so subsequent drift checks re-poll upstream rather than comparing against stale cache - Sync update_status when resolving live branch commit in resolveLatestCommitInfo so in-flight builds evaluate latestInProgress correctly - Add unit tests covering cache invalidation on deployment success and commit resolution sync Fixes oblien#726
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.
Fixes #726
Problem
When an operator applies an update (or deploys a project),
redeployBuildSessionfetches the newest commit from GitHub and deploys it. However,update_status(which caches upstream drift with a 6-hour TTL) was left untouched. If upstream gained new commits since the last scan (e.g. cached77a55ff...vs live9020313...), the new commit was deployed (deployedSha = 9020313...), butupdate_statusremained stale (latestSha = 77a55ff...). Subsequent drift checks compareddeployedSha !== latestSha, causing the UI to continue displaying a false-positive "Update available" notice.Solution
deployment-lifecycle.ts(onSuccess), invalidate the project'supdate_statusrow (repos.updateStatus.deleteByProject) so subsequent drift evaluations re-poll fresh upstream state instead of comparing against a stale pre-deploy cache entry.build.service.ts(resolveLatestCommitInfo), when resolving the branch HEAD from GitHub for the tracked branch, syncupdate_statusimmediately so that in-flight deployments are recognized byfindInProgressByCommit(latestInProgress: true).onSuccesscache invalidation indeploy-outcome-vs-logs.test.ts.redeployBuildSessioncommit cache sync inbuild.service.test.ts.upstream-cache.test.ts.