Repository navigation
fix(program): preserve literal __proto__ fields in generated modules - #497
Conversation
|
JOJO (@moneymaker26754-crypto) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
Hi JOJO (JOJO (@moneymaker26754-crypto)) and Tejas (Tejas Lamba (@TejasLamba2006)) — thank you both. JOJO, the tests here that run the generated module and the real-validator tests in #496 give us coverage worth keeping. Tejas, thanks for the fixes in #525 and #526 and for offering to bring the changes together. Let’s use this thread to coordinate the two fixes: preserving the literal If we haven’t heard back, we’ll plan to pick this up on a fresh branch from |
|
robgruen JOJO (@moneymaker26754-crypto) I'm happy to finish bringing both fixes together. I put together a clean branch rebased on
If you'd like, I can open a fresh consolidated PR from this branch (referencing #496, #497, #525, and #526 and preserving credit, then closing #525/#526 once it lands). Or if JOJO (@moneymaker26754-crypto) prefers to continue on #497 and get the CLA sorted, feel free to pull from the branch and I'll close #525/#526 once that's ready. |
|
Thanks, Tejas Lamba (@TejasLamba2006). Please open a draft PR against JOJO (@moneymaker26754-crypto), thank you for the original fixes and tests. If you’d prefer to bring the combined changes into this PR, a one-line reply by Monday, Nov 30 is enough. No code or rebase is due by then. Otherwise, we’ll continue review on Tejas’s PR. Tejas, please reference #496, #497, #525, and #526 in the description and note which fixes and tests came from each contributor. That lets us preserve credit and confirm CLA coverage for anything carried over. Let’s keep the existing PRs open until the combined changes pass CI, are reviewed, and merge. |
A JSON object with an own proto field is not preserved by createModuleTextFromProgram. The generated object literal uses "proto": value, which JavaScript interprets specially instead of defining the original data field. The interpreter already preserves the field via Object.fromEntries.
Emit a computed property name for this one key, retaining the existing output form for ordinary keys. Add three cases (string, object and null values) that execute the generated module after removing its type-only scaffolding, assert the own property and serialized data, and compare with interpreter output. Execution is confined to controlled test fixtures; production code only generates text as before.
Validation (Node 24.22.1, Windows):
Related PR #448 addresses instance-method shadowing in the same files and is a separate fix. New locally reproduced problem; no separate issue has been filed.
Prepared with AI assistance; proposed as a draft pending human review.