feat(control-plane): harden host-scoped reconcile and acceptance evidence

- add batch-scoped reconcile_runs persistence and queries
- route batch detail and reconcile writes through batch_id/host_id
- refresh production boards with host-scope acceptance artifacts
- include latest real-host acceptance evidence for self_service and subscription
This commit is contained in:
phamnazage-jpg
2026-05-18 22:22:22 +08:00
parent 71cbaf5fa6
commit 85d495dd16
332 changed files with 5561 additions and 422 deletions

View File

@@ -439,6 +439,10 @@ func newSub2APIStubServer(t *testing.T, cfg sub2APIStubConfig) *httptest.Server
accountID, action := parts[0], parts[1]
switch action {
case "test":
if r.Method == http.MethodGet {
writeJSON(t, w, http.StatusOK, map[string]any{"data": map[string]any{"supported": true}})
return
}
if r.Method != http.MethodPost {
http.NotFound(w, r)
return
@@ -468,6 +472,12 @@ func newSub2APIStubServer(t *testing.T, cfg sub2APIStubConfig) *httptest.Server
if !mustStubAuth(t, w, r, cfg.requireAPIKey) {
return
}
if r.Method == http.MethodGet {
writeJSON(t, w, http.StatusOK, map[string]any{
"data": map[string]any{"supported": true},
})
return
}
if r.Method != http.MethodPost {
http.NotFound(w, r)
return

View File

@@ -108,8 +108,8 @@ func TestStoreInitRecordsMigrationLedgerOnce(t *testing.T) {
if err != nil {
t.Fatalf("first sqlite.Open() error = %v", err)
}
if got := countRows(t, store1.SQLDB(), "schema_migrations"); got != 3 {
t.Fatalf("schema_migrations row count after first open = %d, want 3", got)
if got := countRows(t, store1.SQLDB(), "schema_migrations"); got != 6 {
t.Fatalf("schema_migrations row count after first open = %d, want 6", got)
}
if err := store1.Close(); err != nil {
t.Fatalf("first store.Close() error = %v", err)
@@ -121,8 +121,8 @@ func TestStoreInitRecordsMigrationLedgerOnce(t *testing.T) {
}
defer closeTestStore(t, store2)
if got := countRows(t, store2.SQLDB(), "schema_migrations"); got != 3 {
t.Fatalf("schema_migrations row count after second open = %d, want 3", got)
if got := countRows(t, store2.SQLDB(), "schema_migrations"); got != 6 {
t.Fatalf("schema_migrations row count after second open = %d, want 6", got)
}
}
@@ -140,8 +140,8 @@ func TestStoreInitBackfillsLedgerForCompletePreLedgerSchema(t *testing.T) {
}
defer closeTestStore(t, store)
if got := countRows(t, store.SQLDB(), "schema_migrations"); got != 3 {
t.Fatalf("schema_migrations row count after backfill = %d, want 3", got)
if got := countRows(t, store.SQLDB(), "schema_migrations"); got != 6 {
t.Fatalf("schema_migrations row count after backfill = %d, want 6", got)
}
}

View File

@@ -87,6 +87,7 @@ func TestStoreRuntimePersistsOperationalRecords(t *testing.T) {
if _, err := store.ManagedResources().Create(ctx, sqlite.ManagedResource{
BatchID: batchID,
HostID: hostID,
ResourceType: "group",
HostResourceID: "group-1",
ResourceName: "deepseek-group",
@@ -113,6 +114,8 @@ func TestStoreRuntimePersistsOperationalRecords(t *testing.T) {
}
if _, err := store.ReconcileRuns().Create(ctx, sqlite.ReconcileRun{
BatchID: batchID,
HostID: hostID,
ProviderID: providerID,
Status: "drifted",
SummaryJSON: `{"missing_resources":1}`,