Pin the sink-off report in readHost and the timeout hint, and the a/../b capture path
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
673da3e62f
commit
bb60fdfbce
3 changed files with 33 additions and 1 deletions
|
|
@ -130,6 +130,34 @@ public sealed class BrokkrCommandCliTests
|
|||
Assert.False(Directory.Exists(Path.GetDirectoryName(project.StorePath)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ReadHostReportsTheSinkOff()
|
||||
{
|
||||
using var project = new ScratchProject();
|
||||
using var editor = await EditorProbe.StartAsync(project.StorePath);
|
||||
editor.AgentCommandsEnabled = false;
|
||||
await editor.TickAsync();
|
||||
|
||||
var result = await RunAsync("--unity-cache", project.StorePath, "--action", "readHost");
|
||||
|
||||
Assert.Equal(0, result.Exit);
|
||||
Assert.Contains("agent-commands: off", result.Out);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TimeoutSaysWhenTheEditorReportsTheSinkOff()
|
||||
{
|
||||
using var project = new ScratchProject();
|
||||
using var editor = await EditorProbe.StartAsync(project.StorePath);
|
||||
editor.AgentCommandsEnabled = false;
|
||||
await editor.TickAsync();
|
||||
editor.Dispose();
|
||||
|
||||
var result = await RunAsync("--unity-cache", project.StorePath, "--action", "refreshAssets", "--wait-ms", "600");
|
||||
|
||||
Assert.Equal(2, result.Exit);
|
||||
Assert.Contains("agent commands off", result.Error);
|
||||
}
|
||||
[Fact]
|
||||
public async Task ReadHostShowsWhetherTheSinkIsEnabled()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public sealed class BrokkrCommandPolicyTests
|
|||
[InlineData("../../x.png")]
|
||||
[InlineData("..\\x.png")]
|
||||
[InlineData("a/../../x.png")]
|
||||
[InlineData("a/../b.png")]
|
||||
[InlineData("shot.png:stream")]
|
||||
[InlineData("x.txt")]
|
||||
[InlineData("x.cs")]
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ internal sealed class EditorProbe : IDisposable
|
|||
// What the "editor" answers with. Real Unity answers accepted or failed per the executor.
|
||||
internal Func<BrokkrUnityCommand, string> StatusFor { get; set; } = _ => "accepted";
|
||||
|
||||
// What the host snapshot says about the sink; the real editor reports the operator's toggle.
|
||||
internal bool AgentCommandsEnabled { get; set; } = true;
|
||||
|
||||
private EditorProbe(CultMeshNode node)
|
||||
{
|
||||
this.node = node;
|
||||
|
|
@ -59,7 +62,7 @@ internal sealed class EditorProbe : IDisposable
|
|||
|
||||
await node.Database.PutAsync(
|
||||
new CultRecordKey("unity/host/current"),
|
||||
new BrokkrHostSnapshot { observedAt = DateTime.UtcNow.ToString("O"), projectPath = "probe", agentCommandsEnabled = true });
|
||||
new BrokkrHostSnapshot { observedAt = DateTime.UtcNow.ToString("O"), projectPath = "probe", agentCommandsEnabled = AgentCommandsEnabled });
|
||||
await node.FlushAsync(soft: true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue