Repository navigation
fix(project,jobs): stop webhook clobbering default_branch, target it on PR create - #162
Merged
xmiksay merged 2 commits intoJul 10, 2026
Merged
Conversation
…on PR create What: `upsert_project` no longer re-syncs `default_branch` from the webhook payload on an existing project — only on first insert. `Cli::create_pr` now takes the project's default branch and passes it explicitly (`--base`/`--target-branch`) to `gh pr create`/`glab mr create`. Manual project creation now requires `default_branch` instead of guessing "main". Why: the operator's `update_remote` override (#159) was reverted by the very next webhook delivery, since every event re-upserted the project with the provider payload's own live default branch. Independently, PRs/MRs opened by the agent always targeted the provider repo's real default (no --base/ --target-branch was ever passed), so work never landed on a configured integration branch even before the override was reverted (#161). How: made default_branch operator-owned post-insert (mirrors update_remote's existing UI-gap fix); threaded default_branch into the PR/MR create command; replaced the "main" fallback in manual project creation with a required-field 400, since there's no provider call to look up a repo's real default. Updated docs/architecture.md and frontend types/validation to match.
What: remove the unneeded `review_body: _,` field pattern in the FixReview event_id match arm — `..` already covers it. Why: CI's clippy (pinned to a newer toolchain than ran locally) enforces clippy::unneeded_wildcard_pattern as an error under -D warnings, failing the lint gate on unrelated pre-existing code touched by this branch's build.
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
Fixes two leaks that both dragged the effective branch back to the provider repo's real default, defeating an operator's
default_branchoverride:upsert_projectre-synceddefault_branchfrom the webhook payload on every delivery, reverting an operator'supdate_remoteedit on the next issue/comment/PR event. Fixed: the field now seeds from the payload only on first insert; it's operator-owned after that (same UI-gap contract as Project audit: webhook dedupe/spawn data-loss fixes + residual security/docs/UI cleanup #159'supdate_remote).gh pr create --fill/glab mr create --fillnever set a target branch, so both CLIs defaulted the PR/MR base to the provider repo's own default branch. Fixed:Cli::create_prnow takes the project'sdefault_branchand passes--base/--target-branchexplicitly."main"fallback when the operator leftdefault_branchblank. Since there's no provider API call to look up a repo's real default, this now 400s and requires the field explicitly (frontend form updated to match — field is now required).Test plan
cargo fmt --check,cargo clippy --all-targets -D warnings— cleancargo testagainst both Postgres and SQLite backends — all green, including new coverage:tests/project_default_branch.rs::reupsert_does_not_clobber_operator_default_branch_override— seeds a project, applies an operator override viaupdate_remote, re-upserts with the original payload branch, asserts the override stickstests/project_default_branch.rs::reupsert_still_syncs_full_name_and_remote_url— confirms the other synced fields are untouched by the fixsrc/jobs/prompt.rs::create_pr_targets_configured_default_branch— asserts--base/--target-branchcarry the project's configured branch for both GitHub and GitLab, across theIssueandIssueCommentprompt armsnpm run typecheck,npm run build,npm run test(vitest) — cleandocs/architecture.mdupdated to describe insert-onlydefault_branchseeding and the explicit PR/MR targetCloses #161