Skip to content

List the wrong release first in release lookup specs - #764

Merged
AliSoftware merged 1 commit into
ainfra-2725/publish-latest-github-releasefrom
mokagio/pr-763-order-independent-specs
Aug 3, 2026
Merged

List the wrong release first in release lookup specs#764
AliSoftware merged 1 commit into
ainfra-2725/publish-latest-github-releasefrom
mokagio/pr-763-order-independent-specs

Conversation

@mokagio

@mokagio mokagio commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What does it do?

Addresses a false positive risk in the #763 tests highlighted by Copilot #763 (review)

To verify the false positive, I got Claude to open #765, which reverts the code to the pre-#763 lookup yet has green tests.

The two #upload_release_assets specs added there stub client.releases with the release they expect the helper to pick already in first position. That makes them pass against a lookup that simply takes the first match — so neither actually pins the deterministic selection they were added for.

Reordering each stub so the wrong candidate comes first turns them into real regression tests. Verified locally: reverting find_release to matches.first over an unsorted list turns both red, and they go green again with the implementation from #763. The #publish_release specs already had adversarial ordering and need no change.

#766 verifies the test fix in this PR. Same revert to pre-#763 lookup, but CI is red.

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations.
  • Add Unit Tests (aka specs/*_spec.rb) if applicable.
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass.
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section. — n/a, test-only change; Publish the most recent GitHub Release when several share a name #763 carries the entry.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider. — n/a.

Posted by Claude Code (Opus 5) on behalf of @mokagio with approval.

Copilot AI review requested due to automatic review settings August 3, 2026 03:43
@mokagio mokagio self-assigned this Aug 3, 2026
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ Please add an entry in the CHANGELOG.md file to describe the changes made by this PR

Generated by 🚫 Danger

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

Strengthens the regression coverage around GitHub Release lookup in #upload_release_assets by making the specs adversarial to API ordering, ensuring the helper deterministically selects the correct release rather than “whatever comes first”.

Changes:

  • Reordered the stubbed client.releases return value in two #upload_release_assets specs so the wrong candidate is listed first.
  • Added clarifying spec comments explaining the intent (guarding against implementations that rely on API ordering).

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

Both `#upload_release_assets` specs stubbed `client.releases` with the
release they expect the helper to pick already in first position, so they
passed against a lookup that just takes the first match and never exercised
the deterministic selection they were added for.

Putting the wrong candidate first makes them fail against such a lookup:
verified by reverting `find_release` to `matches.first` over an unsorted
list, which turns both red.

---

Generated with the help of Claude Code, https://claude.ai/code

Co-Authored-By: Claude Code Opus 5 <noreply@anthropic.com>
@AliSoftware
AliSoftware force-pushed the mokagio/pr-763-order-independent-specs branch from 93c7349 to eb10938 Compare August 3, 2026 06:22
@AliSoftware
AliSoftware merged commit 3205f9e into trunk Aug 3, 2026
6 checks passed
@AliSoftware
AliSoftware deleted the mokagio/pr-763-order-independent-specs branch August 3, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants