Repository navigation
refactor(release): one source of truth for the platform table; delete the platforms-mirror check - #1105
Merged
Conversation
The published-target table lived twice -- as a TypeScript literal in packages/ts/src/platforms.ts and as a hand-maintained Python subset in internals/distcheck -- and `dirsql-checks platforms-mirror` existed only to prove the copies agreed. The rows now live in packages/ts/src/platforms.json. platforms.ts imports it and casts the two node vocabularies (`NodeJS.Platform` / `NodeJS.Architecture`) at that one boundary; the distcheck flow reads the same file. The JSON sits under src/ so tsc emits it into dist/, which is what `loadNativeCore()` needs at runtime in the published package. With one copy there is nothing left to mirror, so the check, its colocated unit tests, its integration and e2e suites, its registration in the `dirsql-checks` group and its dedicated workflow are deleted. No test assertion changed. Source lines: -338 across the scan roots.
The TypeScript view of the table is now a cast over platforms.json, so no type stops a hand-edited row carrying a platform/arch node never reports; the Python view derives `slug` from `libName` rather than carrying it. Two new assertions pin both, one per side. No existing assertion changed.
thekevinbot
enabled auto-merge
September 5, 2026 12:02
thekevinbot
disabled auto-merge
September 5, 2026 12:10
…table-single-source # Conflicts: # internals/checks/src/checks/cli.py
thekevinbot
enabled auto-merge
September 5, 2026 12:49
thekevinbot
disabled auto-merge
September 5, 2026 12:53
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 #1074. Part of #1072.
The published-target table existed twice — a TypeScript literal in
packages/ts/src/platforms.tsand a hand-maintained Python subset ininternals/distcheck/.../node_flow/platforms.py— and a third component,internals/checks/src/checks/platforms_mirror/, existed only to parse both andprove they agreed. This collapses the duplicate and deletes the check.
The direction, and why
Canonical artifact:
packages/ts/src/platforms.json. The rows move thereverbatim.
platforms.tsimports it and types it; the distcheck flow reads thesame file with
json.loads. Nothing is generated, nothing is committed twice,and there is no derivation step to drift — the file is the table.
Three constraints picked that location, and each ruled out an alternative:
loadNativeCore()callslibTriples()at runtimein the published package, so the data cannot live at the repo root or in
putitoutthere.toml— neither is insidepackages/ts, and npmfilescannotreach a parent directory. Under
src/withresolveJsonModule,tsccopiesthe JSON into
dist/next to the compiled modules, andfiles: ["dist/", …]ships it. Verified, not assumed — see the manual run below.
drift, which would need a check to police it — the exact thing being deleted
here. A generated file that is not committed has to exist before any
consumer builds, including
tsx tools/stage-platform.tsand a Python processthat never runs
tsc. Reading one declarative file sidesteps both.what it needs.
tripleandlibcremain TypeScript-only, as before.Types at the boundary. JSON widens
nodePlatform/nodeArchtostring,so
PLATFORMSis a singleas readonly Platform[]cast — one cast, in the oneplace the JSON and node vocabularies meet. The
Platforminterface isunchanged. On the Python side the only derivation is
slug, stripped fromlibName; existing assertions (p.slug,p.name,p.addon_name) pin it.Public surface
Unaffected.
packages/ts/src/index.tsexports onlyDirSQLandTable,and
package.json'sexportsmap has a single"."entry —PLATFORMS,libTriples()andlibrarySlug()were never reachable by a consumer and stillare not.
librarySlugkeeps its home inlibrary-slug.tsand its behavior.No SDK public API moved, so
PARITY.mdneeds no update.The one packaging-visible change:
dist/platforms.jsonis now in the tarballalongside the
.js/.d.tsfiles.Deleted
internals/checks/src/checks/platforms_mirror/— 24 files (12 source, 12colocated tests), including everything refactor(checks): one function per file across attestation_guard and platforms_mirror #1102 split out of it.
internals/checks/tests/integration/platforms_mirror_test.pyandinternals/checks/tests/e2e/platforms_mirror_test.py.add_commandline inchecks/cli.py, and thetest_platforms_mirror_is_registeredcase incli_test.py..github/workflows/platforms-mirror-check.yml.Added in its place:
packages/ts/src/platforms.jsononinternals-distcheck-ci.yml's path filter, so a table edit still triggers thelane whose lookup reads it.
Source-line delta
Measured with #1072's
srcline.py(non-test, non-comment, non-blank), base3a1e427vs this branch. JSON is data, not source, and is outside the metric —as are the Python and TypeScript comments.
packages/ts/srcinternals/checks/srcinternals/distcheck/src24 fewer files. The issue estimated ~−276; the extra comes from
platforms_mirrorhaving grown under #1020's extraction rungs since that estimate was taken.
Red/green
This is a refactor plus a removal, so neither arm of the rule demands a pushed
RED. The removal is exempt by AGENTS.md. The refactor introduces no new
observable behavior:
PLATFORMSholds byte-identical rows,libTriples()returns the same map, and the Python
Platformtuple is unchanged — all of italready pinned by
packages/ts/src/platforms.test.tsandinternals/distcheck/.../platforms_test.py, which are untouched. Not onetest assertion changed anywhere in this PR. Every deleted test is a test of
deleted source.
Added assertions (not changed ones)
The
colocated-testco-change gate requires a changed source file's test tochange with it, so each side gained one new case — a strengthening, never a
rewrite, and aimed at exactly the risk this PR introduces:
platforms.test.tspins every${nodePlatform}-${nodeArch}key.PLATFORMSis a cast, so no type stops a hand-edited row carrying a value node never
reports.
platforms_test.pypins the fullslugset.slugis the one field thePython side derives rather than carries, and a moved constant is a mutation
survivor without a test on its literal.
Notes
tools/stage-platform.ts's "unsupported host" message pointed atsrc/platforms.ts; it now points atsrc/platforms.json. Not asserted by anytest (
stage-platform.test.tsmatches/unsupported host/only).arch.py's "extend platforms.py" message was already pointing at the wrongfile before this PR (the arch map lives in
arch.py). Left alone — unrelated,and its own one-line fix.
one_function_per_fileat threshold 1:internals/checks/src,packages/ts/srcandinternals/distcheck/srcall still report zeroviolations. Measured with
npx -y testing-conventions@latest, resolvedversion 0.0.116.
Manual verification
Identical to the table on
main, field for field.E2E Verification
packages/pythonuntouchedpackages/rustuntouchedpackages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python) — N/A, unchangedpackages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)internals/checks/e2e-attestations/<branch>.jsonreceipt written (internals/checks/srcchanged)pnpm test:e2einpackages/ts→ 5 files, 16 tests, all passuv run python -m pytest tests/e2e -x -qininternals/checks→ 25 passuvx testing-conventions@latest e2e attest '<above>'in each, receipts committedjust preflight→ all pairs green (3packagingSKIPs, which need a built artifact)git show --staton eachattestation commit shows one file, 7 insertions, no sibling receipt pruned.
Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package —packages/ts/changelog.d/2026-09-05-platform-table-single-source.md.internals/**is outsidechangelog_gate's_ROOTS.<root>/<pkg>/migrations.d/(or: not required — additive/bugfix only) — not required: no public API breaks, no deprecated symbol removed, and no runtime behavior change.PLATFORMSandlibTriples()return exactly what they returned before.