Skip to content

fix(updates): invalidate and sync update_status cache on deployment (#726) - #727

Open
chbndrhnns wants to merge 1 commit into
oblien:mainfrom
chbndrhnns:fix/invalidate-update-status-cache-on-deploy
Open

fix(updates): invalidate and sync update_status cache on deployment (#726)#727
chbndrhnns wants to merge 1 commit into
oblien:mainfrom
chbndrhnns:fix/invalidate-update-status-cache-on-deploy

Conversation

@chbndrhnns

Copy link
Copy Markdown
Contributor

Fixes #726

Problem

When an operator applies an update (or deploys a project), redeployBuildSession fetches 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. cached 77a55ff... vs live 9020313...), the new commit was deployed (deployedSha = 9020313...), but update_status remained stale (latestSha = 77a55ff...). Subsequent drift checks compared deployedSha !== latestSha, causing the UI to continue displaying a false-positive "Update available" notice.

Solution

  1. Invalidate on Deploy Success: In deployment-lifecycle.ts (onSuccess), invalidate the project's update_status row (repos.updateStatus.deleteByProject) so subsequent drift evaluations re-poll fresh upstream state instead of comparing against a stale pre-deploy cache entry.
  2. Sync on Commit Resolution: In build.service.ts (resolveLatestCommitInfo), when resolving the branch HEAD from GitHub for the tracked branch, sync update_status immediately so that in-flight deployments are recognized by findInProgressByCommit (latestInProgress: true).
  3. Tests: Added tests covering:
    • onSuccess cache invalidation in deploy-outcome-vs-logs.test.ts.
    • redeployBuildSession commit cache sync in build.service.test.ts.
    • Post-deployment re-poll behavior in upstream-cache.test.ts.

- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] applyProjectUpdate / redeploy leaves stale update_status cache, displaying false-positive "update available" notices when upstream moved

1 participant