refactor(net): own live session composition
Extract reset, selection, entered-world, and route construction behind LiveSessionHost while preserving the sole LiveSessionController authority. Retain partial route and subscription cleanup for retry, and replace the embedded ACE-only shortcut with the exact named-retail unsigned skill formula. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
18d4b999de
commit
557eb7ef6b
22 changed files with 1430 additions and 236 deletions
|
|
@ -0,0 +1,60 @@
|
|||
using AcDream.App.Net;
|
||||
|
||||
namespace AcDream.App.Tests.Net;
|
||||
|
||||
public sealed class LiveSessionSubscriptionSetTests
|
||||
{
|
||||
[Fact]
|
||||
public void Dispose_RetriesOnlyFailedEdgesUntilTheyConverge()
|
||||
{
|
||||
var order = new List<int>();
|
||||
var subscriptions = new LiveSessionSubscriptionSet();
|
||||
subscriptions.Add(() => order.Add(1));
|
||||
int secondFailures = 1;
|
||||
subscriptions.Add(() =>
|
||||
{
|
||||
order.Add(2);
|
||||
if (secondFailures-- > 0)
|
||||
throw new InvalidOperationException("second failed");
|
||||
});
|
||||
int thirdFailures = 1;
|
||||
subscriptions.Add(() =>
|
||||
{
|
||||
order.Add(3);
|
||||
if (thirdFailures-- > 0)
|
||||
throw new IOException("third failed");
|
||||
});
|
||||
|
||||
AggregateException error = Assert.Throws<AggregateException>(
|
||||
subscriptions.Dispose);
|
||||
|
||||
Assert.Equal([3, 2, 1], order);
|
||||
Assert.Collection(
|
||||
error.InnerExceptions,
|
||||
exception => Assert.IsType<IOException>(exception),
|
||||
exception => Assert.IsType<InvalidOperationException>(exception));
|
||||
|
||||
subscriptions.Dispose();
|
||||
subscriptions.Dispose();
|
||||
|
||||
Assert.Equal([3, 2, 1, 3, 2], order);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Dispose_PersistentFailureNeverReplaysSuccessfulEdges()
|
||||
{
|
||||
var order = new List<int>();
|
||||
var subscriptions = new LiveSessionSubscriptionSet();
|
||||
subscriptions.Add(() => order.Add(1));
|
||||
subscriptions.Add(() =>
|
||||
{
|
||||
order.Add(2);
|
||||
throw new InvalidOperationException("persistent");
|
||||
});
|
||||
|
||||
Assert.Throws<AggregateException>(subscriptions.Dispose);
|
||||
Assert.Throws<AggregateException>(subscriptions.Dispose);
|
||||
|
||||
Assert.Equal([2, 1, 2], order);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue