Skip to content

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

Open
sehawq wants to merge 4 commits intoclockworklabs:masterfrom
sehawq:fix/config-module-path-4475
Open

fix(cli): read module-path from config when no generate entries exist#4482
sehawq wants to merge 4 commits intoclockworklabs:masterfrom
sehawq:fix/config-module-path-4475

Conversation

@sehawq
Copy link

@sehawq sehawq commented Feb 26, 2026

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
Copy link

CLAassistant commented Feb 26, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@bfops bfops left a comment

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
@sehawq sehawq force-pushed the fix/config-module-path-4475 branch from ed71ce1 to 1a8bbf0 Compare February 27, 2026 18:59
@sehawq sehawq requested a review from bfops February 27, 2026 19:05
sehawq

This comment was marked as duplicate.

@sehawq
Copy link
Author

sehawq commented Feb 27, 2026

@bfops Can you check again?

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

3 participants