Skip to content

Merge v4-beta to v4 (2026-05-25)#167

Open
dbolotin wants to merge 2 commits into
v4from
merge-2026-05-25
Open

Merge v4-beta to v4 (2026-05-25)#167
dbolotin wants to merge 2 commits into
v4from
merge-2026-05-25

Conversation

@dbolotin
Copy link
Copy Markdown
Member

@dbolotin dbolotin commented May 25, 2026

Merge v4-beta into v4

Greptile Summary

Adds fix-beta.sh, the inverse companion to merge-beta.sh, which re-syncs v4-beta with v4 when the two branches have diverged (e.g. after a direct commit to v4 or after a merge-beta.sh promotion cycle).

  • Merges origin/v4 into v4-beta with --strategy-option theirs (v4 content wins on conflicts), then runs a two-pattern sed flip to convert @v4 refs back to @v4-beta without the @v4-beta-beta double-replacement hazard.
  • Uses the same self-reexec-from-tmp-copy pattern as merge-beta.sh so the script survives the branch checkout, and adds set -o pipefail (an improvement over merge-beta.sh).
  • Unlike merge-beta.sh (which amends the merge commit), the sed flip here is committed as a separate commit on top of the merge commit before pushing directly to v4-beta.

Confidence Score: 4/5

Safe to merge; the script is a well-documented utility that mirrors an existing pattern in the repo and has no functional bugs.

The core logic — dirty-tree guard, self-reexec, merge-with-theirs, two-pattern sed flip, conditional commit, push — is correct. The only notable gap is the mktemp temp file not being cleaned up on failure, which is a minor hygiene issue that also exists in the pre-existing merge-beta.sh.

No files require special attention; fix-beta.sh is the only change and it follows established patterns in this repo.

Important Files Changed

Filename Overview
fix-beta.sh New utility script that re-syncs v4-beta with v4 (inverse of merge-beta.sh). Logic is sound: dirty-tree guard, self-reexec from tmp copy, merge with theirs strategy, two-pattern sed flip to avoid @v4-beta-beta double-replacement, conditional commit, and push. Minor: temp file from mktemp is never cleaned up.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
fix-beta.sh:45-49
The temp file created by `mktemp` is never removed. If `${tmp_script}` fails mid-run (e.g., merge conflict, push rejected), the script exits via `set -e` and the file lingers in `/tmp`. Adding a `trap` immediately after the `mktemp` call ensures cleanup on any exit. The same gap exists in `merge-beta.sh`.

```suggestion
    tmp_script="$(mktemp)"
    trap "rm -f \"${tmp_script}\"" EXIT
    cat "${0}" > "${tmp_script}"
    chmod +x "${tmp_script}"
    __REAL_RUN="true" "${tmp_script}"
    exit 0
```

Reviews (1): Last reviewed commit: "Merge v4-beta into v4" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Comment thread fix-beta.sh
Comment on lines +45 to +49
tmp_script="$(mktemp)"
cat "${0}" > "${tmp_script}"
chmod +x "${tmp_script}"
__REAL_RUN="true" "${tmp_script}"
exit 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The temp file created by mktemp is never removed. If ${tmp_script} fails mid-run (e.g., merge conflict, push rejected), the script exits via set -e and the file lingers in /tmp. Adding a trap immediately after the mktemp call ensures cleanup on any exit. The same gap exists in merge-beta.sh.

Suggested change
tmp_script="$(mktemp)"
cat "${0}" > "${tmp_script}"
chmod +x "${tmp_script}"
__REAL_RUN="true" "${tmp_script}"
exit 0
tmp_script="$(mktemp)"
trap "rm -f \"${tmp_script}\"" EXIT
cat "${0}" > "${tmp_script}"
chmod +x "${tmp_script}"
__REAL_RUN="true" "${tmp_script}"
exit 0
Prompt To Fix With AI
This is a comment left during a code review.
Path: fix-beta.sh
Line: 45-49

Comment:
The temp file created by `mktemp` is never removed. If `${tmp_script}` fails mid-run (e.g., merge conflict, push rejected), the script exits via `set -e` and the file lingers in `/tmp`. Adding a `trap` immediately after the `mktemp` call ensures cleanup on any exit. The same gap exists in `merge-beta.sh`.

```suggestion
    tmp_script="$(mktemp)"
    trap "rm -f \"${tmp_script}\"" EXIT
    cat "${0}" > "${tmp_script}"
    chmod +x "${tmp_script}"
    __REAL_RUN="true" "${tmp_script}"
    exit 0
```

How can I resolve this? If you propose a fix, please make it concise.

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