server init adds the guardrails to a server.yaml from before them
An upgrade replaces the binary and leaves server.yaml alone, so a control plane installed before guardrails stayed unguarded. Run again, init now appends the baseline guard section (and so fetches the judge) when the file has no guard key at all, keeping the old file as server.yaml.bak-<time>. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3558dba485
commit
dc65ea6899
5 files changed
+103
-3
No files matched your search
@@ -126,8 +126,10 @@ func TestInitNeverOverwritesTheConfiguration(t *testing.T) {
|
||||
if err := in.run(context.Background()); err != nil {
|
||||
t.Fatalf("%v\n%s", err, out)
|
||||
}
|
||||
if got, _ := os.ReadFile(in.configPath()); string(got) != mine {
|
||||
t.Error("an existing server.yaml was rewritten")
|
||||
// Kept as written; only the guardrails it predates are added after it.
|
||||
got, _ := os.ReadFile(in.configPath())
|
||||
if !strings.HasPrefix(string(got), mine) || !strings.Contains(string(got[len(mine):]), "\nguard:\n") {
|
||||
t.Errorf("server.yaml is not the old file with guard: after it:\n%s", got)
|
||||
}
|
||||
// And the store it names is the one used.
|
||||
if _, err := os.Stat(filepath.Join(in.stateDir, "mine.db")); err != nil {
|
||||
|
||||
Reference in new issue
Block a user