From efb5d206c108a13becbc3e6f93d3c34545cec414 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 28 Sep 2026 20:22:45 +0800 Subject: [PATCH] test(db,contracts): register the 0037 tables and agent_run.await_wake in schema checks Co-Authored-By: Claude Opus 5.5 --- packages/contracts/test/db-sync.test.ts | 10 +++++++--- packages/db/test/schema.test.ts | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/contracts/test/db-sync.test.ts b/packages/contracts/test/db-sync.test.ts index 4aacaa29..4e080743 100644 --- a/packages/contracts/test/db-sync.test.ts +++ b/packages/contracts/test/db-sync.test.ts @@ -39,8 +39,8 @@ type Obj = z.ZodObject; const ROWS: Record = { AcquisitionPlan: { row: C.AcquisitionPlan }, AcquisitionSlot: { row: C.AcquisitionSlot, apiOnly: ["currentAsset"] }, - // upstream_id 只在服务端使用(runAgent 选上游),不在 AgentRun 视图里 - AgentRun: { row: C.AgentRun, dbOnly: ["upstreamId"] }, + // upstream_id 只在服务端使用;await_wake 是挂起等待子会话时的唤醒信号(C1-B),都不进 AgentRun 视图 + AgentRun: { row: C.AgentRun, dbOnly: ["upstreamId", "awaitWake"] }, AgentRunEvent: { row: C.AgentRunEventRow }, AgentRunMessage: { row: C.AgentRunMessage }, CapabilityInvocation: { row: C.CapabilityInvocation }, @@ -132,8 +132,12 @@ const INTERNAL_TABLES = [ // W9-I 进程心跳(0034):服务端内部,经 /system/health 的专用 DTO 暴露 "ProcessHeartbeat", "ProcessHeartbeatSample", + // C1-B 恢复码 / Passkey / WebAuthn 挑战(0037):服务端内部,经 contracts/auth.ts 的专用 DTO 暴露 + "AdminRecoveryCode", + "AdminPasskey", + "WebauthnChallenge", ]; -const INTERNAL_ENUMS = ["TasksOpLedgerStatus"]; +const INTERNAL_ENUMS = ["TasksOpLedgerStatus", "WebauthnChallengePurpose"]; /** DB 枚举类型名 → contracts 枚举 */ const ENUMS: Record = { diff --git a/packages/db/test/schema.test.ts b/packages/db/test/schema.test.ts index c6462e7e..b49cbfe1 100644 --- a/packages/db/test/schema.test.ts +++ b/packages/db/test/schema.test.ts @@ -109,6 +109,10 @@ const EXPECTED_TABLES = [ // W9-I 进程心跳(0034) "process_heartbeat", "process_heartbeat_sample", + // C1-B 恢复码 / Passkey / WebAuthn 挑战(0037) + "admin_recovery_code", + "admin_passkey", + "webauthn_challenge", ].sort(); /** 不走 entityTable() 的表:追加型/引擎自有表,没有 uuid id + created_at/updated_at 三件套 */ @@ -128,6 +132,9 @@ const NON_ENTITY_TABLES = [ // 进程心跳:instance_id 主键 / 只追加的采样 "process_heartbeat", "process_heartbeat_sample", + // 一次性凭据:只记创建 / 用掉的时间 + "admin_recovery_code", + "webauthn_challenge", ]; describe.skipIf(skip)("schema migrations (real PG)", () => {