Skip to content

feat(poll): rebase build branch onto origin/<default> before publish - #90

Merged
LukasHirt merged 2 commits into
mainfrom
feat/rebase-before-publish
Jul 20, 2026
Merged

feat(poll): rebase build branch onto origin/<default> before publish#90
LukasHirt merged 2 commits into
mainfrom
feat/rebase-before-publish

Conversation

@LukasHirt

@LukasHirt LukasHirt commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Before pushing a passed build, gateRepairPublish now fetches origin and rebases the branch onto origin/<default_branch>, since a long-running build (repair retries, human review pauses) can leave the branch based on a now-stale commit — most commonly hit when another candidate's PR merged a change to the same shared registration files (docker-compose.yml, *ocis.apps.yaml) in the meantime.
  • On a rebase conflict, a new scoped Claude invocation (prompts/rebase-repair.md) resolves it — restricted to editing conflicted files, staging, and git rebase --continue; it cannot run git rebase --abort, so the orchestrator always owns the decision to abort/retry an attempt.
  • After a successful conflict resolution, the gate is re-run once against the rebased tree before push. Exhausting claude.max_rebase_attempts (default 2), or a gate failure post-rebase, falls back to the existing blocked-draft-PR path used for gate-repair exhaustion.
  • New PhaseRebasing build phase + RebaseAttempts counter in build.State; new git.RebaseOntoOrigin/RebaseAbort/InRebase helpers; new claude.max_rebase_attempts / prompts.rebase_repair config fields (with defaults, so existing extctl.yaml files keep working unchanged).

Test plan

  • go build ./..., go vet ./... clean
  • go test ./... passes, including new TestRebaseOntoOrigin_Clean / TestRebaseOntoOrigin_ConflictThenAbort in internal/git
  • Exercise against a real web-extensions checkout during the next live poll cycle where a rebase conflict actually occurs

🤖 Generated with Claude Code

A build can run for a long time (gate repair retries, human review pauses
between plan/stages/build), so origin/<default_branch> may have advanced
by the time publish() pushes — most commonly because another candidate's
PR touching the same shared registration files (docker-compose.yml,
ocis.apps.yaml) already merged. Pushing without rebasing risked opening a
PR with conflicts against the current base.

gateRepairPublish now fetches and rebases onto origin/<default> after the
gate passes and before push. A conflict triggers a scoped Claude invocation
(new rebase-repair.md prompt) that can only edit conflicted files, stage
them, and continue the rebase — never abort it, so the orchestrator always
decides whether an attempt succeeded or needs to be aborted and retried.
After a successful resolution the gate is re-run once against the rebased
tree before push. Exhausting claude.max_rebase_attempts (default 2), or a
gate failure after rebasing, falls back to the existing blocked-draft-PR
path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Lukas Hirt <info@hirt.cz>
lint: rebaseOntoDefault's loop set conflict = false right before an
unconditional break, so the assignment was never read (ineffassign) — the
break alone already exits the loop.

test: TestRebaseOntoOrigin_Clean/_ConflictThenAbort clone into a fresh
directory (otherClone) and then commit into it, but a plain `git clone`
carries no local git config and CI runners have no global one configured
either — commit failed with "Please tell me who you are". Set a local
identity on the clone the same way initRepo already does for its repos.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Lukas Hirt <info@hirt.cz>
@LukasHirt LukasHirt self-assigned this Jul 20, 2026
@LukasHirt
LukasHirt enabled auto-merge (squash) July 20, 2026 15:03
@LukasHirt
LukasHirt merged commit 38210d3 into main Jul 20, 2026
3 checks passed
@LukasHirt
LukasHirt deleted the feat/rebase-before-publish branch July 20, 2026 15:03
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.

1 participant