Publish schema target and compatibility floor
ci / vet-and-test (pull_request) Successful in 47s

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:
2026-10-12 14:11:07 +00:00
co-authored by Cursor
parent 69ea7dcc14
commit 5c26a86331
4 changed files with 74 additions and 0 deletions
+2
View File
@@ -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()},
}
}
+3
View File
@@ -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) {