Skip to content

refactor: drop the geography spelling folds #945 needed - #980

Merged
jacobvjk merged 3 commits into
epic/v2from
fix/geography-spelling-fold
Oct 7, 2026
Merged

jacobvjk merged 3 commits into
epic/v2from
fix/geography-spelling-fold

Conversation

@jacobvjk

@jacobvjk jacobvjk commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Closes #945. Stacked on #974, which makes timeseries geography labels match the metadata exactly and enforces it in schema:check. Independent of #975, #976 and #979.

With the labels guaranteed equal, three workarounds for "South East Asia" vs "Southeast Asia" go:

  • resolveGeography: the labelVariant arm. A different spelling is now a different geography; if that ever happened it would be a visible, reported fallback.
  • regionMemberCodes: the canonicalGeographyKey fallback (added in Feat/comparison scope #954 as a stopgap).
  • pathwayToolAvailability().hasGeography: the label and spelling-fold attempts. It is now a plain lookup of the metadata token.

Kept on purpose:

  • canonicalGeographyKey itself. comparisonScope uses it to notice when two publishers use one region name with different members. That's a question across publications, not a data mismatch.
  • The comparisonScope.test.ts fixtures with IEA "Southeast Asia" next to ACE "South East Asia" model that same cross-publisher case, so they stay. My comment on Data: IEA pathways spell the same region two ways across metadata and timeseries #945 listed them for removal; that was wrong.

Checked:

  • The tests for the removed behaviour now assert the new contract instead, and the full suite passes.
  • Locally in Chrome, ACE (ASEAN), IEA (Southeast Asia) and JRC (South East Asia) still plot their regional series with no fallback note.

🤖 Generated with Claude Code

Timeseries now carry the metadata's own geography labels, and
validateTimeseries enforces it (#974), so three workarounds for
"South East Asia" vs "Southeast Asia" are no longer needed:

- resolveGeography's labelVariant arm
- regionMemberCodes' fallback to canonicalGeographyKey
- hasGeography's label and spelling-fold attempts; it is now a plain
  lookup of the metadata token

canonicalGeographyKey stays: comparisonScope uses it to spot two
publishers using one region name with different members, which is a
cross-publication question, not a data mismatch.

The tests for the removed behaviour now assert the new contract: a
different spelling is a different geography.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Expected version change and release notes

🚨 WARNING: This PR is not expected to trigger a new version

To trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-980.westus2.2.azurestaticapps.net

…fold

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Expected version change and release notes

🚨 WARNING: This PR is not expected to trigger a new version

To trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-980.westus2.2.azurestaticapps.net

…fold

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Expected version change and release notes

🚨 WARNING: This PR is not expected to trigger a new version

To trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-980.westus2.2.azurestaticapps.net

Base automatically changed from feat/timeseries-v2-schema to epic/v2 October 6, 2026 16:47
@jacobvjk
jacobvjk requested a balanced review from Copilot October 6, 2026 16:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused refactor aligns callers with the enforced timeseries metadata contract and updates relevant tests consistently.

Review effort: Balanced
Findings: None

What changed in this PR

Removes obsolete geography spelling-fold workarounds now that timeseries labels must match pathway metadata exactly.

Changes:

  • Uses exact normalized tokens for timeseries availability and geography resolution.
  • Removes cross-spelling region-member matching.
  • Updates tests and documentation for the stricter contract.
File Description
src/​utils/​timeseriesAvailability.ts Simplifies geography availability lookup.
src/​utils/​timeseriesAvailability.test.ts Tests exact token matching.
src/​utils/​geographyUtils.ts Removes region spelling fallback.
src/​utils/​geographyUtils.test.tsx Updates region matching expectations.
src/​utils/​geographyFallback.ts Removes label-variant resolution.
src/​utils/​geographyFallback.test.ts Tests exact matching and reported fallback.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jacobvjk
jacobvjk requested a review from AlexAxthelm October 6, 2026 16:58
@jacobvjk
jacobvjk merged commit 183cbb2 into epic/v2 Oct 7, 2026
11 checks passed
@jacobvjk
jacobvjk deleted the fix/geography-spelling-fold branch October 7, 2026 09:08
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.

3 participants