mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Add tests for PatchSet and ServeSession functionality
- Introduced comprehensive tests for the `PatchSet` module, covering methods such as `hasRemoves`, `hasAdditions`, `hasUpdates`, and various ID and instance checks. - Added a new test suite for `ServeSession`, focusing on WebSocket message handling and confirmation behavior, ensuring correct merging and application of patches. - Implemented edge case tests in `ChangeBatcher` to verify data integrity during rapid changes and instance removals. - Enhanced `applyPatch` tests to handle scenarios involving missing instances and ignored class names, ensuring robust patch application logic.
This commit is contained in:
parent
a2c8a583a6
commit
4f3e66bec9
11 changed files with 3026 additions and 20 deletions
|
|
@ -714,6 +714,8 @@ function App:startSession()
|
|||
end
|
||||
end)
|
||||
|
||||
local initialSyncConfirmed = false
|
||||
|
||||
serveSession:setConfirmCallback(function(instanceMap, patch, serverInfo)
|
||||
-- Filter out the DataModel name change from the patch
|
||||
-- The project name (DataModel.Name) is managed by Studio independently
|
||||
|
|
@ -721,6 +723,17 @@ function App:startSession()
|
|||
|
||||
local isOneShotMode = Settings:get("oneShotSync")
|
||||
|
||||
-- ONE-SHOT MODE: After the initial sync is confirmed, skip any
|
||||
-- subsequent patches entirely. These are server echoes from processing
|
||||
-- our pull request (e.g. VFS re-snapshots after file deletions).
|
||||
-- The session is about to disconnect — applying them is pointless,
|
||||
-- and without this guard the echo triggers a second confirmation
|
||||
-- dialog that races with endSession() and gets stuck.
|
||||
if isOneShotMode and initialSyncConfirmed then
|
||||
Log.info("One-shot mode: skipping post-initial-sync echo patch")
|
||||
return "Skip"
|
||||
end
|
||||
|
||||
-- ONE-SHOT MODE: Never auto-accept, always require explicit confirmation
|
||||
-- This ensures nothing can "sneak through" without user review
|
||||
if not isOneShotMode then
|
||||
|
|
@ -796,6 +809,7 @@ function App:startSession()
|
|||
-- The actual disconnect is handled by setInitialSyncCompleteCallback
|
||||
-- to ensure any pending writes complete first
|
||||
if Settings:get("oneShotSync") then
|
||||
initialSyncConfirmed = true
|
||||
return result
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue