Freeze SCUM guarded mutation run contract
This commit is contained in:
@@ -156,6 +156,61 @@ func TestRunJobResultRequestParsesTypedRCONTemplateEnvelope(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunJobResultRequestParsesGuardedMutationEnvelope(t *testing.T) {
|
||||
payload := `{
|
||||
"runEndpointId":"run-local",
|
||||
"sessionToken":"run-session",
|
||||
"jobId":"job-mutation",
|
||||
"leaseToken":"lease-mutation",
|
||||
"attempt":1,
|
||||
"state":"succeeded",
|
||||
"progress":{"percent":100,"message":"done"},
|
||||
"executionResult":{
|
||||
"kind":"sqlite.guarded-mutation",
|
||||
"guardedMutation":{
|
||||
"requestId":"request-mutation",
|
||||
"jobId":"job-mutation",
|
||||
"binding":{"serverInstanceId":"server-scum","runBindingId":"runtime-binding-server-scum","runEndpointId":"run-local","pluginId":"server.scum","pluginVersion":"1.0.0","adapterVersion":"scum-live-data-v0","gameVersion":"1.0.0","databaseIdentity":"scum-database"},
|
||||
"status":"succeeded",
|
||||
"capability":"profile-xml.write",
|
||||
"targetKey":"scum-mutation-db",
|
||||
"templateKey":"profile.attributes.patch.v1",
|
||||
"adapterVersion":"scum-live-data-v0",
|
||||
"schemaFingerprint":"sha256:` + strings.Repeat("a", 64) + `",
|
||||
"assetDigest":"sha256:` + strings.Repeat("d", 64) + `",
|
||||
"sourceFingerprint":"sha256:` + strings.Repeat("c", 64) + `",
|
||||
"targetIdentityDigest":"sha256:` + strings.Repeat("1", 64) + `",
|
||||
"expectedRowDigest":"sha256:` + strings.Repeat("2", 64) + `",
|
||||
"expectedValueDigest":"sha256:` + strings.Repeat("3", 64) + `",
|
||||
"expectedXmlDigest":"sha256:` + strings.Repeat("4", 64) + `",
|
||||
"patchDigest":"sha256:` + strings.Repeat("5", 64) + `",
|
||||
"backupEvidenceDigest":"sha256:` + strings.Repeat("6", 64) + `",
|
||||
"offlineEvidenceDigest":"sha256:` + strings.Repeat("7", 64) + `",
|
||||
"dangerConfirmationDigest":"sha256:` + strings.Repeat("8", 64) + `",
|
||||
"readbackExpectationDigest":"sha256:` + strings.Repeat("9", 64) + `",
|
||||
"observedAt":"2026-08-13T00:00:00Z",
|
||||
"resultDigest":"sha256:` + strings.Repeat("b", 64) + `",
|
||||
"beforeDigest":"sha256:` + strings.Repeat("a", 64) + `",
|
||||
"afterDigest":"sha256:` + strings.Repeat("b", 64) + `",
|
||||
"readbackDigest":"sha256:` + strings.Repeat("c", 64) + `",
|
||||
"affectedRows":1,
|
||||
"readbackStatus":"confirmed",
|
||||
"safeSummary":"confirmed by declared readback",
|
||||
"limits":{"maxPayloadBytes":4096,"timeoutMs":5000,"busyTimeoutMs":250,"maxReadbackBytes":16384,"maxAffectedRows":1}
|
||||
}
|
||||
}
|
||||
}`
|
||||
var request RunJobResultRequest
|
||||
if err := json.Unmarshal([]byte(payload), &request); err != nil {
|
||||
t.Fatalf("unmarshal Run job result: %v", err)
|
||||
}
|
||||
domainRequest := request.ToDomain()
|
||||
result := domainRequest.ExecutionResult.GuardedMutation
|
||||
if result == nil || result.TemplateKey != "profile.attributes.patch.v1" || result.PatchDigest != "sha256:"+strings.Repeat("5", 64) || result.AffectedRows != 1 || result.ReadbackStatus != domain.SCUMMutationReadbackConfirmed {
|
||||
t.Fatalf("guardedMutation envelope did not parse: %+v", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAIProviderFromDomainCopiesModels(t *testing.T) {
|
||||
provider := domain.AIProvider{
|
||||
ID: "ai.openai",
|
||||
|
||||
Reference in New Issue
Block a user