[spaceship] fix provisioning profile repair when certificates include nil#29935
Conversation
Avoid crashes during provisioning profile repair/update when certificate arrays include nil or non-certificate entries. Made-with: Cursor
Refactor the certificate fallback logic to reduce nesting/complexity and satisfy rubocop metrics without changing behavior. Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
Fixes sigh repair / ProvisioningProfile#update! crashing when provisioning profile certificate lists include nil entries (e.g., after a distribution cert expires/revokes), by sanitizing certificate/device IDs and improving certificate selection fallback behavior.
Changes:
- Add logic to compact/filter invalid
certificatesand guardcertificate_valid?againstnil/blank IDs. - Refactor “pick a replacement certificate” logic into helper methods with Apple Development/Distribution fallbacks.
- Add RSpec coverage for nil/compaction behavior around profile repair.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| spaceship/spec/provisioning_profile_spec.rb | Adds specs around repairing profiles when certificate lists contain nil. |
| spaceship/lib/spaceship/portal/provisioning_profile.rb | Filters/compacts certificate/device IDs, avoids nil.id crashes, and refactors certificate selection with fallback logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Adjust provisioning profile repair spec to stub nil entries coming from profile details, matching real-world portal payloads. Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Filter pre-populated certificates to Certificate instances instead of clearing all - Raise when suggested_certificates is empty before repair (avoid opaque portal errors) - Add spec for empty certificate selection; align inline comment with project style Made-with: Cursor
There was a problem hiding this comment.
Hey @via-guy 👋
Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a month, and your PR will be included in the next one.
Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀"
… nil (fastlane#29935) * [spaceship] fix: handle nil certificates in provisioning profiles Avoid crashes during provisioning profile repair/update when certificate arrays include nil or non-certificate entries. Made-with: Cursor * [spaceship] refactor: simplify certificate selection in update! Refactor the certificate fallback logic to reduce nesting/complexity and satisfy rubocop metrics without changing behavior. Made-with: Cursor * [spaceship] test: cover nil certificate entries in profile_details Adjust provisioning profile repair spec to stub nil entries coming from profile details, matching real-world portal payloads. Made-with: Cursor * [spaceship] address Copilot review on PR fastlane#29935 - Filter pre-populated certificates to Certificate instances instead of clearing all - Raise when suggested_certificates is empty before repair (avoid opaque portal errors) - Add spec for empty certificate selection; align inline comment with project style Made-with: Cursor
There was a problem hiding this comment.
Congratulations! 🎉 This was released as part of fastlane 2.234.0 🚀
Problem
When a distribution certificate expires or is revoked all provisioning profiles become invalid. Running
sigh repaircrashes because the certificates are returned asnil, leading to the same error presented in #21295.Summary
nil(e.g. duringsigh repair).Test plan
bundle exec rspec spaceship/spec/provisioning_profile_spec.rbFixes #21295