Spaces:
Running
Running
File size: 18,703 Bytes
3dfc93b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | """run λ²λ€ νλ β `proofread_diff@2` μ±μ λ²λ€ (κ³ν 2026-09-26 L3b Β§2.4Β·D5).
μμ: subject verify β μμ°μ νλ³(`is_legacy_results_producer`) β `results.jsonl` λ μ½λ μ€ μμλλ‘ μ½κΈ° β νλ§λ€ μ±μ (μμ
λͺ¨λ) β νμ μ΄μΒ·μμ°μ μ§κ³ β κ°μ `evaluation_run_id` μ κΈ°μ‘΄ μ΅μ κ³Ό λΉκ΅ β μ λ²λ€ μ°κΈ°(`write_scoring_bundle`, subject
λ₯Ό λ겨 E1Β·E2 κΉμ§ μ»€λ° μ μ λ³Έλ€) β (`mirror_root` κ° μμΌλ©΄) `mirror_bundle(area="evaluations")`.
- `evaluation_run_id` = `code_rescore_run_id(subject bundle_id, evaluator_config_hash)` β subject λ²λ€μ΄ λ°λλ©΄ μ id λ€.
- **λ©±λ±(D5).** κΈ°μ‘΄ μ΅μ (κ°μ id)μ΄ subject μ ν¨κ» `verify_scoring_bundle` μ ν΅κ³Όνκ³ (E4 λ‘ `evaluator_config.json` νμΌμ
config ν΄μ = λ§€λνμ€νΈ κ°κΉμ§ λ³Έλ€), νκ°κΈ° ν΄μκ° κ°κ³ , `producer_aggregates.json` λ°μ΄νΈκ° κ°κ³ , `judgments.jsonl` νμμ
`created_at`(μ¬μ±μ μκ°)μ λΊ λͺ©λ‘μ΄ μ λͺ©λ‘κ³Ό κ°μΌλ©΄ μ λ²λ€μ μ°μ§ μκ³ κΈ°μ‘΄ κ²½λ‘λ₯Ό `exists` λ‘ λλ €μ€λ€. νλλΌλ
λ€λ₯΄λ©΄(κΈ°μ‘΄ μ΅μ μ΄ κΉ¨μ‘μ΄λ) `supersedes` = κΈ°μ‘΄ μ΅μ μΌλ‘ μ ULID λ²λ€μ μ΄λ€ β μ ULID β€ κΈ°μ‘΄μ΄λ©΄ `clock_skew`(eval-wrapΒ·
wrap κ³Ό κ°μ κ·μΉ). λΉκ΅κ° id μμ κ²μ¬λ³΄λ€ λ¨Όμ λ€. μμ°μ μ§κ³λ νν¬(`impl_hash`) λ°μ λ κ±°μ μ§κ³ μ½λκ° λ΄λ―λ‘ νμ λ§
보면 κ·Έ μ½λκ° λ°λ κ²μ λμΉλ€.
- **subject κ²½κ³.** `manifest.json` μ΄ μλ λλ ν 리λ `not_a_run_bundle` μ€λ₯(λ²λ€μ΄ μλλ€ β κ²½λ‘ μ€μ), verify μ€ν¨λ
`latest_bundle_invalid` skip(`items.jsonl` μ΄ κΉ¨μ§ κ²½μ° ν¬ν¨ β case λͺ¨λμ μ±νκ³Ό κ°μ λΆλ₯).
- μΆλ ₯Β·μ€λ₯ λ©μμ§μλ idΒ·μ½λΒ·κ²½λ‘λ§ μ£λλ€. μ
λ ₯Β·μΆλ ₯Β·μ λ΅ μλ¬Έμ μ΄λμλ μ°μ§ μλλ€(census D-04 μ κ°μ κ·μΉ).
"""
from __future__ import annotations
import re
import shutil
import tempfile
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
from datetime import UTC, datetime
from pathlib import Path
from typing import Any, Literal
from poc_bundle.adopt import AdoptError, Committed, committed_scoring_bundles, latest
from poc_bundle.bundle import verify_bundle
from poc_bundle.canonical import load_json_strict
from poc_bundle.jsonl import iter_record_lines
from poc_bundle.legacy_run import is_legacy_results_producer
from poc_bundle.mirror import MirrorError, mirror_bundle
from poc_bundle.scoring.ids import code_rescore_run_id, evaluator_config_hash
from poc_bundle.scoring.verify import RunBundleRef, load_run_bundle_ref, verify_scoring_bundle
from poc_bundle.scoring.writer import JudgmentDraft, ScoringWriteError, write_scoring_bundle
from ulid import ULID
from solar_eval._version import __version__
from solar_eval.rescore.drafts import ScoredRow, judgment_drafts, producer_aggregates
from solar_eval.rescore.evaluator_doc import current_evaluator_document
from solar_eval.rescore.paths import EVALUATIONS_AREA, RescorePathError, mirror_area_dir
from solar_eval.rescore.proofread_diff_v2 import has_original, score_row
PRODUCER_NAME = "solar-eval score"
PURPOSE = "rescore_after_fix"
RESULTS_FILE = "results.jsonl"
JUDGMENTS_FILE = "judgments.jsonl"
AGGREGATES_FILE = "producer_aggregates.json"
#: λ©±λ± λΉκ΅μ© μμ λ²λ€ id β κ°μ₯ ν° ULID λΌ μ΄λ€ `supersedes` 보λ€λ λ€μ μ¨λ€. μΆλ ₯ λλ ν 리μλ μ°μ§ μλλ€.
STAGING_BUNDLE_ID = "7ZZZZZZZZZZZZZZZZZZZZZZZZZ"
# run λ¨μ skip μ½λ(μ’
λ£ 0 μ ν¬ν¨)μ μ€λ₯ μ½λ(μ’
λ£ 1) β κ³ν Β§2.2.
SKIP_LATEST_INVALID = "latest_bundle_invalid"
SKIP_UNKNOWN_FORMAT = "unknown_results_format"
SKIP_NO_RESULTS = "no_results"
ERR_ADOPT = "adopt_unreadable_manifest"
ERR_CLOCK_SKEW = "clock_skew"
ERR_MIRROR = "mirror_failed"
ERR_RESULTS = "results_unreadable"
ERR_OUT_INSIDE = "out_inside_bundle"
ERR_NOT_A_BUNDLE = "not_a_run_bundle"
WRITE_FAILED_PREFIX = "write_failed:"
_RULE_ID = re.compile(r"^\[([A-Z]+[0-9]*)\]")
Status = Literal["written", "exists", "skip"]
class RescoreError(RuntimeError):
"""μ΄ run μ μ¬μ±μ ν μ μλ€(μ’
λ£ 1). `code` λ Β§2.2 μ€λ₯ μ΄ν, `run_id` λ μλ©΄ μ£λλ€."""
def __init__(self, code: str, message: str, run_id: str | None = None) -> None:
super().__init__(f"{code}: {message}")
self.code = code
self.run_id = run_id
@dataclass(frozen=True)
class RescoreOutcome:
"""run νλμ κ²°κ³Ό β `written`Β·`exists` λ λ²λ€ κ²½λ‘, `skip` μ μ½λ."""
status: Status
run_id: str | None
path: Path | None = None
code: str | None = None
n_original_missing: int = 0
class _Skip(Exception):
def __init__(self, code: str) -> None:
super().__init__(code)
self.code = code
@dataclass(frozen=True)
class _Subject:
bundle_dir: Path
run_id: str
bundle_id: str
case: dict[str, Any]
ref: RunBundleRef
def rescore_run_bundle(
run_bundle_dir: Path,
out_dir: Path | None = None,
*,
mirror_root: Path | None = None,
now: datetime | None = None,
bundle_id: str | None = None,
evaluator: Mapping[str, Any] | None = None,
repo_root: Path | None = None,
) -> RescoreOutcome:
"""run λ²λ€ νλλ₯Ό μ¬μ±μ νλ€. `out_dir`(μ±μ λ²λ€λ€μ λΆλͺ¨) μ `mirror_root` μ€ **μ νν νλ**λ₯Ό μ€λ€.
Args:
mirror_root: λ―Έλ¬ λ²ν·μ λΆλͺ¨ β μ£Όλ©΄ μΆλ ₯ μμμ subject `case` μ λ―Έλ¬ `evaluations` μ΄κ³ `mirror_bundle` λ‘ λλλ€.
now Β· bundle_id: μ¬ν κ°λ₯ν ν
μ€νΈ μ μ©. λΉμ°λ©΄ μ§κΈ μκ°Β·μ ULID.
evaluator: νκ°κΈ° λ¬Έμ(case μ 체μ ν λ² λ¬ κ²). λΉμ°λ©΄ μ§κΈ λμ€ν¬μ ꡬνμΌλ‘ λ¬λ€.
repo_root: `mirror_bundle` μ λ ν¬ λ° κ²μ¬ κΈ°μ€(κΈ°λ³Έ: λ ν¬λ₯Ό μ°Ύμ λ³Έλ€).
Raises:
RescoreError: Β§2.2 μ€λ₯(μ±ν μμ λ§€λνμ€νΈΒ·μκ³ μνΒ·μ°κΈ°Β·λ―Έλ¬Β·results μ½κΈ°).
"""
if (out_dir is None) == (mirror_root is None):
raise ValueError("give exactly one of out_dir / mirror_root")
try:
subject = _load_subject(Path(run_bundle_dir))
rows, n_missing = _scored_rows(subject)
except _Skip as skip:
run_id = _run_id_or_none(Path(run_bundle_dir))
return RescoreOutcome("skip", run_id, code=skip.code)
doc = dict(evaluator) if evaluator is not None else current_evaluator_document()
at = _utc_seconds(now)
drafts = judgment_drafts(subject.run_id, rows, at)
target = out_dir if out_dir is not None else _mirror_evaluations(mirror_root, subject)
_check_out_dir(Path(target), subject)
plan = _Plan(subject, doc, drafts, producer_aggregates(rows, drafts), at)
status, path = _commit(plan, Path(target), bundle_id, mirror_root, repo_root)
return RescoreOutcome(status, subject.run_id, path=path, n_original_missing=n_missing)
# ββ μ½κΈ° βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def _load_subject(bundle_dir: Path) -> _Subject:
ref = _subject_ref(bundle_dir)
report = ref.verify_report
if not report.is_bundle:
raise RescoreError(ERR_NOT_A_BUNDLE, f"no manifest.json in {bundle_dir}")
if not report.ok or report.manifest is None:
raise _Skip(SKIP_LATEST_INVALID)
manifest = report.manifest
if not is_legacy_results_producer(manifest.producer.name):
raise _Skip(SKIP_UNKNOWN_FORMAT)
return _Subject(
bundle_dir=bundle_dir,
run_id=manifest.run_id,
bundle_id=manifest.bundle_id,
case=manifest.case.model_dump(mode="json"),
ref=ref,
)
def _subject_ref(bundle_dir: Path) -> RunBundleRef:
"""`RunBundleRef` β `items.jsonl` μ λͺ» μ½μΌλ©΄ verify κ²°κ³Όλ‘ κ°λ₯Έλ€: μ€ν¨λ©΄ skip, ν΅κ³ΌμΈλ° λͺ» μ½μΌλ©΄ μ€λ₯.
`load_run_bundle_ref` λ verify κ²°κ³Όμ 무κ΄νκ² items νμ± μ€λ₯λ₯Ό λμ§λ―λ‘, κ·Έλλ‘ λλ©΄ κΉ¨μ§ λ²λ€μ΄ case λͺ¨λ(μ±νμ΄
verify λ₯Ό λ¨Όμ λ³Έλ€)μ λ¬λ¦¬ `results_unreadable` λ‘ λΆλ₯λλ€.
"""
try:
return load_run_bundle_ref(bundle_dir)
except ValueError as exc:
if not verify_bundle(bundle_dir).ok:
raise _Skip(SKIP_LATEST_INVALID) from exc
raise RescoreError(ERR_RESULTS, f"items.jsonl unreadable in {bundle_dir.name}") from exc
def _scored_rows(subject: _Subject) -> tuple[list[ScoredRow], int]:
"""results λ μ½λ μ€ μμλλ‘ μ±μ ν νκ³Ό `original` μ΄ μλ ν μ. λ μ½λκ° 0μ΄λ©΄ `no_results`."""
rows: list[ScoredRow] = []
missing = 0
path = subject.bundle_dir / RESULTS_FILE
for line_no, raw in iter_record_lines(path):
result = _parse_result(raw, line_no, subject)
sample_idx = result["sample_idx"]
input_key, golden_key = subject.ref.items[sample_idx]
rows.append(ScoredRow(sample_idx, input_key, golden_key, score_row(result)))
missing += 0 if has_original(result) else 1
if not rows:
raise _Skip(SKIP_NO_RESULTS)
return rows, missing
def _parse_result(raw: bytes, line_no: int, subject: _Subject) -> Mapping[str, Any]:
"""λ μ½λ ν μ€ β κ°μ²΄. λ©μμ§μλ μ€ λ²νΈλ§ μ£λλ€(ν λ΄μ© μμ)."""
where = f"{RESULTS_FILE}:{line_no} of run bundle {subject.bundle_id}"
try:
row = load_json_strict(raw, safe_integers=False)
except (ValueError, RecursionError) as exc:
raise RescoreError(ERR_RESULTS, f"{where} is not strict JSON", subject.run_id) from exc
sample_idx = row.get("sample_idx") if isinstance(row, dict) else None
if isinstance(sample_idx, bool) or not isinstance(sample_idx, int):
raise RescoreError(ERR_RESULTS, f"{where} has no integer sample_idx", subject.run_id)
if sample_idx not in subject.ref.items:
raise RescoreError(ERR_RESULTS, f"{where} sample_idx is not in items.jsonl", subject.run_id)
return row
def _run_id_or_none(bundle_dir: Path) -> str | None:
"""skip μ€μ μ€μ run_id β λ§€λνμ€νΈλ₯Ό μ½μ μ μμ λλ§(κ²μ¦ μ€ν¨μ¬λ)."""
try:
data = load_json_strict((bundle_dir / "manifest.json").read_bytes())
except (OSError, ValueError, RecursionError):
return None
run_id = data.get("run_id") if isinstance(data, dict) else None
return run_id if isinstance(run_id, str) else None
def _mirror_evaluations(mirror_root: Path | None, subject: _Subject) -> Path:
try:
return mirror_area_dir(
mirror_root, subject.case["account"], subject.case["case"], EVALUATIONS_AREA
)
except RescorePathError as exc:
raise RescoreError(ERR_MIRROR, str(exc), subject.run_id) from exc
def _check_out_dir(out: Path, subject: _Subject) -> None:
target, run_abs = out.resolve(), subject.bundle_dir.resolve()
if target == run_abs or run_abs in target.parents:
raise RescoreError(
ERR_OUT_INSIDE, f"output {target} is inside the run bundle", subject.run_id
)
def _utc_seconds(now: datetime | None) -> str:
moment = (now or datetime.now(UTC)).astimezone(UTC)
return moment.strftime("%Y-%m-%dT%H:%M:%SZ")
# ββ λ©±λ±Β·μ»€λ° βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
@dataclass(frozen=True)
class _Plan:
subject: _Subject
evaluator: Mapping[str, Any]
drafts: Sequence[JudgmentDraft]
aggregates: Mapping[str, Any]
created_at: str
@property
def config_hash(self) -> str:
return evaluator_config_hash(self.evaluator)
@property
def evaluation_run_id(self) -> str:
return code_rescore_run_id(self.subject.bundle_id, self.config_hash)
def _commit(
plan: _Plan,
out: Path,
bundle_id: str | None,
mirror_root: Path | None,
repo_root: Path | None,
) -> tuple[Status, Path]:
previous = _latest_committed(out, plan)
if previous is not None and _same_as(previous, plan):
return "exists", previous.path
new_id = bundle_id or str(ULID())
if previous is not None and previous.bundle_id >= new_id:
raise RescoreError(
ERR_CLOCK_SKEW,
f"new bundle_id {new_id} is not newer than committed {previous.bundle_id}",
plan.subject.run_id,
)
supersedes = None if previous is None else previous.bundle_id
fields = _manifest_fields(plan, new_id, supersedes)
if mirror_root is None:
dest = out / new_id
_write(dest, fields, plan)
return "written", dest
return "written", _write_and_mirror(fields, plan, new_id, Path(mirror_root), repo_root)
def _latest_committed(out: Path, plan: _Plan) -> Committed | None:
try:
committed = committed_scoring_bundles(out)
except AdoptError as exc:
raise RescoreError(ERR_ADOPT, str(exc), plan.subject.run_id) from exc
cands = committed.get(plan.evaluation_run_id, [])
return latest(cands) if cands else None
def _same_as(previous: Committed, plan: _Plan) -> bool:
"""D5 β κΈ°μ‘΄ μ΅μ μ΄ μ¨μ νκ³ νκ°κΈ° ν΄μΒ·μμ°μ μ§κ³Β·`created_at` μ λΊ νμ νμ΄ κ°μκ°.
μ리νμ id λ‘ μ¨ λ³Έ λ²λ€κ³Ό λΉκ΅νλ€. κΈ°μ‘΄ μ΅μ μ΄ verify μ μ€ν¨νλ©΄ κ°μ§ μλ€ β `exists` λ‘ λκΈ°λ©΄ κΉ¨μ§ λ²λ€μ΄ μμ
μ΅μ μΌλ‘ λ¨λλ€(hub λ μ΅μ μ΄ invalid λ©΄ μ΄μ μΌλ‘ λμ΄κ°μ§ μλλ€).
"""
evaluator_ref = previous.manifest.get("evaluator")
if (
not isinstance(evaluator_ref, Mapping)
or evaluator_ref.get("config_hash") != plan.config_hash
or not _previous_verifies(previous, plan)
):
return False
fields = _manifest_fields(plan, STAGING_BUNDLE_ID, previous.bundle_id)
with tempfile.TemporaryDirectory(prefix="solar-eval-score-") as tmp:
staged = Path(tmp) / STAGING_BUNDLE_ID
_write(staged, fields, plan)
new_rows = _rows_without_time(staged / JUDGMENTS_FILE)
new_aggregates = _bytes_or_none(staged / AGGREGATES_FILE)
old_rows = _rows_without_time(previous.path / JUDGMENTS_FILE)
old_aggregates = _bytes_or_none(previous.path / AGGREGATES_FILE)
return (
old_rows is not None
and old_rows == new_rows
and old_aggregates is not None
and old_aggregates == new_aggregates
)
def _previous_verifies(previous: Committed, plan: _Plan) -> bool:
"""κΈ°μ‘΄ μ΅μ μ subject μ ν¨κ» κ²μ¦νλ€ β SB1(νμΌ sha)Β·E4(`evaluator_config.json` config ν΄μ)Β·E1Β·E2 κΉμ§."""
subject = plan.subject
report = verify_scoring_bundle(previous.path, run_bundles={subject.bundle_id: subject.ref})
return report.ok
def _bytes_or_none(path: Path) -> bytes | None:
"""νμΌ λ°μ΄νΈ. λͺ» μ½μΌλ©΄ None(λΉκ΅κ° κ±°μ§ β μ λ²λ€)."""
try:
return path.read_bytes()
except OSError:
return None
def _rows_without_time(path: Path) -> list[dict[str, Any]] | None:
"""νμ νμμ `created_at` μ λΊ λͺ©λ‘. λͺ» μ½μΌλ©΄ None(λΉκ΅κ° κ±°μ§ β μ λ²λ€)."""
try:
rows = [load_json_strict(raw) for _, raw in iter_record_lines(path)]
except (OSError, ValueError, RecursionError):
return None
if not all(isinstance(row, dict) for row in rows):
return None
return [{k: v for k, v in row.items() if k != "created_at"} for row in rows]
def _manifest_fields(plan: _Plan, bundle_id: str, supersedes: str | None) -> dict[str, Any]:
subject = plan.subject
return {
"bundle_id": bundle_id,
"evaluation_run_id": plan.evaluation_run_id,
"id_origin": "deterministic",
"supersedes": supersedes,
"created_at": plan.created_at,
"producer": {"name": PRODUCER_NAME, "version": __version__},
"case": subject.case,
"subject": {
"kind": "run",
"runs": [{"run_id": subject.run_id, "bundle_id": subject.bundle_id, "role": "subject"}],
},
"purpose": PURPOSE,
"retry_of": None,
"golden_basis": "run",
"status": "completed",
"finished_at": plan.created_at,
"reproducible": {"snapshot_complete": True, "missing": []},
"known_defects": [],
"observed": None,
"usage": None,
}
def _write(dest: Path, fields: Mapping[str, Any], plan: _Plan) -> None:
try:
write_scoring_bundle(
dest,
fields=fields,
evaluator=plan.evaluator,
drafts=plan.drafts,
producer_aggregates=plan.aggregates,
run_bundle=plan.subject.ref,
)
except ScoringWriteError as exc:
_remove_uncommitted(dest)
raise RescoreError(_write_code(exc.issues), str(exc), plan.subject.run_id) from exc
except OSError as exc:
_remove_uncommitted(dest)
raise RescoreError(f"{WRITE_FAILED_PREFIX}io_error", str(exc), plan.subject.run_id) from exc
def _write_code(issues: Sequence[str]) -> str:
"""`write_failed:<κ·μΉ id λͺ©λ‘>` β μ΄μ λ¬Έμ₯μ `[<id>]` λ¨Έλ¦¬λ§ λͺ¨μλ€(μμΌλ©΄ `input`)."""
ids = sorted({m.group(1) for issue in issues if (m := _RULE_ID.match(issue))})
return WRITE_FAILED_PREFIX + (",".join(ids) if ids else "input")
def _write_and_mirror(
fields: Mapping[str, Any], plan: _Plan, new_id: str, mirror_root: Path, repo_root: Path | None
) -> Path:
"""μμ λλ ν 리μ μ΄ λ€ λ―Έλ¬μ λλλ€ β λ―Έλ¬μ μ»€λ° κ·μΉ(manifest λ§μ§λ§)Β·λ ν¬ λ° κ²μ¬λ₯Ό `mirror_bundle` μ΄ λ§‘λλ€."""
case = plan.subject.case
with tempfile.TemporaryDirectory(prefix="solar-eval-score-") as tmp:
staged = Path(tmp) / new_id
_write(staged, fields, plan)
try:
return mirror_bundle(
staged,
account=case["account"],
case=case["case"],
area=EVALUATIONS_AREA,
root=mirror_root,
repo_root=repo_root,
)
except (MirrorError, OSError) as exc:
raise RescoreError(ERR_MIRROR, str(exc), plan.subject.run_id) from exc
def _remove_uncommitted(staging: Path) -> None:
"""writer κ° manifest μμ΄ λ¨κΈ΄ λλ ν 리λ₯Ό μ§μ΄λ€ β 컀λ°λ λ²λ€(manifest μμ)μ 건λλ¦¬μ§ μλλ€."""
if staging.is_dir() and not (staging / "manifest.json").exists():
shutil.rmtree(staging)
|