mrc-6988 fix output buttons bug - #45
Open
EmmaLRussell wants to merge 2 commits into
Open
EmmaLRussell wants to merge 2 commits into
EmmaLRussell wants to merge 2 commits into
Conversation
EmmaLRussell
marked this pull request as ready for review
September 8, 2026 15:04
david-mears-2
left a comment
Contributor
There was a problem hiding this comment.
Seems to work, though the logs my job generated wouldn't have failed with the greedy regex in any case (they only listed the summary report in one place).
For unit testing, would it work to update expectedLog in piranha-apps/svelte-app/tests/unit/lib/piranhaAPI.svelte.test.ts to have an adversarial example, i.e. one where greedy-regex would go wrong and lazy-regex wouldn't? And then assert that window.api.openRunOutputFolder was called with the correct parameters?
Current:
const expectedLog = [
"test log message 1",
"test log message 2",
"Generated: /data/run_data/output/output_1/report.html",
];Proposed:
const expectedLog = [
"test log message 1",
"test log message 2",
"Generated: /data/run_data/output/output_1/report.html",
"Honeypot: /data/run_data/output/honeypot_for_greedy_regex/report.html",
];| /\/data\/run_data\/output\/(.*?)\/report\.html/, | ||
| ); | ||
| if (match) { | ||
| this.#runOutputFolderName = match[1]; |
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.
I noticed that the open output buttons had stopped working and the error logged in the server suggested that it had been trying to open a folder name corresponding to a big chunk of the output log.
I'm not quite sure why the logging from Piranha has changed, but it seems that the regex I use in
piranhaAPIto determine the name of the output log had been way too greedy and the match had gobbled multiple lines rather than doing a lazy match. I've joined the log with newlines rather than spaces so that the match should never traverse lines and have also explicitly made the match lazy.This is awkward to put in an e2e test for as it's about opening other programs - best to just test manually that the "Open report" and "Open output folder" buttons work at the end of a run.