Why: a rollback can only be safe when the candidate says which schema it will migrate to and whether older binaries can still read that schema. A new migration that forgets to register that fact must fail the test. Evidence: go test ./internal/store/ ./pkg/identity/ -run 'TestMigrationCompat|TestCapabilities' passed. Impact: version --json and identity capabilities include schema.target and schema.compatFloor. Every migration version is listed in migrationBreaksOldReaders. Current versions do not break old readers, so the floor stays 0. Refs: recovery plan r3.1 D2 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"agent-system-backend/internal/app"
|
||||
"agent-system-backend/internal/store"
|
||||
)
|
||||
|
||||
// Usage 无参/未知子命令时打印到 stderr 的用法行。探测契约:同时含 "identity"
|
||||
@@ -65,6 +66,7 @@ func NewDocument(product, version string) Document {
|
||||
Version: version,
|
||||
Identity: IdentityCaps{Ops: []string{"ensure", "verify"}, Open: "existing-no-migrate", DSN: "env"},
|
||||
CLI: CLICaps{UnknownSubcommand: "reject"},
|
||||
Schema: &SchemaCaps{Target: store.SchemaTarget(), CompatFloor: store.SchemaCompatFloor()},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ func TestCapabilities(t *testing.T) {
|
||||
if doc.Protocol != 1 || doc.Identity.Open != "existing-no-migrate" || doc.CLI.UnknownSubcommand != "reject" {
|
||||
t.Fatalf("能力文档异常:%+v", doc)
|
||||
}
|
||||
if doc.Schema == nil || doc.Schema.Target != store.SchemaTarget() || doc.Schema.CompatFloor != store.SchemaCompatFloor() {
|
||||
t.Fatalf("schema 能力异常:%+v", doc.Schema)
|
||||
}
|
||||
}
|
||||
|
||||
func migratedData(t *testing.T) (string, int) {
|
||||
|
||||
Reference in New Issue
Block a user