From 17ca44c68548e734d0fd37aa0894fdbdbc7872a0 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Mon, 30 Mar 2026 20:47:24 -0700 Subject: [PATCH] fix: PR idempotency checks open state, dedupe touchfiles, sync package.json - Step 8 PR guard now checks state==OPEN so closed PRs don't prevent new PR creation (adversarial review finding) - Remove duplicate ship-idempotency entry in E2E_TOUCHFILES - Sync package.json version to 0.14.3.0 Co-Authored-By: Claude Opus 4.6 (1M context) --- package.json | 2 +- ship/SKILL.md | 6 +++--- ship/SKILL.md.tmpl | 6 +++--- test/helpers/touchfiles.ts | 1 - 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d55bf630..4b0b1267 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gstack", - "version": "0.14.2.0", + "version": "0.14.3.0", "description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.", "license": "MIT", "type": "module", diff --git a/ship/SKILL.md b/ship/SKILL.md index a4140ff2..f796696d 100644 --- a/ship/SKILL.md +++ b/ship/SKILL.md @@ -1969,15 +1969,15 @@ git push -u origin **If GitHub:** ```bash -gh pr view --json url,number -q '"PR #\(.number): \(.url)"' 2>/dev/null || echo "NO_PR" +gh pr view --json url,number,state -q 'if .state == "OPEN" then "PR #\(.number): \(.url)" else "NO_PR" end' 2>/dev/null || echo "NO_PR" ``` **If GitLab:** ```bash -glab mr view -F json 2>/dev/null && echo "MR_EXISTS" || echo "NO_MR" +glab mr view -F json 2>/dev/null | jq -r 'if .state == "opened" then "MR_EXISTS" else "NO_MR" end' 2>/dev/null || echo "NO_MR" ``` -If a PR/MR already exists: **update** the PR body with the latest test results, coverage, and review findings using `gh pr edit --body "..."` (GitHub) or `glab mr update -d "..."` (GitLab). Print the existing URL and continue to Step 8.5. +If an **open** PR/MR already exists: **update** the PR body with the latest test results, coverage, and review findings using `gh pr edit --body "..."` (GitHub) or `glab mr update -d "..."` (GitLab). Print the existing URL and continue to Step 8.5. If no PR/MR exists: create a pull request (GitHub) or merge request (GitLab) using the platform detected in Step 0. diff --git a/ship/SKILL.md.tmpl b/ship/SKILL.md.tmpl index 52bce243..864829b6 100644 --- a/ship/SKILL.md.tmpl +++ b/ship/SKILL.md.tmpl @@ -502,15 +502,15 @@ git push -u origin **If GitHub:** ```bash -gh pr view --json url,number -q '"PR #\(.number): \(.url)"' 2>/dev/null || echo "NO_PR" +gh pr view --json url,number,state -q 'if .state == "OPEN" then "PR #\(.number): \(.url)" else "NO_PR" end' 2>/dev/null || echo "NO_PR" ``` **If GitLab:** ```bash -glab mr view -F json 2>/dev/null && echo "MR_EXISTS" || echo "NO_MR" +glab mr view -F json 2>/dev/null | jq -r 'if .state == "opened" then "MR_EXISTS" else "NO_MR" end' 2>/dev/null || echo "NO_MR" ``` -If a PR/MR already exists: **update** the PR body with the latest test results, coverage, and review findings using `gh pr edit --body "..."` (GitHub) or `glab mr update -d "..."` (GitLab). Print the existing URL and continue to Step 8.5. +If an **open** PR/MR already exists: **update** the PR body with the latest test results, coverage, and review findings using `gh pr edit --body "..."` (GitHub) or `glab mr update -d "..."` (GitLab). Print the existing URL and continue to Step 8.5. If no PR/MR exists: create a pull request (GitHub) or merge request (GitLab) using the platform detected in Step 0. diff --git a/test/helpers/touchfiles.ts b/test/helpers/touchfiles.ts index 5aa07cf8..1c05d836 100644 --- a/test/helpers/touchfiles.ts +++ b/test/helpers/touchfiles.ts @@ -82,7 +82,6 @@ export const E2E_TOUCHFILES: Record = { 'review-dashboard-via': ['ship/**', 'scripts/resolvers/review.ts', 'codex/**', 'autoplan/**', 'land-and-deploy/**'], 'ship-plan-completion': ['ship/**', 'scripts/gen-skill-docs.ts'], 'ship-plan-verification': ['ship/**', 'scripts/gen-skill-docs.ts'], - 'ship-idempotency': ['ship/**', 'scripts/resolvers/utility.ts'], // Retro 'retro': ['retro/**'],