Why: PR #209 is behind main by 14 commits (admin passwords, managed
interpreter path, U8 SQLite instance guard, EXT-20 regulations) and conflicted
in app wiring, host capabilities, migrations and the extension surface; the
user authorized merging the renderer line on 2026-10-18.
Evidence: content is the agent-exec transport 87a99ece (cursor worker, unit
backend-task10-sync-main-56a7f9f-r2, receipt
/tmp/cleanup-20261018/render/backend-sync-run2.json, SELF): gofmt, go build,
go vet and go test ./... (43 packages) passed. Host check: main migrations
1-36 unchanged, feature migrations moved from 36-47 to 37-48 in order with
identical SQL, surface.txt is the sorted union.
Impact: main's migration 36 instance_guard stays authoritative; databases that
ran unmerged feature builds with the old numbering must be recreated.
SurfaceVersion becomes 2.24.0-experimental.
Refs: PR #209, Backend main 56a7f9f
Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.2 KiB
Go
72 lines
2.2 KiB
Go
package store
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestMigrationCompatRegistered(t *testing.T) {
|
|
if len(migrationBreaksOldReaders) != len(migrations) {
|
|
t.Fatalf("兼容登记 %d 条,迁移 %d 条", len(migrationBreaksOldReaders), len(migrations))
|
|
}
|
|
for _, m := range migrations {
|
|
if _, ok := migrationBreaksOldReaders[m.version]; !ok {
|
|
t.Fatalf("迁移 v%d %s 未登记是否破坏旧制品读取", m.version, m.name)
|
|
}
|
|
}
|
|
if SchemaTarget() != latestMigrationVersion() {
|
|
t.Fatalf("target=%d latest=%d", SchemaTarget(), latestMigrationVersion())
|
|
}
|
|
if SchemaCompatFloor() < 0 || SchemaCompatFloor() > SchemaTarget() {
|
|
t.Fatalf("compatFloor=%d target=%d", SchemaCompatFloor(), SchemaTarget())
|
|
}
|
|
}
|
|
|
|
func TestMigrationTailKeepsAdoptedExecEnvBeforeFeatureHistory(t *testing.T) {
|
|
want := []struct {
|
|
version int
|
|
name string
|
|
}{
|
|
{35, "exec_env_layers"},
|
|
{36, "instance_guard"},
|
|
{37, "work_task_bindings"},
|
|
{38, "trusted_context_manifests"},
|
|
{39, "workflow_step_sources"},
|
|
{40, "context_manifest_resolve_scope"},
|
|
{41, "scrub_candidate_context_scope_text"},
|
|
{42, "command_audit_attribution_snapshot"},
|
|
{43, "project_audit_committed_links"},
|
|
{44, "project_audit_committed_prefix"},
|
|
{45, "project_audit_all_writers_guard"},
|
|
{46, "project_work_observation_outbox"},
|
|
{47, "human_decision_proofs"},
|
|
{48, "document_render_deliveries"},
|
|
}
|
|
for _, item := range want {
|
|
if got, ok := MigrationName(item.version); !ok || got != item.name {
|
|
t.Fatalf("migration v%d=%q,%v want %q,true", item.version, got, ok, item.name)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestLegacyFeatureMigrationIdentitiesAreNeverAliases(t *testing.T) {
|
|
for version, legacyName := range legacyFeatureMigrationNames {
|
|
err := ValidateMigrationIdentity(version, legacyName)
|
|
if err == nil {
|
|
t.Fatalf("legacy v%d %q was accepted", version, legacyName)
|
|
}
|
|
if got := err.Error(); !containsAll(got, "migration identity mismatch", "legacy feature migration numbering") {
|
|
t.Fatalf("legacy v%d %q was not explicitly rejected: %v", version, legacyName, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func containsAll(value string, parts ...string) bool {
|
|
for _, part := range parts {
|
|
if !strings.Contains(value, part) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|