HEL-892: apply user exclusion to the 155-workflow delivery scope

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-29 22:15:30 +08:00
co-authored by multica-agent
parent ddf56714ad
commit b01809cf8c
42 changed files with 80725 additions and 35 deletions
@@ -10,6 +10,7 @@ import hashlib
import json
from pathlib import Path
from calliope.comfyui.delivery_scope import exclusion_for
from calliope.comfyui.ui2api import convert
@@ -39,6 +40,10 @@ def load_companions(path: Path) -> dict:
raise ValueError("必须明确记录导出时间/版本的未知状态")
if key in records:
raise ValueError("配套源路径重复")
if exclusion_for(key):
# Keep the receipt, without requiring excluded execution materials.
records[key] = {"binding": entry, "raw": None}
continue
# Store bytes, not a live path: the same bytes are hashed and imported.
relative = Path(entry["export_file"])
if relative.is_absolute() or ".." in relative.parts:
@@ -0,0 +1,16 @@
{
"schema_version": 1,
"excluded": {
"example_ComfyUI_workflows/5-数字人/Wan2.1_I2V_InfiniteTalk_rCM_数字人对口型多动态(KJ版).json": {
"status": "user_excluded",
"case_id": "06",
"reason": "用户明确排除这一份,不补导、不修补,不作为剩余阻塞",
"decision": {
"issue_id": "01a17910-fd9c-72aa-9e76-331f0cfdf896",
"comment_id": "01a187e6-5df9-7c98-8afe-05fc9baa5b55",
"issue_link": "mention://issue/01a17910-fd9c-72aa-9e76-331f0cfdf896",
"quote": "缺的那份不需要了"
}
}
}
}
@@ -0,0 +1,11 @@
"""Current delivery exclusions, independent of immutable source/material history."""
from __future__ import annotations
import json
from pathlib import Path
def exclusion_for(source_path: str) -> dict | None:
scope = json.loads(Path(__file__).with_suffix(".json").read_text(encoding="utf-8"))
return scope["excluded"].get(source_path)
@@ -12,6 +12,7 @@ from pathlib import Path
from typing import Any
from calliope.comfyui.companions import resolve_companion
from calliope.comfyui.delivery_scope import exclusion_for
from calliope.comfyui.lint import workflow_warnings
from calliope.comfyui.output_map import auto_output_map, needs_user_output_map
from calliope.comfyui.parser import classify_usage, parse_dynamic_inputs, parse_dynamic_outputs
@@ -325,6 +326,18 @@ def import_library(
"SELECT * FROM workflows WHERE source_repo_path=?", (relative,)
).fetchone()
record = {"path": relative, "source_sha": sha}
excluded = exclusion_for(relative)
if excluded:
report["files"].append(
{
**record,
"result": "user_excluded",
"scope": excluded,
"workflow_id": existing["id"] if existing else None,
"historical_row_preserved": bool(existing),
}
)
continue
companion = (companions or {}).get(relative)
# Version companion documentation separately from the immutable received bytes.
companion_sha = hashlib.sha256(
@@ -502,7 +515,14 @@ def import_library(
}
)
report["counts"] = dict(Counter(r["result"] for r in report["files"]))
report["states"] = dict(Counter(r.get("state", "conflict") for r in report["files"]))
report["states"] = dict(
Counter(
r.get("state", "conflict") for r in report["files"] if r["result"] != "user_excluded"
)
)
report["source_total"] = len(report["files"])
report["excluded_total"] = sum(r["result"] == "user_excluded" for r in report["files"])
report["target_total"] = report["source_total"] - report["excluded_total"]
report["total"] = len(report["files"])
report["doc_completed"] = 0
report["exec_verified"] = 0
@@ -12,6 +12,7 @@ from pathlib import Path
import httpx
from calliope.comfyui.companions import load_companions
from calliope.comfyui.delivery_scope import exclusion_for
from calliope.comfyui.library import import_library, load_snapshot, rollback_batch
from calliope.db import get_db, migrate_db
@@ -82,6 +83,9 @@ def main() -> None:
"SELECT source_repo_path, source_sha, import_state, doc_json "
"FROM workflows WHERE source_repo_path IS NOT NULL ORDER BY source_repo_path"
):
if exclusion_for(row["source_repo_path"]):
# Historical rows stay in the DB, outside current delivery exports.
continue
doc = json.loads(row["doc_json"])
key = hashlib.sha256(row["source_repo_path"].encode()).hexdigest()[:16]
write(args.output_dir / "documents" / (key + ".json"), doc)