Skip to content

chore(release): refactor sync-dev-after-release.sh to PR-based flow#28

Merged
brettdavies merged 1 commit into
devfrom
chore/sync-dev-after-release-prs-only
Jun 4, 2026
Merged

chore(release): refactor sync-dev-after-release.sh to PR-based flow#28
brettdavies merged 1 commit into
devfrom
chore/sync-dev-after-release-prs-only

Conversation

@brettdavies
Copy link
Copy Markdown
Owner

@brettdavies brettdavies commented Jun 4, 2026

Summary

Refactors scripts/sync-dev-after-release.sh to open a PR against dev instead of committing directly, aligning the script with this repo's PR-only convention documented in AGENTS.md ("Squash merges only. PR title becomes the commit title; PR body becomes the commit message.") and RELEASES.md ("Direct commits to dev or main are not permitted").

The same refactor is landing in the sibling repo brettdavies/xurl-rs-skill as PR #7, so both copies stay byte-identical going forward.

What changes:

  • Cuts a chore/sync-dev-after-vX.Y.Z branch off dev (with both local and remote existence checks; exit 68 on conflict).
  • Commits VERSION + CHANGELOG.md backport on the new branch.
  • Pushes the branch and opens a PR against dev via gh pr create --body-file (body composed at runtime into a mktemp file, with a trap-cleanup, so the body itself uses the same --body-file pattern this repo's CLAUDE.md mandates).
  • Exits 69 if gh is not on PATH, leaving the local branch in place, so the operator can push and PR by hand.

What is unchanged:

  • Idempotency. If dev already matches main on VERSION and CHANGELOG.md after the file edits, the script switches back to dev, deletes the empty sync branch, and exits 0 cleanly.
  • The preflight: tag existence, origin/main ancestry, GitHub Release published-state, working tree clean.
  • The post-sync generate-changelog.sh --dry-run drift warning.

Changelog

Changed

  • scripts/sync-dev-after-release.sh refactored to open a PR against dev instead of committing directly, aligning the script with this repo's PR-only convention. Same effective end state per release; the PR-and-merge is now the unit of work, not a direct commit.

Type of Change

  • chore: Maintenance tasks (producer-side release infrastructure refactor)

Related Issues/Stories

  • Related PRs: brettdavies/xurl-rs-skill#7 lands the same refactor on the sibling repo.

Testing

  • Manual testing completed

Test Summary:

  • shellcheck --severity=style scripts/sync-dev-after-release.sh clean.
  • The refactored script was not executed end-to-end against a live release in this PR; the next release cut will exercise it. Each preflight and exit-code branch was reviewed against the documented postcondition.
  • Byte-diff against the sibling repo (brettdavies/xurl-rs-skill@feat/port-sync-dev-after-release) produced no output; the two copies stay aligned.

Files Modified

Modified:

  • scripts/sync-dev-after-release.sh (+86 lines for the PR-based refactor; total 207 lines)

Breaking Changes

  • No breaking changes

The script's invocation surface is unchanged (./scripts/sync-dev-after-release.sh vX.Y.Z). What changes is where the backport lands: previously a single commit on dev; now a PR against dev that the operator merges via the normal CI-gated flow.

Deployment Notes

  • No special deployment steps required

Checklist

  • Code follows project conventions and style guidelines
  • Commit messages follow Conventional Commits
  • Self-review of code completed
  • No new warnings or errors introduced
  • Changes are backward compatible

The script currently commits directly to dev at the end of the
backport. That conflicts with this repo's PR-only convention
documented in AGENTS.md ("Squash merges only. PR title becomes the
commit title; PR body becomes the commit message.") and RELEASES.md
("Direct commits to dev or main are not permitted — every change
has a PR number in its squash commit message.").

Refactor the dev-side write step so the same backport now:

- Cuts a chore/sync-dev-after-vX.Y.Z branch off dev (with both local
  and remote existence checks; exit 68 on conflict).
- Commits VERSION + CHANGELOG.md backport on that branch.
- Pushes the branch and opens a PR against dev via gh pr create
  --body-file (PR body composed at runtime into a mktemp file, with
  a trap-cleanup, so the body itself uses the same --body-file
  pattern this repo's CLAUDE.md mandates).
- Exits 69 if gh is not on PATH, leaving the local branch in place
  so the operator can push and PR by hand.

Idempotency preserved: if dev already matches main on VERSION and
CHANGELOG.md after the file edits, the script switches back to dev,
deletes the empty sync branch, and exits 0 cleanly. The preflight
(tag existence, main ancestry, GitHub Release published-state) and
the post-sync generate-changelog.sh dry-run drift warning are
unchanged.

Mirrors the same refactor landing in brettdavies/xurl-rs-skill PR #7
so the two scripts stay byte-identical going forward.
@brettdavies brettdavies merged commit e96840c into dev Jun 4, 2026
4 checks passed
@brettdavies brettdavies deleted the chore/sync-dev-after-release-prs-only branch June 4, 2026 05:21
brettdavies added a commit that referenced this pull request Jun 4, 2026
…#29)

## Summary

PR #28 refactored `scripts/sync-dev-after-release.sh` from
direct-commit-to-dev to PR-based flow (cuts a
`chore/sync-dev-after-vX.Y.Z` branch and opens a PR), but the
accompanying documentation in `RELEASES.md` and `RELEASES-RATIONALE.md`
still describes the old direct-commit shape. Bring both docs in sync
with the shipped script.

No script changes; this PR only updates the prose that lagged the
script.

### What changed in `RELEASES.md` § "After publish — sync dev with the
release"

- Replace "commits the result directly to `dev` as one signed commit (no
PR)" with "cuts a `chore/sync-dev-after-vX.Y.Z` branch off `dev` and
opens a PR".
- Add a pointer to the rationale section explaining the PR-only norm
applies here too.
- Update the idempotency line from "exits 0 with no commit" to "exits 0
without creating a branch or PR" to match the script's actual
short-circuit behavior.

### What changed in `RELEASES-RATIONALE.md` § "Why backport main → dev
after publish"

- Replace the "lands directly on `dev` (one signed commit, no PR). This
is a deliberate exception to the PR-only norm" paragraph with the
current behavior: the backport opens a PR, the PR-only norm applies, the
mechanical-diff and idempotency arguments justify reviewer spot-check +
squash-merge rather than the prior exception-from-norm framing.
- Same idempotency-line correction as RELEASES.md.

## Changelog

### Fixed

- `RELEASES.md` and `RELEASES-RATIONALE.md` corrected to reflect the
PR-based dev-sync flow that `scripts/sync-dev-after-release.sh` has
shipped since PR #28. The previous text claimed the backport lands
directly on `dev` as one signed commit; the script actually cuts a
`chore/sync-dev-after-vX.Y.Z` branch and opens a PR.

## Type of Change

- [x] `fix`: Bug fix (non-breaking change which fixes an issue)

## Related Issues/Stories

- Architecture: pairs with the PR-based-flow refactor in PR #28 that
introduced the staleness; the prose docs lagged the script change.
- Related PRs: this is a sibling fix to `brettdavies/agent-skills` PR
#12, which lands the same documentation (RELEASES.md +
RELEASES-RATIONALE.md + RELEASES-PREFLIGHT.md triad) into the canonical
`github-repo-setup` skill template with the corrected PR-based wording
from day one.

## Testing

- [x] Manual testing completed

**Test Summary:**

- `markdownlint-cli2 RELEASES.md RELEASES-RATIONALE.md` clean on both
files.
- No script changes; runtime behavior is unaffected.

## Files Modified

**Modified:**

- `RELEASES.md`
- `RELEASES-RATIONALE.md`

## Breaking Changes

- [x] No breaking changes

## Deployment Notes

- [x] No special deployment steps required

This is a docs-only fix. After merge to `dev`, the file changes will sit
on `dev` until the next `release/* → main` cherry-pick brings them onto
`main` (per RELEASES.md's branching model).

## Checklist

- [x] Code follows project conventions and style guidelines
- [x] Commit messages follow [Conventional
Commits](https://www.conventionalcommits.org/)
- [x] Self-review of code completed
- [x] No new warnings or errors introduced
- [x] Changes are backward compatible
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