feat(ack): shard task records for merge-safe workspaces

This commit is contained in:
2026-09-20 19:15:43 +08:00
parent fd13dad2b0
commit 130dcc36c5
29 changed files with 985 additions and 218 deletions
+10 -37
View File
@@ -25,13 +25,7 @@ import sys
from pathlib import Path
from approval_payload import approval_payload_hash
from yaml_subset import (
DuplicateKeyError,
YamlSubsetError,
load_json_unique,
load_yaml_subset,
make_unique_pyyaml_loader,
)
from task_store import TaskStoreError, is_task_store_manifest, materialize_board, parse_document
from worker_profiles import validate_orchestration
from worker_profiles import validate_routing_document
@@ -243,38 +237,12 @@ def _nonempty_string(value: object) -> bool:
def load_document(path: Path) -> dict:
try:
content = path.read_text(encoding="utf-8")
except OSError as exc:
data = parse_document(path)
if is_task_store_manifest(data):
data = materialize_board(data, path)
except TaskStoreError as exc:
sys.stderr.write(f"任务板读取失败: {exc}\n")
raise SystemExit(1)
if path.suffix.lower() == ".json":
try:
data = load_json_unique(content)
except (json.JSONDecodeError, DuplicateKeyError) as exc:
sys.stderr.write(f"JSON 解析失败: {exc}\n")
raise SystemExit(1)
else:
try:
import yaml # type: ignore
except ImportError:
try:
data = load_yaml_subset(content)
except YamlSubsetError as exc:
sys.stderr.write(f"YAML 子集解析失败: {exc}\n")
raise SystemExit(1)
else:
try:
data = yaml.load(
content,
Loader=make_unique_pyyaml_loader(yaml),
)
except yaml.YAMLError as exc: # type: ignore
sys.stderr.write(f"YAML 解析失败: {exc}\n")
raise SystemExit(1)
if not isinstance(data, dict):
sys.stderr.write("任务板顶层必须是对象(mapping)\n")
raise SystemExit(1)
return data
@@ -901,6 +869,11 @@ def validate_builtin(
orchestration_override: dict | None = None,
) -> list[str]:
errors: list[str] = []
store_errors = data.get("taskStoreErrors")
if isinstance(store_errors, list):
for error in store_errors:
if isinstance(error, str) and error.strip():
errors.append(f"taskStore: {error}")
project_intake_workflow = "read-only-v1"
def validate_string_fields(