Skip to content

Conversation

jonthegeek
Copy link
Contributor

@jonthegeek jonthegeek commented Sep 19, 2025

This was meant to be a PR into #2169, but I forgot to set that when I created this PR, so I'm closing that and moving here.

Added a simple helper to escape curly braces for glue (ui_escape_glue() in utils-ui.R), then applied it in the relevant pr_*() functions. I used Positron Assistant (with Claude) and Google Gemini (using my personal setup) on this to test Positron Assistant, then revised their fixes significantly.

pr_pause() then pr_resume() shows the title of this PR properly, as does pr_fetch() (with no number). pr_fetch(2171) also shows this title properly.

Fixes #2107.

Added a simple helper to escape curly braces for glue (`ui_escape_glue()` in `utils-ui.R`), then applied it in the relevant `pr_*()` functions. I used Positron Assistant and Google Gemini as a test on this, then revised their fixes significantly.

Do you want to add a test for this in `manual-pr-functions.R`? Or I could automate this stuff with mocked github API calls if you want to go that far.

Fixes r-lib#2107
And implicitly test the curly brace thing.
@jonthegeek
Copy link
Contributor Author

jonthegeek commented Sep 19, 2025

Doh, I forgot to change the target! I... guess this replaces #2169. Or I can close this and re-create the PR so it targets that branch.

@jennybc
Copy link
Member

jennybc commented Sep 19, 2025

Just recording that if I fetch the initial PR, do load_all(), I can in fact do pr_fetch() and it doesn't fall over in the presence of this PR, so that's good empirical proof of success:

> pr_fetch(2169)
✔ Setting active project to "/Users/jenny/rrr/usethis".Checking out PR r-lib/usethis/#2169 (@jonthegeek): "Escape curly braces in
  `pr_title` ".
✔ Switching to branch "jonthegeek-fix-2107-escape_curlies".
> devtools::load_all()
ℹ Loading usethis
> pr_fetch()
✔ Setting active project to "/Users/jenny/rrr/usethis".
ℹ No PR specified ... looking up open PRs.
Which PR are you interested in? (0 to exit) 

1: PR #2171 (@jonthegeek): "Add a {test} for `ui_escape_glue()` helper"
2: PR #2170 (@karawoo): "Add placeholder spot for mocked bindings"
3: PR #2169 (@jonthegeek): "Escape curly braces in `pr_title` "
4: PR #2071 (@eitsupi): "Support `suggests` field of standalone files"
5: PR #2049 (@focardozom): "document data "
6: PR #2001 (@olivroy): "Include file names in `challenge_uncommited_changes()`"
7: PR #1529 (@jennybc): "Shields.io experiment"

Selection: 

@jonthegeek
Copy link
Contributor Author

If you specify this number, it did the escape but then didn't glue. This fix ended up not actually being inside pr_fetch() at all, just in pr_choose() and choose_branch().

@jennybc
Copy link
Member

jennybc commented Sep 19, 2025

This solution LGTM! Do you want to add a NEWS bullet? We can either merge this one or you can update the original PR. Finish off one of them and I'll merge.

@jennybc I added the `Fixes r-lib#2107` to the description, but it didn't retroactively link to the issue, so make sure that's showing in Development to auto-close.
@jennybc jennybc merged commit 7a71a95 into r-lib:main Sep 19, 2025
13 checks passed
@jonthegeek jonthegeek deleted the test-curlies branch September 19, 2025 16:15
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.

pr_fetch() missing escaping
2 participants