Fix two latent bugs in export docs and hot-path label parsing - #11
Open
EmilHvitfeldt wants to merge 2 commits into
Open
Fix two latent bugs in export docs and hot-path label parsing#11EmilHvitfeldt wants to merge 2 commits into
EmilHvitfeldt wants to merge 2 commits into
Conversation
The roxygen for pv_to_json() and pv_to_list() advertised "callers" as an include option, but it was absent from both the default vector and the function body, so following the docs errored in match.arg(). It cannot be implemented as-is: pv_callers() requires a function name, and a whole-profile export has none to supply. Removed from the docs instead, with a test asserting the documented set matches what is actually accepted.
pv_print_hot_paths() stripped the trailing " (file:line)" from a stack
entry with sub(" \\(.*\\)$", "", x). The greedy .* begins at the first
" (" in the string, so any label containing a space before an open paren
lost that part too:
"if (x > 1) (file.R:3)" -> "if"
The truncated name then fed is_user_function() and the pv_focus(p, "...")
next-step suggestion, which could name a function that does not exist.
Extracted strip_location() into utils.R, anchored on the file:line shape,
which the location always has and a label never does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two unrelated bugs found while auditing debrief's output for machine readability, both of which bite a user following the documentation.
pv_to_json()andpv_to_list()documented aninclude = "callers"option that was never wired up, so using it errored inmatch.arg(). It can't be implemented as-is, sincepv_callers()needs a function name that a whole-profile export has no way to supply, so the docs now match reality.Separately,
pv_print_hot_paths()used a greedy regex to strip the" (file:line)"suffix off a stack entry, which also swallowed any part of the label after an earlier" (". Labels likeif (x > 1)came back asif, and that truncated name feeds thepv_focus(p, "...")next-step suggestion, so the printed advice could name a function that doesn't exist.