feat: reconcile retained client commands

This commit is contained in:
2026-09-06 07:18:52 +00:00
parent 3ecab55faa
commit 7e902d1103
3 changed files with 81 additions and 7 deletions
@@ -39,7 +39,19 @@ func TestWebSocketHelloWelcome_HP_SES_06(t *testing.T) {
if result.ID == "" || result.Generation != 1 || result.Protocol.GetMajor() != 1 {
t.Fatalf("handshake result = %#v", result)
}
if reconciled, err := agent.Reconcile(ctx, transport, result, &rvboxv1.ReconcileSnapshot{}, agentproto.DefaultLimits()); err != nil || reconciled == nil {
t.Fatalf("empty reconciliation = %#v, %v", reconciled, err)
activeIssue := "019c46f1-1d02-7000-8000-000000000072"
terminalIssue := "019c46f1-1d02-7000-8000-000000000073"
reconciled, err := agent.Reconcile(ctx, transport, result, &rvboxv1.ReconcileSnapshot{RetainedCommands: []*rvboxv1.ReconcileCommandState{
{IssueUuid: activeIssue, Lifecycle: rvboxv1.CommandLifecycle_COMMAND_RUNNING, CommandRevision: 1, ImmutableRequestSha256: make([]byte, 32)},
{IssueUuid: terminalIssue, Lifecycle: rvboxv1.CommandLifecycle_COMMAND_SUCCEEDED, CommandRevision: 1, Tombstoned: true, ImmutableRequestSha256: make([]byte, 32)},
}}, agentproto.DefaultLimits())
if err != nil {
t.Fatal(err)
}
if got := reconciled.GetTerminateLocalIssueUuids(); len(got) != 1 || got[0] != activeIssue {
t.Fatalf("terminate local issues = %v", got)
}
if got := reconciled.GetDiscardLocalTerminalIssueUuids(); len(got) != 1 || got[0] != terminalIssue {
t.Fatalf("discard local terminal issues = %v", got)
}
}