Skip to content

Make sure that multiple setModuleDefaults calls update the config sources properly#825

Closed
jdmarshall wants to merge 1 commit intonode-config:masterfrom
jdmarshall:moduleDefaultsFidelity
Closed

Make sure that multiple setModuleDefaults calls update the config sources properly#825
jdmarshall wants to merge 1 commit intonode-config:masterfrom
jdmarshall:moduleDefaultsFidelity

Conversation

@jdmarshall
Copy link
Copy Markdown
Collaborator

@jdmarshall jdmarshall commented Jun 3, 2025

I don't know if this constitutes a breaking change. I don't know if anyone is relying on configSources for programmatic behavior.

Abundance of caution says yes.

fixes #827

config and the sources being consistent with each other.
@jdmarshall
Copy link
Copy Markdown
Collaborator Author

I'd like us to sort out the setModuleDefaults issue.

I think I may have a solution we could to in Util to keep the defaults and the loaded config as two separate pieces of data and do the heavy lifting in setModuleDefaults so that it's a zero cost abstraction if nobody is using this feature.

Since it's a startup only operation I'm a little less concerned about the perf. Plus I just landed some perf improvements anyway.

I have another idea for fixing it but it might introduce a circular dependency so I need to think on it more:

const defaults = Util.loadFileConfigs({configDir: Path.join(__dirname, 'config')}); 
const myConfig = Config.withDefaults(defaults);

Copy link
Copy Markdown
Collaborator

@markstos markstos left a comment

Choose a reason for hiding this comment

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

Looks OK, but let's not merge it ahead of the regression fix, since it's a breaking change and the regression fix may go out before 4.1.

QA Log

  • Reviewed diff
  • Noted extra test coverage.

@jdmarshall
Copy link
Copy Markdown
Collaborator Author

@markstos So I think we are probably ready for 4.0.1

@markstos
Copy link
Copy Markdown
Collaborator

4.0.1 is OK with me.

@jdmarshall
Copy link
Copy Markdown
Collaborator Author

this conflicts a bit with a PR for #822 which also happens to fix this one.

@jdmarshall jdmarshall closed this Jul 15, 2025
@jdmarshall jdmarshall deleted the moduleDefaultsFidelity branch January 18, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] configSources contains incorrect data from multiple setModuleDefaults calls

2 participants