Skip to content

[scan] output_remove_retry_attempts should also remove retries when the test is skipped#29887

Merged
iBotPeaches merged 10 commits into
fastlane:masterfrom
foxware00:master
Mar 16, 2026
Merged

[scan] output_remove_retry_attempts should also remove retries when the test is skipped#29887
iBotPeaches merged 10 commits into
fastlane:masterfrom
foxware00:master

Conversation

@foxware00

@foxware00 foxware00 commented Feb 3, 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 (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary. (I don't believe it's necessary)
  • I've added or updated relevant unit tests.

Motivation and Context

I've noticed if we have tests that fail, then skip on their second attempt. They are marked as an overall failure in the results. This change aligns the success logic with that of skipped

Description

I extended output_remove_retry_attempts to also see if the last result ended up being a skipped result and in that case also remove the retries

@foxware00 foxware00 marked this pull request as ready for review February 3, 2026 15:59
@foxware00 foxware00 changed the title output_remove_retry_attempts should also remove retries when the test is skipped [scan] output_remove_retry_attempts should also remove retries when the test is skipped Feb 3, 2026
@foxware00

Copy link
Copy Markdown
Contributor Author

@iBotPeaches is there anything you would want changed here?

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

Updates the legacy xcresult parsing path to better support output_remove_retry_attempts, ensuring retries are removed consistently even when the final attempt ends in a skipped result (and aligning the output with the “final attempt only” interpretation used elsewhere in Trainer).

Changes:

  • Refactors retry-attempt removal in LegacyXCResult::Parser#summaries_to_data into a dedicated helper.
  • Updates retry filtering to keep only the final test row per identifier and adjusts failure/skip/retry counters accordingly.

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

Comment thread trainer/lib/trainer/legacy_xcresult.rb
…kipped-on-retry scenario

Covers the case where a test fails on the first attempt and is skipped
on retry, ensuring failure/skip/retry counts are correctly adjusted when
output_remove_retry_attempts is true.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@foxware00

Copy link
Copy Markdown
Contributor Author

Added a regression test in trainer/spec/test_parser_spec.rb that directly exercises summaries_to_data with output_remove_retry_attempts: true for the fail-then-skip scenario. It asserts that only the final skipped row is kept and that all counts (failures, skips, retries) are correctly adjusted.

@foxware00

Copy link
Copy Markdown
Contributor Author

@iBotPeaches Is there anything you'd like changing?

@iBotPeaches

Copy link
Copy Markdown
Member

Code wise? No. I got lost in time trying to just learn about the change. In my head I was trying to think how some folks run tests in order to find flake, so running with retries and encountering a failure is a still a failure.

Then I thought I was overthinking if it the retry mode was like Jest and its purpose is to workaround flaky tests, then I was going to see if this was opt-in via the parameter - then I forgot all about it.

@foxware00

Copy link
Copy Markdown
Contributor Author

Code wise? No. I got lost in time trying to just learn about the change. In my head I was trying to think how some folks run tests in order to find flake, so running with retries and encountering a failure is a still a failure.

Then I thought I was overthinking if it the retry mode was like Jest and its purpose is to workaround flaky tests, then I was going to see if this was opt-in via the parameter - then I forgot all about it.

I think for the case of people running to find a flake, they wouldn't be skipping a test. I'll admit it's a bit of a odd usecase but I think treating skip the same as a pass makes sense in this case. Appreciate it's hard to know what behaviours people are relying on. My hunch is this is sensible enough to cater for the expected behaviour. We only see this in rare cases where our tests are setup to "skip" if they hit a flaky Apple API, but might actually fail before that.

if you'd prefer this as an opt in parameter, just me know. Happy to make any changes

@iBotPeaches

Copy link
Copy Markdown
Member

Reading through the options more - I believe this is a safe fix. You are just removing the retries if the test is skipped, which still semantically means "remove retry attempts"

        FastlaneCore::ConfigItem.new(key: :output_remove_retry_attempts,
                                     env_name: "TRAINER_OUTPUT_REMOVE_RETRY_ATTEMPTS",
                                     description: "Doesn't include retry attempts in the output",
                                     is_string: false,
                                     default_value: false)

@foxware00

Copy link
Copy Markdown
Contributor Author

Reading through the options more - I believe this is a safe fix. You are just removing the retries if the test is skipped, which still semantically means "remove retry attempts"

        FastlaneCore::ConfigItem.new(key: :output_remove_retry_attempts,
                                     env_name: "TRAINER_OUTPUT_REMOVE_RETRY_ATTEMPTS",
                                     description: "Doesn't include retry attempts in the output",
                                     is_string: false,
                                     default_value: false)

Yeah agreed, I think this is going to be expected behaviour though appreciate you can't garunatee how people are using it.

@iBotPeaches iBotPeaches merged commit e1b50b1 into fastlane:master Mar 16, 2026
9 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 @foxware00 👋

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

@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.233.0 🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants