Publish a preview of the benchmark page with PR results on pastila.nl - #2388
Merged
Merged
Conversation
A new workflow (results-preview.yml, pull_request_target) builds index.html with the data of main and the PR's result files embedded, publishes it on pastila.nl unencrypted (gzipped), and appends the link to the last bot comment or posts a new one. No PR code runs: result files are read from git objects as data. collect-new-results.py adds the link to its comments itself, because its GITHUB_TOKEN pushes don't trigger workflows. The pastila code moves to a shared module, pastila.py. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
For pull requests that add or change results (
*/results/**), publish the benchmark page with those results on pastila.nl and link to it from the PR.results-preview.yml(pull_request_target):results_preview.pytakes the results of main, lays the PR's result files over them (added, changed, renamed or removed) and embeds the data intoindex.htmlin place ofdata.generated.js. It posts the page to pastila.nl unencrypted, gzipped, as a.html.gzlink. The link is appended to the last comment if that comment is from the bot (a collect comment or an earlier preview, whose link it replaces); otherwise a new comment is posted.collect-new-results.pyincludes the preview link in its comments and in the descriptions of automated results PRs. Its pushes useGITHUB_TOKEN, which doesn't trigger workflows, so the workflow above never runs for them.collect-new-results.pyinto a shared module,pastila.py, unchanged apart from optional gzip.Security: no code from the PR runs. The PR head is fetched, not checked out, and result files are read from git objects as data. Symlinks are ignored, and
<is escaped in the embedded data so a string in a result can't close the<script>tag.Testing: on the current tree, the data
results_preview.pygenerates equals the output ofgenerate-results.sh(compared as sets; the shellsortorder depends on the locale and the page sorts the data itself). A real paste of main data read back identical and renders in headless Chromium. Dry runs covered the workflow script against #2384 and the collect script's main-branch and fork-PR paths with fake runs. The collect script wasn't run against the real sink database, which needs its secret. The workflow hasn't run on GitHub yet;pull_request_targetuses the workflow from the base branch, so it first runs after this is merged.🤖 Generated with Claude Code