Skip to content

spacetime dev - Fix file watcher ignoring --module-path / spacetime.json module_path#4464

Open
clockwork-labs-bot wants to merge 3 commits intomasterfrom
bot/fix-dev-module-path-watcher
Open

spacetime dev - Fix file watcher ignoring --module-path / spacetime.json module_path#4464
clockwork-labs-bot wants to merge 3 commits intomasterfrom
bot/fix-dev-module-path-watcher

Conversation

@clockwork-labs-bot
Copy link
Collaborator

Summary

Fixes #4443spacetime dev ignores both --module-path CLI flag and module-path in spacetime.json for the file watcher, always watching <project-path>/spacetimedb/ instead.

Root Cause

Two bugs:

  1. Config's module-path never applied to spacetimedb_dir: When spacetime.json contains module-path, the recovery prompt is correctly skipped (the code checks for its existence), but the value is never used to update spacetimedb_dir. It stays as project_dir/spacetimedb.

  2. Hardcoded fallback in determine_publish_configs(): When there are no publish targets in config (no database key or children), the fallback creates a publish config entry with module-path: "spacetimedb" hardcoded. This propagates to extract_watch_dirs() (file watcher) and the publish loop, overriding any CLI or config value.

Fix

  1. After loading config, resolve spacetimedb_dir from config's module-path in additional_fields when CLI did not provide --module-path.

  2. Pass the resolved spacetimedb_dir to determine_publish_configs() as default_module_path so the fallback uses the correct path instead of hardcoding "spacetimedb".

Testing

  • All 5 existing determine_publish_configs tests pass
  • Added new test test_determine_publish_configs_fallback_uses_provided_module_path that verifies the fallback uses the provided path

…ile watcher (#4443)

Two bugs caused spacetime dev to always watch ./spacetimedb/ regardless of
module-path settings:

1. Config's module-path in additional_fields was checked for existence (to skip
   the recovery prompt) but never used to set spacetimedb_dir. The directory
   stayed as project_dir/spacetimedb even when config specified a different path.

2. determine_publish_configs() hardcoded "spacetimedb" as the module-path in
   fallback publish configs. This wrong path propagated to extract_watch_dirs()
   (file watcher) and the publish loop, overriding any CLI or config value.

Fix: resolve spacetimedb_dir from config's module-path when CLI doesn't provide
one, and pass the resolved path to determine_publish_configs() for the fallback
instead of hardcoding.
@bfops bfops changed the title Fix spacetime dev ignoring --module-path for file watcher Fix spacetime dev ignoring --module-path for file watcher Feb 26, 2026
Instead of the confusing:
  Could not detect the language of the module. Are you in a SpacetimeDB project directory?

Now shows:
  Module directory does not exist: '<path>'. Check your --module-path flag or
  the module-path setting in spacetime.json.
bfops
bfops previously approved these changes Feb 26, 2026
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.

This fixes watching for both --module-path and spacetime.json's module_path for me (Linux)

@bfops bfops changed the title Fix spacetime dev ignoring --module-path for file watcher spacetime dev - Fix file watcher ignoring --module-path / spacetime.json module_path Feb 26, 2026
@clockwork-labs-bot clockwork-labs-bot added this pull request to the merge queue Feb 26, 2026
@bfops bfops removed this pull request from the merge queue due to a manual request Feb 26, 2026
@bfops bfops dismissed their stale review February 26, 2026 03:25

dismissing my review because I'm waiting for another approval

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 dev: --module-path / config module-path ignored by file watcher

2 participants