gapfill G3: unify all 5 private row_get onto peer_messages.row_get (approvals, automations, marker_tools, todos, wait_ops; resident import retargeted); semantics identical on None/dict/sqlite3.Row, identity tests added
This commit is contained in:
1 parent
5ca642c86e
commit
aa6179b5e1
7 files changed
+58
-52
No files matched your search
+5
-12
@@ -1,7 +1,8 @@
|
||||
"""线程等待与移交操作(对照 codex app 的 8 项工具面)。
|
||||
|
||||
本模块只做控制面纯逻辑,不跑模型、不联网、不 import cloud 其它
|
||||
模块(与 automations / peer_messages 同款,避免循环 import);
|
||||
本模块只做控制面纯逻辑,不跑模型、不联网;行取值复用
|
||||
cloud.peer_messages(该模块本身只依赖标准库,故不产生循环
|
||||
import),其余不 import cloud 其它模块;
|
||||
server.py 只负责鉴权、路由与错误码映射。
|
||||
|
||||
8 项在控制面的落点(详见 docs/thread-wait-ops.md 对照表):
|
||||
@@ -40,6 +41,8 @@ import re
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from cloud.peer_messages import row_get
|
||||
|
||||
HANDOFF_STATUSES = ("pending", "accepted", "running",
|
||||
"completed", "failed")
|
||||
# report 允许的状态转移:终态(completed / failed)不可再动;
|
||||
@@ -74,16 +77,6 @@ SIGNIFICANT_KINDS = ("terminal", "needs_approval", "needs_input",
|
||||
"needs_continue")
|
||||
|
||||
|
||||
def row_get(row, name):
|
||||
"""行取值容错:sqlite3.Row 缺列报 IndexError、dict 缺键报
|
||||
KeyError、空行报 TypeError,一律回 None(与 automations
|
||||
的 row_get 同款,老库行缺列时读移交列表不能因此炸掉)。"""
|
||||
try:
|
||||
return row[name]
|
||||
except (KeyError, IndexError, TypeError):
|
||||
return None
|
||||
|
||||
|
||||
def _row_dict(row, columns):
|
||||
if row is None or isinstance(row, dict):
|
||||
return row
|
||||
|
||||
Reference in new issue
Block a user