desk: envelope names, decider bounds, a failing port is unavailable, hardening tests

The door context carries mind, authority, subject and deciders (fork-card.md M5).
Deciders are 1 to 64 unique ids per Mind, refused at startup and again before any
door call. A throwing credential port or account lookup answers 503 unavailable.
Startup refuses two Minds sharing one socket. Behavioural tests for the per-Mind
list, the body cap to the byte, Retry-After, audience case, no-store, cancellation
and the stale-fork card read.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Heimdall 2026-11-10 20:15:05 +00:00
commit f03027d929
12 changed files with 449 additions and 18 deletions

View file

@ -35,6 +35,9 @@ public sealed class DeskWebApplicationFactory : TestWebApplicationFactory
public FakeDeskDoor Door { get; } = new();
public FakeDeskCredential Credential { get; } = new();
public static Dictionary<string, string?> DefaultConfiguration()
{
var values = new Dictionary<string, string?>
@ -49,14 +52,23 @@ public sealed class DeskWebApplicationFactory : TestWebApplicationFactory
{
values[$"Desk:Minds:{i}:Id"] = mind.Key;
values[$"Desk:Minds:{i}:Socket"] = SocketOf(mind.Key);
values[$"Desk:Minds:{i}:Deciders:0"] = Alice;
values[$"Desk:Minds:{i}:Deciders:1"] = Steward;
var deciders = DecidersOf(mind.Key);
for (var d = 0; d < deciders.Length; d++)
{
values[$"Desk:Minds:{i}:Deciders:{d}"] = deciders[d];
}
i++;
}
return values;
}
// A distinct list per Mind (different members, order and length), so a door context that carries another
// Mind's list cannot pass for the route Mind's.
public static string[] DecidersOf(string mindId) =>
mindId == "nibu" ? [Steward, Alice, Member] : [Alice, Steward];
public static string SocketOf(string mindId) =>
"/run/huginn/" + (string)DeskVectors.Root["transport"]!["mindRoutes"]!["minds"]![mindId]!;
@ -75,7 +87,7 @@ public sealed class DeskWebApplicationFactory : TestWebApplicationFactory
{
builder.ConfigureServices(services =>
{
services.AddSingleton<IDeskCredential, FakeDeskCredential>();
services.AddSingleton<IDeskCredential>(Credential);
services.AddSingleton<IDeskDoor>(Door);
});
}