Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5049ca7
Push updated heads before retargeting PR bases in the fan-out path
claude Jun 9, 2026
bc5f5a9
Merge remote-tracking branch 'origin/main' into claude/code-review-bu…
claude Jun 9, 2026
f1f2a0e
Fix e2e merge-command assertion broken by the ff-only step
claude Jun 9, 2026
972442a
Drop the e2e assertion fix, split out into its own PR
claude Jun 9, 2026
f516594
Merge remote-tracking branch 'origin/main' into claude/code-review-bu…
claude Jun 9, 2026
7352003
Address PRs by number instead of head branch name
claude Jun 9, 2026
51cdb03
Merge remote-tracking branch 'origin/main' into claude/code-review-bu…
claude Jun 9, 2026
4fff137
Merge branch 'claude/code-review-bug-check-3njvdx' into claude/pr-num…
claude Jun 9, 2026
49cfcc7
Abort the resume when label or comment reads fail
claude Jun 9, 2026
7ac9aea
Trust only our own comments for the state marker
claude Jun 9, 2026
25b9a38
Merge updates from main and squash commit
invalid-email-address Jun 10, 2026
33f91fd
Reword the marker-trust comment
Phlogistique Jun 10, 2026
3b790a2
Merge updates from main and squash commit
invalid-email-address Jun 11, 2026
8e565f3
Merge branch 'main' into claude/fail-loud-resume-reads-3njvdx
Phlogistique Jun 11, 2026
bad55ab
Apply suggestion from @Phlogistique
Phlogistique Jun 11, 2026
6ab8295
Apply suggestion from @Phlogistique
Phlogistique Jun 11, 2026
55e48ae
Apply suggestion from @Phlogistique
Phlogistique Jun 11, 2026
01988fc
Merge remote-tracking branch 'origin/claude/fail-loud-resume-reads-3n…
claude Jun 11, 2026
f9030b4
Update update-pr-stack.sh
Phlogistique Jun 11, 2026
97545d1
Merge updates from main and squash commit
invalid-email-address Jun 11, 2026
d00892a
Merge remote-tracking branch 'origin/claude/marker-author-trust-3njvd…
claude Jun 11, 2026
77ab69f
Die on a malformed state marker instead of commenting
claude Jun 11, 2026
ebf2ae4
Merge remote-tracking branch 'origin/claude/marker-author-trust-3njvd…
claude Jun 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion tests/test_conflict_resolution_resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ echo "gh $*" >> "$CALLS"
if [[ "$1 $2" == "pr view" ]]; then
case "$*" in
*--json\ labels*) printf '%s\n' "${MOCK_LABELS:-}";;
*--json\ comments*) cat "${MOCK_COMMENTS_FILE:-/dev/null}";;
*--json\ comments*)
# The comments file stands for our own comments only, so the query
# must restrict itself to those.
[[ "$*" == *viewerDidAuthor* ]] || { echo "comments query must filter by viewerDidAuthor" >&2; exit 1; }
cat "${MOCK_COMMENTS_FILE:-/dev/null}";;
*) echo "unhandled pr view: $*" >&2; exit 1;;
esac
elif [[ "$1 $2" == "pr comment" ]]; then
Expand Down Expand Up @@ -167,5 +171,21 @@ grep -q -- "--base" "$CALLS" && fail "D: base must NOT be edited"
[[ "$(git -C "$ORIGIN" rev-parse child)" == "$CHILD_BEFORE" ]] || fail "D: child was pushed"
ok "D: missing target detected, no branch mutation, label removed"

# ---------------------------------------------------------------------------
echo "### Scenario E: malformed state marker -> internal error, die without touching the PR"
setup_repo
MOCK_LABELS="autorestack-needs-conflict-resolution"
PR_BASE="parent"
MOCK_COMMENTS_FILE="$WORK/comments.txt"
{ echo "### conflict"; echo; echo '<!-- autorestack-state: base=parent target=main -->'; } > "$MOCK_COMMENTS_FILE"
run_resume

grep -q "EXIT=1" "$WORK/out.log" || fail "E: run must die on a malformed marker"
grep -q "remove-label" "$CALLS" && fail "E: label must stay on"
grep -q "gh pr comment" "$CALLS" && fail "E: no PR comment for an internal error"
grep -q -- "--base" "$CALLS" && fail "E: base must NOT be edited"
[[ "$(git -C "$ORIGIN" rev-parse child)" == "$CHILD_BEFORE" ]] || fail "E: child was pushed"
ok "E: malformed marker dies, PR untouched, label kept"

echo
echo "All conflict-resume tests passed 🎉 ($PASS scenarios)"
8 changes: 7 additions & 1 deletion update-pr-stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ format_state_marker() {
read_state_marker() {
local PR_NUMBER="$1"
local BODIES
if ! BODIES=$(gh pr view "$PR_NUMBER" --json comments --jq '.comments[].body'); then
if ! BODIES=$(gh pr view "$PR_NUMBER" --json comments \
--jq '.comments[] | select(.viewerDidAuthor) | .body'); then
echo "Error: could not read comments of PR #$PR_NUMBER" >&2
exit 1
fi
Expand Down Expand Up @@ -307,6 +308,11 @@ continue_after_resolution() {
read -r OLD_BASE NEW_TARGET SQUASH_HASH < <(parse_state_marker "$MARKER")
echo "Recorded state: base=$OLD_BASE target=$NEW_TARGET squash=$SQUASH_HASH"

if [[ -z "$OLD_BASE" || -z "$NEW_TARGET" || -z "$SQUASH_HASH" ]]; then
echo "Error: malformed state marker on $PR_BRANCH: $MARKER" >&2
exit 1
fi

Comment on lines +311 to +315

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

a malformed state marker is an internal error, it does not merit a pr comment, just dying

# The PR was left based on the merged parent branch. If the payload shows a
# different base, a human retargeted the PR; the recorded target is stale,
# so step back before any mutation.
Expand Down
Loading