Update vscode-rojo submodule reference and complete migration plan for path encoding

- Updated the vscode-rojo submodule to the latest commit.
- Marked all phases of the path encoding migration plan as completed, transitioning to a slugify and deduplication approach.
- Updated documentation to reflect changes in filename handling and metadata management.
This commit is contained in:
Joe 2026-02-10 03:14:18 -06:00
parent 0955e38b45
commit 126c8e66a4
77 changed files with 3512 additions and 799 deletions

View file

@ -4,25 +4,25 @@ overview: "Remove the `%NAME%` path encoding system entirely and replace it with
todos:
- id: phase1-infrastructure
content: "Manual port of PR #1187 infrastructure: specified_name on InstanceMetadata, slugify_name(), deduplicate_name(), name field on meta file structs, apply_name() methods, json_model name field support"
status: pending
status: completed
- id: phase2-replace-encode-decode
content: Replace all encode_path_name/decode_path_name callsites with slugify + dedup + name property approach in snapshot middleware, syncback/file_names.rs, syncback/snapshot.rs
status: pending
status: completed
- id: phase3-two-way-sync
content: "Replace encoding in two-way sync: change_processor.rs renames and web/api.rs added instances, with dedup checks"
status: pending
status: completed
- id: phase4-remove-config
content: Remove decode_windows_invalid_chars from InstanceContext, encode_windows_invalid_chars from SyncbackRules, serve_session propagation, JSON schema
status: pending
status: completed
- id: phase5-delete-module
content: Delete src/path_encoding.rs and remove pub mod declaration from lib.rs
status: pending
status: completed
- id: phase6-hardcore-tests
content: "Hardcore test suite: unit tests for slugify/dedup, integration tests for build/syncback/two-way-sync roundtrips, collision tests, edge case tests; update existing encoded pattern tests; regenerate snapshots"
status: pending
status: completed
- id: phase7-update-docs
content: Update cursor rules (.cursor/rules/rojo.mdc, src.mdc) to reflect new approach
status: pending
status: completed
isProject: false
---

View file

@ -210,10 +210,12 @@ snapshot.with_new_path(path, new_ref, old_ref)
```
**Filename generation** (`file_names.rs`):
- Uses instance name
- Slugifies instance name (`slugify_name()`: forbidden chars → `_`)
- Deduplicates against taken names (`deduplicate_name()`: appends `~1`, `~2`, etc.)
- Adds appropriate extension based on middleware
- Encodes Windows-invalid chars if enabled
- Stores real name in `.meta.json5` `name` field when slug differs
- Example: `Script` named "My Script" → `My Script.server.luau`
- Example: `Script` named "Hey/Bro" → `Hey_Bro.server.luau` + meta with `name: "Hey/Bro"`
### Property Filtering
@ -378,7 +380,7 @@ Filesystem:
- Solution: Use clean mode
2. **Invalid filename** - Instance name contains invalid chars
- Solution: Enable `decodeWindowsInvalidChars` or rename in Studio
- Solution: Handled automatically by `slugify_name()` + metadata `name` field
3. **Ref to pruned instance** - Property points to instance not in project
- Logged as warning, property not synced

View file

@ -185,10 +185,11 @@ fn do_something() -> Result<()> {
pub struct InstanceContext {
pub path_ignore_rules: Arc<Vec<PathIgnoreRule>>,
pub sync_rules: Vec<SyncRule>,
pub decode_windows_invalid_chars: bool,
}
```
**Filename handling:** Instance names with forbidden filesystem chars are slugified (forbidden chars → `_`), deduplicated (`~1`, `~2`, etc. on collision), and the real name is stored in `.meta.json5`/`.model.json5` `name` fields. See `src/syncback/file_names.rs`.
**VFS passed separately to snapshot functions:**
```rust
snapshot_from_vfs(&context, &vfs, &path)?

View file

@ -68,10 +68,16 @@ Transforms files → `InstanceSnapshot`. Main entry: `snapshot_from_vfs()`
pub struct InstanceContext {
pub path_ignore_rules: Arc<Vec<PathIgnoreRule>>,
pub sync_rules: Vec<SyncRule>,
pub decode_windows_invalid_chars: bool, // Default: true
}
```
**Filename handling (syncback/two-way sync):**
Instance names with forbidden filesystem chars (`<>:"/\|?*`) are handled by:
1. `slugify_name()` -- replaces forbidden chars with `_` (pure, stateless)
2. `deduplicate_name()` -- appends `~1`, `~2`, etc. on collision (stateful)
3. Metadata `name` field -- stores the real instance name in `.meta.json5`/`.model.json5` when the slug differs
### 3. Commands (`src/cli/`)
- `serve.rs` - Live sync with WebSocket