chore: 升级 Trellis 并精简规则(09-05-trellis-upgrade-rule-cleanup)
这个提交包含在:
@@ -12,10 +12,11 @@ Provides:
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
from .io import read_json
|
||||
from .io import describe_json_read_failure, read_json_checked
|
||||
from .paths import FILE_TASK_JSON
|
||||
from .types import TaskInfo
|
||||
|
||||
@@ -28,13 +29,22 @@ def load_task(task_dir: Path) -> TaskInfo | None:
|
||||
|
||||
Returns:
|
||||
TaskInfo if task.json exists and is valid, None otherwise.
|
||||
|
||||
A directory without task.json is not a task, so it is skipped silently.
|
||||
A task.json that exists but cannot be loaded is different: the task
|
||||
disappears from `task.py list` and from every context the iterator feeds.
|
||||
Callers stay tolerant, but the skip is announced on stderr so a task
|
||||
cannot vanish from the workflow with no diagnostic anywhere.
|
||||
"""
|
||||
task_json = task_dir / FILE_TASK_JSON
|
||||
if not task_json.is_file():
|
||||
return None
|
||||
|
||||
data = read_json(task_json)
|
||||
if not data:
|
||||
data, reason = read_json_checked(task_json)
|
||||
if data is None:
|
||||
problem, hint = describe_json_read_failure(task_json, reason)
|
||||
print(f"[WARN] Skipping task '{task_dir.name}': {problem}", file=sys.stderr)
|
||||
print(f" {hint}", file=sys.stderr)
|
||||
return None
|
||||
|
||||
return TaskInfo(
|
||||
|
||||
在新工单中引用
屏蔽一个用户