Conversation
Reference docs for the spacetime.json config file (proposal 0032), covering config structure, field reference, generate configuration, children/inheritance, dev configuration, database selection, flag overrides, environments, config discovery, and editor support.
Docs fixes: - Use game-world region names instead of cloud regions (region-us etc.) - Replace "testnet" server with "maincloud" - Fix config precedence order to match Vite's convention - Fix spacetime dev step ordering (build, generate, publish) - Fix config auto-generation description (spacetime.json + spacetime.local.json) - Fix safety prompt description (only spacetime.json triggers it) - Move --build-options from global to per-database overrides Code fixes: - Stop inheriting generate from parent to children, preventing different modules from silently overwriting each other's bindings - Implement source conflict rule: if a child specifies any of module-path/bin-path/js-path, the others are not inherited - Mark --num-replicas as module_specific (per-database override) - Update tests to match new generate inheritance behavior
|
These new docs allowed me to quickly understand how the config files work, and the order/hierarchy in which everything is applied. I thought that might be helpful feedback :) Thanks a lot! |
gefjon
left a comment
There was a problem hiding this comment.
I haven't tested the CLI changes, but they look reasonable to me and I'm convinced by the updated automated test. The new docs page looks good; I think we should deploy it as soon as we can (thus the label).
| fn test_generate_not_inherited_for_children_sharing_module() { | ||
| // Even when children share the parent's module-path, generate is not inherited. | ||
| // Deduplication in generate.rs handles the common case; inheritance would be | ||
| // dangerous when a child overrides module-path. |
There was a problem hiding this comment.
Please move test description to outer doc comment.
| fn test_generate_not_inherited_for_children_sharing_module() { | |
| // Even when children share the parent's module-path, generate is not inherited. | |
| // Deduplication in generate.rs handles the common case; inheritance would be | |
| // dangerous when a child overrides module-path. | |
| /// Even when children share the parent's module-path, generate is not inherited. | |
| /// | |
| /// Deduplication in generate.rs handles the common case; inheritance would be | |
| /// dangerous when a child overrides module-path. | |
| fn test_generate_not_inherited_for_children_sharing_module() { |
| | `build-options` | string | Yes | Options passed to the build command | | ||
| | `break-clients` | boolean | Yes | Allow breaking changes | | ||
| | `num-replicas` | number | Yes | Number of database replicas | | ||
| | `anonymous` | boolean | Yes | Use anonymous identity | |
There was a problem hiding this comment.
Does this apply to all CLI operations, or only specific ones? Is this gonna try to anonymously publish my database?
bfops
left a comment
There was a problem hiding this comment.
my code-owned changes in crates/cli/src/subcommands LGTM. the spacetime_config changes are inscrutable to me since I haven't had a chance to understand the iceberg of code that is spacetime dev + spacetime.json, so I abdicate my code-ownership of that file.
Description of Changes
Adds a new reference documentation page for
spacetime.jsonand fixes several bugs where the CLI behavior diverged from the proposal.Docs:
/cli-reference/spacetime-jsoncovering config structure, field reference, generate configuration, children/inheritance,spacetime devconfig, database selection, flag overrides,--no-config,--env/environments, config file discovery, and editor supportBug fixes:
generatewas incorrectly inherited by child databases. A child with a differentmodule-pathwould silently inherit the parent's generate entries, causing bindings to be written to the wrong output directory. Generate is now never inherited, matching the proposal.module-path/bin-path/js-pathwas not implemented during inheritance. A child specifyingmodule-pathcould still inheritbin-pathfrom the parent. Now, if a child specifies any module source, the others are not inherited.--num-replicaswas not marked as a per-database override, so it could be used with multiple databases selected without error.API and ABI breaking changes
None. These are bug fixes aligning the implementation with the intended behavior from the proposal:
generateinheritance was never documented or intended--num-replicasas per-database is consistent with the other module-source flagsExpected complexity level and risk
2 - The changes are small and well-scoped. The generate inheritance fix simplifies the code (removes a parameter). The source conflict rule adds a straightforward check during field inheritance. Tests have been updated to match.
Testing
module-pathno longer inherits parent'sgenerate--num-replicaserrors when multiple databases are selected