Repository navigation
Extract the code lists into a @zod/codes package with a weekly refresh - #6602
Open
colinhacks wants to merge 6 commits into
Open
colinhacks wants to merge 6 commits into
colinhacks wants to merge 6 commits into
Conversation
Contributor
|
Run failed. View the logs →
|
colinhacks
force-pushed
the
iso-datasets
branch
from
October 9, 2026 19:52
16d6a3e to
7d17b55
Compare
colinhacks
force-pushed
the
iso-datasets
branch
from
October 9, 2026 19:54
7d17b55 to
0407b52
Compare
…ekly by CI Three zero-dependency data packages, currency-codes, country-codes and language-codes, generated from SIX Group, the IANA language subtag registry and CLDR by a private packages/datasets generator that cross-checks every list against Debian iso-codes. A weekly workflow regenerates them, bumps versions and opens one PR with the per-list diff; a second workflow publishes any version missing from npm. The single-list script and job from the currencyCode change are replaced, and zod's regex is regenerated from the currency package.
One package with an entry point per list (/currencies, /countries, /languages) and a root that re-exports them as namespaces, replacing @zod/currency-codes, @zod/country-codes and @zod/language-codes. The generator bumps one manifest and treats a new publication date alone as no change, so a source republished with the same data opens no PR. Both workflows follow the package. The live sources moved since the last generation: SIX marks UYW and XAD as funds, and the registry now names NR "Naoero".
Dispatch only, through the npm environment and the shared npm-stage-publish.sh, so CI can only fill the staged queue and a maintainer approves the version with 2FA, the same shape release.yml took after the 2026-09-21 compromise. A push to main no longer triggers it.
- the Debian cross-check reports a disagreement in the PR body instead of failing the run; Debian lagged the ISO 4217 amendments by three years once, and a hard gate would have blocked every refresh in that window - a currency, numeric or CLDR code that is not the expected shape fails the parse, so a poisoned list cannot reach the regex literal - a missing CLDR mapping for a newly assigned country is reported and left out instead of failing the run - the version rule is major for a removed code, minor for an added one, patch otherwise, and the package starts at 1.0.0 so a minor flows through a caret range - the decisions of a run live in rules.ts, free of I/O, with tests; a test proves the zod regex carries the package's codes - biome formats from stdin, so a failed format leaves no dirty module behind - the refresh job keeps the token out of .git/config, times out after 20 minutes, and replaces an open generated PR unless it is one commit over the tracked paths - the publish workflow header spells out the first staged publish by hand, since npm binds a trusted publisher to an existing package
colinhacks
force-pushed
the
iso-datasets
branch
from
October 10, 2026 00:22
0407b52 to
9d89ff8
Compare
- a code may leave a list only with a retirement record in the source (list three for a currency, a deprecated subtag for a country or a language), so a source glitch cannot become a removal; a code set that moved is a minor, since a withdrawn code leaving the union is the point of the refresh - every write is planned and checked before the first one, so a failed run leaves the tree as it found it - the Debian fetches are advisory: an outage is a warning, and warnings also reach the run page as annotations - an IsFund value other than true or WAHR fails the parse instead of silently un-funding a code - the refresh job generates with no write token in reach and hands a patch to a second job that runs no installed code; that job resolves the open generated PR by number, same-repo only, fetches its head by id, and closes it when main already carries the data - the publish workflow builds and tests with no OIDC token in reach and stages the built package from a second job that installs nothing; its header names the environment in the npm trust command and the build before the first staged publish - the tracked paths are a bash array, so actionlint is clean like release.yml
The stage job takes only the build outputs from the artifact, keeps it for the 30 days an environment can hold a job, checks the entry points landed, stages with --ignore-scripts and skips the summary once the registry serves the version. The refresh workflow takes its patch after the build and the tests, holds the workflow token on the steps that call gh, and replaces a stale generated PR instead of force-pushing over it.
colinhacks
force-pushed
the
iso-datasets
branch
from
October 12, 2026 14:29
0fc87d6 to
c7705c5
Compare
This branch had an error being 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.

Extracts the code lists behind zod's format validators into one workspace package and moves the refresh job with them. The single-list script and workflow that landed with
z.currencyCode()in cc4cd4e are replaced by a generator feeding the package, and the regex is regenerated from it instead of from SIX directly.@zod/codeshas one entry point per list. Each exportscodesas a readonly tuple, so the literal union falls out of the type, plus a records array with the source's fields; the root re-exports the three as namespaces.@zod/codes/currencies: the active ISO 4217 codes from SIX Group's list one, with numeric code, name, minor units and fund flag, plus the withdrawn codes from list three.@zod/codes/countries: the assigned ISO 3166-1 alpha-2 codes from the IANA language subtag registry, with alpha-3 and numeric codes from CLDR, and the ten exceptionally reserved codes exported separately.@zod/codes/languages: the ISO 639-1 codes from the same registry, deprecated subtags excluded.Zero dependencies, ESM plus CJS through zshy, starting at 1.0.0 so a minor flows through a caret range. One package rather than three: the country and language lists are near-static and the existing packages for them are correct, so they ride along as the data zod's own validators are generated from, while the currency list is the one that needs a maintained source, since every published ISO 4217 package is stale today.
The generator is a private
packages/datasetspackage. Every run cross-checks each list against Debian's iso-codes, read and never copied since those files are LGPL, and reports any disagreement in the PR body rather than failing, because Debian lagged the ISO 4217 amendments by three years once. The weekly workflow generates in a job with no write token in reach, hands the patch to a second job that runs no installed code, and that job bumps a minor when a code set changes and a patch otherwise, refuses a removal that the source itself does not record as a withdrawal or a deprecation, runs the tests that read the data, and opens or updates one PR with the per-list diff; it leaves that PR alone only while it is one bot commit over the generated paths, and otherwise closes it and opens a fresh one. A source republished with the same data changes nothing, so a new publication date alone opens no PR. A second workflow, dispatched by a maintainer like the zod release, builds and tests in one job and stages the built package from another, which holds the OIDC token and installs only the npm CLI, through the samenpmenvironment and the shared stage script; the maintainer then approves it with 2FA, so CI can fill the staged queue and nothing else.The first version needs a maintainer: npm binds a trusted publisher to an existing package, so the package is created by a staged publish from a logged-in session, approved with 2FA, and only then gets its stage-only trusted publisher for this workflow and the
npmenvironment. The workflow header spells out the order. Validators for country and language codes are not in this PR; they can be generated from the package the same way the currency one is.Refs #6601.