Skip to content

v3.2.6: patch upstream push-to-pantheon unshallow + fix verify dev→master mapping - #103

Merged
square360-george merged 5 commits into
mainfrom
fix/v3.2.6-shallow-clone-race
May 23, 2026
Merged

v3.2.6: patch upstream push-to-pantheon unshallow + fix verify dev→master mapping#103
square360-george merged 5 commits into
mainfrom
fix/v3.2.6-shallow-clone-race

Conversation

@square360-george

Copy link
Copy Markdown
Member

Summary

Two upstream/downstream bugs surfaced during Yale Health's first deploy on v3.2.5 (2026-05-22 evening):

  1. Upstream pantheon-systems/push-to-pantheon@0.9.x has an unguarded git fetch --unshallow origin in prepare_site_root (scripts/main.sh:352). Fails two different ways depending on checkout depth — race on shallow, deterministic error on complete. Bug exists in every upstream version 0.8.0–0.9.2; never fixed by them. We runtime-patch their main.sh on the runner before invoking the action: append || true to the unguarded unshallow line. Safe because upstream's own guarded unshallow at line 382 (inside push_to_pantheon) still runs before the actual push.

  2. Our verify-after-push step (added v3.2.4) was checking the wrong ref on dev deploys. Pantheon's dev env lives on the master branch; multidevs use a branch with their env name. Without a TARGET_ENV → PANTHEON_BRANCH mapping, every dev deploy false-failed verify even when the push landed cleanly. Fixed by mirroring upstream's push-target logic.

Changes

  • actions/pantheon-push/action.yml: new "Patch upstream push-to-pantheon" step before the upstream invocation. Idempotent, self-validating, pinned to upstream 0.9.0 via env var — bumping upstream requires re-validating the sed pattern.
  • actions/pantheon-push/action.yml (verify step): map dev → master before git ls-remote refs/heads/<branch>.
  • 4 reusables: internal self-refs bumped to @v3.2.6.

Repro / validation

  • Yale Health RC deploy run 70394172925 (shallow race), 70396096336 (complete-repo error), 70400355314 (verify false-fail on dev push that actually succeeded), 70400355314 attempt 2 (sed delimiter bug — fixed in this branch), then a clean dev deploy on the final HEAD.
  • Tested end-to-end on Yale Health while branch-pinned. Both RC multidev creation and DEV deploy now succeed under v3.2.6 code.

Test plan

  • Yale Health RC multidev deploy succeeds (rc-2026-21 created from live)
  • Yale Health DEV deploy succeeds with verify-after-push passing
  • Internal self-refs verified at @v3.2.6 (no stragglers) — verified pre-merge: 18 refs, all consistent
  • Tag v3.2.6 after merge

🤖 Generated with Claude Code

square360-george and others added 5 commits May 22, 2026 17:15
reusable-pantheon-deploy-{dev,rc-multidev,epic-multidev,pr-multidev} all
checked out with fetch-depth: 1. upstream pantheon-systems/push-to-pantheon
@0.9.0's prepare_site_root then trips "fatal: shallow file has changed
since we read it" exit-128 after our pre-commit step writes a new commit
on top of the shallow HEAD.

bumping fetch-depth to 0 removes .git/shallow entirely so the race can't
fire. small checkout cost vs an unrecoverable mid-step failure that aborts
the deploy before the verify-after-push step can run.

scoped to the four reusable workflows that call our pantheon-push composite
(the four with the pre-commit step). reusable-deploy-pantheon.yml and
reusable-deploy-multidev.yml don't call pantheon-push so left alone.

repro: Yale Health rc-2026-21 first-run, 2026-05-22 run id 70394172925.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Upstream pantheon-systems/push-to-pantheon@0.9.0 has an unguarded
`git fetch --unshallow origin` at scripts/main.sh:352 inside
prepare_site_root. Same bug exists 0.8.0 (action.yml:363) through 0.9.2,
never fixed upstream.

The bug fires two ways:
- fetch-depth: 1 → races with "shallow file has changed since we read it"
  (intermittent, exit 128)
- fetch-depth: 0 → "--unshallow on a complete repository does not make
  sense" (deterministic, exit 128)

Both abort the deploy in prepare_site_root before our verify-after-push
step can run. Upstream's bobheadxi/deployments@v1 then marks the GitHub
deployment "success" despite the failure.

Fix: sed-patch upstream's main.sh on the runner before invoking the
action, appending `|| true` to the unshallow call. Safe because upstream
itself does the proper guarded unshallow later in push_to_pantheon (line
382: is-shallow-repository check + `||` fallback) — the line we patch
is redundant defense, not the only deepen.

Patch step is idempotent and fails loudly if upstream changes shape
(missing file, sed pattern miss). UPSTREAM_VERSION env var is the canary
for upstream bumps.

Also reverts the fetch-depth: 0 misadventure on the 4 pantheon-push-
consuming reusables back to fetch-depth: 1 — that was an attempt to
sidestep the race that just traded it for the deterministic error.

Repro: Yale Health rc-2026-21 first-run 2026-05-22 run id 70394172925
(shallow race), follow-up run id 70396096336 (complete-repo error).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…internal refs

