Skip to content

Conversation

@hadley
Copy link
Member

@hadley hadley commented Oct 20, 2025

Renamed continue_test to muffle_expectation to make it more clear what the purporse of this restart is — it's to allow us to opt-out of further handling.

Renamed `continue_test` to `muffle_expectation` to make it more clear what the purporse of this restart is — it's to allow us to opt-out of further handling.
@claude
Copy link

claude bot commented Oct 20, 2025

Claude finished @hadley's task —— View job


Reviewing PR changes...

Todo List

  • Read and analyze changed files
  • Check for potential bugs or issues
  • Verify rename consistency
  • Provide review feedback

Analysis

The PR renames continue_test to muffle_expectation across the codebase. Based on my review:

Changes Made:

  • R/expectation.R:107 - Updated restart name in exp_signal()
  • R/snapshot.R:138 - Updated restart name in snapshot error handling
  • R/test-that.R:114 - Updated invokeRestart() call in expectation handler
  • R/expect-self-test.R:14,18 - Updated invokeRestart() calls
  • Documentation and tests updated accordingly

Issues Found:
None. The rename is consistent and complete.

Assessment:
LGTM - Clean refactoring that improves code clarity without changing functionality.

@hadley hadley requested a review from DavisVaughan October 20, 2025 20:19
Copy link
Member

@DavisVaughan DavisVaughan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment is based on gut feeling rather than actual testthat knowledge

Comment on lines -134 to 140
} else {
cnd_signal(state$error)
# This might be a failed expectation, so we need to make sure
# that we can muffle it
withRestarts(
cnd_signal(state$error),
muffle_expectation = function() NULL
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know very little about testthat internals, but is this supposed to be exp_signal(state$error)?

It feels like there should only be 1 place in testthat where you set up withRestarts(muffle_expectation =), and then other places should reuse that helper. Otherwise you end up with weird ad hoc calls like this one.

I'm not totally sure what state$error is though, and if calling exp_signal() on it is appropriate

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state$error could be any error, not just an expectation.

I agree that there shouldn't be multiple places where we have to add this restart, but the condition handling in snapshots is complicated and I know I've got it wrong before, so I don't really want to touch that code. (I just looked back at the blame and it seems like literally every line of that if statement required a different PR to get right 😭). (But I'll take one more look)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I tried again, and it got me into an even weirder state. So I don't think it's worth 100% reasoning through again, and this should be the only place where we need it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds fine

@hadley hadley requested a review from lionel- October 21, 2025 13:23
@hadley
Copy link
Member Author

hadley commented Oct 21, 2025

Adding @lionel- just in case he has any insights.

Copy link
Member

@lionel- lionel- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hadley hadley merged commit 957cfad into main Oct 23, 2025
23 checks passed
@hadley hadley deleted the snapshot-restart branch October 23, 2025 12:53
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