THRIFT-6130: Restore CommonJS UUID compatibility - #3685
Conversation
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. One suggestion, not a blocker: The regression guard is weaker than it looks on modern Node. Re-installing the broken dependency ( thrift/lib/nodejs/test/uuid.test.js Lines 33 to 44 in e398e41 Every other assertion passes against the broken dependency — including the one named "CommonJS runtime loads without an ESM transform", and both protocol round-trips — because Node >= 20.19 satisfies thrift/lib/nodejs/test/uuid.test.js Lines 51 to 58 in e398e41 No workflow pins a Node version (the Two ways to re-arm it, if you think it's worth it: pin an older Node on one Separately, worth stating in the commit message or PR body: 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Client: nodejs Constrain uuid to ^11.1.1, its maintained legacy-11 floor. This preserves the CommonJS and ESM conditional exports required by the Node.js runtime and generated code, while the caret range remains within v11 and cannot resolve ESM-only v12 or newer. Add a behavioral regression that disables require(esm) when the runtime supports it, plus coverage for the generated-code v4 API and binary/compact UUID round trips. Generated-by: OpenAI Codex (GPT-5) Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
e398e41 to
152b8bd
Compare
|
Thanks — addressed in 152b8bd.
Validated on Node 16 and Node 24; formatting and |
Summary
uuidto^11.1.1, its maintainedlegacy-11floor with both CommonJS and ESM conditional exportsv4APIsMotivation
The Node.js runtime and generated CommonJS code load
uuidwithrequire(), butuuid12 and newer are ESM-only. Consequently,require("thrift")fails in CommonJS tooling such as Jest before application tests execute.The
11.1.1floor is deliberate: it is the maintainedlegacy-11release, while the caret range remains within v11 and cannot resolve an ESM-only major. It should not be relaxed to an earlier 11.x release.Downstream reproduction: databricks/databricks-sql-nodejs#461
Test plan
npm run lint-testsnpx prettier --check lib/nodejs/test/uuid.test.jsnode lib/nodejs/test/binary.test.jsnode lib/nodejs/test/header.test.jsnode lib/nodejs/test/uuid.test.json Node 16 and Node 24; modern Node runs the load check withrequire(esm)explicitly disabledThe broad
npm run lintcommand remains red on existing legacy files onmaster; the changed test file and the complete Node.js test directory pass ESLint.Generated-by: OpenAI Codex (GPT-5)