chore: require Package.resolved to move with the contract pins - #978
Merged
Merged
Conversation
Xcode Cloud resolves only from the committed Package.resolved and will not update it, so a Package.swift pin that moved without it fails the deploy. The CI check catches that after the commit lands; the pre-commit hook now refuses it when either file is staged. It parses the `case .<pkg>: return "X.Y.Z"` pins and the identity mapping from the staged Package.swift and compares them with the staged Package.resolved. Text only: no network, no xcodebuild.
…ge.resolved together The pre-commit hook now rejects a pin that disagrees with Package.resolved; this is the path that produces both changes in one step. It refuses unless the version's tag exists on the client-protocol repo, edits the pin, resolves with FLIPCASH_PROTO_LOCAL unset, aborts and restores both files if anything besides that package's entry (and originHash) changed, then stages both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The flipcash2 pin in
FlipcashAPI/Package.swiftmoved to0.17.0while the workspacePackage.resolvedstill named0.16.0, and it reachedmainthrough #974. ThePackage.resolved is currentcheck failed on that PR, but it runs after the fact and admins can merge past it. Xcode Cloud resolves only from the committed file, so deploys break until #977 lands.This makes the two files move together at commit time:
Scripts/git-hooks/pre-commitrejects a commit where a contract pin in the stagedPackage.swiftdoesn't match that package's version in the stagedPackage.resolved. It reads the pin-to-identity mapping fromContractPackageinPackage.swift, compares text only (no network, noxcodebuild), and runs only when one of the two files is staged.Scripts/bump-contract.sh <ocp|flipcash2> <version>is the way to bump. It refuses unless the tag exists on the client repo, edits the pin, resolves withFLIPCASH_PROTO_LOCALandFLIPCASH_PROTO_LOCAL_PACKAGESunset for that call, aborts and restores both files if any other package's entry moved, and stages both. It also refuses to start if either file already has uncommitted changes. The resolve takes about 4.5 minutes and prints nothing until it finishes..claude/docs/technology-stack.mdpoints the contract-bump instructions at the script.The hook only runs in checkouts with
core.hooksPathset toScripts/git-hooks, whichScripts/build.shdoes on first run. The CI check stays as the backstop for everything else.