Skip to content

CI screenshot commits make every merge of main conflict on screenshots/*.png #212

Closed

Description

@zhollis21

Found while merging main into feature/199-details-adult-filter (PR #210) on 2026-11-18: the merge stopped on conflicts in all 10 screenshots/*.png.

Problem

ci-build-and-preview.yml runs on pull_request to main, and its screenshot step commits the captures back to the PR branch:

git add screenshots/
if git diff --cached --quiet; then
  echo "Screenshots unchanged — nothing to commit"
else
  git commit -m "CI: Update UI screenshots [skip ci]"
  git push
fi

So every PR branch picks up a bot commit that rewrites the same 10 PNGs, and once that PR squash-merges, main has them too. Any other open branch that has its own bot commit and then merges main conflicts on every PNG whose pixels moved. Two things make it worse:

  • PNGs are binary, so git can't merge them and every one needs resolving by hand.
  • If you merged main locally before pulling, the push is rejected too, because the bot commit is on the remote branch and not local.

The resolution itself doesn't matter. CI regenerates all 10 on the next push, so either side is fine. The conflict is pure friction.

The PR comment step (<!-- ci-ui-screenshots --> marker) builds its image links from the screenshot commit's SHA (SCREENSHOT_SHA), so the committed PNGs are also how the PR comment shows its images. Any option that stops committing them has to replace that.

Options

Settled at kickoff (2026-11-18): B, hosted on per-PR orphan branches ci-screenshots/pr-<N> force-pushed as one commit per run, promoted on merge to ci-screenshots/main (latest/ for the README plus the newest 10 sets under history/). PNGs are quantized before publishing.

A. merge=ours driver for the screenshots. Add screenshots/*.png merge=ours to .gitattributes, and run git config merge.ours.driver true once per clone (worktrees share it). Local merges keep the branch's PNGs silently.

  • Small change; CI untouched.
  • The driver config isn't versioned, so it needs an AGENTS.md note, and a clone without it falls back to conflicting.
  • GitHub's web "Update branch" and conflict editor ignore custom drivers.
  • Doesn't help the rejected-push case; you still pull first.

B. Stop committing screenshots to the branch. Publish them another way and drop screenshots/ from the PR's history: an artifact (already uploaded at several steps), an orphan or dedicated branch the comment links into, or images attached to the PR comment.

  • Removes the conflicts everywhere, the web UI included, plus the rejected pushes and the bot commits in PR history.
  • Bigger change: the PR comment's image hosting has to be rebuilt, since artifact files aren't directly embeddable as images.
  • Whether main should still carry current screenshots (e.g. for the README) needs deciding.

C. Leave it, and document the resolution. Resolve with git checkout --ours -- screenshots/, then git add screenshots/ and commit, since CI regenerates on the next push.

  • Zero cost.
  • Keeps the friction, and agents mid-merge stop and ask about it each time.

Constraint

Related

Activity

  1. added
    p3-medium
    Tech Debt
    on Nov 18, 2026
  2. zhollis21 commented on Nov 18, 2026

    @zhollis21
    OwnerAuthor

    Verified against origin/main @ d4529c5:

    • The commit-back step is still as described: .github/workflows/ci-build-and-preview.yml:1354 (Commit Screenshots), and the PR comment builds raw.githubusercontent.com/<sha>/screenshots/... URLs at :1426.
    • main has a second consumer of the committed PNGs: README.md:21 embeds six of them by relative path.
    • Size: the current 10 PNGs total 15 MB (about 1.5 MB each at the Pixel 10 Pro XL resolution from CI screenshots run on a Pixel 7 Pro at API 34, two Android versions behind anything we use #176). origin/main history holds 442 distinct screenshots/*.png blobs, 653 MiB on disk (git rev-list --objects origin/main | grep " screenshots/" summed with cat-file --batch-check=%(objectsize:disk)).
    • Repo settings: squash merge only, delete_branch_on_merge: true, main has no branch protection.
  3. zhollis21 commented on Nov 19, 2026

    @zhollis21
    OwnerAuthor

    Updated during planning: the Options section said "Not settled"; it now records the choice (B, per-PR orphan branches plus a ci-screenshots/main branch with latest/ and a 10-set history/). Per-PR branches beat one shared branch because parallel PR runs would race on a shared one, and compacting it would break other PRs' SHA-based image links. A deletion-only ruleset now protects ci-screenshots/main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Tech Debtp3-medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions