revert(ack): restore three-role collaboration scope
This reverts commit a0f1c15b85.
This commit is contained in:
@@ -128,15 +128,8 @@ DISPATCH_FIELDS = {
|
||||
"worker",
|
||||
"developer",
|
||||
"test",
|
||||
"operator",
|
||||
"rounds",
|
||||
}
|
||||
DELIVERY_OPERATION_FIELDS = {"skill", "request"}
|
||||
DELIVERY_OPERATION_SKILLS = {
|
||||
"manage-release",
|
||||
"deb-publisher",
|
||||
"publish-docker-image",
|
||||
}
|
||||
KNOWLEDGE_CANDIDATE_REQUIRED_FIELDS = {
|
||||
"kind",
|
||||
"title",
|
||||
@@ -439,14 +432,11 @@ def validate_delivery_runs(
|
||||
value: object,
|
||||
task_statuses: dict[str, object],
|
||||
errors: list[str],
|
||||
*,
|
||||
delivery_operation_ids: set[str] | None = None,
|
||||
) -> None:
|
||||
if not isinstance(value, list):
|
||||
errors.append("deliveryRuns 必须是列表")
|
||||
return
|
||||
|
||||
excluded_task_ids = delivery_operation_ids or set()
|
||||
seen_run_ids: set[str] = set()
|
||||
for index, run in enumerate(value):
|
||||
where = f"deliveryRuns[{index}]"
|
||||
@@ -486,11 +476,6 @@ def validate_delivery_runs(
|
||||
for task_id in task_ids:
|
||||
if task_id not in task_statuses:
|
||||
errors.append(f"{where}.taskIds: 未知任务 {task_id!r}")
|
||||
elif task_id in excluded_task_ids:
|
||||
errors.append(
|
||||
f"{where}.taskIds: deliveryRuns 不能引用 delivery-operation "
|
||||
f"{task_id!r}"
|
||||
)
|
||||
elif task_statuses[task_id] != "verified":
|
||||
errors.append(
|
||||
f"{where}: delivery run 只能引用 verified 任务,"
|
||||
@@ -822,30 +807,6 @@ def validate_builtin(data: dict) -> list[str]:
|
||||
if not _nonempty_string(source.get("updatedAt")):
|
||||
errors.append(f"{where}.source.updatedAt: 必须是非空字符串")
|
||||
|
||||
operation = task.get("operation")
|
||||
if operation is not None:
|
||||
if not isinstance(operation, dict):
|
||||
errors.append(f"{where}.operation: 必须是对象")
|
||||
else:
|
||||
reject_unknown_fields(
|
||||
operation,
|
||||
DELIVERY_OPERATION_FIELDS,
|
||||
f"{where}.operation",
|
||||
errors,
|
||||
)
|
||||
skill = operation.get("skill")
|
||||
if skill not in DELIVERY_OPERATION_SKILLS:
|
||||
errors.append(
|
||||
f"{where}.operation.skill: 必须是 "
|
||||
"manage-release/deb-publisher/publish-docker-image"
|
||||
)
|
||||
if not _nonempty_string(operation.get("request")):
|
||||
errors.append(f"{where}.operation.request: 必须保留非空用户请求")
|
||||
|
||||
if task.get("type") == "delivery-operation":
|
||||
if not isinstance(operation, dict):
|
||||
errors.append(f"{where}: delivery-operation 必须声明 operation")
|
||||
|
||||
validate_knowledge_fields(task, where, status, errors)
|
||||
|
||||
if "dispatch" not in task:
|
||||
@@ -868,12 +829,6 @@ def validate_builtin(data: dict) -> list[str]:
|
||||
nullable=True,
|
||||
)
|
||||
|
||||
if task.get("type") == "delivery-operation" and (
|
||||
not isinstance(dispatch, dict)
|
||||
or not isinstance(dispatch.get("operator"), dict)
|
||||
):
|
||||
errors.append(f"{where}: delivery-operation 必须声明 dispatch.operator")
|
||||
|
||||
rounds = dispatch.get("rounds", [])
|
||||
if not isinstance(rounds, list):
|
||||
errors.append(f"{where}.dispatch.rounds: 必须是列表")
|
||||
@@ -974,19 +929,7 @@ def validate_builtin(data: dict) -> list[str]:
|
||||
for task in tasks
|
||||
if isinstance(task, dict) and _nonempty_string(task.get("id"))
|
||||
}
|
||||
delivery_operation_ids = {
|
||||
task["id"]
|
||||
for task in tasks
|
||||
if isinstance(task, dict)
|
||||
and _nonempty_string(task.get("id"))
|
||||
and task.get("type") == "delivery-operation"
|
||||
}
|
||||
validate_delivery_runs(
|
||||
data["deliveryRuns"],
|
||||
task_statuses,
|
||||
errors,
|
||||
delivery_operation_ids=delivery_operation_ids,
|
||||
)
|
||||
validate_delivery_runs(data["deliveryRuns"], task_statuses, errors)
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user