Commit Graph

2 Commits

Author SHA1 Message Date
jbetala7 ea7e9448d6 fix(pr-title): handle bare version titles without duplicating the prefix
gstack-pr-title-rewrite.sh anchored both its no-change case match
("v$NEW_VERSION "*) and its prefix-strip sed (/^v…+ /) on a trailing
space, so a title that is a bare version with no description fell through
to the prepend case and got a second prefix:

  v1.2.3.4 + "v1.2.3.4"  -> "v1.2.3.4 v1.2.3.4"   (should be no change)
  v1.2.3.4 + "v1.2.3"    -> "v1.2.3.4 v1.2.3"      (stale prefix kept)

This violated the helper's documented case 1 (no change) and case 2
(replace prefix) and its idempotency contract. It is reachable in CI:
.github/workflows/pr-title-sync.yml feeds the real PR title through the
helper and then `gh pr edit`s the result, so a version-only PR title (the
format ship/CHANGELOG uses for branch-ahead bumps) gets corrupted, and it
never self-heals (the duplicated form then matches case 1).

Match the bare "v$NEW_VERSION" form in the no-change case, strip an
existing prefix at a space OR end-of-string, and emit a bare new prefix
when the title had no description. Adds 3 regression tests (bare correct,
bare different, bare idempotency) that fail on main and pass with the fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 12:54:11 +05:30
Garry Tan 7efa85cb4f
v1.23.0.0 feat: always prefix PR titles with v<VERSION> (#1284)
* feat: add bin/gstack-pr-title-rewrite.sh shared helper

Single source of truth for "rewrite a PR title to start with v<VERSION>".
Three cases: already correct (no-op), different prefix (replace), no prefix
(prepend). Rejects malformed VERSION (anything outside ^[0-9]+(\.[0-9]+)*$)
with exit code 2. Uses literal case prefix match instead of bash's pattern-
matching # operator so a VERSION with glob metacharacters cannot mismatch.

Free bun test covers the four branches plus malformed-input rejection,
plain-words-not-stripped, single-segment-not-stripped, idempotence, and
missing-args. 9 tests, ~400ms.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(skills): /ship and /document-release always prefix PR titles with v<VERSION>

ship/SKILL.md.tmpl Step 19: idempotency block now always rewrites titles
to start with v$NEW_VERSION via the new helper. Removes the "custom title
kept intentionally" loophole that let unprefixed titles persist forever.
Adds a post-edit self-check that re-fetches the title and retries once if
the edit didn't stick. Inline comments on the create-PR snippets at lines
867 and 876 make the rule unmissable.

document-release/SKILL.md.tmpl Step 9: new "PR/MR title sync" sub-step
calls the same helper after the body update. Catches the case where Step 8
bumped VERSION after /ship had already created the PR — title now follows
VERSION instead of going stale.

Golden fixtures regenerated for claude/codex/factory ship variants.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(ci): pr-title-sync rewrites titles unconditionally

Drops the "eligible only if already prefixed" gate. Sources the new shared
helper, rewrites unconditionally on every VERSION change. Defense-in-depth
backstop for PRs opened outside the skills (manual gh pr create, web UI).

Uses env: for OLD_TITLE so YAML expression injection cannot reach run:.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore: bump version and changelog (v1.23.0.0)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 07:06:37 -07:00