Repository navigation
Keep same-named UK constituencies and local authorities apart in the calibration views - #237
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
anth-volk
force-pushed
the
uk-calibration-views
branch
from
October 19, 2026 21:09
ffd5b9e to
6e65097
Compare
This was referenced Oct 19, 2026
anth-volk
force-pushed
the
uk-calibration-views
branch
from
October 20, 2026 12:44
6e65097 to
6931416
Compare
anth-volk
force-pushed
the
uk-calibration-views
branch
from
October 20, 2026 13:15
0820b3f to
fdb77ff
Compare
anth-volk
force-pushed
the
uk-calibration-views
branch
from
October 20, 2026 14:13
fdb77ff to
a3b3d70
Compare
The dashboard groups, filters and lists calibration targets by the geography's label. Microcosm's UK local-area builds calibrate parliamentary constituencies and local authorities side by side, and 115 labels belong to one of each. In the published tree of the 19 Sep local candidate, the explorer's geography map therefore shows one "Ashfield" tile holding 18 constituency and 26 local-authority targets, and its Geography filter, the targets page and the comparison maps select both areas at once. The hierarchy validator already keys a geography by its level and code; only the label merged them. A label that more than one level uses now carries its level, for example "Ashfield (constituency)" and "Ashfield (local authority)". Labels used at one level stay as published, and so does the country's own national label, because a target with no resolvable geography falls back to it at the national level and still means the whole country. Of the 45 trees published today, only the three UK local candidates have such labels, so US, Belgian and UK national outputs are unchanged; the golden record still reproduces byte for byte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Staging reconciliation threw at the first finalized run it could not publish or repair, such as a repair whose rebuilt index differs from the digest the manifest records. Every run after it then stayed unpublished on every later invocation. The September UK local-area trees are staging builds, and the level-qualified geography labels change what the builder writes for them, so repairing one would stop UK staging publication. Each run's error is now recorded as that run's "failed" outcome, with the error as its reason, and the remaining runs are still reconciled. After printing the report, the publisher exits with an error naming every failed run, so the workflow still fails. Errors before the per-run loop (an unavailable repository, incompatible runs) still stop reconciliation. reconcileStagingBuilds now takes the manifest store that release reconciliation already takes, and runPublisher accepts that store, so both can be tested without Vercel Blob. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The calibration map hierarchy document still said the dashboard does not construct labels for schema 8. buildCalibration now qualifies a geography label that more than one level uses in a build, so the document describes that rule and its exceptions, and the tree artifact document notes that published trees keep the labels they were built with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
uk-calibration-views
branch
from
October 20, 2026 14:54
a3b3d70 to
780d6d4
Compare
This was referenced Oct 20, 2026
anth-volk
added a commit
that referenced
this pull request
Oct 21, 2026
Release reconciliation throws at the first release it cannot publish or repair, so it prints no report, never reaches the releases after it, and never updates the latest-release selection. These tests describe the behaviour staging reconciliation has had since #237: - a release the schema 8 reader refuses is reported as `failed` with the error, and the releases after it are still published; - a release whose uploaded build fails its audit gets no manifest entry; the audit now comes before the manifest write; - when the release the line pointer names fails, the latest-release selection is left as it was and the report says why; - the publisher prints the whole report, then exits with an error that names every failed release; - a dry run records the failure and writes nothing; - the recorded-digest repair test now expects a `failed` outcome instead of a rejected call. The in-memory store in publish-calibration-tree.test.ts now records the order of uploads, listings, audits and manifest writes. Tests only. All six fail on the current publisher, which throws at the failing release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
added a commit
that referenced
this pull request
Oct 21, 2026
Release reconciliation threw at the first release it could not publish or repair. It printed no report, left every release after it unreconciled and never updated the latest-release selection, on every later invocation. Since 2026-10-02 one US release has blocked every later US release this way. Each release's error is now recorded as that release's `failed` outcome, with the error as its reason, and the remaining releases are still reconciled, as staging reconciliation has done since #237. After printing the report, the publisher exits with an error naming every failed release, so the workflow still fails. Errors before the per-release loop (reading the manifest, listing releases or tags) still stop reconciliation. A failed release leaves no manifest entry and is never selected as the latest release: - The uploaded build is now listed and audited before its manifest entry is written, not after, so an incomplete upload is never registered. The audit reads the build's own index and the Blob listing, not the manifest. Successful publications upload and write the same bytes as before. - The latest-release selection skips a release that failed in the same run, keeping the build it named before. When the selection cannot be read or updated, the report's new `latestReleaseFailure` field says why, and the publisher exits with an error after printing the report (it used to throw without a report). The failure message reads "N of M releases failed to reconcile" for releases; the staging message is unchanged. The docs describe the new behaviour and the order of a release's writes. Co-Authored-By: Claude Opus 5.5 <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.
Fixes #236
Summary
Stacked on #220, which is stacked on #223, in GitHub stack #230; #239 sits on top. Base:
calibration-tree-package. After #220's review fix (ca4edf5),gh stack rebase --no-trunkreplayed this branch onto #220 without conflicts; the first commit is now6931416. Two review fixes follow it (commits 2 and 3 below).This PR checks the UK calibration views that #223 doesn't change, using the shapes UK data has today:
microcosm-uk-2024-25-national;<dataset>.diagnostics.json;One view was still wrong, and this PR fixes it. A UK constituency and a local authority with the same name were merged into one geography.
The fix
The dashboard groups, filters and lists targets by the geography's label. UK local-area builds calibrate constituencies and local authorities side by side, and 115 labels belong to one of each. As a result:
/microcosm/targetsand the Staging comparison maps selected both areas at once.buildCalibrationnow gives any label that more than one level uses its level as well, for example "Ashfield (constituency)" and "Ashfield (local authority)" (new modulegeography-labels, exported as@policyengine/calibration-tree/geography-labels). Two kinds of label are left as published:Every view reads its rows from
buildCalibration: the explorer and its published trees, the targets page, the live Staging trees and comparisons, and the treemap route. So they all change together. Target matching between builds uses target names and identities, not geography labels, so comparisons are unaffected.What changes in published output: I checked the filter index of all 45 trees published today (28 US, 2 Belgian, 15 UK). Only the three UK local candidates from September have labels at more than one level, 115 labels each. Every US, Belgian and UK national tree has none, so the new function returns its input unchanged for them. The golden record still reproduces byte for byte.
Before merging: trees already published keep merged labels
A tree's build ID comes from its inputs, not from the builder's code, and published trees are never rebuilt. So:
reconcileStagingBuildsthrew at that run, so every UK staging run after it would have stayed unpublished on every later run of the publisher.failedoutcome, the remaining runs are still reconciled, and the publisher then exits with an error naming the failed run.CALIBRATION_TREE_BUILD_ENABLED=FALSEwas set on 2026-10-19 at 20:58 UTC, and it pauses every country. The plan keeps it paused until Keep same-named UK constituencies and local authorities apart in the calibration views #237 and Compare UK local-area Staging candidates with the local-area release #239 are deployed.Commits
6931416; earlierffd5b9e, then6e65097)Red: 3 of 4 new tests in
shared-geography-labels.test.tsfailed, each with both areas under "Ashfield":The fourth test, which checks that UK national labels are unchanged, passed, as intended.
Green: 4 of 4 passed. Rerun after the commit across 5 files, 113 passed and 0 failed: the new tests, the package boundary test (now including the new export),
latest-artifact.test.ts(84), and both golden suites (16, unchanged record).bun run lint(dashboard and package typecheck): clean.19699ac, from review)failedoutcome, with the error asreason, and the loop continues;runPublisherthrows "N of M staging sources failed to reconcile: .", so the command exits with status 1;reconcileStagingBuildsis exported and takes theCalibrationManifestStorethat release reconciliation already takes, andrunPublisheraccepts that store, so both can be tested without Vercel Blob. The Blob store is the default, and it makes the same calls as before.docs/calibration-tree-artifacts.mdlists thefailedoutcome and when it occurs.publish-calibration-tree-golden.test.tsfailed. For this run, the store parameter had already been added (no behavior change), so the file loaded.runPublisherignored the store and stopped at "Vercel Blob: Invalid token". No request was sent.bun run lintclean.ukStagingRepositoryFiles). The newer run has a manifest entry with a missing index and a stale digest. The golden record is unchanged.0820b3f, from review; documentation only, so no red step)docs/calibration-map-hierarchy.mdno longer says the dashboard doesn't construct labels for schema 8. A new section, "Geography labels shared by several levels", gives the rule:country.geography_label, or else the registration'sgeography);docs/calibration-tree-artifacts.md("Filtering indices") says geography postings use those labels, and that a tree published before the rule keeps one merged label, so a repair of it is refused.What I checked in the other UK views
Data used
main, without Publish Microcosm UK release cuts, open the UK page on the national line, and show local candidates on Staging #223, so it reads only the national release folder, not the tagged builds. I read its UK release list, target diagnostics, tree manifest, tree indexes and filter indexes, and one staging comparison.policyengine/populace-uk-private). The local login gets 404 there, so the tagged builds and the local-area diagnostics themselves were checked only through the shapes above and the tests.Findings
/microcosmcalibration fit map. The page renders the explorer (calibration-explorer-map) over published calibration trees.calibration-map.tsxand/api/microcosm/target-treemaparen't rendered or called by any page. A tagged build resolves through its tree manifest entry, which Publish Microcosm UK release cuts, open the UK page on the national line, and show local candidates on Staging #223 adds, so this map works for UK tagged builds once the publisher has run.countryandregion, 15 labels, all distinct.constituency,country,local_authorityandregion: 1,006 labels, of which 115 were merged (fixed here)./microcosm/targets. Production's UK national response lists levelscountryandregionand the 15 geographies. Its level and geography lists come from the data.<dataset>.diagnostics.jsonthrough Publish Microcosm UK release cuts, open the UK page on the national line, and show local candidates on Staging #223's staged-bundle reader; the receipt ofuk-local-candidate-f100-s42-20261019T000432Z-ee5c2dberecordsmicrocosm_uk_2024_25_local.diagnostics.json.Tests run
bun run lint.0820b3f): every test file this branch adds or changes, plus both golden suites, the boundary test and the harness test. That is 132 passed and 0 failed across 7 files:shared-geography-labels,latest-artifact,package-boundary,calibration-tree-golden,publish-calibration-tree-golden,publish-calibration-treeandtest-support/calibration-tree-golden-cases.bun run lintwas clean.next build, because the machine is shared. CI runs them.Environment variables
This PR changes no workflow, deploy script or configuration, and the code reads no new variables. Commit 2 changes how the publisher run by
publish-calibration-tree.ymlends: the command exits with an error after a failed staging run, instead of stopping at it. So here is the publish job's wiring, which is unchanged:CALIBRATION_TREE_BUILD_ENABLEDif:FALSEsince 2026-10-19 at 20:58 UTC, so the job is skippedgh variable listBLOB_READ_WRITE_TOKENrunPublisherenv:and inherited bybun run publish:calibration-treegh secret listHF_TOKENenv:POPULACE_UK_STAGING_HF_TOKENtoken_env)env:HUGGINGFACE_TOKEN,CALIBRATION_TREE_MAX_RAW_BYTES,CALIBRATION_TREE_MAX_GZIP_BYTES, repository overridesUnverified: the secret values. Only their names are visible, and this PR doesn't change them.
🤖 Generated with Claude Code