Repository navigation
feat(api): add GitTarget spec.parentBranch, the branch a new write branch starts from - #408
Merged
Merged
Conversation
…anch starts from spec.parentBranch names the branch the write branch is created from, and compared against while the remote does not carry it. Omitted keeps the remote's default branch. It is mutable and only read, so it need not be in allowedBranches. A configured parent must exist for the write branch to be created: a fetch that finds neither reports ParentBranchNotFound and writes nothing, so a typo never starts an orphan branch. Every GitTarget on one write branch must name the same parent, compared as written; the later one reports TargetConflict. A change keeps the branch worker and drops its base trust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (34)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
sunib
added this pull request to stack #409
October 1, 2026 07:52
…arent checks Review fixes for spec.parentBranch: - A parent change now reaches writes retained during the push cooldown. They were planned against the old parent, and an invalidated base does not reach them, so the event loop takes the change and refetches and replays before the next commit or push. A missing new parent then refuses publication instead of creating the branch from the old one. - Parent conflicts apply whatever either target's path is. A target with a path its writer rejects still wires the shared worker and would set its parent; path validity now gates only the overlap check. - ParentBranchNotFound ignores an observation proved against another repository than the one the GitProvider names now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
GitTarget.spec.parentBranchnames the branch the write branch (spec.branch) is created from. While the remote does not carry the write branch, the target compares against the parent. Omitting the field keeps today's behavior: the remote's default branch, and a branch with no history in an empty repository.This is the standby flow #407 made correct, applied to
release-1.xorenv/prod, not justmain. Once the write branch exists, the parent is not followed. That matches FluxImageUpdateAutomationand Argo CD's hydrator. Resetting a merged write branch onto its parent is separate work.Contract
Ready=False/Stalled=True, reasonParentBranchNotFound, nothing written, no orphan branchallowedBranches. It is only read.parentBranch == branchis legal when that branch exists. When it is absent, creation is refused, including in an empty repository. Only an omitted parent bootstraps.checkForConflictsreportsTargetConflictfor two targets on the same provider and write branch that name different parents. The later one loses. Values are compared as written, so omitted andmainconflict even when the remote's HEAD ismain. The answer needs no round trip and does not flip when the remote's default branch changes.MinLength=1when set; optional; no transition rule.How
SmartFetchFrom,PrepareBranchFromandsyncToRemoteFromtake the parent. A configured parent is the fallback when the target is absent; if the parent is missing too, they returnErrParentBranchNotFoundinstead of an empty ref. The remote-HEAD mirror is still written from the remote's real HEAD.EnsureWorker, and passes it to every fetch through two wrappers. A fetch that hitsErrParentBranchNotFoundrecords a remote observation withMissingParentset, because the advertisement did say so.GitTargetReconciler.parentBranchReadinessreads that observation: no round trip, and it works with--git-refresh-interval=0. It stalls the target asParentBranchNotFound. While that reason holds, each reconcile forces a recheck, the same recovery a refused Git path uses, so the target recovers once the branch is pushed.Tests
internal/git:SmartFetchFromtable: omitted, configured, missing, existing target with a missing parent, parent equal to the target (present and absent), and an empty repository.SetParentBranchinvalidates the base.internal/controller:main, earlier wins, same parent on sibling paths, another write branch);"".spec.parentBranch: release. In the second runreleaseis not inallowedBranches.Docs
architecture.md: the GitTarget key fields, the conflict rule, and the new-branch paragraph now names the configured parent.definitions.md: write branch and parent branch added under "Write side".configuration.md: a settings-table row (viahack/crdfields/fields.yaml) and a "Starting the write branch from another branch" section.Validation
task lintandtask testpass, with coverage at baseline. The local e2e run is pending.🤖 Generated with Claude Code