fix(statestore): build the recovery control-plane server on the shared step vocabulary
After the rebase onto main, controlplane.NewServer takes the step vocabulary it resolves definitions against (controlplane.ResourceStore, *workflow.Manager) and returns (Server, error). Both offline call sites still passed the store alone, so internal/app/archied stopped compiling -- and with it cmd/archie-state-store, cmd/archied and cmd/archie-gateway. validate and rollback now build their server through openStateStoreControlPlane, the root helper the served path already uses, so the offline checks resolve the same shared provider set (internal/infrastructure/workflowsteps) as the process whose verdict they predict, and the constructor's error is returned as a refusal rather than dropped. No second vocabulary call site: the fwmp pin on openStateStoreControlPlane covers these paths unchanged. The test's seeding helper builds its server from the same shared set (workflowsteps.NewManager) because it cannot call the unexported root helper; an empty manager there would seed values the served path never validates against. That is not merely a claim: with an empty manager the three validate tests fail with `workflow "bootstrap" step 1: unknown type "bootstrap.prepare"`, so they already pin that the offline path resolves a live, shared vocabulary.
This commit is contained in:
1 parent
b5b58c370a
commit
21c6aca513
2 files changed
+32
-4
No files matched your search
@@ -11,6 +11,12 @@
|
||||
// cannot stop the process that runs it, so the snapshot that makes a failed
|
||||
// update reversible is taken against a serving store through SQLite's own
|
||||
// consistent copy.
|
||||
//
|
||||
// The control-plane server both validate and rollback read through is built by
|
||||
// openStateStoreControlPlane -- the same root helper the served path uses -- so
|
||||
// the offline checks resolve the same workflow step vocabulary as the process
|
||||
// whose verdict they predict, and a constructor error is a refusal here rather
|
||||
// than a server that would validate against a different vocabulary.
|
||||
package archied
|
||||
|
||||
import (
|
||||
@@ -19,7 +25,6 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/controlplane"
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
pb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
|
||||
@@ -131,7 +136,10 @@ func validateStore(ctx context.Context, options StateStoreRecoveryOptions) (stri
|
||||
}
|
||||
defer func() { _ = st.Close() }()
|
||||
|
||||
server := controlplane.NewServer(st)
|
||||
server, err := openStateStoreControlPlane(st)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// Is there a resources table at all? A store written before the control plane
|
||||
// existed has none, and the State Store creates it and seeds every kind from
|
||||
// this same config on its next start -- so there is nothing stored to check
|
||||
@@ -210,7 +218,10 @@ func rollbackResource(ctx context.Context, options StateStoreRecoveryOptions) (s
|
||||
}
|
||||
defer func() { _ = st.Close() }()
|
||||
|
||||
server := controlplane.NewServer(st)
|
||||
server, err := openStateStoreControlPlane(st)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if !server.Owns(options.Kind) {
|
||||
return "", fmt.Errorf("unknown resource kind %q", options.Kind)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user