ci(swift): reference staged package by its SPM identity in verify smoke#1506
Conversation
The release-swift verify gate builds a throwaway smoke project that depends on the staged package via .package(path:) and references it as .product(package: "Moq"). SPM derives a path-based package's identity from the final path component, not the manifest's name: field, so the staged dir (moq-ffi-X.Y.Z-swift) resolves under that identity and the smoke project fails with "unknown package 'Moq'". Symlink the staged dir to $WORK/moq-swift and reference moq-swift as the package identity. Matching the published mirror name (moq-swift) means the smoke test now exercises the same identity real consumers see when depending on github.com/moq-dev/moq-swift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe PR updates swift/scripts/verify.sh to set PKG_IDENTITY="moq-swift", create a symlink PKG_LINK="$WORK/$PKG_IDENTITY" pointing at the staged package, and generate a smoke-test Package.swift that depends on the package via .package(path: "$PKG_LINK") and references the product using package: "$PKG_IDENTITY". The existing verification flow (input checks, tarball extraction, manifest presence, swift package resolve, swift build) is unchanged. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
swift/scripts/verify.sh (1)
77-77: ⚡ Quick winExtract the package identity to a variable for maintainability.
The string
"moq-swift"appears in both the symlink path (line 77) and the product package reference (line 96). These must remain synchronized for the smoke test to work. Consider extracting to a variable to make this coupling explicit and reduce the risk of future desynchronization.♻️ Proposed refactor
+# Package identity that matches the published moq-dev/moq-swift mirror +PKG_IDENTITY="moq-swift" +PKG_LINK="$WORK/$PKG_IDENTITY" -PKG_LINK="$WORK/moq-swift" ln -s "$STAGED_DIR" "$PKG_LINK"And update the generated Package.swift:
.executableTarget( name: "Smoke", - dependencies: [.product(name: "Moq", package: "moq-swift")], + dependencies: [.product(name: "Moq", package: "$PKG_IDENTITY")], path: "Sources/Smoke" ),Also applies to: 96-96
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@swift/scripts/verify.sh` at line 77, The hardcoded package name "moq-swift" is duplicated and should be centralized; introduce a single shell variable (e.g., PKG_NAME or PACKAGE_ID) and use it to build PKG_LINK (replace PKG_LINK="$WORK/moq-swift" with PKG_LINK="$WORK/$PKG_NAME") and also use that variable when emitting or updating the Package.swift product/package reference (ensure any generation or sed/template that writes the product name uses the same PKG_NAME variable) so both references stay synchronized.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@swift/scripts/verify.sh`:
- Line 77: The hardcoded package name "moq-swift" is duplicated and should be
centralized; introduce a single shell variable (e.g., PKG_NAME or PACKAGE_ID)
and use it to build PKG_LINK (replace PKG_LINK="$WORK/moq-swift" with
PKG_LINK="$WORK/$PKG_NAME") and also use that variable when emitting or updating
the Package.swift product/package reference (ensure any generation or
sed/template that writes the product name uses the same PKG_NAME variable) so
both references stay synchronized.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1ae5c7e8-c66d-43d6-a2f5-15b4718fed3c
📒 Files selected for processing (1)
swift/scripts/verify.sh
Per CodeRabbit nit: the "moq-swift" string lived in both the symlink path and the generated Package.swift's .product(package:) reference, so they had to be kept in sync by hand. Extract to PKG_IDENTITY. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Verify staged package resolvesjob in release-swift.yml, which failed on themoq-ffi-v0.2.14tag run withunknown package 'Moq'(run 26413362356)..product(package: "Moq"), but SPM derives a path-based package's identity from the final path component (moq-ffi-0.2.14-swift), not from the manifest'sname:field. So the dependency was never findable under the name"Moq".$WORK/moq-swiftand referencemoq-swiftas the package identity. Matching the published mirror name (moq-dev/moq-swift) means the smoke test now exercises the same SPM identity real consumers see.Why this matters
The verify step gates the mirror publish, so the
moq-ffi-v0.2.14release never actually shipped to the Swift mirror. Once this lands the release workflow will need to be retriggered (or a fresh patch tag cut) to publish the artifacts.Test plan
Verify staged package resolvesjob passes.🤖 Generated with Claude Code