Fix server crash when deleting folders

Handle the case where a folder's parent path no longer exists when
processing VFS removal events. This can happen when a folder and its
contents are deleted together, causing a race between removal events.

Added a regression test for this scenario.
This commit is contained in:
warsam 2026-01-27 16:03:44 -08:00
parent 4965165ad5
commit 752be0d56f
8 changed files with 137 additions and 4 deletions

View file

@ -0,0 +1,16 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-2:
Children: []
ClassName: Folder
Id: id-2
Metadata:
ignoreUnknownInstances: false
Name: remove_folder
Parent: "00000000000000000000000000000000"
Properties: {}
messageCursor: 1
sessionId: id-1

View file

@ -0,0 +1,38 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-2:
Children:
- id-3
ClassName: Folder
Id: id-2
Metadata:
ignoreUnknownInstances: false
Name: remove_folder
Parent: "00000000000000000000000000000000"
Properties: {}
id-3:
Children:
- id-4
ClassName: Folder
Id: id-3
Metadata:
ignoreUnknownInstances: false
Name: my-folder
Parent: id-2
Properties: {}
id-4:
Children: []
ClassName: StringValue
Id: id-4
Metadata:
ignoreUnknownInstances: false
Name: test
Parent: id-3
Properties:
Value:
String: "This file is inside my-folder\r\n"
messageCursor: 0
sessionId: id-1

View file

@ -0,0 +1,13 @@
---
source: tests/tests/serve.rs
expression: redactions.redacted_yaml(info)
---
expectedPlaceIds: ~
gameId: ~
placeId: ~
projectName: remove_folder
protocolVersion: 5
rootInstanceId: id-2
serverVersion: "[server-version]"
sessionId: id-1
unexpectedPlaceIds: ~

View file

@ -0,0 +1,13 @@
---
source: tests/tests/serve.rs
expression: "socket_packet.intern_and_redact(&mut redactions, ())"
---
body:
messageCursor: 1
messages:
- added: {}
removed:
- id-3
updated: []
packetType: messages
sessionId: id-1

View file

@ -0,0 +1,6 @@
{
"name": "remove_folder",
"tree": {
"$path": "src"
}
}

View file

@ -0,0 +1 @@
This file is inside my-folder