Root 維運操作
供維運人員內部使用的排程、永久清除、復原、索引建議、保留期清理、資料修復、composer 儲存設定與一次性回填操作;這些路由不是應用程式對外 API。
其中有幾個會直接寫入或刪除生產環境的資料。執行前請先讀該端點的注意事項;若該路由提供預覽模式(apply=false、dry_run=true、execute=false),請先跑預覽並確認它回報的內容。各路由的預設值不同:apply 與 execute 預設為預覽,但索引套用路由預設 dry_run=false,除非你要求 dry run,否則會直接執行 DDL。
Trigger-secrets 清理會跨租戶改寫次要 IaC-state 與 table-history 儲存中較舊的憑證。預設為 execute=false;先檢查各儲存區的 ticket 計數,再用 execute=true 改寫。即時 trigger/command 設定與讀取回應保持不變。原始碼已有此能力,不代表任何環境已執行這項操作人員遷移。
資料表的 write_policy: commands_only 不會擋下維運操作。永久清除資料表(table_lifecycle)與 sort-order 回填(platform_operator_maintenance)都是已公布的例外,而對這類資料表執行的每個例外操作都會寫入一筆 ct.write_policy.exemption 稽核事件。
/root/hotfix/custom-table-trigger-secrets-scrub啟動跨租戶的操作人員遷移,處理舊 IaC trigger/command 基準與 schema_triggers_update history 列。預設 dry run 只統計;execute=true 才改寫。
部署會遮罩次要憑證儲存的來源版本後,先檢查 dry run,再於該環境執行清理。文件不代表清理已執行。
- 完整路由
/root/hotfix/custom-table-trigger-secrets-scrub
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
execute | query | boolean | 否 | 預設 false,只統計。True 會改寫符合的資料列,每個 keyset 分頁使用一個交易。 |
batch_size | query | int 1..1000 | 否 | 每個 keyset 分頁的列數;預設 200,最小 1,最大 1000。 |
回應結構
TaskResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
message | string | 否 | 未指定 |
ticket_id | string | 是 | Ticket ID |
範例
啟動 dry run(示意 ticket)
{
"pathParams": {},
"query": {
"execute": "false",
"batch_size": "200"
}
}{
"ticket_id": "66666666-6666-4666-8666-666666666666",
"message": "Trigger secrets scrub started (dry run). Use the ticket ID to track progress."
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 需通過 BaseRoot、SuperRoot、CloudManager 的 root key 檢查;無效 key 回 403。範例顯示 CloudManager 拒絕。 | |
| 422 | execute 不是布林值,或 batch_size 不在 1–1000。 | |
/root/hotfix/custom-table-trigger-secrets-scrub/{ticket_id}回傳各儲存區的 scanned、needs_rewrite、rewritten 計數,不含任何憑證值。
追蹤 root.triggerSecretsScrub 回傳的 ticket,直到 completed 或 failed。
- 完整路由
/root/hotfix/custom-table-trigger-secrets-scrub/{ticket_id}
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
ticket_id | path | uuid | 是 | 清理 POST 回傳、符合 UUID 格式的 ticket_id。 |
回應結構
TriggerSecretsScrubStatus| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
batch_size | integer | 是 | Rows per keyset page |
error | string | null | 否 | Exception type (+ numeric driver error code) of a failed run; never a value |
execute | boolean | 是 | False: dry run (counts only); true: rows rewritten |
iac_state_command | TriggerSecretsScrubStoreCounts | 是 | custom_table_iac_state command rows stamped before callback redaction |
iac_state_trigger | TriggerSecretsScrubStoreCounts | 是 | custom_table_iac_state trigger rows (declared spec at rest) |
status | "processing" | "completed" | "failed" | 是 | Ticket state |
store | "iac_state_trigger" | "iac_state_command" | "table_history" | null | 否 | Store of the last finished page |
table_history | TriggerSecretsScrubStoreCounts | 是 | custom_table_record_history schema_triggers_update rows |
ticket_id | string | 是 | Ticket id returned by the POST |
範例
完成的 dry run(示意計數)
{
"pathParams": {
"ticket_id": "66666666-6666-4666-8666-666666666666"
}
}{
"ticket_id": "66666666-6666-4666-8666-666666666666",
"status": "completed",
"execute": false,
"batch_size": 200,
"store": "table_history",
"iac_state_trigger": {
"scanned": 12,
"needs_rewrite": 3,
"rewritten": 0
},
"iac_state_command": {
"scanned": 4,
"needs_rewrite": 1,
"rewritten": 0
},
"table_history": {
"scanned": 20,
"needs_rewrite": 6,
"rewritten": 0
},
"error": null
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 需通過 BaseRoot、SuperRoot、CloudManager root key 檢查。範例顯示無效 CloudManager key。 | |
| 404 | Ticket 不存在,或其狀態列已逾期。 | |
| 422 | ticket_id 不符合 UUID 格式。 | |
/root/custom-tables/run-due-triggers認領到期的 schedule 觸發器、建立待執行 run、重新派送孤兒暫存變更,並回收遺失的 pending 與停滯的 running 觸發器 run(以 trigger_runs_requeued 回報;門檻 300 秒,每次 tick 最多 500 筆)。
由每分鐘至少一次的內部 cron、EventBridge 或 Cloudflare 排程呼叫。
- 完整路由
/root/custom-tables/run-due-triggers
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | BaseRoot X-ADMIN-TOKEN |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
table_limit | query | int 1..2000 | 否 | 本次最多認領幾張候選資料表,可填 1 到 2,000,預設為 200。 |
record_limit | query | int 1..10000 | 否 | 每個 date_column_reached 觸發器每一頁 cursor page 的實體 live 列數,可填 1 到 10,000,預設為 1,000。若整頁都沒有到期列,一次 tick 最多掃描 10 頁,因此每一筆 live 列都會被輪替到。 |
回應結構
RunDueTriggersResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
runs_created | integer | 是 | Pending trigger-run rows inserted and enqueued |
staged_changes_requeued | integer | 否 | Approval-gate recovery (spec §5 step 7): orphaned staged changes (pending under a terminal process, or stale-applying) re-dispatched this tick |
tables_scanned | integer | 是 | Candidate tables claimed this tick |
tables_with_schedules | integer | 是 | Of those, tables carrying a schedule trigger |
trigger_runs_requeued | integer | 否 | Lost-pending or stale-running trigger runs reclaimed and re-dispatched this tick |
範例
執行一次排程觸發器 tick
{
"pathParams": {},
"query": {
"table_limit": "200",
"record_limit": "1000"
}
}{
"tables_scanned": 12,
"tables_with_schedules": 3,
"runs_created": 4,
"staged_changes_requeued": 1,
"trigger_runs_requeued": 0
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | root token 缺少或無效。 | |
/root/custom-tables/{table_id}/purge永久刪除資料表、資料列、歷程及跨表相依設定。
保留期結束且已確認不需還原垃圾桶資料表時,由維運人員執行。
- 完整路由
/root/custom-tables/{table_id}/purge
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
table_id | path | uuid | 是 | 要永久清除的資料表 UUID。 |
force | query | boolean | 否 | 設為 true 可略過「必須已在垃圾桶」的保護條件。 |
回應結構
PurgeTableResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
message | string | 是 | Human-readable outcome |
purged | boolean | 是 | True when the table was permanently destroyed |
table_id | string | 是 | The purged table's id |
範例
永久清除垃圾桶資料表
{
"pathParams": {
"table_id": "11111111-1111-4111-8111-111111111111"
},
"query": {
"force": "false"
}
}{
"table_id": "11111111-1111-4111-8111-111111111111",
"purged": true,
"message": "Table permanently purged (records, history, and dependent config removed)"
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 404 | 資料表不存在。 | |
| 409 | 資料表尚未軟刪除,且未設定 force=true。 | |
| 423 | 無法在此表,或 purge 必須改寫的表(link 來源表、incoming rollup 或 lookup fallback 的持有表、規則相依表)上取得遷移鎖。detail 會指出持有者目前的操作,例如 unlink_table 或 add_column。這些鎖要到 purge 提交前置效果之後才會嘗試取得(見 unique_tuple 的 400);回 423 並不會撤銷那些效果。 | |
| 409 | 另一張表的 same_dimension_reference 規則以此表為參照目標或維度表。請先移除該規則;這項檢查在任何變更之前進行,即使 force=true 也一樣。 | |
| 400 | 存活表的 unique_tuple 規則用到 purge 會剝除的連結欄位。與 423 相同,這個拒絕發生在 purge 已提交前置效果之後,而這些效果會保持已提交:此表上或涉及此表的待審暫存變更已被捨棄(審核以 table purged 為由取消),仍在 pending 或 applying 的指令計畫已被標為失敗(執行稽核改為 failed,並送出失敗 callback),若以 force=true 清除現行資料表,資料表也已移入垃圾桶。 | |
| 400 | 存活資料表的 `date_interval_exclusion` 規則把這次 purge 會剝除的 link 欄位當作分割。和 unique-tuple 拒絕一樣,它出現在 purge 已 commit 其前置效果之後,那些效果仍然保留。請先移除規則,再重新執行 purge。 | |
/root/hotfix/custom-table-lock/{table_id}回傳此資料表目前存放在 Redis 中的遷移鎖:lock_id、operation(持有者正在進行的操作,例如 add_column)、acquired_at 與 expires_at(ISO 8601,UTC)。每把鎖取得時的 TTL 都是 600 秒;背景遷移執行期間會持續續期,因此 expires_at 會一直往後延。
在判斷鎖是否真的卡住、以及是否需要強制釋放前使用。
- 完整路由
/root/hotfix/custom-table-lock/{table_id}
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
table_id | path | uuid | 是 | 要檢查的資料表 UUID。 |
回應結構
Dict[str, Any]OpenAPI 快照中沒有此模型的頂層元件欄位。
範例
確認資料表目前未上鎖
{
"pathParams": {
"table_id": "11111111-1111-4111-8111-111111111111"
}
}{}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三組 CloudManager root token 之一缺少或錯誤。X-ADMIN-TOKEN 錯誤時,會先由 /root 路由以 BaseRoot access denied: Invalid X-ADMIN-TOKEN 拒絕。 | |
/root/hotfix/custom-table-lock/{table_id}不論擁有者為何,強制移除一把仍存在的資料表遷移鎖。
確認程序已崩潰、鎖已卡住且不能等待 TTL 時,作為緊急復原手段。
- 完整路由
/root/hotfix/custom-table-lock/{table_id}
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
table_id | path | uuid | 是 | 要強制解鎖的資料表 UUID。 |
回應結構
Dict[str, Any]OpenAPI 快照中沒有此模型的頂層元件欄位。
範例
強制釋放卡住的遷移鎖
{
"pathParams": {
"table_id": "11111111-1111-4111-8111-111111111111"
}
}{
"message": "Lock force-released successfully",
"released_lock": {
"lock_id": "f1e2d3c4-b5a6-4978-8a69-5b4c3d2e1f00",
"operation": "add_column",
"acquired_at": "2026-09-04T02:11:07.123456+00:00",
"expires_at": "2026-09-04T02:21:07.123456+00:00"
}
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 404 | 資料表目前沒有有效鎖。 | |
| 500 | 路由讀取時鎖還在,但刪除時已經消失:持有者在這段期間釋放了它,或它的 600 秒 TTL 剛好到期。儘管訊息這樣寫,這其實是上述的時間差,而不是 Redis 故障(沒有 Redis 用戶端的 worker 會回上面的 404)。請再呼叫一次 lockGet;回傳 {} 代表資料表現在已解鎖。 | |
/root/hotfix/custom-table-index-suggestions/{table_id}為一張自訂資料表的 JSON 篩選欄位產生 MySQL 虛擬欄位與索引 DDL 建議。
分析熱欄位、評估索引預算並準備維運側 DDL 時使用。
- 完整路由
/root/hotfix/custom-table-index-suggestions/{table_id}
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
table_id | path | uuid | 是 | 要分析的資料表 UUID。 |
回應結構
CustomTableIndexPlan| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
already_applied | string[] | 是 | 未指定 |
company_id | string (uuid) | 是 | 未指定 |
index_budget | CustomTableIndexBudget | 是 | 未指定 |
notes | string[] | 是 | 未指定 |
projections | CustomTableIndexProjection[] | 是 | 未指定 |
suggestions | string[] | 是 | 未指定 |
table_id | string (uuid) | 是 | 未指定 |
table_name | string | 是 | 未指定 |
範例
取得訂單資料表的索引建議
{
"pathParams": {
"table_id": "11111111-1111-4111-8111-111111111111"
}
}{
"table_id": "11111111-1111-4111-8111-111111111111",
"table_name": "訂單",
"suggestions": [],
"already_applied": [],
"index_budget": {
"current_secondary_indexes": 8,
"remaining_to_64_cap": 56
},
"notes": [
"READ-ONLY advisory — these statements are NOT executed by this endpoint.",
"Apply operator-side AFTER POST /root/hotfix/db/alembic (per-tenant dynamic DDL, not ORM autogen).",
"Apply only to genuinely hot columns — InnoDB caps custom_table_records at 64 secondary indexes.",
"Index names embed two UUIDs and may exceed MySQL's 64-char identifier limit; truncate if so.",
"Runbook: docs/superpowers/runbooks/2026-06-16-custom-tables-json-index-optimization.md"
]
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 404 | 資料表不存在,或在垃圾桶中。 | |
| 422 | 資料表結構中有欄位的內部鍵不是系統產生的 col_<hex> 格式(舊版結構),或資料表 id 不是 36 字元的小寫 UUID。detail 會指出問題所在;這張資料表無法產生 DDL。 | |
/root/hotfix/custom-table-index-suggestions彙整指定聊天室、部門或公司內每一張資料表(包括垃圾桶中的表)的索引建議與共用索引預算。無法產生建議的資料表仍會列出,但清單為空並附上 error 字串(「Cannot generate suggestions: …」),整個呼叫不會因此失敗。
要以租戶範圍規劃一批 JSON 篩選索引時使用。
- 完整路由
/root/hotfix/custom-table-index-suggestions
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
scope_type | query | enum:chatroom|department|company | 是 | 資料表範圍種類:chatroom、department 或 company。 |
scope_id | query | uuid | 是 | 該範圍的聊天室、部門或公司 UUID。 |
回應結構
CustomTableScopedIndexPlan| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
index_budget | CustomTableIndexBudget | 是 | 未指定 |
notes | string[] | 是 | 未指定 |
reclaimable_orphans | CustomTableIndexOrphanSummary | 是 | 未指定 |
scope_id | string (uuid) | 是 | 未指定 |
scope_type | "chatroom" | "department" | "company" | 是 | 未指定 |
table_count | integer | 是 | 未指定 |
tables | CustomTableIndexPlan[] | 是 | 未指定 |
範例
取得聊天室內全部索引建議
{
"pathParams": {},
"query": {
"scope_type": "chatroom",
"scope_id": "22222222-2222-4222-8222-222222222222"
}
}{
"scope_type": "chatroom",
"scope_id": "22222222-2222-4222-8222-222222222222",
"table_count": 1,
"tables": [
{
"table_id": "11111111-1111-4111-8111-111111111111",
"table_name": "訂單",
"suggestions": [],
"already_applied": []
}
],
"index_budget": {
"current_secondary_indexes": 8,
"remaining_to_64_cap": 56
},
"reclaimable_orphans": null,
"notes": [
"READ-ONLY advisory — these statements are NOT executed by this endpoint.",
"Apply operator-side AFTER POST /root/hotfix/db/alembic (per-tenant dynamic DDL, not ORM autogen).",
"Apply only to genuinely hot columns — InnoDB caps custom_table_records at 64 secondary indexes.",
"Index names embed two UUIDs and may exceed MySQL's 64-char identifier limit; truncate if so.",
"Runbook: docs/superpowers/runbooks/2026-06-16-custom-tables-json-index-optimization.md"
]
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 422 | scope_type 不是支援的三種範圍之一。 | |
/root/hotfix/custom-table-index-orphans找出不再由任何有效自訂資料表欄位使用的 MySQL 虛擬欄位,並產生 DROP DDL。
索引預算吃緊,或資料表與欄位大量刪除後清查遺留物件時使用。
- 完整路由
/root/hotfix/custom-table-index-orphans
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
回應結構
CustomTableIndexOrphans| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
available | boolean | 是 | 未指定 |
drops | string[] | 是 | 未指定 |
existing_virtual_columns | integer | 是 | 未指定 |
live_column_ids | integer | 是 | 未指定 |
notes | string[] | 是 | 未指定 |
orphan_count | integer | 是 | 未指定 |
範例
檢查全域孤兒索引欄位
{
"pathParams": {}
}{
"available": true,
"orphan_count": 0,
"drops": [],
"existing_virtual_columns": 8,
"live_column_ids": 24,
"notes": [
"READ-ONLY advisory — DROP statements are NOT executed by this endpoint.",
"Orphan detection is GLOBAL across all scopes (col_<hex> ids are not scope-scoped).",
"DROP COLUMN <col>_virtual also drops the index that covers it.",
"Apply operator-side AFTER POST /root/hotfix/db/alembic."
]
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三組 CloudManager root token 之一缺少或錯誤。X-ADMIN-TOKEN 錯誤時,會先由 /root 路由以 BaseRoot access denied: Invalid X-ADMIN-TOKEN 拒絕。 | |
/root/hotfix/custom-table-index-suggestions/{table_id}/apply對指定資料表執行尚未套用的 MySQL 虛擬欄位與索引 DDL。
維運人員檢查建議與索引預算後,才在受控維護時段執行。
- 完整路由
/root/hotfix/custom-table-index-suggestions/{table_id}/apply
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
table_id | path | uuid | 是 | 要套用索引的資料表 UUID。 |
dry_run | query | boolean | 否 | 預設為 false,會直接執行尚未套用的 DDL。設為 true 只預覽 pending 與 already_applied,不執行 DDL。 |
回應結構
CustomTableIndexApplyResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
already_applied | string[] | 是 | 未指定 |
applied | string[] | 是 | 未指定 |
dry_run | boolean | 是 | 未指定 |
errors | CustomTableIndexDdlError[] | 是 | 未指定 |
index_budget | CustomTableIndexBudget | 是 | 未指定 |
notes | string[] | 是 | 未指定 |
pending | string[] | 是 | 未指定 |
table_id | string (uuid) | 是 | 未指定 |
table_name | string | 是 | 未指定 |
範例
以 dry run 預覽索引套用結果
{
"pathParams": {
"table_id": "11111111-1111-4111-8111-111111111111"
},
"query": {
"dry_run": "true"
}
}{
"table_id": "11111111-1111-4111-8111-111111111111",
"table_name": "訂單",
"dry_run": true,
"applied": [],
"already_applied": [],
"pending": [],
"errors": [],
"index_budget": {
"current_secondary_indexes": 8,
"remaining_to_64_cap": 56
},
"notes": [
"Apply operator-side AFTER POST /root/hotfix/db/alembic (per-tenant dynamic DDL, not ORM autogen).",
"Apply only to genuinely hot columns — InnoDB caps custom_table_records at 64 secondary indexes.",
"Index names embed two UUIDs and may exceed MySQL's 64-char identifier limit; truncate if so.",
"Runbook: docs/superpowers/runbooks/2026-06-16-custom-tables-json-index-optimization.md"
]
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 404 | 資料表不存在,或在垃圾桶中。 | |
| 422 | 資料表結構中有欄位的內部鍵不是系統產生的 col_<hex> 格式(舊版結構),或資料表 id 不是 36 字元的小寫 UUID。不會執行任何 DDL。 | |
| 400 | 無法存取 MySQL information_schema,因此不能保證冪等套用。 | |
/root/hotfix/custom-table-trigger-runs/requeue把超過門檻仍為 pending 的自訂資料表觸發器 run 重新排入佇列,並回收最後更新時間早於門檻(至少 300 秒)的 running run:它們會被重設為 pending,並從第一個未成功的 action 繼續。
程序可能在資料提交後、佇列發布前崩潰,造成 pending run 孤立時使用;或是 worker 在執行中途停止,留下停滯的 running run 時使用。
- 完整路由
/root/hotfix/custom-table-trigger-runs/requeue
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
older_than_seconds | query | int >= 0 | 否 | pending 超過幾秒(以 created_at 起算)的 run 會重新排入;running run 以 updated_at 起算,並有固定的 300 秒下限。預設為 300。 |
limit | query | int 1..2000 | 否 | 單次最多重新派送幾筆,可填 1 到 2,000,預設為 500。這是 pending 與 running 共用的單一額度,由最舊的開始消耗(running 以 updated_at、pending 以 created_at 計算),因此某一類的大量舊積壓可能讓另一類留到下一次呼叫才處理。 |
回應結構
Dict[str, Any]OpenAPI 快照中沒有此模型的頂層元件欄位。
範例
重新派送逾時 pending run
{
"pathParams": {},
"query": {
"older_than_seconds": "300",
"limit": "500"
}
}{
"requeued": 2
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三組 CloudManager root token 之一缺少或錯誤。X-ADMIN-TOKEN 錯誤時,會先由 /root 路由以 BaseRoot access denied: Invalid X-ADMIN-TOKEN 拒絕。 | |
/root/hotfix/custom-table-staged-changes/requeue重新派送終止流程下仍 pending,或 worker 逾時卡在 applying 的自訂資料表暫存變更。
覆核已結束但變更沒有套用,或套用 worker 中途死亡時使用。
- 完整路由
/root/hotfix/custom-table-staged-changes/requeue
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
limit | query | int 1..2000 | 否 | 本次最多重新派送幾筆,可填 1 到 2,000,預設為 500。 |
回應結構
StagedChangeRequeueResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
requeued | integer | 是 | Orphaned staged changes re-dispatched this call |
範例
重新派送孤兒暫存變更
{
"pathParams": {},
"query": {
"limit": "500"
}
}{
"requeued": 1
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三組 CloudManager root token 之一缺少或錯誤。X-ADMIN-TOKEN 錯誤時,會先由 /root 路由以 BaseRoot access denied: Invalid X-ADMIN-TOKEN 拒絕。 | |
/root/hotfix/custom-table-sort-order-backfill替所有自訂資料表(包括垃圾桶中的表)裡 sort_order 為 NULL 的現行資料列,依 created_at 順序在每張表內編號 1..N。已有值的 sort_order 不會變動。
在加入 sort_order 欄位的資料庫遷移完成後、所有資料列的 sort_order 仍為 NULL 時執行一次。每張表的編號都從 1 重新開始,因此若資料表已有部分 sort_order 值,回填的資料列會與既有編號重複。
- 完整路由
/root/hotfix/custom-table-sort-order-backfill
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
回應結構
TaskResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
message | string | 否 | 未指定 |
ticket_id | string | 是 | Ticket ID |
範例
啟動 sort_order 回填工作
{
"pathParams": {}
}{
"message": "Sort order backfill task started. Use the ticket ID to track progress.",
"ticket_id": "66666666-6666-4666-8666-666666666666"
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三組 CloudManager root token 之一缺少或錯誤。X-ADMIN-TOKEN 錯誤時,會先由 /root 路由以 BaseRoot access denied: Invalid X-ADMIN-TOKEN 拒絕。 | |
/root/hotfix/custom-table-sort-order-backfill/{ticket_id}以 ticket_id 取得 sort_order 回填工作的進度、結果或錯誤。
啟動回填後輪詢,直到 status 變成 completed 或 failed。
- 完整路由
/root/hotfix/custom-table-sort-order-backfill/{ticket_id}
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
ticket_id | path | uuid | 是 | 啟動回填時回傳的工作 ticket UUID。 |
回應結構
Dict[str, Any]OpenAPI 快照中沒有此模型的頂層元件欄位。
範例
取得已完成的回填結果
{
"pathParams": {
"ticket_id": "66666666-6666-4666-8666-666666666666"
}
}{
"ticket_id": "66666666-6666-4666-8666-666666666666",
"status": "completed",
"progress": 100,
"tables_processed": 3,
"total_tables": 3,
"total_rows_updated": 42,
"results": [
{
"table_id": "11111111-1111-4111-8111-111111111111",
"updated": 30
},
{
"table_id": "12121212-1212-4212-8212-121212121212",
"updated": 12
},
{
"table_id": "13131313-1313-4313-8313-131313131313",
"updated": 0,
"reason": "no records with NULL sort_order"
}
]
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 404 | ticket 不存在或狀態資料已過期。 | |
/root/hotfix/custom-table-agent-deliveries列出每筆已確認的 agent 指令寫入所留下的私有 per-execution 標記——這些標記會保留到自然語言結果跨過頻道可見性邊界為止——並附上標記狀態、絕對到期時間、replay guard 是否仍有效、所屬指令與範圍,以及該列的存在時間。
當某個 agent 指令對同一個人、在同一個頻道上一直回覆寫入保護失敗(confirmation_unavailable)時使用。調解查找以指令、呼叫的使用者或客戶,以及頻道(LINE 另加群組)為鍵,所以積壓的標記只會卡住這個人使用的這個指令,而不是整個聊天室的所有指令:該指令 pending 卡了好幾小時的標記就是候選,可用 command_id 把列表縮小到它們。也可以用 state=expired 查看惰性到期已經釋放了哪些。
- 完整路由
/root/hotfix/custom-table-agent-deliveries
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
command_id | query | string 1..36 | 否 | 只列出單一 command id 的標記,長度 1 到 36 字元。省略則掃描所有指令。 |
state | query | enum:pending|expired | 否 | 要列出的標記狀態:pending(預設)或 expired。惰性到期的標記仍可被確認,所以整理流程需要能把它們列出來。 |
older_than_hours | query | number >= 0 | 否 | 只回傳執行紀錄超過這麼多小時的標記,預設 0 代表全部回傳。可以填小數。 |
limit | query | int 1..500 | 否 | 單次最多回傳幾筆,可填 1 到 500,預設 100。結果由舊到新排序。 |
回應結構
AgentDeliveryMarkerListResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
rows | AgentDeliveryMarkerRow[] | 是 | 未指定 |
total_listed | integer | 是 | 未指定 |
範例
列出超過兩小時的 pending 標記
{
"pathParams": {},
"query": {
"state": "pending",
"older_than_hours": "2",
"limit": "100"
}
}{
"total_listed": 1,
"rows": [
{
"execution_id": "88888888-8888-4888-8888-888888888888",
"command_id": "77777777-7777-4777-8777-777777777777",
"command_name": "排班登記",
"execution_status": "succeeded",
"channel_scope": "line_group",
"marker_state": "pending",
"expires_at": "2026-09-04T02:26:07Z",
"in_window": false,
"scope_chatroom_id": "22222222-2222-4222-8222-222222222222",
"scope_department_id": null,
"scope_company_id": null,
"created_at": "2026-09-04T02:11:07",
"age_hours": 5.4
}
]
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三個 CloudManager root token 之中有一個缺少或錯誤。 | |
| 422 | state 不是 pending 或 expired、older_than_hours 為負數、limit 超出 1..500 範圍,或 command_id 不在 1..36 字元之間。 | |
/root/hotfix/custom-table-agent-deliveries/acknowledge把指定的派送標記從 pending 或 expired 翻成 acknowledged,讓對應的執行紀錄不再佔用調解容量,並逐一回報每個 execution id 的結果。execute=false 只預覽結果、不寫入。
在與租戶確認過已執行的寫入確實可見或被接受之後,對列表端點顯示為 pending 且早已超過視窗的標記執行。
- 完整路由
/root/hotfix/custom-table-agent-deliveries/acknowledge
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
請求結構
AgentDeliveryAckRequest| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
execute | boolean | 否 | False previews per-id outcomes; true flips the markers. |
execution_ids | string[] | 是 | 未指定 |
force | boolean | 否 | Required to acknowledge a pending marker whose reconciliation window is still live — that cancels an active replay guard and re-enables an in-window duplicate execution. Expired or past-window markers never need it. |
回應結構
AgentDeliveryAckResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
executed | boolean | 是 | 未指定 |
results | AgentDeliveryAckResult[] | 是 | 未指定 |
範例
只預覽結果、不寫入(execute=false)
{
"pathParams": {},
"body": {
"execution_ids": [
"88888888-8888-4888-8888-888888888888"
],
"execute": false
}
}{
"executed": false,
"results": [
{
"execution_id": "88888888-8888-4888-8888-888888888888",
"outcome": "would_acknowledge"
}
]
}正式提交確認(execute=true)
{
"pathParams": {},
"body": {
"execution_ids": [
"88888888-8888-4888-8888-888888888888"
],
"execute": true
}
}{
"executed": true,
"results": [
{
"execution_id": "88888888-8888-4888-8888-888888888888",
"outcome": "acknowledged"
}
]
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三個 CloudManager root token 之中有一個缺少或錯誤。 | |
| 422 | execution_ids 是空陣列或超過 200 筆,或其中某個 id 為空字串、超過 36 字元。 | |
/root/hotfix/custom-table-command-callback-runs/requeue一次清掉指令 callback 卡住的三種狀態:發布佇列時遺失的 pending、仍未達重試上限的 failed、以及 worker 死掉的 running;後兩者會先重設為 pending,再全部重新發布。
指令已完成但 callback 沒有送達呼叫方時使用:指令成功很久之後 callback run 仍停在 pending 或 running,或 worker 部署中斷了進行中的派送。
- 完整路由
/root/hotfix/custom-table-command-callback-runs/requeue
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
older_than_seconds | query | int >= 0 | 否 | 只處理停滯超過幾秒的 run,預設為 300;判斷依據是 pending 的 created_at 與 failed 的 updated_at。 |
limit | query | int 1..2000 | 否 | 單次最多復原幾筆,可填 1 到 2,000,預設為 500。 |
回應結構
CommandCallbackRequeueResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
requeued | integer | 是 | 未指定 |
範例
清掉停滯超過五分鐘的 callback
{
"pathParams": {},
"query": {
"older_than_seconds": "300",
"limit": "500"
}
}{
"requeued": 7
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三個 CloudManager root token 之中有一個缺少或錯誤。 | |
| 422 | limit 超出 1..2,000 範圍,或 older_than_seconds 為負數。 | |
/root/hotfix/custom-table-command-executions/prune硬刪除已達終態(succeeded 或 failed)且 created_at 超過 180 天的自訂資料表指令執行稽核紀錄,並回報刪除筆數、保留天數與這次實際使用的 cutoff 時間點。被 effect identity claim 參照的執行是該業務事件持久的 replay receipt,永遠不會被刪除:超過 cutoff 後只會清空它私有的 lifecycle_snapshot。
以較低頻率的維護節奏執行,控制指令稽核表的大小;或在該表開始造成儲存壓力、稽核清單查詢變慢時執行。
- 完整路由
/root/hotfix/custom-table-command-executions/prune
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
回應結構
CommandExecutionPruneResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
cutoff | string (date-time) | 是 | 未指定 |
pruned | integer | 是 | 未指定 |
retention_days | integer | 否 | 未指定 |
範例
清除超過保留期的終態指令稽核
{
"pathParams": {}
}{
"pruned": 1284,
"retention_days": 180,
"cutoff": "2026-01-26T11:04:07"
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三個 CloudManager root token 之中有一個缺少或錯誤。 | |
/root/hotfix/custom-table-crossref-repair走訪所有含跨表 hop 的 FORMULA 欄位,透過 column_mapping 與權威的 link 定義重新解析配對的兩側,回報——或在 apply=true 時改寫——沒有存成應有內部鍵的配對。
在動到連結資料表的改名或改型之後執行,或在跨表公式開始算出錯誤、空值時執行,用來判斷是不是儲存的運算式本身損壞了。
- 完整路由
/root/hotfix/custom-table-crossref-repair
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
apply | query | boolean | 否 | false(預設)只回報、完全不寫入;true 才會就地改寫損壞的運算式。請一律先跑預設值。 |
回應結構
CrossRefRepairResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
applied | boolean | 是 | Whether repairs were committed |
corrupted_pairs | integer | 是 | Cross-ref pairs found corrupted |
items | CrossRefRepairItem[] | 是 | Per-pair detail, capped at 500 entries |
repaired_pairs | integer | 是 | Pairs rewritten (apply=true) or rewritable (apply=false) |
scanned_formula_columns | integer | 是 | FORMULA columns containing a cross-ref token |
scanned_tables | integer | 是 | Tables whose schema was inspected |
skipped_locked_tables | integer | 否 | Tables skipped because a schema-migration lock was held — rerun the sweep after the migration finishes |
unrepairable_pairs | integer | 是 | Pairs needing manual attention (reported, never touched) |
範例
不寫入、只預覽損壞的跨表參照(apply=false)
{
"pathParams": {},
"query": {
"apply": "false"
}
}{
"scanned_tables": 214,
"scanned_formula_columns": 37,
"corrupted_pairs": 4,
"repaired_pairs": 3,
"unrepairable_pairs": 1,
"skipped_locked_tables": 0,
"applied": false,
"items": [
{
"table_id": "11111111-1111-4111-8111-111111111111",
"column_key": "col_9f2a1c",
"pair_before": "[col_4b7e08->單價]",
"pair_after": "[col_4b7e08->col_c31d5a]",
"status": "repaired",
"reason": null
},
{
"table_id": "11111111-1111-4111-8111-111111111111",
"column_key": "col_77b0e4",
"pair_before": "[供應商->金額]",
"pair_after": null,
"status": "unrepairable",
"reason": "rhs '金額' resolves to non-numeric target column 'col_2ea9f1'"
}
]
}正式提交修復(apply=true)
{
"pathParams": {},
"query": {
"apply": "true"
}
}{
"scanned_tables": 214,
"scanned_formula_columns": 37,
"corrupted_pairs": 4,
"repaired_pairs": 3,
"unrepairable_pairs": 1,
"skipped_locked_tables": 1,
"applied": true,
"items": [
{
"table_id": "11111111-1111-4111-8111-111111111111",
"column_key": "col_9f2a1c",
"pair_before": "[col_4b7e08->單價]",
"pair_after": "[col_4b7e08->col_c31d5a]",
"status": "repaired",
"reason": null
},
{
"table_id": "11111111-1111-4111-8111-111111111111",
"column_key": "",
"pair_before": "",
"pair_after": null,
"status": "unrepairable",
"reason": "table busy (migration lock held) — rerun the sweep"
}
]
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | 三個 CloudManager root token 之中有一個缺少或錯誤。 | |
| 422 | apply 的值無法被 FastAPI 解讀為布林值。 | |
/root/hotfix/custom-table-composer/checkpointer/setup一次性、可重複執行地建立指令 composer 用來存放持久狀態的 LangGraph checkpoint 資料表。重跑安全。
每個環境在開始回合或讀取/刪除 checkpoint history 前執行一次。若完全沒有設定 composer Postgres,這些 REST route 回 `503 composer_unavailable`,WebSocket 以 1013 關閉;若已設定但尚未執行此 setup,缺少的資料表會表現為這些呼叫本身的失敗——請先執行這條 route。`GET …/turn` 與 `GET …/ws/docs` 不需要 checkpointer。
- 完整路由
/root/hotfix/custom-table-composer/checkpointer/setup
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
回應結構
ComposerCheckpointerSetupResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
configured | boolean | 是 | 未指定 |
message | string | 是 | 未指定 |
setup_ran | boolean | 是 | 未指定 |
範例
資料表已建立(或本來就存在)
{
"pathParams": {}
}{
"configured": true,
"setup_ran": true,
"message": "checkpoint tables ready"
}這個環境沒有設定 composer 儲存
{
"pathParams": {}
}{
"configured": false,
"setup_ran": false,
"message": "MEMSTORE_POSTGRES_* is not configured"
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | Root operator 憑證被拒。 | |
| 500 | Setup 因 120 秒上限以外的原因失敗,例如帳密錯誤、連線被拒,或在 composer Postgres 上權限不足。這條 route 不會攔截這類錯誤,所以回的是不帶原因的通用 500:請查看伺服器 log、修正設定後,再重跑這個 idempotent setup。 | |
| 504 | Setup 在 120 秒內未完成——後端 Postgres 無法連線、封包被丟棄或反應太慢。是否完成無法確認;連線恢復後可安全重跑這個 idempotent setup。 | |
/root/hotfix/custom-table-composer/threads/prune掃出閒置超過指定時間的 composer thread 並刪除其 checkpoints。預設只預覽:不加 `execute=true` 就不會刪除任何東西。
排程維護 composer 狀態,或事故後的一次性清理。
- 完整路由
/root/hotfix/custom-table-composer/threads/prune
範圍
| 範圍 | 是否提供 | 驗證與權限 |
|---|---|---|
| 完整路由 | 可使用 | CloudManager root keys (X-ADMIN-TOKEN + X-SUPER-TOKEN + X-CLOUD-TOKEN) |
參數
| 欄位 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
older_than_hours | query | int 1..720 | 否 | 只處理閒置超過這麼多小時的 thread(1–720)。預設 24。 |
execute | query | boolean | 否 | 設為 true 才會真的刪除。預設 false,只回報會被刪除的內容。 |
回應結構
ComposerThreadPruneResponse| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
candidates | integer | 是 | 未指定 |
deleted | integer | 是 | 未指定 |
executed | boolean | 是 | 未指定 |
older_than_hours | integer | 是 | 未指定 |
threads | string[] | 否 | 未指定 |
truncated | boolean | 是 | 未指定 |
範例
預覽閒置超過 24 小時的 thread
{
"pathParams": {},
"query": {
"older_than_hours": "24",
"execute": "false"
}
}{
"executed": false,
"older_than_hours": 24,
"candidates": 2,
"deleted": 0,
"threads": [
"ctcomposer:11111111-1111-4111-8111-111111111111:22222222-2222-4222-8222-222222222222:33333333-3333-4333-8333-333333333333:tab-1",
"ctcomposer:11111111-1111-4111-8111-111111111111:22222222-2222-4222-8222-222222222222:44444444-4444-4444-8444-444444444444:ws-3a0f"
],
"truncated": false
}錯誤
驗證錯誤範例列出識別欄位;部署中的驗證器也可能回傳 input 與 ctx。錯誤訊息 URL 的版本由建置決定,因此使用 pydantic-version 佔位符。
| 狀態 | 發生條件 | 錯誤本文 |
|---|---|---|
| 403 | Root operator 憑證被拒。 | |
| 503 | 無法建構 composer checkpointer——這個環境沒有設定它的 Postgres。 | |