Skip to content

Fix spacetime generate ignoring module-path from spacetime.json#4491

Closed
clockwork-labs-bot wants to merge 1 commit intomasterfrom
bot/fix-generate-module-path-config
Closed

Fix spacetime generate ignoring module-path from spacetime.json#4491
clockwork-labs-bot wants to merge 1 commit intomasterfrom
bot/fix-generate-module-path-config

Conversation

@clockwork-labs-bot
Copy link
Collaborator

Problem

When spacetime.json has module-path but no generate entries:

{
  "module-path": "server-rust"
}

spacetime generate ignores the configured path and defaults to spacetimedb/.

Root Cause

get_filtered_generate_configs() only processes targets that have generate entries. When no generate entries exist, exec_ex() falls back to creating a CommandConfig with an empty HashMap, discarding all config values including module-path.

Fix

When get_filtered_generate_configs() returns empty but a config was loaded, pass through the top-level additional_fields from the loaded config (which includes module-path, database, server, etc.) to the fallback CommandConfig.

Testing

cargo test -p spacetimedb-cli --no-default-features -- generate
# 24 passed, 0 failed

New test: test_module_path_from_config_without_generate_entries — verifies that module-path from config is used when no generate entries are present.

Closes #4475

Note: There is also a community PR #4482 for the same issue. This PR takes a different approach — instead of modifying get_filtered_generate_configs to synthesize a generate entry, it passes through the existing config fields at the exec_ex level.

When spacetime.json has module-path but no generate entries:

  { "module-path": "server-rust" }

the generate command ignored it and defaulted to 'spacetimedb'.

Root cause: get_filtered_generate_configs() only processes targets with
generate entries. When none exist, exec_ex() fell back to creating a
CommandConfig with an empty HashMap, discarding all config values.

Fix: pass through the top-level additional_fields from the loaded config
so module-path (and other entity-level fields) are preserved.

Closes #4475
@bfops bfops closed this Feb 27, 2026
@bfops bfops deleted the bot/fix-generate-module-path-config branch February 27, 2026 18:59
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

2 participants