Two fixes stacked together because the dev deploy on v3.2.5 / v3.2.6-branch
exposed both at once on Yale Health rc/dev pushes 2026-05-22.

1. verify-after-push: map TARGET_ENV → Pantheon branch name before
   ls-remote. Pantheon's `dev` env lives on `master`; multidevs use a
   branch with their own name. Mirrors upstream push-to-pantheon's
   push-target logic (scripts/main.sh:369-378). Without this, dev deploys
   false-fail here even though the push lands cleanly — ls-remote for
   refs/heads/dev returns empty because the ref doesn't exist.

   Repro: Yale Health dev deploy run 70400355314. Upstream logged
   `pushing to 'master' branch on Pantheon` and the force-push succeeded
   (HEAD -> master). Our verify step then aborted on refs/heads/dev.

2. Branch-pin internal self-refs across the 4 pantheon-push-consuming
   reusables. Files on the branch were still calling pantheon-push@v3.2.5,
   terminus-install@v3.2.5, pantheon-post-deploy-drush@v3.2.5, and the
   security-scan / vrt / semantic-release reusables at @v3.2.5. That
   meant the upstream-patch step (commit 318c115) was never invoked —
   Yale Health was running tagged v3.2.5 code, not the branch. Earlier
   RC/dev runs only worked because the upstream shallow race didn't fire.

   This is the documented [[release-pin-drift-trap]] / [[branch-pin-
   during-pre-merge-test]] pattern — flipped @v3.2.5 → @fix/v3.2.6-
   shallow-clone-race so the branch's code actually runs end-to-end. To
   revert pre-merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lided with |)

The patch step shipped in commit 318c115 used `|` as the sed delimiter, but
the replacement string contains `||` (the bash short-circuit) which sed
parsed as the end-of-replacement separator. Result: `sed: -e expression
#1, char 82: unknown option to 's'`, step exit 1, deploy aborted before
upstream push-to-pantheon was invoked.

Switch delimiter to `#` — not present in pattern or replacement.

Validated locally against the actual upstream main.sh@0.9.0: line 352
correctly gets `|| true` appended, line 384 (already-guarded variant) is
correctly skipped by `^...$` anchoring.

Repro: Yale Health dev deploy run 70400355314 attempt 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Flip the four pantheon-push-consuming reusables from the temporary
branch-pin @fix/v3.2.6-shallow-clone-race back to @v3.2.6 ahead of the
v3.2.6 tag. 18 refs across pantheon-push, terminus-install,
pantheon-post-deploy-drush, reusable-semantic-release, reusable-pantheon-
security-scan, and reusable-pantheon-vrt — all now consistent at v3.2.6.

This is the [[release-pin-drift-trap]] discipline: tag a release with
internal refs already pointing at the version being released, so the
release is internally consistent the moment the tag exists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 23, 2026 01:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the shared Pantheon deployment automation to (1) runtime-patch an upstream pantheon-systems/push-to-pantheon@0.9.0 bug around git fetch --unshallow, and (2) fix verify-after-push behavior for dev deploys by mapping dev → master when checking Pantheon-side refs. It also bumps internal reusable workflow references to v3.2.6.

Changes:

  • Add a pre-step in pantheon-push to patch upstream scripts/main.sh so git fetch --unshallow origin is tolerant of failure modes.
  • Fix verify-after-push to check refs/heads/master for dev deploys instead of refs/heads/dev.
  • Bump internal self-references in reusable workflows from v3.2.5 to v3.2.6.

Reviewed changes

Copilot reviewed 1 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/workflows/reusable-pantheon-deploy-rc-multidev.yml Bumps composite/workflow self-refs to v3.2.6 for RC multidev pipeline.
.github/workflows/reusable-pantheon-deploy-pr-multidev.yml Bumps composite/workflow self-refs to v3.2.6 for PR multidev pipeline.
.github/workflows/reusable-pantheon-deploy-epic-multidev.yml Bumps composite/workflow self-refs to v3.2.6 for epic multidev pipeline.
.github/workflows/reusable-pantheon-deploy-dev.yml Bumps composite/workflow self-refs to v3.2.6 for DEV deploy pipeline.
.github/actions/pantheon-push/action.yml Adds upstream runtime patching step and corrects dev-branch verification mapping.

UPSTREAM_VERSION: "0.9.0"
run: |
set -euo pipefail
UPSTREAM_SCRIPT="/home/runner/work/_actions/pantheon-systems/push-to-pantheon/${UPSTREAM_VERSION}/scripts/main.sh"
Comment on lines +172 to +180
# Pinned to upstream 0.9.0 — if we ever bump that, this step needs to be
# re-validated against the new source (sed pattern may not match).
- name: Patch upstream push-to-pantheon to tolerate unshallow errors
shell: bash
env:
UPSTREAM_VERSION: "0.9.0"
run: |
set -euo pipefail
UPSTREAM_SCRIPT="/home/runner/work/_actions/pantheon-systems/push-to-pantheon/${UPSTREAM_VERSION}/scripts/main.sh"
@square360-george
square360-george merged commit 94d15ba into main May 23, 2026
1 check passed
@square360-george
square360-george deleted the fix/v3.2.6-shallow-clone-race branch May 23, 2026 01:55
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.

2 participants