Repository navigation
Release history page: one panel's timeline, by reference engine - #324
Draft
juaristi22 wants to merge 7 commits into
Draft
juaristi22 wants to merge 7 commits into
juaristi22 wants to merge 7 commits into
Conversation
…ard and marks The page (PR 2 of #224) opens a card on a step with the facts of its two builds, and marks a change of build engine on the time axis. Those facts are in the points, and `timeline.json` copied none of them, so the page would have read every point on each request. - `buildTimeline` adds a `declared` block to each build: the build its point was fetched through, its built-at time, the model and core it was built with, the range of models it declares, its Microcosm repository and commit, its target set's digest and size, the target registry version and the household weight year. It is null where the panel holds no point. Two builds that publish one file carry the same facts. - The key is optional in `timeline.schema.json`, as the schema's rule for a key added later says: a timeline written before this commit stays valid, and the next finalize rewrites it. No id and no stored point changes. - The Python `TimelineBuild` type, the generated TypeScript types and both countries' timeline fixtures follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… panel's timeline, and its CSV The page (PR 2 of #224) reads the store PR 1 writes. Three routes read it on the server, through the store module, so the browser never gets a Blob URL or token. - `GET /api/microcosm/release-history?country=`: the country's panels, one per reference engine that holds a measured file, with engine, coverage and whether the definition equals the default panel's, and the panel the page opens. That is the served panel: after an engine bump the pinned panel fills first and the page moves to it once it is complete. A country with no measured file answers `available: false`. The per-file entries stay in the manifest. - `GET /api/microcosm/release-history/timeline?country=&panel=`: one panel's summary, its whole `timeline.json`, and what its `panel.json` says about presenting its outputs (currency, period labels, the baseline items and reforms in spec order, the disclosure policy). Without `panel` it serves the default one. Only a panel the country's manifest entry lists is read, and a stored timeline of another panel or format is a 502. - `GET /api/microcosm/release-history/export?country=&panel=`: the same timeline as a CSV download with the columns of the producer's `export` command; a test reads the column list from the Python file. A withheld value is an empty cell. - A timeline grows with every build and a function's response is capped, so the timeline and the CSV are sent gzipped to a client that accepts it. - Every route requires a country and answers an unknown code with the shared not-configured response before reading; all three join the every-route test. - `RELEASE_HISTORY_LOCAL_DIR` names a local folder in the store's layout (a pulled panel, or a synthetic one) for the routes to read instead of Blob. It is read-only, never leaves the folder, and is unset on a hosted deployment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and test it on No production data exists while the page is built, so the logic is tested on a synthetic store: each country's committed fixtures and a seeded generator, put through the real finalize and timeline code. Everything here is pure. - Outputs: each one gets a label, a group and a place in the order from its id and the panel's spec (receipts, spending, caseloads, population, incomes, poverty rates, then one group per reform), in neutral words. An entry holds one output's own values across builds, with every number removed from a cell or a step that is not `ok`, so nothing further down can show or derive a withheld value. Nothing adds or compares two outputs. - Chart layout: one column per build in publish order; Relative places each value as a percentage of the output's official figure and Absolute places the values; an output with no official figure is drawn in values under both. A build with no value keeps its column, shaded and labelled with why (withheld, not measured, gap, retrying, failed, withdrawn), so the axis is the same on every engine. A line joins two builds only where the timeline has a step. A withdrawn build's value is a hollow marker no line joins. - What moved: outputs ranked by their step beside their own typical step, the median of their earlier steps. A republished file is left out of that median, an output with fewer than three earlier steps is ranked after by the size of its step, and a step beside a withheld cell is counted and never ranked. A step is "nearer to" or "further from" the official figure. - Builds: the marks on the time axis (a new build engine, a republished file, a withdrawn build), the builds an engine has no run for by why, and the facts of a step's two builds with links to their Microcosm commits. - The page's state in its URL: the engine's panel, the output, the scale, the open step. Defaults are never written. - `scripts/release-history-dev-store.ts --out <folder>` writes the synthetic store for `RELEASE_HISTORY_LOCAL_DIR`: the UK part-way through an engine bump, the US with a second engine's panel under another definition. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`/microcosm/release-history?country=<code>` draws what #304 stores: every national data file a country publishes, measured on one fixed engine. It is reachable by URL; a navigation entry needs a capability in the calibration tree package, which is a change in microcosm-collector. - The page opens the served panel. After an engine bump a notice says how many files the newer engine holds and links to it. The engine toggle lists every panel that holds a measured file, and the page names the builds the chosen engine has no value for, by why: never run, retrying, out of attempts, or a file the producer refused. - In order: the notices, the series facts, what moved at the latest build, the builds of the series, and the outputs, with the selected output's stats, chart, official reference, step card and table. The table sits behind a toggle, closed by default. - The chart is SVG drawn from the tested layout, with a Relative (%) / Absolute switch, Relative by default. Each column is a button: hover or focus reads out its value, and a click opens its step. A withdrawn build is listed and marked, and its column stays, shaded. - The step card sets what a step's two builds declare side by side, with links to their Microcosm commits and to each build's Calibration fit page. - The state is in the URL (the engine's panel, the output, the scale, the open step), and a value the loaded panel cannot use leaves the URL. - After a neutrality review of the page's text: an output "moved" and is "nearer to" or "further from" its official figure; the page labels every output and never prints an output's id, because four ids per reform spell "gaining" and "losing"; a build's state reads "Out of attempts" and "File refused", which say what happened to the run and are no verdict on the build. - Also in the logic: axis labels keep the decimals that tell two ticks apart, the latest value's label stays clear of the line and of a shaded column, and a step away from a value of zero ranks first with no percentage. - The rendered page is tested on the synthetic store, including that a number a timeline wrongly carried beside a withheld status reaches no markup. - `docs/release-history.md` gains a section on the page. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…y-page-224-b50b5f
…als, passing none The page's routes passed `BLOB_READ_WRITE_TOKEN` to the Blob client when the environment held one. The dashboard's other Blob reads pass no credential (frontend/HOSTED_RUNTIME.md), so `@vercel/blob` uses the deployment's Vercel OIDC token with `BLOB_STORE_ID` when both are present and the token otherwise. An explicit token skipped that choice. - `releaseHistoryReadStore` now opens the Blob store with no token, whatever the environment holds, and gives the routes a store they cannot write through. The page needs no setting of its own for Blob. - A named local folder (`RELEASE_HISTORY_LOCAL_DIR`) is still read in place of Blob, which is then never opened. - `docs/release-history.md` and `frontend/HOSTED_RUNTIME.md` say so. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The entry goes with the `calibration` capability, which every country the dashboard serves holds: the country registry has no capability for the release history itself, and adding one is a change to @policyengine/calibration-tree in PolicyEngine/microcosm-collector. A country with nothing measured gets the page's empty state. No country code is branched on. The sidebar tests, the third-country conformance test and the docs follow. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch was successfully deployed
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.
Summary
The second PR for #224: the page that reads what #304 stores. For one country, it draws every national data
file the country publishes, measured on one fixed engine, so a move between two releases comes from the data
and not the model. It is stacked on #304 and reads its
timeline.json.The page is at
/microcosm/release-history?country=<code>. The sidebar lists it under Releases as "Releasehistory", for every country the dashboard serves (see Follow-ups).
How it works:
GET /api/microcosm/release-historygives a country's panels fromthe manifest, one per reference engine, and the panel the page opens.
.../timeline?panel=gives one panel'swhole
timeline.json, with what itspanel.jsonsays about presenting its outputs..../export?panel=gives the same timeline as a CSV, with the columns of the producer's
exportcommand. The browser nevergets a Blob URL or a token, and only a panel the country's manifest entry lists is read. The routes read
Blob as the dashboard's other Blob reads do, with no credential passed (
frontend/HOSTED_RUNTIME.md), sothe page needs no new setting, and they never write.
first: a notice says how many files it holds and links to it, and the page moves to it once it is complete.
ref filled. Choosing one switches the whole page to that engine's timeline. The page names the builds the
chosen engine has no value for, by why: never run, retrying, out of attempts, or a file the producer refused.
default, places each release as a percentage above or below the output's official figure. An output with no
official figure shows values under both, with a note. A line joins two builds only where the timeline has a
step.
withdrawn build is listed and marked; a value measured before the withdrawal is a hollow marker that no line
joins.
median of their earlier steps on the panel, so no outside threshold is needed. A step is "nearer to" or
"further from" the official figure.
the model and core each file was built with, the number of targets and whether the target set changed, the
registry version, and the columns the reference model does not define. It links to the two commits on GitHub
and to each build's Calibration fit page.
view. A default is never written, and a value the page cannot use falls back to its default.
number from a cell or a step that is not
okbefore anything is drawn, ranked or exported, and it computesnothing across outputs: no sum of deciles and no total less its parts.
has a label, and the page never prints an output's id: four ids per reform spell "gaining" and "losing".
dashboard's country registration and from whether the manifest holds a measured file.
One change to #304's timeline
buildTimelinenow copies what each build declares intotimeline.json, in an optionaldeclaredblock perbuild: the build its point was fetched through, its built-at time, the model and core it was built with, the
range of models it declares, its Microcosm repository and commit, its target set's digest and size, the target
registry version and the household weight year. The step card and the build-engine mark read it. Without it
the page would read every point on each request.
It is the first commit and stands alone, so it can move into #304. The key is optional in
timeline.schema.json: a timeline written before it stays valid, and the next finalize rewrites it. No id andno stored point changes.
What's here
frontend/app/api/microcosm/release-history/: the three routes. A timeline grows with every build and afunction's response is capped, so the timeline and the CSV are sent gzipped to a client that accepts it.
frontend/app/microcosm/release-history/page.tsxandfrontend/components/microcosm/release-history-*.tsx:the page, its sections, the chart (SVG, drawn from a layout the tests check) and the step card.
frontend/lib/microcosm/release-history-{summary,read,http,source,export}.ts: what the routes share.frontend/lib/microcosm/release-history-{outputs,format,chart,moved,builds,url,page}.ts: the page's logic,all pure.
frontend/lib/api/hooks/use-release-history.ts: the page's two reads.frontend/components/layout/nav-items.ts: the sidebar entry, which goes with thecalibrationcapability.frontend/lib/microcosm/test-support/: a store built from the producer's fixtures, and a synthetic storewith the cases the page must show.
frontend/scripts/release-history-dev-store.ts: writes the synthetic store to a folder.RELEASE_HISTORY_LOCAL_DIR: names a local folder in the store's layout for the routes to read in place ofBlob. It is read-only and unset on a hosted deployment.
docs/release-history.md: a section on the page.Testing
No production data exists yet, so the page was built and tested on synthetic data: each country's committed
fixtures and a seeded generator, put through the real finalize and timeline code. The synthetic UK is part-way
through an engine bump; the synthetic US has a second engine's panel under another definition.
cd frontend && bun test: 723 passed.bun run lintis clean, andbun run buildpasses.cd release_history && uv run pytest -q: 131 passed, withruffandpyrightclean, after the timelinechange.
store (no country, an unknown country, no history, a panel the manifest does not list, a timeline of another
panel, the cache headers, gzip); labels, groups and order for both countries' specs; the chart's layout; the
what-moved ranking; the marks and the step card's facts; the URL state; and the CSV, whose columns are
compared with the Python command's.
withheld status yields none in the page's entries, the chart, the rendered markup or the CSV.
withheld in some builds, the step card, the US, a country with no history, an unknown country code, and a
phone width.
own credentials.
To look at it locally:
cd frontend bun run scripts/release-history-dev-store.ts --out ../.tmp/release-history-store RELEASE_HISTORY_LOCAL_DIR=../.tmp/release-history-store bun run devthen open
/calibration/dashboard/microcosm/release-history?country=uk.Follow-ups
the entry goes with
calibrationand shows for every country; one with nothing measured gets the page'sempty state. A
release_historycapability belongs in@policyengine/calibration-tree'scountries.ts,which lives in PolicyEngine/microcosm-collector: a change there, a new npm version, then a PR here that
raises the pinned version and moves the entry to it.
citation with no value, so the Relative view has an official figure for those 13 outputs only. Values for the
UK reforms need HMRC's ready reckoner in Chronicle.
labels.jsonholds reform labelsonly.
🤖 Generated with Claude Code