Skip to content

[match] Fix match_nuke certificate_id filtering#30022

Merged
iBotPeaches merged 1 commit into
fastlane:masterfrom
nakshatrasinghh:30015-fix-match-nuke-certificate-id
May 9, 2026
Merged

[match] Fix match_nuke certificate_id filtering#30022
iBotPeaches merged 1 commit into
fastlane:masterfrom
nakshatrasinghh:30015-fix-match-nuke-certificate-id

Conversation

@nakshatrasinghh

@nakshatrasinghh nakshatrasinghh commented May 7, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

match_nuke exposes the certificate_id option, but the nuke flow did not use it when filtering certificates, provisioning profiles, or files.

As a result, running match_nuke with both force: true and a specific certificate_id could still list and revoke/delete every fetched certificate and matching provisioning profile, instead of only the selected certificate and profiles that depend on it.

Resolves #30015

Description

This change makes match_nuke honor certificate_id before the existing force behavior short-circuits certificate filtering.

When certificate_id is provided, match_nuke now:

  • filters the fetched certificates down to the requested certificate ID
  • filters provisioning profiles to only profiles associated with that certificate
  • filters repository files to only the selected certificate/key files and matching provisioning profile files
  • raises an explicit error if the requested certificate_id does not match any fetched certificate

I also added unit coverage for the force: true case reported in the issue, plus coverage for the invalid certificate_id path.

No documentation update was needed because certificate_id was already documented for match_nuke; this fixes the implementation to match the documented behavior.

Testing Steps

Added regression coverage that simulates the match_nuke environment from #30015:

  • force: true
  • certificate_id: "1111111111"
  • two fetched certificates: 1111111111 and 2222222222
  • one provisioning profile tied to each certificate
  • stored .cer, .p12, and .mobileprovision files for both certificates/profiles

The spec calls filter_by_cert and verifies that only the selected certificate, its key, and its dependent provisioning profile remain queued for deletion. It also verifies that an unmatched certificate_id raises an explicit error.

Ran the focused match_nuke specs covering this change:

env -u NO_COLOR bundle exec rspec match/spec/nuke_spec.rb

Result:

3 examples, 0 failures

Ran RuboCop on the touched files:

env -u NO_COLOR RUBOCOP_CACHE_ROOT=/private/tmp/rubocop-cache bundle exec rubocop match/lib/match/nuke.rb match/spec/nuke_spec.rb

Result:

2 files inspected, no offenses detected

Ran the full RuboCop suite:

RUBOCOP_CACHE_ROOT=/private/tmp/rubocop-cache bundle exec rubocop

Result:

1313 files inspected, no offenses detected

Ran docs validation:

env -u NO_COLOR bundle exec fastlane validate_docs

Result: passed.

@nakshatrasinghh nakshatrasinghh marked this pull request as ready for review May 7, 2026 11:28
@iBotPeaches iBotPeaches requested a review from Copilot May 7, 2026 13:16

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 fixes match_nuke so the certificate_id option is honored even when force: true, ensuring only the selected certificate and its dependent provisioning profiles/files are targeted.

Changes:

  • Apply certificate_id filtering before the existing force short-circuit in Match::Nuke#filter_by_cert.
  • Refactor certificate/profile/file filtering into helper methods to reuse the same selection logic.
  • Add specs covering the force: true + certificate_id regression and the “unknown certificate_id” error path.

Reviewed changes

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

File Description
match/lib/match/nuke.rb Ensures certificate_id drives certificate/profile/file selection (even with force: true) and centralizes filtering logic.
match/spec/nuke_spec.rb Adds regression + error-path unit coverage for certificate_id behavior in the nuke flow.

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

Comment thread match/lib/match/nuke.rb Outdated
@nakshatrasinghh nakshatrasinghh force-pushed the 30015-fix-match-nuke-certificate-id branch from 0cafe31 to a95af18 Compare May 7, 2026 16:07
@iBotPeaches iBotPeaches changed the title Fix match_nuke certificate_id filtering [match] Fix match_nuke certificate_id filtering May 8, 2026
@iBotPeaches iBotPeaches requested a review from Copilot May 9, 2026 09:48

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@iBotPeaches iBotPeaches merged commit c0c5d06 into fastlane:master May 9, 2026
13 checks passed

@github-actions github-actions Bot 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.

Hey @nakshatrasinghh 👋

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 🚀"

PratikPatil131 pushed a commit to PratikPatil131/fastlane that referenced this pull request May 9, 2026

@github-actions github-actions Bot 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.

Congratulations! 🎉 This was released as part of fastlane 2.234.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

certificate_id not used when running match_nuke

3 participants