Skip to content

refactor: assert_suggestion_result() family of functions#3775

Open
hippietrail wants to merge 1 commit into
Automattic:masterfrom
hippietrail:assert-suggestion-result-iterator
Open

refactor: assert_suggestion_result() family of functions#3775
hippietrail wants to merge 1 commit into
Automattic:masterfrom
hippietrail:assert-suggestion-result-iterator

Conversation

@hippietrail

Copy link
Copy Markdown
Collaborator

Issues

N/A

Description

Some months back I used AI to help me convert the suggestion assertions to find any suggestion rather than just the first three, after failing a couple of attempts to do it with human brain only.

At the time I did not apply the fix also to assert_good_and_bad_suggestions() because it was a bit more complicated and I wanted to be sure the general fix was fine. It has now long since proven itself.

This PR goes a step further by converting these methods from using recursion to iterators, including assert_good_and_bad_suggestions.

I've looked through the code line by line and all tests pass, but because I used more AI than I like in the PR I'd appreciate more eyes checking it. My grasp of all the recursion vs iterator issues in Rust is probably not total at this point too.

There are some tests sprinkled through the code that don't go as far as they should due to the known limitations with the good vs bad assertion. These can be improved over time.

How Has This Been Tested?

cargo test

AI Disclosure

  • I am a human and didn't use any AI.
  • I used LLM features of my editor, but not an agent.
  • I used an AI agent interactively.
  • I am an agent or I got an agent to do the work autonomously.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have considered splitting this into smaller pull requests.

…sion to iteration, including `assert_good_and_bad_suggestions`, which was a holdout still limited to the first few suggestions
@hippietrail hippietrail requested a review from elijah-potter July 6, 2026 10:28
@hippietrail hippietrail added rust Pull requests that update Rust code harper-core labels Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

harper-core rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant