Route executions through neutral snapshots

This commit is contained in:
2026-10-11 01:25:45 +00:00
parent 24e8cd8629
commit 7e5f84bf16
12 changed files with 217 additions and 191 deletions

View File

@@ -106,7 +106,7 @@ func TestRunnableCommandCapturesChildrenAndLeavesOriginalUnchanged(t *testing.T)
if err != nil {
t.Fatalf("runnable parent with children rejected: %v", err)
}
if _, ok := app.commandAt([]string{"parent", "child"}); !ok {
if len(app.commands["parent"].command.record.children) != 1 {
t.Fatal("child declaration was not installed")
}
}
@@ -122,7 +122,7 @@ func TestGroupCapturesChildrenAndSkipsNestedAbsence(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if _, ok := app.commandAt([]string{"parent", "visible"}); !ok {
if len(app.commands["parent"].command.record.children) != 2 {
t.Fatal("captured child missing")
}
}
@@ -160,11 +160,11 @@ func TestNoOpOnlyRegistrationPreservesRoutingSnapshot(t *testing.T) {
if err != nil {
t.Fatal(err)
}
before := app.bridgeTree()
before := app.routeSnapshot()
if err := app.Register(NoCommand()); err != nil {
t.Fatal(err)
}
if after := app.bridgeTree(); after != before {
if after := app.routeSnapshot(); after != before {
t.Fatal("no-op-only registration invalidated derived metadata")
}
}
@@ -179,10 +179,10 @@ func TestCapturedDeclarationCanBeInstalledIntoMultipleApps(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if _, ok := first.commandAt([]string{"tools", "run"}); !ok {
if len(first.commands["tools"].command.record.children) != 1 {
t.Fatal("first app lost reused declaration")
}
if _, ok := second.commandAt([]string{"tools", "run"}); !ok {
if len(second.commands["tools"].command.record.children) != 1 {
t.Fatal("second app lost reused declaration")
}
}