Skip to content

fix(cli): read module-path from config when no generate entries exist#4482

Open
omerarslan0 wants to merge 14 commits into
clockworklabs:masterfrom
omerarslan0:fix/config-module-path-4475
Open

fix(cli): read module-path from config when no generate entries exist#4482
omerarslan0 wants to merge 14 commits into
clockworklabs:masterfrom
omerarslan0:fix/config-module-path-4475

Conversation

@omerarslan0

@omerarslan0 omerarslan0 commented Feb 26, 2026

Copy link
Copy Markdown

When spacetime.json has module-path at the root level but no generate block, spacetime generate ignores it and defaults to spacetimedb/.

The fallback path in exec_ex() created a CommandConfig with an empty HashMap, discarding entity-level fields from the config. Fix by passing the root config's additional_fields instead.

Closes #4475

Description of Changes

When spacetime.json contains module-path at the root level but no generate block, spacetime generate ignores the configured path and defaults to spacetimedb/. The root cause is in exec_ex(): when get_filtered_generate_configs() returns empty (no generate entries), the fallback CommandConfig was created from an empty HashMap, discarding module-path from the root entity's additional_fields. Fixed by passing loaded.config.additional_fields.clone() instead of HashMap::new().

API and ABI breaking changes

None. This is a bug fix that makes the existing module-path config option work as documented.

Expected complexity level and risk

1 - Trivial. Single line change from HashMap::new() to loaded.config.additional_fields.clone() in the fallback path. The existing code paths for configs with generate entries are unaffected.

Testing

Added regression test test_root_module_path_without_generate_entries_is_forwarded that validates module-path from root config without generate entries is properly forwarded. Existing tests remain unmodified and should continue to pass.

@CLAassistant

CLAassistant commented Feb 26, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ omerarslan0
✅ cloutiertyler
❌ sehawq


sehawq seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread crates/cli/src/subcommands/generate.rs

@bfops bfops left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for opening a PR for this! Unfortunately I'm getting a different error in this case now.

When spacetime.json has module-path at the root level but no generate
block, spacetime generate ignored it and defaulted to spacetimedb/.

The fallback path in exec_ex() created a CommandConfig with an empty
HashMap, discarding entity-level fields from the config. Fix by
passing the root config's additional_fields instead.

Closes clockworklabs#4475
@omerarslan0 omerarslan0 force-pushed the fix/config-module-path-4475 branch from ed71ce1 to 1a8bbf0 Compare February 27, 2026 18:59
@omerarslan0 omerarslan0 requested a review from bfops February 27, 2026 19:05
omerarslan0

This comment was marked as duplicate.

@omerarslan0

Copy link
Copy Markdown
Author

@bfops Can you check again?

@omerarslan0

Copy link
Copy Markdown
Author

Is there any progress? @bfops

@bfops

bfops commented Mar 3, 2026

Copy link
Copy Markdown
Collaborator

Is there any progress? @bfops

Thank you for updating it. I will try to do another review soon!

@omerarslan0

Copy link
Copy Markdown
Author

Is there any progress? @bfops

@bfops

bfops commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator

@sehawq I will try to get another review on this soon!

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.

spacetime generate: "module-path" was not read correctly from the configuration file

4 participants