Skip to content

Artifact presentation, publisher labels, and structured dimensions (spec-driven countries 2/2) - #170

Merged
MaxGhenis merged 12 commits into
mainfrom
spec-artifact-contract
Aug 23, 2026
Merged

Artifact presentation, publisher labels, and structured dimensions (spec-driven countries 2/2)#170
MaxGhenis merged 12 commits into
mainfrom
spec-artifact-contract

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Second of two PRs for #166, on top of #168. The remaining three conformance test.todos are now passing tests, so the zz acceptance suite is fully green: a fourth country renders from artifacts alone, with one registry entry as the only country-specific change.

What changed

  • release_manifest.presentation (typed, narrow): overview_intro and targets_intro only — the two existing text slots. Trimmed, capped, unknown keys dropped; null when nothing valid. Served on the overview and target-diagnostics responses. lib/microcosm/presentation.ts centralizes the fallback order: artifact slot → legacy per-country copy (marked for deletion once producers publish the block) → generic sentence. The overview keeps the code-owned "Data is built live from …" sentence.
  • release_manifest.publisher_labels: keyed by the first Chronicle record-ID segment, validated. Every row now carries source_label (artifact label → structured source.label → the shared humanizer); the treemap, calibration tree, variable summary, and target detail read the row's label instead of calling the code map directly.
  • Structured dimensions: a calibration_diagnostics.dimensions dictionary (label, role: "geography" + level, value labels, explicit order) plus targets[].dimensions values. Facet ordering follows the artifact's declared order when every value is ranked; geography-role dimensions set the row's geography/level. Adapter selection is per artifact and per row — structured when targets[].dimensions is present, else the legacy_filter pattern adapter, else legacy_name grammar — recorded on every row as dimension_adapter and summarized as target_schema on the calibration. Never by country.
  • Structured targets[].source / targets[].variable: objects ({id, citation, label, url} / {id, label, measure}) accepted alongside the legacy strings. Publisher precedence stays Chronicle-record-ID first; source_citation keeps its v2 string behavior; new source_url gives the target detail a "View official source" link (Chronicle-entry fallback unchanged); variable_label and measure flow into grouping and detail views.
  • A dimensioned row is no longer treated as a whole-population estimate scope, and sourceAuthorityLabel uses an own-property check.

Backward compatibility

The live US artifact (schema_version 5, dotted names, filter: null, string source) and the UK/BE filter-coded artifacts shape byte-identically — pinned by a new live-US-shaped regression test plus ~650 lines of reader tests (validation, malformed blocks, rank ordering, adapter selection, publisher-label precedence). bun test: 263 pass / 0 todo / 0 fail; tsc --noEmit clean; next build clean.

Conformance

All four zz todos enabled with their original assertions intact, plus a fifth test for the structured identifiers. docs/spec-driven-countries.md now documents the contract as implemented and the producer follow-up list (microcosm publishes country, presentation, publisher_labels, dimensions, structured source/variable; the legacy adapters retire after that).

Closes the reader side of #166.

🤖 Generated with Claude Code

@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 8:47pm

Request Review

@MaxGhenis
MaxGhenis merged commit 5e694ea into main Aug 23, 2026
4 checks passed
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