fix: make deployment reconciliation latest-wins - #234
Merged
Conversation
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.
Summary
This changes deployment reconciliation from one long, environment-wide serialized lock to a durable latest-wins model.
Previously, successive commits could queue behind an older deployment. A slow A could block B and C long enough to exhaust the 120 lock-attempt limit, and old work could potentially publish after a newer commit.
Now:
desiredGeneration.observedGenerationrecords the latest completed generation.acceptedRefs.Migration
031adds the generation/mailbox fields and a partial index for builds with pending reconciliation work.Follow-up reliability fixes
AuthorityLockLostErrorduring Native Helm deployment is now treated as retryable infrastructure loss. It no longer publishes a falseDEPLOY_FAILED, GitHub failure event, comment, or failure metric.ERRORand advancesobservedGeneration.E2E validation
Forced A → B → C race
Used
vmelikyan/lc-testPR #803 with a controllable BuildKit barrier.exceeds 120 attempts to lock the resource build deploymenterrors occurred.Static environment selectivity
Used
vmelikyan/lc-test-2PR #56 with two services sourced from different repositories.Verified:
lc-test-3/mainrebuilt and deployed onlylc-test-3.lc-test/mainselected only the Helm service.9/9; onlylc-test-3received new build/deploy Jobs, while the Helm service’s SHA, run UUID, timestamp, and Jobs remained unchanged.The local Native Helm fixture still encounters the pre-existing worker kubeconfig issue and attempts to contact
localhost:8080. Repository selection was verified despite that unrelated deployment failure.Automated validation
pnpm buildcurrently fails during Next.js page-data collection for an unrelated AI-admin route. The same failure reproduces on cleanorigin/mainand was not introduced by this branch.