fix(api): 决议O终审修复波——判卡/判因子与decompose worker并发窗口闭合(两端点load→save持_DECOMPOSE_LOCK+在飞判死409,C2)+判卡半态诚实化(append_event/卡片库失败留痕card_verdict_half_state附记+终态竞态422,I1)+reason 500上限(NOTE2) [vps]

This commit is contained in:
2026-10-10 23:07:13 +08:00
parent 705cc6eae1
commit 580e832a4f
2 changed files with 110 additions and 42 deletions
@@ -696,6 +696,24 @@ class TestCardVerdict:
json={"reason": "想法被新文献证伪"})
assert r.status_code == 200 and r.json()["buried"] == []
def test_kill_while_decompose_running_409(self, client, monkeypatch):
"""codex 终审 C2:在飞分解时判死 409 快拒(防 worker 旧对象覆盖复活墓园)."""
from sanguo_api import decompose_jobs
monkeypatch.setattr(decompose_jobs, "is_running", lambda hyp_id: True)
r = client.post("/api/v1/pipeline/hypotheses/hyp-any/verdict",
json={"reason": "分解中判死"})
assert r.status_code == 409 and "分解" in r.json()["detail"]
def test_kill_reason_too_long_422(self, client, env2, monkeypatch, tmp_path):
"""codex 终审 NOTE2:reason 上限 500,超限 422."""
reg = tmp_path / "empty2.yaml"
reg.write_text("factors: {}\n", encoding="utf-8")
monkeypatch.setenv("SANGUO_FACTOR_REGISTRY", str(reg))
self._mk_card("queued")
r = client.post("/api/v1/pipeline/hypotheses/hyp-kill1/verdict",
json={"reason": "长" * 501})
assert r.status_code == 422 and "reason 过长" in r.json()["detail"]
class TestFactorsCauseAndDecompose422:
def test_factors_carry_cause(self, client, monkeypatch, tmp_path):