code-foundry 0.34.0 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -218,6 +218,56 @@ jobs:
218
218
  --watch \
219
219
  --fail-fast \
220
220
  --interval 10
221
+ # gh pr checks --watch only waits for checks registered when the
222
+ # watch starts; a ruleset may register additional required checks
223
+ # afterwards (observed: "Validation / Gate" appearing after
224
+ # "Tauri 2 / Linux" had passed), which leaves the PR blocked by
225
+ # branch policy at merge time. Poll mergeStateStatus and accept
226
+ # only states GitHub reports as mergeable: CLEAN, or UNSTABLE with
227
+ # mergeable MERGEABLE. UNSTABLE is still mergeable when only
228
+ # non-required checks are failing or still running (observed: Kilo
229
+ # Code Review running after every required check passed); keep
230
+ # waiting for BLOCKED/BEHIND/UNKNOWN, fail fast on
231
+ # DIRTY/CONFLICTING, and fail closed on a bounded timeout so the
232
+ # workflow never sleeps indefinitely.
233
+ echo "Waiting for release PR #$pr to become mergeable under branch policy"
234
+ merge_state=UNKNOWN
235
+ mergeable=UNKNOWN
236
+ for attempt in $(seq 1 30); do
237
+ : "$attempt"
238
+ if read -r merge_state mergeable < <(
239
+ gh pr view "$pr" \
240
+ --repo "$GITHUB_REPOSITORY" \
241
+ --json mergeStateStatus,mergeable \
242
+ --jq -r '[.mergeStateStatus, .mergeable] | @tsv' 2>/dev/null
243
+ ); then
244
+ case "$merge_state" in
245
+ CLEAN|UNSTABLE)
246
+ if [ "$mergeable" = MERGEABLE ]; then
247
+ break
248
+ fi
249
+ ;;
250
+ DIRTY)
251
+ echo "Release PR #$pr is not mergeable (mergeStateStatus=$merge_state); resolve conflicts before retrying the release." >&2
252
+ exit 1
253
+ ;;
254
+ esac
255
+ if [ "$mergeable" = CONFLICTING ]; then
256
+ echo "Release PR #$pr is not mergeable (mergeable=$mergeable); resolve conflicts before retrying the release." >&2
257
+ exit 1
258
+ fi
259
+ else
260
+ # gh API failure: read leaves the variables empty on EOF;
261
+ # treat the state as unknown and keep polling.
262
+ merge_state=UNKNOWN
263
+ mergeable=UNKNOWN
264
+ fi
265
+ sleep 10
266
+ done
267
+ if { [ "$merge_state" != CLEAN ] && [ "$merge_state" != UNSTABLE ]; } || [ "$mergeable" != MERGEABLE ]; then
268
+ echo "Release PR #$pr did not become mergeable within the mergeability window (last mergeStateStatus=$merge_state, mergeable=$mergeable). Required checks may still be pending or branch policy blocks the merge; review the pull request before retrying." >&2
269
+ exit 1
270
+ fi
221
271
  release_head=$(gh pr view "$pr" \
222
272
  --repo "$GITHUB_REPOSITORY" \
223
273
  --json headRefOid \
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.34.1](https://github.com/0xPlayerOne/code-foundry/compare/v0.34.0...v0.34.1) (2026-08-01)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **release:** wait for PR mergeability before guarded auto-merge ([#311](https://github.com/0xPlayerOne/code-foundry/issues/311)) ([e9be192](https://github.com/0xPlayerOne/code-foundry/commit/e9be192e6b42020f327d42d928f2c6a835358e59))
9
+
3
10
  ## [0.34.0](https://github.com/0xPlayerOne/code-foundry/compare/v0.33.0...v0.34.0) (2026-08-01)
4
11
 
5
12
 
package/docs/RELEASES.md CHANGED
@@ -80,7 +80,15 @@ Configure a narrowly scoped `RELEASE_PLEASE_TOKEN` repository or organization
80
80
  secret to enable guarded automatic merging and downstream workflows triggered
81
81
  by the resulting release. The token needs `contents`, `issues`, and
82
82
  `pull-requests` write permissions. Code Foundry validates every changed path in
83
- the generated version pull request before using the token to merge it.
83
+ the generated version pull request before using the token to merge it, waits
84
+ for the required checks to finish, and then polls the pull request's
85
+ `mergeStateStatus` until it is `CLEAN`, or `UNSTABLE` with `mergeable`
86
+ `MERGEABLE`, before merging. Non-required checks that branch policy does not
87
+ require (for example external code review still running after every required
88
+ check passed) do not block the merge; conflicts fail immediately and a bounded
89
+ polling window fails closed if branch or ruleset policy still blocks the merge
90
+ (a ruleset may register additional required checks after earlier ones have
91
+ already passed).
84
92
 
85
93
  ## Operational checklist
86
94
 
package/docs/WORKFLOWS.md CHANGED
@@ -50,6 +50,15 @@ workflow refuses to run unless its strategy is exactly `squash`.
50
50
  | `staging` → `main` promotion PR | Rebase (`merge_strategy: rebase`) | `merge_strategy` must be `rebase`; merge commits are rejected |
51
51
  | Release Please version PR into `main` | Squash (`release_merge_strategy: squash`) | Release automation fails closed unless `squash`; never defaults to `merge`, never uses `--admin` |
52
52
 
53
+ Release auto-merge waits for required checks and then polls `mergeStateStatus`
54
+ until it is `CLEAN`, or `UNSTABLE` with `mergeable` `MERGEABLE`, before
55
+ merging. Non-required checks that branch policy does not require (for example
56
+ external code review) never block the merge, so a ruleset that registers
57
+ additional required checks after earlier ones have passed (for example
58
+ `Validation / Gate` appearing after a platform-specific check) cannot leave the
59
+ merge policy-blocked. The mergeability poll is bounded and fails closed on
60
+ conflicts or timeout; releases without an automation token remain manual.
61
+
53
62
  Keeping `main` linear — rebase promotions and squash release PRs — is what
54
63
  lets the post-release reconciliation fast-forward or replay `staging` safely.
55
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-foundry",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "A fast, language-aware repository factory for agent-ready workflows, testing, security, and release automation.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",