Repository navigation
feat(render): draw report pages in the browser from the site's data - #18
Merged
Merged
Conversation
perfkit render now writes a data-driven site: data/runs.json, the run's data/runs/<id>/report.json, the browser app under app/<version>/app.js (the existing renderer bundled with esbuild) and small shells (index.html and runs/<id>/index.html per run) with the run's title, description and Open Graph tags. The app picks the run from the URL path and draws the same page renderRunPage drew, so publishing never re-renders older runs and a newer perfkit redraws every run.
Merged
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.
What
perfkit rendernow publishes a data-driven site. Pages are drawn in the browser, when someone views them, from JSON on the same site. Each run's HTML is no longer frozen with the perfkit version that drew it.New
--outlayout:app/<version>/app.jswithdefer. The app takes the site root as two levels above its own script (document.currentScript.src). The page path relative to that root picks the run: `` orindex.htmlis the latest run (`runs[0]` of `data/runs.json`), and `runs//` (with or without `index.html`) is that run. The app fetches `data/runs.json` and `data/runs//report.json` (with `cache: no-cache`) and validates both with the same Zod schemas as `perfkit validate`. It then calls the unchanged `renderRunPage`. The returned document replaces the shell's ``, and the picker script is re-inserted so it runs once. If drawing fails, the shell shows the error lines in a `role=alert`.data/runs.jsonand the shells, and adds the app version. It never reads or rewrites older reports. Every shell pins the current app version, so publishing with a newer perfkit redraws every run.--historystill takes any runs.json v1, including the old rootruns.json. If a report is missing fromdata/runs/<id>/, the app falls back toruns/<id>/report.json, so a site in the old layout migrates by rendering once with--history <old runs.json>.npm run buildnow also writesdist/app/app.js. The CLI ships that file; when run fromsrcwith tsx, it bundles on the fly instead.Visual output unchanged
No markup or styles changed. Tests show the app's document equals
renderRunPageoutput, node for node:documentElement.outerHTMLwith the parsedrenderRunPageoutput. This covers every example report form, with and without history, on both the latest and run pages.test/render/app/published.unit.test.tscovers the six reports currently on Routr's gh-pages (test/fixtures/published/, byte for byte, prettier-ignored). They are rendered in sequence into one site, and each is drawn through the bundled app's validation and render path.Notes for publishers
--history <site>/benchmarks/data/runs.json. The oldbenchmarks/runs.jsonis no longer written.docs/github-workflow.mdis updated.keep_files(or an equivalent), so olderdata/andapp/folders stay.🤖 Generated with Claude Code