Skip to content

Country registry + typed release_manifest.country (spec-driven countries 1/2) - #168

Merged
MaxGhenis merged 5 commits into
mainfrom
spec-countries-registry
Aug 23, 2026
Merged

Country registry + typed release_manifest.country (spec-driven countries 1/2)#168
MaxGhenis merged 5 commits into
mainfrom
spec-countries-registry

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

First of two PRs for #166 (heads-up + contract on the issue thread). One country registry replaces the closed client tables, and release_manifest.country becomes a typed artifact block. Conformance todo 1 of 4 is now a passing test.

What changed

  • frontend/lib/microcosm/countries.ts (new): the one registration point. An entry carries the HF repo/revision (+ the deployment override variable names), display and dataset labels, national geography label/id, repository visibility, capabilities, and optional fixture: true. Isomorphic — no env reads, no server imports.
  • latest-artifact.ts resolves registrations into the existing COUNTRY_REPO shape server-side (env overrides unchanged: POPULACE_HF_REPO etc. still work) and re-exports parseCountry/isCountry/MicrocosmCountry, so no import churn.
  • Typed release_manifest.country (releaseCountry): registry defaults, overridden by well-typed string fields; a block whose code names another country is ignored whole (an artifact cannot re-route the dashboard); capabilities is filtered to the enumerated set and intersected with the registration — an artifact can narrow, never widen. Served as country on the overview summary and target-diagnostics responses; the resolved geography_label is the national geography for rows that carry none.
  • Capabilities gate pages, not country codes: nav items declare a capability (staging, model_coverage, pipeline, variables, external_checks, cross_dataset, …); the staging routes, hooks, release-picker candidates, and staging page gate on hasCapability(country, "staging"). navGroupsForCountry accepts an artifact-narrowed capability list.
  • The sidebar selector, dataset label, and repo line come from selectableCountries() (fixtures excluded) and visibility; the HF-webhook allowlist derives from the registered repos (unchanged names, BE now included; a BE tag still alerts nothing — no webhook configured); public/private source links read visibility (artifact override wins); cross-dataset env-var suffixing keys on DEFAULT_COUNTRY and the UK's GB alias moves onto its registration.
  • The "Healthcare programs" focus card was country === "us"; it now renders when the release actually has healthcare targets, via a new additive scope_counts: { healthcare } field on the target-diagnostics response.
  • Overview/targets per-country copy tables become Partial legacy fallbacks with generic sentences — the artifact presentation block that replaces them is the follow-up PR (todos Upgrade frontend to canonical Next 16 stack #2Dataset-mode loader: load runs from canonical us-data repo (no calibration_package.pkl) #4).

Conformance

Todo #1 ("zz can enter the shared client views") is enabled with its original assertion, plus: the summary's typed country block from the registration alone, a manifest override flowing through to rows and responses, zz excluded from selectors, and zz nav gated by its registered capabilities. No zz conditional exists outside the registry entry; the repo-wide grep for country === "us"-style gates comes back empty.

Validation

  • bun test: 240 pass / 3 todo / 0 fail (was 219 / 4)
  • bun run lint (tsc --noEmit) clean; bun run build exit 0
  • uv run pytest -q: 403 passed (untouched)
  • Live-shape regressions: US dotted names / UK-BE filter-coded rows shape identically (new latest-artifact tests cover the merge rules, malformed blocks, and geography fallback)

Part of #166.

🤖 Generated with Claude Code

MaxGhenis and others added 4 commits August 23, 2026 20:41
One isomorphic registration point per country (repository, revision,
deployment variable names, labels, national geography, visibility,
capabilities, jurisdiction aliases) with a fixture flag for the
conformance-only zz country. Selectors, parsers, and capability gates
read the registry so adding a country is one entry (issue #166).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
latest-artifact.ts derives COUNTRY_REPO (with the existing POPULACE_*
deployment overrides) from the registry and re-exports MicrocosmCountry,
parseCountry, and isCountry. releaseCountry merges a typed
release_manifest.country block over the registration: string fields
override, a mismatched code ignores the block, capabilities intersect.
The resolved block is stored as Calibration.country_info, served as
country on the summary and target-diagnostics responses, and supplies
the national geography for rows without one. Staging loaders and
routes gate on the staging capability; the webhook allowlist is the
non-fixture registry; cross-dataset env naming and jurisdiction aliases
read the registry. The target page also reports scope_counts so the
healthcare focus can be offered from data rather than a country code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Country is the registry's MicrocosmCountry; the sidebar lists selectable
countries with the registered dataset label and shows the repository
slug only for public registrations. Navigation items carry a capability
instead of usOnly and filter on the country's (or an artifact-narrowed)
capability list. Staging hooks, the staging page, and the targets
release picker gate on the staging capability; the healthcare focus card
appears when the release reports healthcare targets. Source attribution
links public repositories, honouring the artifact's repository
visibility when the summary carries one. Legacy overview and browse copy
tables become partial with a generic fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The zz conformance country now enters the shared client views through
the registry (valid, never selectable, navigation gated by capability),
and the registration test asserts the summary's typed country block and
a release_manifest.country override flowing through buildCalibration to
the summary and row geography. The spec records the implemented block,
its merge rule, the capability list, and the fixture flag.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
calibration-diagnostics Ready Ready Preview Aug 23, 2026 7:32pm

Request Review

…llowlist, placeholder-safe healthcare card

An explicit code: null in release_manifest.country is a malformed field, not
an absent one — the whole block is now ignored. The HF-webhook allowlist uses
the env-resolved repositories the dashboard actually reads. The healthcare
focus card no longer trusts kept-previous placeholder data across a country
or release switch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant