code-to10 v6 A1: delete server merge-gate modes, hard only
Server POST /tasks/{id}/merge no longer has record/enforce/off:
hard_mode_from_env and HARD_MODES deleted (not re-defaulted),
handler always evaluates the hard gate, env CLOUD_MERGE_GATE_MODE
and body merge_gate_mode are ignored server-side. The record
'no-evidence passes' and 'unprotected+confirm passes with
merge_gate_risk' server paths are gone with the dead risk audit;
no production caller justified keeping them (only production
caller of the non-hard evaluator was the merge handler itself;
audit_loop_wiring already used the hard gate). cloud/merge_gate
pure functions keep their #209 semantics but are documented as
non-server: they are no longer wired to any endpoint.
Server-level record/enforce/off tests rewritten to the new
behavior (renamed, not deleted silently); pure-function tests
unchanged.
(cherry picked from commit 08e75edbd6d04701965c5db951fa054cfbb75bb0)
Reconcile-port: handler_lifecycle.py hunks redirected into cloud/server.py _merge_task (target keeps 6-mixin split; mixin file does not exist here); handler_support.py kept at HEAD (its A1 hunk is a docstring of _validate_hard_gate_body, ported to server.py copy); test mock paths cloud.handler_lifecycle.* rewritten to cloud.server.*.
This commit is contained in:
1 parent
b0d51b139c
commit
32620c4517
8 files changed
+200
-183
No files matched your search
@@ -4,10 +4,10 @@
|
||||
(本地或 Docker 容器内)执行,成功后再调本接口把云端
|
||||
任务从 completed 改为 merged。规则:404/401/403/409
|
||||
语义、maintainer 以上才能合并、审计里有 merge_task。
|
||||
门禁注意:默认模式已是 hard(见 test_merge_gate_hard.py),
|
||||
门禁注意:服务端只有 hard(见 test_merge_gate_hard.py),
|
||||
所以本文件里期望 200 的合并调用必须带完整硬门禁证据;
|
||||
无证据调用在默认下 409(本文件末尾两项新用例钉住它),
|
||||
record 下的旧行为由硬门禁测试文件覆盖。
|
||||
旧 record 下的“无证据放行”已随 A1 删模式消失,不再覆盖。
|
||||
"""
|
||||
|
||||
import http.client
|
||||
@@ -176,13 +176,14 @@ class MergeTestCase(unittest.TestCase):
|
||||
"GET", "/tasks/%s" % task["id"], key=self.owner_key)
|
||||
self.assertEqual(got["status"], "completed")
|
||||
|
||||
def test_merge_record_env_preserves_old_no_evidence_call(self):
|
||||
def test_merge_record_env_no_longer_passes_no_evidence_call(self):
|
||||
# A1:record 环境变量在服务端被忽略,无证据调用按 hard 409。
|
||||
os.environ["CLOUD_MERGE_GATE_MODE"] = "record"
|
||||
task = self._completed_task()
|
||||
status, merged = self._req(
|
||||
status, body = self._req(
|
||||
"POST", "/tasks/%s/merge" % task["id"], {}, self.owner_key)
|
||||
self.assertEqual(status, 200)
|
||||
self.assertEqual(merged["status"], "merged")
|
||||
self.assertEqual(status, 409)
|
||||
self.assertEqual(body["merge_gate"]["mode"], "hard")
|
||||
|
||||
def test_merge_missing_and_no_key(self):
|
||||
status, _ = self._req(
|
||||
|
||||
Reference in new issue
Block a user