From da8d0c29fd36421bcc524b75225b003c754eb86d Mon Sep 17 00:00:00 2001 From: host Date: Sat, 7 Nov 2026 00:43:50 +0000 Subject: [PATCH] round-12: fix integration fallout (P9 gate x P1, P7 check x P2/P4 fixtures) - P1 resident tests: P9's inference gate is a precondition of _run_with_vm, so _RealExecCase.make_executor now configures a default inference origin (CHV_INFERENCE_ORIGIN=https://xgapi.lol + CHV_INFERENCE_ALLOW_HOSTS=xgapi.lol) and a public fake resolver (same setup as P9's GateTest). No assertion changed; the gate's fail-closed behavior on missing origin stays pinned by P9's own ask test. 9 resident tests fixed (7 errors + 2 failures). - P2/P4 dry-run fixtures: P7's build.sh hard check requires chv-memory.py in the repo; add it to both fixtures' copy lists. 2 failures fixed. - No production code changed in this commit (test setup only). --- cloud/tests/test_chv_muse_p1_resident.py | 15 ++++++++++++++- cloud/tests/test_chv_muse_p2.py | 2 +- cloud/tests/test_chv_muse_p4.py | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cloud/tests/test_chv_muse_p1_resident.py b/cloud/tests/test_chv_muse_p1_resident.py index 8a3b260..8dd3ffa 100644 --- a/cloud/tests/test_chv_muse_p1_resident.py +++ b/cloud/tests/test_chv_muse_p1_resident.py @@ -113,6 +113,11 @@ class _FakeExecutor: self.emits.append(event) +def _public_resolver(host, port): + """假解析器:公网 IP(与 P9 测试同款,供推理门放行用)。""" + return ["93.184.216.34"] + + def _write(path, content): with open(path, "w") as fh: fh.write(content) @@ -485,9 +490,16 @@ class _RealExecCase(unittest.TestCase): @staticmethod def make_executor(state_dir, base_dir, env_extra=None): + # round-12:P9 推理门是 _run_with_vm 的前置条件——本类 + # 的任务都不带 model_provider,须配默认推理 origin + + # 公网解析器才放行(与 P9 GateTest 同款;未配时门应 + # fail-closed,见 test_chv_muse_p9 的 ask 用例——这里 + # 测的是常驻接线本身,不是门的行为,所以配好放行)。 env = {"CHV_EGRESS_PROXY": "http://10.0.0.1:8888", "CHV_HOST_KEY_MODE": "keyscan", - "CHV_SSH_FORWARD": "1"} + "CHV_SSH_FORWARD": "1", + "CHV_INFERENCE_ORIGIN": "https://xgapi.lol", + "CHV_INFERENCE_ALLOW_HOSTS": "xgapi.lol"} if env_extra: env.update(env_extra) cpuinfo = os.path.join(base_dir, "cpuinfo") @@ -506,6 +518,7 @@ class _RealExecCase(unittest.TestCase): state_dir=state_dir, sleeper=lambda s: None, env=env) ex.audit_callback = lambda e, t, d, k=None: None + ex.sentinel_resolver = _public_resolver return ex def setUp(self): diff --git a/cloud/tests/test_chv_muse_p2.py b/cloud/tests/test_chv_muse_p2.py index e67f051..99e9182 100644 --- a/cloud/tests/test_chv_muse_p2.py +++ b/cloud/tests/test_chv_muse_p2.py @@ -552,7 +552,7 @@ class BuildDryRunTest(unittest.TestCase): "authd.py", "git-credential-chv-authd", "chv-authd.service", "chv-cdp-broker.py", "chv_browser_guard.py", - "browser-blocklist.txt"): + "browser-blocklist.txt", "chv-memory.py"): shutil.copy2(ROOT / "chv-guest" / name, os.path.join(guest, name)) shutil.copy2(ROOT / "host.py", os.path.join(repo, "host.py")) diff --git a/cloud/tests/test_chv_muse_p4.py b/cloud/tests/test_chv_muse_p4.py index 1cfe873..9542f3a 100644 --- a/cloud/tests/test_chv_muse_p4.py +++ b/cloud/tests/test_chv_muse_p4.py @@ -718,7 +718,7 @@ class BuildDryRunTest(unittest.TestCase): "chv-cdp-broker.py", "chv_browser_guard.py", "browser-blocklist.txt", "authd.py", "git-credential-chv-authd", - "chv-authd.service"): + "chv-authd.service", "chv-memory.py"): shutil.copy2(ROOT / "chv-guest" / name, os.path.join(guest, name)) shutil.copy2(ROOT / "host.py", os.path.join(repo, "host.py"))