mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-15 00:31:58 +00:00
评测题目返回给界面的说明改成合规文案:check-copy 三项规则恢复全过
check-copy 也扫后端交给界面的报错文案,nr2/c 交付时没跑这一道,有三项没过(复核 C-1): - 口语补语:期望 SQL 行数不够时写的「取不到值」「取不到第 N 行」,改成「没有可用的值」「没有第 N 行」; 同一处 where 匹配到多行的「取不准是哪一行」一并改成「无法确定是哪一行」。 - 禁用词「钉住」「改钉」:升版处置的叫法(UPGRADE_LABEL)和 DisposeRefused、升版状态的说明,按全站 「固定版本」的说法改成「固定的…」「改为固定新版本」,和应用、子工作流的升版说明一致。 - 半角标点和英文引号:题目 where 写错时的报错例子原来是一段 JSON,改成全角的「地区:华南」,并写明取值只能是 文字或数字(校验本来就只收这两种)。 只改文案,判断和机读码都不变。代码注释和模块说明里的「钉」不上界面,照全仓库的写法保留。
This commit is contained in:
@@ -244,7 +244,7 @@ def _expectation(raw: Any, i: int, *, gold_kind: str | None, taken: set[str]) ->
|
||||
if not isinstance(cond, Mapping) or not cond or not all(
|
||||
isinstance(k, str) and k.strip() and isinstance(v, (str, int, float)) and not isinstance(v, bool)
|
||||
for k, v in cond.items()):
|
||||
raise CaseInvalid(f"{where}的 where 需要是「列名:取值」的对象,例如 {{\"地区\": \"华南\"}}",
|
||||
raise CaseInvalid(f"{where}的 where 需要是「列名:取值」的对象,例如「地区:华南」,取值只能是文字或数字",
|
||||
f"{path}.where")
|
||||
if "row" in raw:
|
||||
raise CaseInvalid(f"{where}按 where 找行时不写 row", f"{path}.row")
|
||||
|
||||
@@ -75,7 +75,7 @@ CANCEL_GRACE_S = 15.0
|
||||
QUERY_NODE = "gold_q"
|
||||
|
||||
#: 口径升版的三种处置(评测里的说法;节点上的 upgrade_policy 叫法见 engine/labels)
|
||||
UPGRADE_LABEL = {"recompute": "改钉新版本(历史在这里断开)", "dual": "新旧两版各算一份期望",
|
||||
UPGRADE_LABEL = {"recompute": "改为固定新版本(历史在这里断开)", "dual": "新旧两版各算一份期望",
|
||||
"incomparable": "旧题归档,按新版本另建新题"}
|
||||
|
||||
|
||||
@@ -319,13 +319,13 @@ def _sql_value(exp: Mapping[str, Any], snapshot: Mapping[str, Any]) -> dict[str,
|
||||
if not hits:
|
||||
raise _NoValue(f"期望 SQL 的结果里没有 {cond} 的行" + ("(结果被截断,只取回了前几行)" if truncated else ""))
|
||||
if len(hits) > 1:
|
||||
raise _NoValue(f"期望 SQL 的结果里 {cond} 的行有 {len(hits)} 行,取不准是哪一行:请在 where 里多写一列")
|
||||
raise _NoValue(f"期望 SQL 的结果里 {cond} 的行有 {len(hits)} 行,无法确定是哪一行:请在 where 里多写一列")
|
||||
ri = hits[0]
|
||||
else:
|
||||
ri = int(exp.get("row") or 0)
|
||||
if ri >= len(rows):
|
||||
raise _NoValue("期望 SQL 没有返回行,取不到值:期望没有数据的题请把期望写成「没有数据」" if not rows else
|
||||
f"期望 SQL 只返回了 {len(rows)} 行,取不到第 {ri + 1} 行")
|
||||
raise _NoValue("期望 SQL 没有返回行,没有可用的值:期望没有数据的题请把期望写成「没有数据」" if not rows else
|
||||
f"期望 SQL 只返回了 {len(rows)} 行,没有第 {ri + 1} 行")
|
||||
value = rows[ri][ci] if ci < len(rows[ri]) else None
|
||||
if value is None:
|
||||
raise _NoValue(f"期望的那一格(第 {ri + 1} 行「{columns[ci]}」)是空值:期望没有数据的题请把期望写成「没有数据」")
|
||||
@@ -487,7 +487,7 @@ async def upgrade_state(session: AsyncSession, gold: Mapping[str, Any], pinned:
|
||||
if errors:
|
||||
message = f"口径已升版到 v{latest},待处置"
|
||||
elif retired:
|
||||
message = f"钉住的「{pinned.workflow_name}」v{pinned.version} 已退役,待处置"
|
||||
message = f"固定的「{pinned.workflow_name}」v{pinned.version} 已退役,待处置"
|
||||
versions: tuple[int, ...] = (pinned.version,)
|
||||
if policy == "dual" and upgrade and int(upgrade.get("to_version") or 0) > pinned.version:
|
||||
versions = (pinned.version, int(upgrade["to_version"]))
|
||||
@@ -681,15 +681,15 @@ async def plan_dispose(session: AsyncSession, case: Mapping[str, Any], policy: s
|
||||
try:
|
||||
pinned = await derive.load_pinned(session, gold["workflow_id"], gold["version"], gold["node_id"])
|
||||
except derive.NotDerivable as e:
|
||||
raise DisposeRefused(f"钉住的口径读不出来:{e.message}", CALIBER_NOT_REUSABLE) from e
|
||||
raise DisposeRefused(f"固定的口径版本无法读取:{e.message}", CALIBER_NOT_REUSABLE) from e
|
||||
state = await upgrade_state(session, gold, pinned)
|
||||
if not state.pending or state.latest is None or state.latest <= pinned.version:
|
||||
raise DisposeRefused("这道题钉的口径没有待处置的新版本" if not state.pending else
|
||||
f"{state.message}:已经没有更新的已发布版本可以改钉,只能另建新题或删除这道题",
|
||||
raise DisposeRefused("这道题固定的口径没有待处置的新版本" if not state.pending else
|
||||
f"{state.message}:已经没有更新的已发布版本可以改为固定,只能另建新题或删除这道题",
|
||||
DISPOSE_NOTHING)
|
||||
latest = state.latest
|
||||
if policy == "dual" and state.retired:
|
||||
raise DisposeRefused(f"钉住的 v{pinned.version} 已退役,不能新旧两版并算:请改钉新版本或另建新题", DISPOSE_INVALID)
|
||||
raise DisposeRefused(f"固定的 v{pinned.version} 已退役,不能新旧两版并算:请改为固定新版本或另建新题", DISPOSE_INVALID)
|
||||
try:
|
||||
newer = await derive.load_pinned(session, gold["workflow_id"], latest, gold["node_id"])
|
||||
except derive.NotDerivable as e:
|
||||
|
||||
Reference in New Issue
Block a user