Files
story/internal/elderagent/legacy_sync_integration_test.go
T
Codex Local bf1233d5df
ci / verify (push) Canceled after 0s
feat: expand companion platform, device controls, and memoir workflows
Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
2026-10-08 10:06:44 +08:00

38 lines
1.5 KiB
Go

package elderagent
import (
"context"
"strings"
"testing"
"github.com/google/uuid"
)
func TestPersonaSyncDefersLegacyUnresolvedMedia(t *testing.T) {
f := personaTestFixture(t)
f.sync(t)
sid := uuid.NewString()
f.exec(t, `INSERT INTO call_session(id,device_id,tenant_id,subject_id,boot_id,hook_event_id,call_generation,binding_generation,manifest_status,local_audio_off,sdk_stopped,remote_state) VALUES($1::uuid,$2::uuid,'10000000-0000-0000-0000-000000000001',$3::uuid,$1::uuid,$1,0,0,'ISSUED',true,true,'UNKNOWN')`, sid, f.device, f.id)
f.exec(t, `UPDATE subject_profile SET preferred_name='旧链路新称呼' WHERE id=$1::uuid`, f.id)
if i := f.sync(t); i.PersonaSyncStatus != "DEFERRED" {
t.Fatal("legacy NULL budget bypassed active guard", i)
}
f.exec(t, `UPDATE call_session SET remote_state='STOPPED_OBSERVED' WHERE id=$1::uuid`, sid)
if i := f.sync(t); i.PersonaSyncStatus != "SYNCED" {
t.Fatal("completed legacy media blocked sync", i)
}
}
func TestPersonaSyncClearsVoicePermissionWithoutProfileEdit(t *testing.T) {
f := personaTestFixture(t)
f.sync(t)
f.exec(t, `UPDATE consent_snapshot SET effective_consents='{"voice_chat":false}' WHERE subject_id=$1::uuid`, f.id)
if err := f.s.SyncPending(context.Background()); err != nil {
t.Fatal(err)
}
i, err := f.s.Get(context.Background(), f.public)
if err != nil || i.PersonaSyncStatus != "SYNCED" || i.PersonalizationIncluded || strings.Contains(f.p.role(), "旧称呼") || strings.Contains(f.p.role(), "京剧") {
t.Fatal("voice withdrawal kept profile on Bot", i, err)
}
}