Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/node-compat-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Node Compat Matrix Guard

# Gates scripts/node_compat_matrix.mjs --check: a breadth sweep over every
# Gates scripts/node_compat_matrix.mts --check: a breadth sweep over every
# require("module").builtinModules entry, both import forms (M and node:M),
# against a PINNED, SRI-verified Node oracle (external-tools.json tools.node,
# currently 26.5.1). It compares Perry's export-SHAPE fingerprint per module
Expand All @@ -11,7 +11,7 @@ name: Node Compat Matrix Guard
#
# Its OWN job on purpose: the runner downloads the pinned Node dist tarball
# (~40MB) and verifies it, which must not slow the main cargo-test job. The
# node used by setup-node here only EXECUTES the .mjs; the oracle Node is the
# node used by setup-node here only EXECUTES the .mts; the oracle Node is the
# pinned dist the runner fetches + SRI-verifies itself.
#
# Decoupled from the (not-yet-enabled) merge queue like node-suite-guard.yml:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
uses: actions/setup-node@v7
with:
# Single source of truth: .node-version at the repo root. This node
# only RUNS node_compat_matrix.mjs; the compat oracle is the pinned
# only RUNS node_compat_matrix.mts; the compat oracle is the pinned
# Node the runner downloads + SRI-verifies from external-tools.json.
node-version-file: .node-version

Expand All @@ -91,6 +91,6 @@ jobs:
set -euo pipefail
echo '### Node builtin compat matrix guard' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
node scripts/node_compat_matrix.mjs --check \
node scripts/node_compat_matrix.mts --check \
| tee -a "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ jobs:
# newly-soaked upstream releases as advisories.
- name: Binding upstream pins (lock-step)
if: ${{ !cancelled() }}
run: node scripts/binding_pins.mjs --check
run: node scripts/binding_pins.mts --check

# GC write-barrier store-site inventory: every raw heap-slot store in
# perry-codegen / perry-runtime / perry-stdlib must be barriered or
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ __pycache__/
*.py[cod]

# Pinned Node oracle for the builtin-module compat matrix
# (scripts/node_compat_matrix.mjs downloads + SRI-verifies + caches here).
# (scripts/node_compat_matrix.mts downloads + SRI-verifies + caches here).
.cache/node-pin/

# Android Gradle: caches and build outputs are regenerable. Source under
Expand Down Expand Up @@ -192,7 +192,7 @@ private-*
# mdBook output
docs/book/

# scripts/fp_fuzz.mjs failure dumps (regenerable, machine-local)
# scripts/fp_fuzz.mts failure dumps (regenerable, machine-local)
fp_fuzz_failures/

test-files/.perry-cache/
Expand Down
16 changes: 8 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ Three workflows are deliberately exempt and say so inline: `node-core-subset.yml
- **Test/CI mechanics** — `#794` (per-category parity thresholds), `#796` (gap-suite output truncation + O(n²) `normalize_output`), `#812` (42-module behavioral matrix), `#806/#807/#808` (test harnesses for mixins / async context / ≥300-init scale).
- **Skip-list audit** — `#797` covers `test-parity/known_failures.json` provenance (issue # + date per entry).

### Node builtin compatibility matrix (`scripts/node_compat_matrix.mjs`)
### Node builtin compatibility matrix (`scripts/node_compat_matrix.mts`)

Breadth sweep over EVERY `require("module").builtinModules` entry, both import forms (`M` and `node:M`), against a **pinned, SRI-verified Node** (the "latest stable" oracle, pinned in `external-tools.json` `tools.node.version` — currently **26.5.1**, independent of the `.node-version` gap-suite oracle). It compares Perry's export-SHAPE fingerprint (sorted `name:typeof` over the module namespace + the default export's typeof) to the oracle's. This is the systematic version of the #812 "42-module behavioral matrix" — shape, not deep behavior (behavioral cases stay in the node-suite).

