Skip to content

Conversation

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Sep 19, 2025

Closes #1609
Closes #1482

Copilot wrote the code and the tests and hallucinated the snapshots. Fixed a syntax code in the test and updated snapshots. Looks legit to me now.

@krlmlr krlmlr changed the title f 1609 rethrow Initial plan Sep 19, 2025
@krlmlr krlmlr changed the title Initial plan Fix internal error in pivot_wider() Sep 19, 2025
Comment on lines 349 to 356
Warning:
Using an external vector in selections was deprecated in tidyselect 1.1.0.
i Please use `all_of()` or `any_of()` instead.
# Was:
data %>% select(x)
# Now:
data %>% select(all_of(x))
Copy link
Member

Choose a reason for hiding this comment

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

We do not want to see this warning in the snapshot output

Comment on lines 923 to 931
# Character vector case
expect_snapshot(error = TRUE, {
pivot_wider(
df,
id_cols = c("a", "b", "c"),
names_from = name,
values_from = value
)
})
Copy link
Member

Choose a reason for hiding this comment

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

This is a duplicate test


expect_snapshot(error = TRUE, {
pivot_wider(
df,
Copy link
Member

Choose a reason for hiding this comment

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

This should be using df2, the tests aren't useful otherwise, looks like a thinko

Comment on lines 892 to 906
# Original issue scenario
x <- c(1, 2, 12, 31, 123, 2341)
df <- data.frame(x = x)

# This should produce a proper tidyselect error, not an internal error
expect_snapshot(error = TRUE, {
df %>%
dplyr::mutate(y = stringr::str_split(x, "")) %>%
unnest(cols = y) %>%
pivot_wider(
id_cols = x,
values_from = y,
names_from = x
)
})
Copy link
Member

Choose a reason for hiding this comment

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

Simplified this pretty dramatically to a minimal reprex with meaningful comments

@DavisVaughan
Copy link
Member

I've gone ahead and updated everything, but I think Copilot did not do very well with these tests. I left comments above.

@krlmlr
Copy link
Member Author

krlmlr commented Sep 19, 2025

Thanks for reviewing. This helps a lot in calibrating my expectations around autogenerating tests. I'll do another round myself next time.

@DavisVaughan DavisVaughan merged commit 16cbe9e into tidyverse:main Sep 19, 2025
15 checks passed
@DavisVaughan
Copy link
Member

Thanks!

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.

Error in rethrow_id_cols_oob Internal error discovered in pivot_wider()

2 participants