Skip to content

Ship the commit the build produced, not whatever inputs.ref points at now - #86

Merged
aterga merged 1 commit into
mainfrom
claude/ship-checkout-build-sha-d74205
Jul 27, 2026
Merged

aterga merged 1 commit into
mainfrom
claude/ship-checkout-build-sha-d74205

Conversation

@aterga

@aterga aterga commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

The ship job in deploy-native.yml checked out inputs.ref. The binary reaches it as an artifact built from one specific commit, but deploy.sh ships two of the three payloads straight from that checkout:

tar -C "$repo_root/build-out" -cf - imcp2   # from the build job's commit
tar -C "$repo_root"           -cf - static      # from the ship job's checkout
tar -C "$repo_root"           -cf - monitoring  # from the ship job's checkout

Those agree only while the ref holds still, and it need not. A workflow_dispatch rollback can name a branch rather than a tag, and a release tag can be moved. The window is not small either — it spans the whole Rust cross-build plus however long ship waits on the environment's approval gate, which is unbounded when required reviewers are configured.

What makes this worth fixing rather than noting: the post-deploy check cannot catch it. The Verify deployed version step asserts GET /version against needs.build.outputs.sha, and the binary reports that SHA correctly no matter how stale the static/ and monitoring/ trees shipped beside it are. A mixed deployment goes green.

Checking out needs.build.outputs.sha closes it. The build job still resolves inputs.ref, so the ref is interpreted exactly once, at one point in time, and everything that reaches the host comes from that single commit — which is also what makes the /version assertion mean what it claims to.

Found by Copilot review on #84 (#84 (comment)), which merged before the comment could be addressed there. Split out rather than folded into #81 so a correctness fix to shared deploy mechanics gets its own review and its own revert handle.

Related issues

None. Separately tracked deploy-mechanics follow-up: #85.

Changes

  • ship checks out needs.build.outputs.sha instead of inputs.ref, with a comment recording why, including why the /version assertion does not cover the case.

Testing

  • deploy-native.yml parses as YAML; verified structurally that ship declares needs: build, that build exports the sha output the new ref consumes, and that no reference to inputs.ref remains anywhere in the ship job.
  • Not exercised end to end — this is a deploy workflow; it runs only on a push to main or a release tag. The staging deploy that follows this merge is what exercises it.
  • Not run: cargo build / cargo test / clippy — no Rust source changed.
  • Not run: npm test --prefix monitoring/mcp-status — no dashboard code changed; the workflow runs it anyway.

Checklist

  • I have read the Contributing guidelines.
  • Docs (README / comments) updated for any user-visible change — the reasoning lives in a comment at the change site. The README's build/ship section is being edited concurrently by Deploy production on release-* tags #81, so it is left alone here to avoid a conflict.
  • No secrets, credentials, or internal-only information are included.

Generated by Claude Code

… now

The ship job checked out inputs.ref. The binary reaches it as an artifact
built from a specific commit, but deploy.sh ships static/ and monitoring/
from the checkout, so the two only agree while that ref holds still. It need
not: a workflow_dispatch rollback can name a branch, a release tag can be
moved, and the gap spans the whole Rust cross-build plus however long the
job waits on the environment's approval gate — potentially hours.

The post-deploy check does not cover this. It asserts GET /version against
the build job's SHA, and the binary reports that correctly however stale the
assets shipped beside it are, so the run goes green on a mixed deployment.

Check out needs.build.outputs.sha instead. The build job still resolves
inputs.ref, so the ref is interpreted exactly once and everything shipped
comes from that one commit — which is also what makes the /version assertion
mean what it claims.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01R8ZshwKmjD5fZ4Hs9dS6zh
@aterga aterga mentioned this pull request Jul 27, 2026
6 of 9 tasks
@aterga
aterga marked this pull request as ready for review July 27, 2026 19:51
@aterga
aterga requested a review from a team as a code owner July 27, 2026 19:51
Copilot AI review requested due to automatic review settings July 27, 2026 19:51

Copilot AI left a comment

Copy link
Copy Markdown

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 fixes a deploy correctness hazard in the reusable native deploy workflow by ensuring the ship job checks out the exact commit that produced the built binary artifact, preventing mixed deployments where static/ and monitoring/ come from a different (moved) ref than the binary.

Changes:

  • Update .github/workflows/deploy-native.yml so the ship job checks out ${{ needs.build.outputs.sha }} instead of ${{ inputs.ref }}.
  • Add an in-file comment explaining the failure mode (ref movement during build/approval gate) and why the /version post-deploy check would not detect asset skew.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aterga
aterga merged commit ba48011 into main Jul 27, 2026
2 checks passed
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.

3 participants