feat: add shared test acceptance and release 1.5.0

This commit is contained in:
chenmingxuan committed 2026-10-12 12:33:55 +08:00
1 parent 3fbcdfefea
commit ec2c1265d3
35 files changed
+826 -51

No files matched your search

+25 -3
View File
@@ -284,6 +284,7 @@ async def exit_settlement_node(state: State, ctx: ArtemisContext):
max_attempts = int(getattr(setup, "final_check_max_attempts", 3) or 3) if setup else 3
verify_blocked = False
case_result = None
blocked_findings: list[str] = []
if final_check_enabled(ctx):
attempt_no = ctx.final_check_attempts + 1
@@ -320,9 +321,20 @@ async def exit_settlement_node(state: State, ctx: ArtemisContext):
),
timeout=checkpoint_timeout,
)
case_result = report.test_result
except Exception as e:
# Fail-open: release, but the verdict value stays inconclusive.
logger.warning(f"Final check errored ({e}); releasing fail-open.")
from artemis.runtime.case_result import CaseTestResult
detail = (
f"超过 {checkpoint_timeout:g} 秒"
if isinstance(e, TimeoutError)
else f"{type(e).__name__}: {e}"
)
case_result = CaseTestResult(
status="inconclusive", reason=f"最终验收未完成:{detail}。"
)
error_verdicts: list[dict] = []
for ci in snapshot.all_check_items:
append_ledger_record(
@@ -444,10 +456,20 @@ async def exit_settlement_node(state: State, ctx: ArtemisContext):
verify_blocked=verify_blocked,
retired=retired if isinstance(retired, set) else None,
)
if snapshot.all_check_items or records or verify_blocked:
update["run_outcome"] = outcome.model_dump()
if snapshot.all_check_items or records or verify_blocked or case_result is not None:
from artemis.runtime.case_result import resolve_case_result
payload = outcome.model_dump()
if case_result:
payload["test_result"] = case_result.model_dump()
resolved = resolve_case_result(
payload, "completed" if outcome.task_status == "completed" else "failed"
)
payload["test_result"] = resolved.model_dump() if resolved else None
update["run_outcome"] = payload
# BLOCKED/partial wrap-ups carry the last findings in the metadata file.
extra: dict = {"last_findings": blocked_findings} if blocked_findings else {}
extra["test_result"] = payload["test_result"]
# Which UI-hierarchy source served the run, so a report reader can tell a
# helper run from a UIAutomator2 fallback without reading logs.
from artemis.clients.screen_client_factory import hierarchy_backend_summary
@@ -461,7 +483,7 @@ async def exit_settlement_node(state: State, ctx: ArtemisContext):
{
"event": "run_outcome",
"phase": "outcome",
**outcome.model_dump(),
**payload,
"last_findings": list(blocked_findings),
},
)