style: auto-format with black + isort + prettier [skip ci-format-check]
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 44s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 47s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 45s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m35s
AI Code Review / AI Code Review (pull_request) Failing after 1m45s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m57s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 2m5s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m9s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m48s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 6m15s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 8m17s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m46s
CI/CD Pipeline / CI Gate (pull_request) Successful in 24s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 552h6m21s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 552h6m23s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 552h6m23s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 552h6m21s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 552h6m24s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 552h13m53s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 552h13m55s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 552h13m57s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 552h13m59s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 552h13m57s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 552h14m38s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 552h14m40s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 552h14m42s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 552h40m14s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 552h47m49s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 552h47m53s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 44s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 47s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 45s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m35s
AI Code Review / AI Code Review (pull_request) Failing after 1m45s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m57s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 2m5s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m9s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m48s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 6m15s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 8m17s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m46s
CI/CD Pipeline / CI Gate (pull_request) Successful in 24s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 552h6m21s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 552h6m23s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 552h6m23s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 552h6m21s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 552h6m24s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 552h13m53s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 552h13m55s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 552h13m57s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 552h13m59s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 552h13m57s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 552h14m38s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 552h14m40s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 552h14m42s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 552h40m14s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 552h47m49s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 552h47m53s
This commit is contained in:
@@ -5,11 +5,12 @@ source_edit_plan_id 为空时直接 return failed 字典,但没有调用
|
||||
_update_task_status(task_id, "mark_failed"),导致 DB 状态永远停在
|
||||
running,前端轮询永远等不到完成。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
GENERATION_PY = Path(__file__).resolve().parents[2] / "apps" / "worker" / "worker_app" / "tasks" / "generation.py"
|
||||
|
||||
|
||||
@@ -26,24 +27,22 @@ class TestEmptyPlanIdMarksFailed:
|
||||
|
||||
# 找到 else 分支: 包含 source_edit_plan_id 为空 的日志
|
||||
else_pattern = re.compile(
|
||||
r"else:\s*\n"
|
||||
r"\s+logger\.error\("
|
||||
r"[^)]*source_edit_plan_id",
|
||||
r"else:\s*\n" r"\s+logger\.error\(" r"[^)]*source_edit_plan_id",
|
||||
re.DOTALL,
|
||||
)
|
||||
assert else_pattern.search(source), "未找到 source_edit_plan_id 为空的 else 分支"
|
||||
|
||||
else_match = else_pattern.search(source)
|
||||
else_start = else_match.start()
|
||||
else_block = source[else_start:else_start + 800]
|
||||
else_block = source[else_start : else_start + 800]
|
||||
|
||||
return_match = re.search(r'return\s*\{[^}]*"status"\s*:\s*"failed"', else_block, re.DOTALL)
|
||||
assert return_match, "else 分支中未找到 return failed"
|
||||
|
||||
block_before_return = else_block[:return_match.start()]
|
||||
assert "mark_failed" in block_before_return, (
|
||||
"source_edit_plan_id 为空的 else 分支在 return 之前必须调用 mark_failed"
|
||||
)
|
||||
block_before_return = else_block[: return_match.start()]
|
||||
assert (
|
||||
"mark_failed" in block_before_return
|
||||
), "source_edit_plan_id 为空的 else 分支在 return 之前必须调用 mark_failed"
|
||||
|
||||
def test_mark_failed_before_return_in_else(self):
|
||||
"""mark_failed 调用必须在 return 之前,而非之后。"""
|
||||
@@ -58,6 +57,6 @@ class TestEmptyPlanIdMarksFailed:
|
||||
|
||||
assert mark_failed_idx != -1, "else 分支中没有 mark_failed 调用"
|
||||
assert return_failed_idx != -1, "else 分支中没有 return failed"
|
||||
assert mark_failed_idx < return_failed_idx, (
|
||||
f"mark_failed (pos {mark_failed_idx}) 必须在 return failed (pos {return_failed_idx}) 之前"
|
||||
)
|
||||
assert (
|
||||
mark_failed_idx < return_failed_idx
|
||||
), f"mark_failed (pos {mark_failed_idx}) 必须在 return failed (pos {return_failed_idx}) 之前"
|
||||
|
||||
Reference in New Issue
Block a user