```bash
# FAST LOOP — reach for this first when iterating on ONE builtin:
node scripts/node_compat_matrix.mjs --module fs # one module, both forms
node scripts/node_compat_matrix.mjs --module fs,path,crypto # a few
node scripts/node_compat_matrix.mjs --module fs --method readFileSync,promises # only these exports
node scripts/node_compat_matrix.mjs --only fs.readFileSync,path.join # combined mod.export form
node scripts/node_compat_matrix.mts --module fs # one module, both forms
node scripts/node_compat_matrix.mts --module fs,path,crypto # a few
node scripts/node_compat_matrix.mts --module fs --method readFileSync,promises # only these exports
node scripts/node_compat_matrix.mts --only fs.readFileSync,path.join # combined mod.export form
# (the pinned Node download is skipped once cached under .cache/node-pin/)

# FULL SWEEP + GATE:
node scripts/node_compat_matrix.mjs # whole matrix + summary table
node scripts/node_compat_matrix.mjs --check # CI gate: exit 1 on regressions vs the baseline
node scripts/node_compat_matrix.mjs --update-baseline # rewrite test-parity/node-compat-matrix.baseline.json
node scripts/node_compat_matrix.mts # whole matrix + summary table
node scripts/node_compat_matrix.mts --check # CI gate: exit 1 on regressions vs the baseline
node scripts/node_compat_matrix.mts --update-baseline # rewrite test-parity/node-compat-matrix.baseline.json
```

