Files
阿白叔 a0f0a4b232
Core regression / Python core, intervention UI and release configuration (push) Successful in 3m52s
Core regression / JavaScript syntax (push) Successful in 5s
Core regression / Python core, intervention UI and release configuration (pull_request) Successful in 4m13s
Core regression / JavaScript syntax (pull_request) Successful in 9s
test: make Windows retry fixture portable and retain live diagnostics
2026-11-13 16:30:07 +08:00

48 lines
2.4 KiB
Python

"""One disposable source task through the real queue, with helper stack traces."""
import json
from pathlib import Path
import sys
import time
import traceback
out = Path(__file__).resolve().parent
repo = out.parents[1]
sys.path[:0] = [str(repo / 'src'), str(repo / 'tools')]
from accept_random_cad import prepare, workbook, write
from dx_productivity.trial_task_center import isolated_cad
from dx_productivity.trial_task_center.logging_setup import configure_logging
from dx_productivity.trial_task_center.service import TaskCenterService
from dx_productivity.trial_task_center.store import TaskStore
from dx_productivity.trial_task_center.stop_control import StopControl
from dx_productivity.trial_task_center.task_queue import execute_task_queue
from dataclasses import asdict
ref = json.loads((repo / 'outputs/supp-rule-mode-final-20261112/manifest.json').read_text(encoding='utf-8'))
root = out / 'project-cad-diagnostic'
manifest = prepare(root, Path(ref['source']), json.loads(Path(ref['baseline']).read_text(encoding='utf-8')),
ref['target_parts'], count=1, supplemental='normal')
manifest.update(baseline=ref['baseline'], library=ref['library'], purpose='Source diagnostic, not frozen/UI acceptance')
write(root / 'manifest.json', manifest)
workbook(root, manifest)
diagnostic = out / 'diagnose_empty_cad.py'
isolated_cad._helper_command = lambda action, evidence, pid: (sys.executable, '-X', 'utf8', str(diagnostic), action, str(evidence), str(pid))
record = dict(status='running', started_ns=time.time_ns(), source_diagnostic_only=True, product_timeout_unchanged=True)
path = out / 'project-cad-diagnostic.json'
store = TaskStore(root / 'data/task-center.db')
try:
service = TaskCenterService(store, configure_logging(root / 'data'))
tasks = service.create_project_tasks(root / 'projects')
assert len(tasks) == 1
report = service.import_bom_drafts(tasks[0].task_id, (root / 'random-bom.xlsx',))
assert report.deferred and not report.errors
print('real source task prepared', flush=True)
result = execute_task_queue(service, tuple(t.task_id for t in tasks), stop_event=StopControl())
record.update(status='completed', result=asdict(result), finished_ns=time.time_ns())
print(json.dumps(record, ensure_ascii=False), flush=True)
except BaseException:
record.update(status='failed_preserved', failure=traceback.format_exc(), finished_ns=time.time_ns())
raise
finally:
write(path, record)
store.close()