From 31350cd701bc8a0d0b16064c72c43a412bf051cc Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 17 Feb 2026 06:21:51 -0600 Subject: [PATCH] Consolidate glob patterns in MDC files for improved clarity - Streamlined the `globs` entries in multiple MDC files by removing unnecessary line breaks and consolidating patterns into single lines. - Updated `atlas-api.mdc`, `atlas-dedup.mdc`, `atlas-project.mdc`, `atlas-src.mdc`, `atlas-syncback.mdc`, `plugin.mdc`, `python.mdc`, and `rbx-dom.mdc` to enhance readability and maintainability. These changes improve the organization of the MDC files, making it easier to manage and understand the file patterns used across the project. --- .cursor/rules/atlas-api.mdc | 9 ++---- .cursor/rules/atlas-dedup.mdc | 48 +++++++++++--------------------- .cursor/rules/atlas-project.mdc | 10 ++----- .cursor/rules/atlas-src.mdc | 6 ++-- .cursor/rules/atlas-syncback.mdc | 6 ++-- .cursor/rules/plugin.mdc | 7 ++--- .cursor/rules/python.mdc | 3 +- .cursor/rules/rbx-dom.mdc | 7 ++--- 8 files changed, 30 insertions(+), 66 deletions(-) diff --git a/.cursor/rules/atlas-api.mdc b/.cursor/rules/atlas-api.mdc index c45b3588..f226a83d 100644 --- a/.cursor/rules/atlas-api.mdc +++ b/.cursor/rules/atlas-api.mdc @@ -1,11 +1,6 @@ --- -description: "Web API and plugin communication: WebSocket protocol, live sync architecture, two-way sync, patch format, ServeSession state management, and ChangeBatcher." -globs: - - "src/web/**/*.rs" - - "src/serve_session.rs" - - "plugin/src/ServeSession.lua" - - "plugin/src/ChangeBatcher/**/*.lua" - - "plugin/src/ApiContext.lua" +globs: src/web/**/*.rs,src/serve_session.rs,plugin/src/ServeSession.lua,plugin/src/ChangeBatcher/**/*.lua,plugin/src/ApiContext.lua +alwaysApply: false --- # Atlas API & Communication diff --git a/.cursor/rules/atlas-dedup.mdc b/.cursor/rules/atlas-dedup.mdc index d4002ab8..d6c1b202 100644 --- a/.cursor/rules/atlas-dedup.mdc +++ b/.cursor/rules/atlas-dedup.mdc @@ -1,24 +1,6 @@ --- -description: "Dedup system: matching algorithm, filesystem-collision dedup, suffix cleanup, ref path system, slugification, and cross-system integration for duplicate-named instances." -globs: - - "src/syncback/file_names.rs" - - "src/syncback/dedup_suffix.rs" - - "src/syncback/matching.rs" - - "src/syncback/ref_properties.rs" - - "src/snapshot/matching.rs" - - "src/snapshot/tree.rs" - - "src/snapshot/patch_compute.rs" - - "src/rojo_ref.rs" - - "src/variant_eq.rs" - - "src/change_processor.rs" - - "src/web/api.rs" - - "plugin/src/Reconciler/matching.lua" - - "plugin/src/Reconciler/trueEquals.lua" - - "plugin/src/Reconciler/hydrate.lua" - - "plugin/src/Reconciler/diff.lua" - - "plugin/src/XXH32.luau" - - "tests/tests/two_way_sync.rs" - - "tests/tests/syncback_roundtrip.rs" +globs: src/syncback/file_names.rs,src/syncback/dedup_suffix.rs,src/syncback/matching.rs,src/syncback/ref_properties.rs,src/snapshot/matching.rs,src/snapshot/tree.rs,src/snapshot/patch_compute.rs,src/rojo_ref.rs,src/variant_eq.rs,src/change_processor.rs,src/web/api.rs,plugin/src/Reconciler/matching.lua,plugin/src/Reconciler/trueEquals.lua,plugin/src/Reconciler/hydrate.lua,plugin/src/Reconciler/diff.lua,plugin/src/XXH32.luau,tests/tests/two_way_sync.rs,tests/tests/syncback_roundtrip.rs +alwaysApply: false --- # Atlas Dedup System @@ -58,11 +40,11 @@ All three use the same recursive change-count scoring + greedy assignment algori | File | Subsystem | Purpose | |------|-----------|---------| -| `src/syncback/file_names.rs` | Dedup | `slugify_name`, `deduplicate_name_with_ext`, `name_for_inst`, `parse_dedup_suffix` | -| `src/syncback/dedup_suffix.rs` | Dedup | `compute_cleanup_action`, `DedupCleanupAction`, suffix cleanup rules | +| `src/syncback/file_names.rs` | Dedup | `slugify_name`, `deduplicate_name_with_ext`, `name_for_inst`, `name_needs_slugify` | +| `src/syncback/dedup_suffix.rs` | Dedup | `compute_cleanup_action`, `DedupCleanupAction`, `parse_dedup_suffix`, `build_dedup_name` | | `src/syncback/matching.rs` | Matching | Syncback matching: `match_children` (WeakDom) | | `src/snapshot/matching.rs` | Matching | Forward sync matching: `match_forward` (Snapshot vs Tree) | -| `plugin/src/Reconciler/matching.lua` | Matching | Lua matching: `matchChildren` (Studio vs Virtual) | +| `plugin/src/Reconciler/matching.lua` | Matching | Lua matching: `Matching.matchChildren` (Virtual vs Studio) | | `src/rojo_ref.rs` | Ref Paths | `ref_target_path_from_tree`, `RefPathIndex`, `Rojo_Ref_*` constants | | `src/snapshot/tree.rs` | Ref Paths | `get_instance_by_path`, `filesystem_name_for` | | `src/syncback/ref_properties.rs` | Ref Paths | `collect_referents`, `tentative_fs_path`, `RefLinks` | @@ -97,7 +79,7 @@ const INVALID_WINDOWS_NAMES: [&str; 22] = ["CON", "PRN", "AUX", "NUL", "COM1".." ### name_needs_slugify -Returns `true` if the name contains any `SLUGIFY_CHARS`. Used to decide whether metadata `name` field is needed. +Returns `true` if the name requires slugification. Checks for: `SLUGIFY_CHARS`, control characters, leading/trailing spaces, trailing dots, dangerous suffixes (`.server` etc.), Windows reserved names (`CON` etc.), and empty string. Used to decide whether metadata `name` field is needed. ### deduplicate_name_with_ext @@ -141,9 +123,9 @@ pub fn name_for_inst<'a>( - In clean mode: slugifies name, adds middleware extension, deduplicates against `taken_names` - Returns `needs_meta_name = true` when slug differs from real name (including dedup suffix) -### parse_dedup_suffix +### parse_dedup_suffix (in `dedup_suffix.rs`) -Parses `~N` suffix from a stem: `"Foo~3"` → `Some(("Foo", 3))`, `"Foo"` → `None`. +Parses `~N` suffix from a stem: `"Foo~3"` → `Some(("Foo", 3))`, `"Foo"` → `None`. Returns `None` for `~0` (invalid) and `~abc` (non-numeric). ### Metadata `name` Field @@ -220,14 +202,18 @@ pub fn match_forward( **Lua plugin:** ```lua -function matchChildren(virtualInstances, virtualRootId, instanceMap, instance) -> MatchResult +function Matching.matchChildren( + virtualChildren: { string }, -- array of virtual instance IDs + studioChildren: { Instance }, -- array of Studio Instance objects + virtualInstances: { [string]: any } -- map of virtual ID → virtual instance data +) -> { matched, unmatchedVirtual, unmatchedStudio } ``` ### Algorithm (All Three Implementations) -**Fast-path 1: Ref Pin.** Scan parent's Ref properties (PrimaryPart, Value, etc.). If parent A's PrimaryPart points to child X on side A, and parent B's PrimaryPart points to child Y on side B, pin (X, Y) as matched. Remove both. +**Fast-path: (Name, ClassName) Grouping.** Group children by `(Name, ClassName)`. 1:1 groups get instant-matched with zero scoring. -**Fast-path 2: (Name, ClassName) Grouping.** Group remaining children by `(Name, ClassName)`. 1:1 groups get instant-matched with zero scoring. +> **Note on Ref Pin:** The Lua matching module has a commented-out Ref pin fast-path (scanning parent Ref properties to pin child matches). In practice this is a no-op because during initial hydration the instanceMap is empty. The Rust implementations do not have Ref pin logic. Ref property correctness is maintained by `computeChangeCount` counting Ref property diffs. **Ambiguous Groups: Recursive Scoring + Greedy Assignment.** For groups with multiple candidates on at least one side: @@ -315,9 +301,9 @@ Paths are slash-separated from DataModel's children downward: `"Workspace/TestMo pub fn ref_target_path_from_tree(tree: &RojoTree, target_ref: Ref) -> String // Uses filesystem_name_for() for each ancestor -// From WeakDom (CLI syncback): +// From WeakDom (CLI syncback, legacy instance-name paths): pub fn ref_target_path(dom: &WeakDom, target_ref: Ref) -> String -// Uses dom.full_path_of() +// Uses dom.ancestors_of() with escape_ref_path_segment (instance names, NOT filesystem names) // Tentative path (before dedup suffixes assigned): fn tentative_fs_path(dom: &WeakDom, target_ref: Ref) -> String diff --git a/.cursor/rules/atlas-project.mdc b/.cursor/rules/atlas-project.mdc index 56cea3da..f4bf39b1 100644 --- a/.cursor/rules/atlas-project.mdc +++ b/.cursor/rules/atlas-project.mdc @@ -1,12 +1,6 @@ --- -description: "Project file format specification: .project.json5 schema, file extensions, middleware types, init files, sync rules, and property reference." -globs: - - "**/*.project.json5" - - "**/*.project.json" - - "**/*.meta.json5" - - "**/*.meta.json" - - "**/*.model.json5" - - "**/*.model.json" +globs: **/*.project.json5,**/*.project.json,**/*.meta.json5,**/*.meta.json,**/*.model.json5,**/*.model.json +alwaysApply: false --- # Atlas Project File Format diff --git a/.cursor/rules/atlas-src.mdc b/.cursor/rules/atlas-src.mdc index 1390c938..611dac43 100644 --- a/.cursor/rules/atlas-src.mdc +++ b/.cursor/rules/atlas-src.mdc @@ -1,8 +1,6 @@ --- -description: "Rust server/CLI implementation: snapshot system, middleware, commands, syncback, and web API architecture." -globs: - - "src/**/*.rs" - - "crates/**/*.rs" +globs: src/**/*.rs,crates/**/*.rs +alwaysApply: false --- # Rojo Server/CLI (Rust) diff --git a/.cursor/rules/atlas-syncback.mdc b/.cursor/rules/atlas-syncback.mdc index e4ebb80b..236a3210 100644 --- a/.cursor/rules/atlas-syncback.mdc +++ b/.cursor/rules/atlas-syncback.mdc @@ -1,8 +1,6 @@ --- -description: "Syncback architecture: Roblox→filesystem synchronization, incremental vs clean modes, hash-based change detection, middleware selection, and property filtering." -globs: - - "src/syncback/**/*.rs" - - "src/cli/syncback.rs" +globs: src/syncback/**/*.rs,src/cli/syncback.rs +alwaysApply: false --- # Atlas Syncback Architecture diff --git a/.cursor/rules/plugin.mdc b/.cursor/rules/plugin.mdc index b2e7efdd..7a69eb54 100644 --- a/.cursor/rules/plugin.mdc +++ b/.cursor/rules/plugin.mdc @@ -1,9 +1,6 @@ --- -description: "Rojo Studio plugin specifics: Roact patterns, reconciler logic, WebSocket protocol, and plugin testing." -globs: - - "plugin/**/*.lua" - - "plugin/**/*.luau" - - "plugin/**/*.json" +globs: plugin/**/*.lua,plugin/**/*.luau,plugin/**/*.json +alwaysApply: false --- # Rojo Studio Plugin diff --git a/.cursor/rules/python.mdc b/.cursor/rules/python.mdc index 4330332e..d35b54e7 100644 --- a/.cursor/rules/python.mdc +++ b/.cursor/rules/python.mdc @@ -1,6 +1,5 @@ --- -description: Python code style and conventions -globs: ["**/*.py"] +globs: **/*.py alwaysApply: false --- diff --git a/.cursor/rules/rbx-dom.mdc b/.cursor/rules/rbx-dom.mdc index a807d4b8..0bd1a857 100644 --- a/.cursor/rules/rbx-dom.mdc +++ b/.cursor/rules/rbx-dom.mdc @@ -1,9 +1,6 @@ --- -description: "rbx-dom submodule: separate Git repo for Roblox format libraries. Has own CI/CD and release cycle." -globs: - - "rbx-dom/**/*.rs" - - "rbx-dom/**/*.lua" - - "rbx-dom/**/*.toml" +globs: rbx-dom/**/*.rs,rbx-dom/**/*.lua,rbx-dom/**/*.toml +alwaysApply: false --- # rbx-dom Submodule