dev-reload: trusted root is the dev root, so dev-watch live-slots reloads load
dev-watch writes the reload pointer under artifacts/dev-reload/live-slots, a sibling of slots; a slot-directory root refused every watch reload and the reopen path. Test: a sibling directory loads inside an explicit root, not under the default root, and an outside assembly is still refused. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d44666ec69
commit
e0fc49b720
2 changed files with 18 additions and 1 deletions
|
|
@ -196,7 +196,7 @@ function Start-AquariumProcess {
|
|||
"--shader-source", (Join-Path $SlotPath "Render\Shaders\D3D12HeightField.hlsl"),
|
||||
"--client-assembly", $LiveAssemblyPath,
|
||||
"--client-reload-pointer", $liveReloadPointerPath,
|
||||
"--client-trusted-root", $slotRoot
|
||||
"--client-trusted-root", $devRoot
|
||||
)
|
||||
if ($RunHeadless) {
|
||||
$arguments += "--headless"
|
||||
|
|
|
|||
|
|
@ -38,6 +38,23 @@ public sealed class ClientRuntimeLoaderTrustTests : IDisposable
|
|||
Assert.NotNull(loader.Runtime);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SiblingDirectoryOfTheInitialAssemblyLoadsOnlyInsideTheExplicitRoot()
|
||||
{
|
||||
// dev-watch reloads from live-slots, a sibling of the slot the host started in.
|
||||
var slot = Directory.CreateDirectory(Path.Combine(trusted, "slots", "s1")).FullName;
|
||||
var live = Directory.CreateDirectory(Path.Combine(trusted, "live-slots", "s2")).FullName;
|
||||
var sibling = Copy(live);
|
||||
using var loader = new ClientRuntimeLoader(Options, Copy(slot), trustedRoot: trusted);
|
||||
loader.Load();
|
||||
loader.Reload(sibling, Options);
|
||||
Assert.Throws<InvalidOperationException>(() => loader.Reload(Copy(outside), Options));
|
||||
|
||||
using var narrow = new ClientRuntimeLoader(Options, Path.Combine(slot, "client.dll"));
|
||||
narrow.Load();
|
||||
Assert.Throws<InvalidOperationException>(() => narrow.Reload(sibling, Options)); // default root is the initial directory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InitialAssemblyOutsideTheExplicitRootIsRefused()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue