feat(ship): clarify delivery stop semantics

This commit is contained in:
2026-10-14 11:49:50 +08:00
parent 125bfe0c23
commit 19aac17a0a
8 changed files with 133 additions and 21 deletions
+12
View File
@@ -13,6 +13,7 @@ from ship_lib import (
DELIVERY_STATE,
KIND,
SHIP_STATUS,
STOP_AT,
SOURCE_KIND,
TASK_STATUS,
check_ship_id,
@@ -77,6 +78,17 @@ def validate_ship_dir(ship_dir: Path) -> list[str]:
if not isinstance(data.get("title"), str) or not str(data.get("title")).strip():
_issue(issues, "title 不能为空")
for path, value in (
("stopAt", data.get("stopAt")),
("delivery.stopAt", (data.get("delivery") or {}).get("stopAt")
if isinstance(data.get("delivery"), dict) else None),
):
if value not in (None, "") and value not in STOP_AT:
_issue(
issues,
f"{path} 无效: {value!r}({', '.join(sorted(STOP_AT))})",
)
source = data.get("source")
if source is not None:
src = _mapping(source, "source", issues)