A `--module` selector scopes `--check`/`--update-baseline` to just that slice (a single-module refresh never rewrites the whole baseline). A `--method`/`--only` subset is a print-only fast diagnostic (it narrows the fingerprint, so it is refused for `--check`/`--update-baseline`). **Bump the pinned Node** by editing `tools.node.version` in `external-tools.json` (add per-platform sha512 SRI), then `--update-baseline` and review the diff. Needs the release binary (`cargo build --release -p perry`). Full page: `docs/src/testing/node-compat-matrix.md`.
Expand Down
1 change: 1 addition & 0 deletions changelog.d/8241-scripts-mts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Converted the three remaining `scripts/**/*.mjs` files (`binding_pins`, `fp_fuzz`, `node_compat_matrix`) to TypeScript `.mts`, standardizing onto the same module + type-stripping convention the soak scripts already use. Declared `engines.node >= 22.18.0` in `package.json` (the floor for native `.mts` type stripping; the repo's `.node-version` pin of 26.5.1 is well above it). All invocation sites — CI workflows, docs, config JSON, in-script help text, Rust comments — updated to reference the new `.mts` paths.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
10 changes: 5 additions & 5 deletions crates/perry/src/commands/compile/well_known.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct WellKnownBinding {
/// Upstream provenance pin — which release of the npm package this
/// wrapper ports, and when it was last reviewed against it. See
/// `docs/src/native-libraries/upstream-pins.md` and the lock-step
/// gate in `scripts/binding_pins.mjs`. `None` for entries exempt
/// gate in `scripts/binding_pins.mts`. `None` for entries exempt
/// from pinning (`node_builtin`, `alias_of`, and perry-owned
/// packages).
// Provenance metadata parsed from `well_known_bindings.toml` and consulted
Expand Down Expand Up @@ -133,7 +133,7 @@ fn binding_is_faithful(
///
/// The **lock-step rule**: `ported_at` must equal `version`. Re-pinning
/// an upstream release without re-reviewing the wrapper against the
/// upstream diff reds the `binding_pins.mjs --check` gate until
/// upstream diff reds the `binding_pins.mts --check` gate until
/// `ported_at` advances with the review — an upstream release can never
/// go silently stale, and a pin bump can never outrun its port.
#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -317,7 +317,7 @@ fn parse_well_known_toml(raw: &str) -> Result<BTreeMap<String, WellKnownBinding>
let version = required("version")?;
let ported_at = required("ported-at")?;
// Parse-time lock-step backstop. The authoritative gate is
// `scripts/binding_pins.mjs --check` (CI); failing here too
// `scripts/binding_pins.mts --check` (CI); failing here too
// means a skewed pin can't even ship inside the binary.
if ported_at != version {
return Err(format!(
Expand Down Expand Up @@ -741,7 +741,7 @@ mod tests {

/// The lock-step rule enforced at parse time: a pin bump
/// (`version`) that outruns its review (`ported-at`) must refuse
/// to load — the authoritative CI gate is binding_pins.mjs
/// to load — the authoritative CI gate is binding_pins.mts
/// --check, but a skewed pin must not even ship inside the binary.
#[test]
fn upstream_pin_rejects_lock_step_violation() {
Expand Down Expand Up @@ -793,7 +793,7 @@ mod tests {
assert!(
unpinned.is_empty(),
"bindings without an [bindings.<name>.upstream] pin — provision one with \
`node scripts/binding_pins.mjs --set <name>`:\n {}",
`node scripts/binding_pins.mts --set <name>`:\n {}",
unpinned.join("\n ")
);
}
Expand Down
4 changes: 2 additions & 2 deletions docs/po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -52183,13 +52183,13 @@ msgstr "Korrektheits-Zahlen"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — generiert zufällig TS-Programme, die die sechs "
"`scripts/fp_fuzz.mts` — generiert zufällig TS-Programme, die die sechs "
"Muster ausüben, die am ehesten Per-Instruction-FMFs auslösen (Left-Fold-, "
"Tree-Fold-, Right-Fold-Reduktionen; FMA-förmige Ketten; algebraische "
"Identitäten wie `(a/b)*b`; Cancellation-Prädikate). Jedes Programm wird "
Expand Down
4 changes: 2 additions & 2 deletions docs/po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -52566,13 +52566,13 @@ msgstr "Números de corrección"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — genera aleatoriamente programas TS que ejercitan los"
"`scripts/fp_fuzz.mts` — genera aleatoriamente programas TS que ejercitan los"
" seis patrones con más probabilidad de activar FMFs por instrucción "
"(reducciones left-fold, tree-fold, right-fold; cadenas con forma FMA; "
"identidades algebraicas como `(a/b)*b`; predicados de cancelación). Cada "
Expand Down
4 changes: 2 additions & 2 deletions docs/po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -52693,13 +52693,13 @@ msgstr "Chiffres de correction"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — génère aléatoirement des programmes TS exercant les "
"`scripts/fp_fuzz.mts` — génère aléatoirement des programmes TS exercant les "
Comment thread
jdalton marked this conversation as resolved.
"six motifs les plus susceptibles de déclencher des FMF par instruction "
"(réductions left-fold, tree-fold, right-fold ; chaînes de forme FMA ; "
"identités algébriques comme `(a/b)*b` ; prédicats d'annulation). Chaque "
Expand Down
4 changes: 2 additions & 2 deletions docs/po/id.po
Original file line number Diff line number Diff line change
Expand Up @@ -51605,13 +51605,13 @@ msgstr "Angka kebenaran"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — secara acak menghasilkan program TS yang menjalankan"
"`scripts/fp_fuzz.mts` — secara acak menghasilkan program TS yang menjalankan"
" enam pola yang paling mungkin memicu FMF per-instruksi (reduksi left-fold, "
"tree-fold, right-fold; rantai berbentuk FMA; identitas aljabar seperti "
"`(a/b)*b`; predikat pembatalan). Setiap program dikompilasi dengan Node dan "
Expand Down
4 changes: 2 additions & 2 deletions docs/po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -52042,13 +52042,13 @@ msgstr "Numeri sulla correttezza"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — genera casualmente programmi TS che esercitano i sei"
"`scripts/fp_fuzz.mts` — genera casualmente programmi TS che esercitano i sei"
" pattern più suscettibili di attivare i FMF per istruzione (riduzioni left-"
"fold, tree-fold, right-fold; catene con forma FMA; identità algebriche come "
"`(a/b)*b`; predicati di cancellazione). Ogni programma viene compilato sia "
Expand Down
4 changes: 2 additions & 2 deletions docs/po/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -49531,13 +49531,13 @@ msgstr "正確性の数字"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — 命令ごとの FMF を発生させやすい 6 "
"`scripts/fp_fuzz.mts` — 命令ごとの FMF を発生させやすい 6 "
"つのパターン(左折りたたみ、木折りたたみ、右折りたたみリダクション、FMA 形のチェーン、`(a/b)*b` "
"のような代数恒等式、キャンセル述語)を行使する TS プログラムをランダムに生成します。各プログラムは Node と Perry "
"の両方でコンパイルされ、stdout はバイト単位で diff されます。"
Expand Down
4 changes: 2 additions & 2 deletions docs/po/ko.po
Original file line number Diff line number Diff line change
Expand Up @@ -49482,13 +49482,13 @@ msgstr "정확성 수치"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — 명령어별 FMF를 트리거할 가능성이 가장 높은 여섯 가지 패턴(왼쪽 폴드, 트리 폴드, 오른쪽"
"`scripts/fp_fuzz.mts` — 명령어별 FMF를 트리거할 가능성이 가장 높은 여섯 가지 패턴(왼쪽 폴드, 트리 폴드, 오른쪽"
" 폴드 리덕션; FMA 형태 체인; `(a/b)*b`와 같은 대수 항등식; 소거 술어)을 실행하는 TS 프로그램을 무작위로 생성합니다. "
"각 프로그램은 Node와 Perry 양쪽에서 컴파일되며 stdout을 바이트 단위로 비교합니다."

Expand Down
2 changes: 1 addition & 1 deletion docs/po/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -46721,7 +46721,7 @@ msgstr ""

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node "
Expand Down
4 changes: 2 additions & 2 deletions docs/po/th.po
Original file line number Diff line number Diff line change
Expand Up @@ -51127,13 +51127,13 @@ msgstr "ตัวเลขความถูกต้อง"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — สร้างโปรแกรม TS "
"`scripts/fp_fuzz.mts` — สร้างโปรแกรม TS "
"แบบสุ่มที่ทดสอบรูปแบบหกแบบที่มีแนวโน้มจะทำให้ per-instruction FMF สะดุด "
"(การรวม left-fold, tree-fold, right-fold; chain รูปแบบ FMA; identity "
"เชิงพีชคณิตเช่น `(a/b)*b`; predicate การยกเลิก) แต่ละโปรแกรมถูก compile "
Expand Down
4 changes: 2 additions & 2 deletions docs/po/vi.po
Original file line number Diff line number Diff line change
Expand Up @@ -51541,13 +51541,13 @@ msgstr "Số liệu tính chính xác"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — tạo ngẫu nhiên các chương trình TS thực thi sáu mẫu "
"`scripts/fp_fuzz.mts` — tạo ngẫu nhiên các chương trình TS thực thi sáu mẫu "
"có khả năng kích hoạt FMF từng lệnh nhất (rút gọn left-fold, tree-fold, "
"right-fold; chuỗi hình FMA; đẳng thức đại số như `(a/b)*b`; vị từ triệt "
"tiêu). Mỗi chương trình được biên dịch bằng cả Node và Perry, và stdout được"
Expand Down
4 changes: 2 additions & 2 deletions docs/po/zh-CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -49008,13 +49008,13 @@ msgstr "正确性数据"

#: src/cli/fast-math.md:123
msgid ""
"`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the six "
"`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the six "
"patterns most likely to trip per-instruction FMFs (left-fold, tree-fold, "
"right-fold reductions; FMA-shaped chains; algebraic identities like "
"`(a/b)*b`; cancellation predicates). Each program is compiled with both Node"
" and Perry, and stdout is diffed byte-for-byte."
msgstr ""
"`scripts/fp_fuzz.mjs` — 随机生成 TS 程序,使用最有可能触发按指令 FMF 的六种模式(左折叠、树折叠、右折叠归约;FMA "
"`scripts/fp_fuzz.mts` — 随机生成 TS 程序,使用最有可能触发按指令 FMF 的六种模式(左折叠、树折叠、右折叠归约;FMA "
"形状链;像 `(a/b)*b` 的代数恒等式;抵消谓词)。每个程序都用 Node 和 Perry 编译,并对 stdout 进行逐字节比对。"

#: src/cli/fast-math.md:129
Expand Down
2 changes: 1 addition & 1 deletion docs/src/cli/fast-math.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ giving up bit-exact parity.

## Correctness numbers

`scripts/fp_fuzz.mjs` — randomly generates TS programs exercising the
`scripts/fp_fuzz.mts` — randomly generates TS programs exercising the
six patterns most likely to trip per-instruction FMFs (left-fold,
tree-fold, right-fold reductions; FMA-shaped chains; algebraic
identities like `(a/b)*b`; cancellation predicates). Each program is
Expand Down
Loading
Loading