spacetime dev - Fix file watcher ignoring --module-path / spacetime.json module_path#4464
Open
clockwork-labs-bot wants to merge 3 commits intomasterfrom
Open
spacetime dev - Fix file watcher ignoring --module-path / spacetime.json module_path#4464clockwork-labs-bot wants to merge 3 commits intomasterfrom
spacetime dev - Fix file watcher ignoring --module-path / spacetime.json module_path#4464clockwork-labs-bot wants to merge 3 commits intomasterfrom
Conversation
…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.
--module-path for file watcher
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.
This reverts commit ef440b7.
bfops
previously approved these changes
Feb 26, 2026
Collaborator
bfops
left a comment
There was a problem hiding this comment.
This fixes watching for both --module-path and spacetime.json's module_path for me (Linux)
--module-path for file watcherspacetime dev - Fix file watcher ignoring --module-path / spacetime.json module_path
dismissing my review because I'm waiting for another approval
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4443 —
spacetime devignores both--module-pathCLI flag andmodule-pathinspacetime.jsonfor the file watcher, always watching<project-path>/spacetimedb/instead.Root Cause
Two bugs:
Config's
module-pathnever applied tospacetimedb_dir: Whenspacetime.jsoncontainsmodule-path, the recovery prompt is correctly skipped (the code checks for its existence), but the value is never used to updatespacetimedb_dir. It stays asproject_dir/spacetimedb.Hardcoded fallback in
determine_publish_configs(): When there are no publish targets in config (nodatabasekey orchildren), the fallback creates a publish config entry withmodule-path: "spacetimedb"hardcoded. This propagates toextract_watch_dirs()(file watcher) and the publish loop, overriding any CLI or config value.Fix
After loading config, resolve
spacetimedb_dirfrom config'smodule-pathinadditional_fieldswhen CLI did not provide--module-path.Pass the resolved
spacetimedb_dirtodetermine_publish_configs()asdefault_module_pathso the fallback uses the correct path instead of hardcoding"spacetimedb".Testing
determine_publish_configstests passtest_determine_publish_configs_fallback_uses_provided_module_paththat verifies the fallback uses the provided path