feat: guard frozen split products against silent overwrite (--force)

This commit is contained in:
2026-07-16 05:00:42 -04:00
parent 5bb8319220
commit a39846af6e
3 changed files with 73 additions and 0 deletions
+9
View File
@@ -519,6 +519,7 @@ async def run_pipeline(
questions_dir: Path,
out_dir: Path,
generated_at: str,
force: bool = False,
) -> SplitBuildResult:
"""内联三阶段:Phase 0 INFRA T0 补录 → Phase 1 诊断 → Phase 2 冻结切分 → McNemar 护栏。
@@ -534,6 +535,7 @@ async def run_pipeline(
questions_dir: benchmark 题库目录(Phase 2 加载题库切池)。
out_dir: 冻结产物目录(pools.json + split_manifest.json)。
generated_at: 生成时间戳(ISO 字符串,由调用方传入;见模块 C-2 复现锚点约定)。
force: 覆盖已存在冻结产物开关,透传给 build_split(False 时已存在即报错)。
返回:
SplitBuildResult(冻结三池 + manifest + assignment)。
@@ -577,6 +579,7 @@ async def run_pipeline(
out_path=out_dir / "pools.json",
manifest_path=out_dir / "split_manifest.json",
generated_at=generated_at,
force=force,
)
# McNemar 功效护栏(build_split 契约外的 capstone 层校验)。
@@ -650,6 +653,7 @@ def _execute_real(config: VideoSplitConfig, fingerprint: str, args: argparse.Nam
questions_dir=questions_dir,
out_dir=out_dir,
generated_at=generated_at,
force=args.force,
)
)
finally:
@@ -773,6 +777,11 @@ def build_arg_parser() -> argparse.ArgumentParser:
"对 manifest 做字节级复现比对。"
),
)
parser.add_argument(
"--force",
action="store_true",
help="覆盖已存在的冻结 pools.json/manifest(旧产物备份为 .bak.*",
)
return parser