Summary
Perry does not implement util.diff(actual, expected). Node exposes this helper and returns an edit-tuple sequence for string inputs and arrays of strings, with validation errors for unsupported input types.
Node Behavior
Minimal repro:
import * as util from "node:util";
console.log("diff typeof:", typeof util.diff);
for (const [actual, expected] of [
["abc", "adc"],
[["a", "b", "c"], ["a", "d", "c"]],
["same", "same"],
[123, "x"],
["x", 123],
] as any[]) {
try {
console.log(`${JSON.stringify(actual)} -> ${JSON.stringify(expected)}:`, JSON.stringify(util.diff(actual, expected)));
} catch (err) {
const e = err as NodeJS.ErrnoException;
console.log(`${JSON.stringify(actual)} -> ${JSON.stringify(expected)} error:`, e.name, e.code, e.message.split("\n")[0]);
}
}
Node v25.9.0 with FORCE_COLOR=0 node --experimental-strip-types prints:
diff typeof: function
"abc" -> "adc": [[0,"a"],[1,"b"],[-1,"d"],[0,"c"]]
["a","b","c"] -> ["a","d","c"]: [[0,"a"],[1,"b"],[-1,"d"],[0,"c"]]
"same" -> "same": []
123 -> "x" error: TypeError ERR_INVALID_ARG_TYPE The "actual" argument must be of type string. Received type number (123)
"x" -> 123 error: TypeError ERR_INVALID_ARG_TYPE The "expected" argument must be of type string. Received type number (123)
Perry Behavior
Focused probe test-files/tmp_util_diff.ts fails at compile time:
Collecting modules...
Error: `util.diff` is not implemented in Perry — see `perry --print-api-manifest` for the supported surface, or set `PERRY_ALLOW_UNIMPLEMENTED=1` to ignore. (#463)
Evidence:
./run_parity_tests.sh --filter tmp_util_diff
- report:
test-parity/reports/parity_report_20260530_110312.json
- Node output:
test-parity/output/node/tmp_util_diff.txt
- Perry compile log:
test-parity/output/tmp_util_diff.compile_error.log
- docs list
util.diff(actual, expected) as a gap in docs/runtime-parity-gaps.md.
crates/perry-api-manifest/src/entries.rs omits diff from the supported util surface.
Suggested PR Cut
Batch this with related issues in:
node:util: comparison helper parity
Good batch candidates:
Do not batch with:
- unrelated modules
- broad subsystem rewrites
- fixes needing different test harnesses
Acceptance
- parity/regression test proves string and string-array diffs return Node-compatible edit tuples
- invalid input types throw Node-compatible
ERR_INVALID_ARG_TYPE errors
- related known-failure/docs/manifest entries updated if touched
Summary
Perry does not implement
util.diff(actual, expected). Node exposes this helper and returns an edit-tuple sequence for string inputs and arrays of strings, with validation errors for unsupported input types.Node Behavior
Minimal repro:
Node v25.9.0 with
FORCE_COLOR=0 node --experimental-strip-typesprints:Perry Behavior
Focused probe
test-files/tmp_util_diff.tsfails at compile time:Evidence:
./run_parity_tests.sh --filter tmp_util_difftest-parity/reports/parity_report_20260530_110312.jsontest-parity/output/node/tmp_util_diff.txttest-parity/output/tmp_util_diff.compile_error.logutil.diff(actual, expected)as a gap indocs/runtime-parity-gaps.md.crates/perry-api-manifest/src/entries.rsomitsdifffrom the supported util surface.Suggested PR Cut
Batch this with related issues in:
node:util: comparison helper parityGood batch candidates:
Do not batch with:
Acceptance
ERR_INVALID_ARG_TYPEerrors