4.4 branch: Guard against odd object prototypes triggered by changes in TOML 4.0 by jdmarshall · Pull Request #916 · node-config/node-config · GitHub
Skip to content

4.4 branch: Guard against odd object prototypes triggered by changes in TOML 4.0#916

Merged
jdmarshall merged 2 commits into
node-config:4.4from
jdmarshall:tomlFix
Jun 26, 2026
Merged

4.4 branch: Guard against odd object prototypes triggered by changes in TOML 4.0#916
jdmarshall merged 2 commits into
node-config:4.4from
jdmarshall:tomlFix

Conversation

@jdmarshall

@jdmarshall jdmarshall commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Note that test in 0-util.js:

assert.deepStrictEqual(result.config.messages, [...

Still fails with toml 4.1 because there is no prototype on messages, which is problematic

Fixes #911

Summary by CodeRabbit

  • Bug Fixes

    • Improved object immutability property detection to use more reliable methods.
  • Chores

    • Updated continuous integration workflow to include additional branch for automated testing.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Comment thread lib/util.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lib/util.js (1)

189-191: ⚡ Quick win

Remove unused ownProps variable.

The ownProps array is computed but never referenced. This appears to be leftover code from refactoring.

🧹 Proposed fix to remove dead code
-              const ownProps = [
-                ...Object.getOwnPropertyNames(target),
-              ]
-
               // Bypass proxy receiver for properties directly on the target (e.g., RegExp.prototype.source)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/util.js` around lines 189 - 191, Remove the dead-variable declaration for
ownProps in the function where target is used: delete the const ownProps =
[...Object.getOwnPropertyNames(target)] line (and any related unused references)
so the code no longer computes an unused array; ensure no other logic depends on
ownProps and keep existing behavior of the surrounding function (refer to the
ownProps identifier and the target parameter to locate the statement).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lib/util.js`:
- Around line 189-191: Remove the dead-variable declaration for ownProps in the
function where target is used: delete the const ownProps =
[...Object.getOwnPropertyNames(target)] line (and any related unused references)
so the code no longer computes an unused array; ensure no other logic depends on
ownProps and keep existing behavior of the surrounding function (refer to the
ownProps identifier and the target parameter to locate the statement).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 32190c04-7633-4b41-bdf7-3eedc0cd3788

📥 Commits

Reviewing files that changed from the base of the PR and between 890084d and 43ea2c9.

📒 Files selected for processing (1)
  • lib/util.js

@jdmarshall jdmarshall changed the title Guard against odd object prototypes triggered by changes in TOML 4.0 4.4 branch: Guard against odd object prototypes triggered by changes in TOML 4.0 Jun 10, 2026
@jdmarshall jdmarshall force-pushed the tomlFix branch 2 times, most recently from 2b9786c to 93755f2 Compare June 13, 2026 05:46
Note that test in 0-util.js:

    assert.deepStrictEqual(result.config.messages, [...

Still fails with toml 4.1 because there is no prototype on messages, which is problematic
@jdmarshall jdmarshall merged commit 1537469 into node-config:4.4 Jun 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant