test(caps): golden coverage for every WO-WZ-019 method (full provisioner family + jobs.progress)

The cms host parity gate requires one golden per registered handler; this
completes the set so TestGoldenParity's count check holds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Alex Dunmow 2026-07-04 10:17:49 +08:00
parent 9e39119555
commit b6e9fdd531
23 changed files with 143 additions and 0 deletions

View File

@ -742,6 +742,127 @@ func TestCapabilityRoundTrip(t *testing.T) {
}
},
},
// --- remaining provisioner methods (WO-WZ-019) ---
{
name: "provisioner_ensure_data_table", wantMethod: "provisioner.ensure_data_table",
resp: &abiv1.ProvisionerEnsureDataTableResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
err := cs.Provisioner.EnsureDataTable(plugin.DataTableConfig{
Key: "playgrounds", Name: "Playgrounds", Description: "d",
Schema: []byte(`{"fields":[]}`), PrimaryKey: "id",
})
if err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_ensure_setting", wantMethod: "provisioner.ensure_setting",
resp: &abiv1.ProvisionerEnsureSettingResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
if err := cs.Provisioner.EnsureSetting("review_dimensions", map[string]any{"max": float64(5)}); err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_override_site_settings", wantMethod: "provisioner.override_site_settings",
resp: &abiv1.ProvisionerOverrideSiteSettingsResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
if err := cs.Provisioner.OverrideSiteSettings(map[string]any{"default_template": "homepage"}); err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_register_embedding_config", wantMethod: "provisioner.register_embedding_config",
resp: &abiv1.ProvisionerRegisterEmbeddingConfigResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
err := cs.Provisioner.RegisterEmbeddingConfig(plugin.EmbeddingConfigDef{
TableKey: "playgrounds", TextTemplate: "{{name}}", Enabled: true,
})
if err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_ensure_embed", wantMethod: "provisioner.ensure_embed",
resp: &abiv1.ProvisionerEnsureEmbedResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
err := cs.Provisioner.EnsureEmbed(plugin.EmbedConfig{
Key: "playground-card", Title: "Playground Card", Description: "d",
Icon: "📍", LabelField: "name", Template: "<div>{{name}}</div>",
DataSource: plugin.EmbedDataSource{Type: "row", TableKey: "playgrounds"},
})
if err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_ensure_job_schedule", wantMethod: "provisioner.ensure_job_schedule",
resp: &abiv1.ProvisionerEnsureJobScheduleResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
err := cs.Provisioner.EnsureJobSchedule(plugin.JobScheduleConfig{
JobType: "bounty_rotation", CronExpression: "0 3 * * *", Config: []byte(`{"n":3}`),
})
if err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_update_data_table_row_field", wantMethod: "provisioner.update_data_table_row_field",
resp: &abiv1.ProvisionerUpdateDataTableRowFieldResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
if err := cs.Provisioner.UpdateDataTableRowField(ctx, idRow, "status", "active"); err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_disable_orphaned_job_schedules", wantMethod: "provisioner.disable_orphaned_job_schedules",
resp: &abiv1.ProvisionerDisableOrphanedJobSchedulesResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
if err := cs.Provisioner.DisableOrphanedJobSchedules([]string{"bounty_rotation", "reindex"}); err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_ensure_plugin", wantMethod: "provisioner.ensure_plugin",
resp: &abiv1.ProvisionerEnsurePluginResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
if err := cs.Provisioner.EnsurePlugin("symposium"); err != nil {
t.Fatal(err)
}
},
},
{
name: "provisioner_ensure_custom_color", wantMethod: "provisioner.ensure_custom_color",
resp: &abiv1.ProvisionerEnsureCustomColorResponse{},
run: func(t *testing.T, cs plugin.CoreServices) {
err := cs.Provisioner.EnsureCustomColor(plugin.CustomColorConfig{
Name: "brand", LightValue: "oklch(0.7 0.1 200)", DarkValue: "oklch(0.4 0.1 200)", Source: "myplugin",
})
if err != nil {
t.Fatal(err)
}
},
},
// --- jobs.progress (WO-WZ-019; sent by the job dispatch path, not a
// CoreServices stub, so the case drives the transport directly) ---
{
name: "jobs_progress", wantMethod: "jobs.progress",
resp: &abiv1.JobsProgressResponse{},
run: func(t *testing.T, _ plugin.CoreServices) {
req := &abiv1.JobsProgressRequest{Current: 2, Total: 5, Message: "halfway"}
if err := f.call("jobs.progress", req, &abiv1.JobsProgressResponse{}); err != nil {
t.Fatal(err)
}
},
},
}
for _, tc := range cases {

View File

@ -0,0 +1 @@
halfway

View File

@ -0,0 +1,3 @@
bounty_rotation
reindex

View File

@ -0,0 +1,2 @@
brandoklch(0.7 0.1 200)oklch(0.4 0.1 200)"myplugin

View File

@ -0,0 +1,2 @@
playgrounds Playgroundsd" {"fields":[]}*id

View File

@ -0,0 +1,2 @@
playground-cardPlayground Cardd"📍*name2<div>{{name}}</div>:rowB playgrounds

View File

@ -0,0 +1,2 @@
bounty_rotation 0 3 * * *{"n":3}

View File

@ -0,0 +1,2 @@
symposium

View File

@ -0,0 +1,2 @@
review_dimensions {"max":5}

View File

@ -0,0 +1,2 @@
{"default_template":"homepage"}

View File

@ -0,0 +1,2 @@
playgrounds{{name}}

View File

@ -0,0 +1,2 @@
$bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbbstatus"active"