Hive Hive
Sign in

feat(server): surface and configure a project’s default branch

GitHub issue · Closed

Metadata
Source
tuist/tuist #11319
Updated
Jun 24, 2026
Details

Not tied to an existing issue.

What & why

A project’s default branch is the baseline for a surprising amount of logic: bundle size comparisons, flaky-test detection / quarantine eligibility, test sharding timing data, and latest-preview resolution all key off it. But there was no way to view or change it from the dashboard — it defaulted to main and was silently wrong for any project whose real default branch is something else (master, develop, trunk, …), quietly pointing all of those baselines at a branch with no data.

This PR:

  • Surfaces the default branch in project General settings as a card with the current branch shown as a badge.
  • Lets users edit it via an “Edit default branch” modal (pencil icon trigger, matching the test automations edit affordance).
  • Auto-syncs from GitHub on connect: when a project is connected to a GitHub repository, Tuist adopts the repository’s default_branch. The repository list is already loaded with default_branch, so this is a free metadata copy with no extra API call. Only the initial connection syncs, so a later manual edit is preserved.

The settings field is the manual fallback (self-managed repos, projects not connected to GitHub); the GitHub sync covers the common case with zero user effort.

Root cause / gotcha worth knowing

Blank input is rejected in the LiveView handler before it reaches the changeset. Ecto.Changeset.cast substitutes the schema default (main) for an empty string, so a naive “clear the field and save” would have silently reset the branch to main rather than erroring — and validate_required could never catch it. The handler guards the blank case and surfaces a “can’t be blank” error instead. update_changeset also caps the branch length.

User / developer impact

  • Users can finally see and set the baseline branch their analytics, insights, and comparisons run against.
  • GitHub-connected projects get the correct branch automatically.
  • No schema/migration change — default_branch already existed; this just exposes and populates it.

How to test locally

  1. Open a project’s Settings → General. You’ll see a Default branch card with the current branch as a badge and a pencil edit button.
  2. Click the pencil, change the branch in the modal, Save — the badge updates and persists across reloads.
  3. Clear the field and save — it’s rejected with “can’t be blank” and the value is preserved.
  4. Connect a GitHub repository (Integrations) to a project — the project’s default branch is set from the repository’s default branch.

Validation run: mix test test/tuist_web/live/project_settings_live_test.exs test/tuist_web/live/integrations_live_test.exs test/tuist/projects_test.exs (105 tests, 0 failures), mix credo, mise run format, and a manual pass through the full UI flow (edit, persist, blank-reject, GitHub sync).

Changelog

Includes a marketing changelog entry (“Configurable default branch”). The pull_request field is intentionally omitted for now — I’ll add this PR number before merge.

🤖 Generated with Claude Code

Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments
TA
tuist-atlas[bot] Jun 18, 2026

The feature to surface and configure a project’s default branch is now available. Update to xcresult-processor-image@0.25.0 to use it.

TA
tuist-atlas[bot] Jun 18, 2026

The ability to surface and configure a project’s default branch is now available in server@1.214.0. Update to this version to use the new feature.