Skip to content

Commit c00c35f

Browse files
fix: support external paper workspace checks
1 parent ba93a9f commit c00c35f

8 files changed

Lines changed: 61 additions & 17 deletions

scripts/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
| --- | --- |
1515
| `DIFFAUDIT_WORKSPACE_ROOT` | 工作区根目录覆盖 |
1616
| `DIFFAUDIT_RESEARCH_PYTHON` | Python 解释器路径覆盖 |
17+
| `DIFFAUDIT_EVIDENCE_PAPER_DIR` | 私有 evidence paper 工作区路径覆盖,用于 paper/recode packet 脚本 |
1718

1819
脚本默认从当前 `Research/scripts` 位置推导路径,可以通过环境变量覆盖。
1920

scripts/e2/aggregate_false_promotion_external_review.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
import argparse
1313
import csv
14+
import os
1415
import re
1516
from collections import Counter, defaultdict
1617
from itertools import combinations
1718
from pathlib import Path
1819

1920

2021
ROOT = Path(__file__).resolve().parents[2]
21-
PAPER = ROOT / "papers" / "diffaudit-evidence-paper"
22+
PAPER = Path(os.environ.get("DIFFAUDIT_EVIDENCE_PAPER_DIR", ROOT / "papers" / "diffaudit-evidence-paper")).resolve()
2223
DEFAULT_REVIEW_DIR = PAPER / "build" / "false_promotion_external_review_labels"
2324
DEFAULT_OUTPUT_DIR = PAPER / "build"
2425

scripts/e2/build_claim_gate_recode_packet.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
import csv
1212
import hashlib
1313
import io
14+
import os
1415
from pathlib import Path
1516

1617

1718
ROOT = Path(__file__).resolve().parents[2]
18-
PAPER = ROOT / "papers" / "diffaudit-evidence-paper"
19+
PAPER = Path(os.environ.get("DIFFAUDIT_EVIDENCE_PAPER_DIR", ROOT / "papers" / "diffaudit-evidence-paper")).resolve()
1920
CLAIM_TRACE = PAPER / "data" / "claim_trace.csv"
2021
OUT_TEMPLATE = PAPER / "data" / "claim_gate_recode_template.csv"
2122
OUT_MANIFEST = PAPER / "data" / "claim_gate_recode_packet_manifest.csv"
@@ -176,9 +177,9 @@ def write_outputs() -> None:
176177
def check_outputs() -> None:
177178
expected_template, expected_manifest = render_outputs()
178179
if not OUT_TEMPLATE.exists() or OUT_TEMPLATE.read_text(encoding="utf-8") != expected_template:
179-
raise SystemExit(f"{OUT_TEMPLATE} is stale; run scripts/build_claim_gate_recode_packet.py")
180+
raise SystemExit(f"{OUT_TEMPLATE} is stale; run scripts/e2/build_claim_gate_recode_packet.py")
180181
if not OUT_MANIFEST.exists() or OUT_MANIFEST.read_text(encoding="utf-8") != expected_manifest:
181-
raise SystemExit(f"{OUT_MANIFEST} is stale; run scripts/build_claim_gate_recode_packet.py")
182+
raise SystemExit(f"{OUT_MANIFEST} is stale; run scripts/e2/build_claim_gate_recode_packet.py")
182183
print("Claim-gate recode packet check passed (prepared template only; no labels).")
183184

184185

scripts/e2/build_e2_public_freeze_ledger.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010

1111
import argparse
1212
import csv
13+
import os
1314
from pathlib import Path
1415

1516

1617
ROOT = Path(__file__).resolve().parents[2]
1718
PREFLIGHT = ROOT / "docs" / "internal" / "e2-n50-freeze-preflight-2026-06-06"
18-
PAPER = ROOT / "papers" / "diffaudit-evidence-paper"
19+
PAPER = Path(os.environ.get("DIFFAUDIT_EVIDENCE_PAPER_DIR", ROOT / "papers" / "diffaudit-evidence-paper")).resolve()
1920

2021
REFRESH_CSV = PREFLIGHT / "e2_high_value_public_asset_delta_refresh_late_2026_06_09.csv"
2122
E2Q005_AGG_CSV = PREFLIGHT / "e2q005_external_style_review_aggregation_2026_06_06.csv"

scripts/e2/check_e2_freeze_preflight.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
from __future__ import annotations
88

99
import csv
10+
import os
1011
from pathlib import Path
1112

1213

1314
ROOT = Path(__file__).resolve().parents[2]
1415
PREFLIGHT = ROOT / "docs" / "internal" / "e2-n50-freeze-preflight-2026-06-06"
15-
PAPER = ROOT / "papers" / "diffaudit-evidence-paper"
16+
PAPER = Path(os.environ.get("DIFFAUDIT_EVIDENCE_PAPER_DIR", ROOT / "papers" / "diffaudit-evidence-paper")).resolve()
1617

1718
REVIEW_DECISION_FIELDS = {
1819
"review_id",

scripts/e2/export_false_promotion_review_bundle.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import csv
1313
import hashlib
1414
import io
15+
import os
1516
import re
1617
import zipfile
1718
from dataclasses import dataclass
@@ -877,7 +878,7 @@ def parse_args() -> argparse.Namespace:
877878
def main() -> None:
878879
args = parse_args()
879880
repo_root = Path(__file__).resolve().parents[2]
880-
paper = repo_root / "papers" / "diffaudit-evidence-paper"
881+
paper = Path(os.environ.get("DIFFAUDIT_EVIDENCE_PAPER_DIR", repo_root / "papers" / "diffaudit-evidence-paper")).resolve()
881882
errors: list[str] = []
882883
items = validate_inputs(paper, errors)
883884
reviewer_items = [item for item in items if not is_post_label_item(item)]

scripts/paper/evaluate_report_correctness_faults.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import copy
1313
import csv
1414
import json
15+
import os
1516
import sys
1617
from dataclasses import dataclass
1718
from pathlib import Path
@@ -25,8 +26,9 @@
2526

2627

2728
DEFAULT_BUNDLE = REPO_ROOT / "workspaces/implementation/artifacts/admitted-evidence-bundle.json"
28-
DEFAULT_CSV = REPO_ROOT / "papers/diffaudit-evidence-paper/data/report_correctness_fault_injection.csv"
29-
DEFAULT_MD = REPO_ROOT / "papers/diffaudit-evidence-paper/versions/direction-d-report-correctness-fault-injection.md"
29+
PAPER = Path(os.environ.get("DIFFAUDIT_EVIDENCE_PAPER_DIR", REPO_ROOT / "papers" / "diffaudit-evidence-paper")).resolve()
30+
DEFAULT_CSV = PAPER / "data" / "report_correctness_fault_injection.csv"
31+
DEFAULT_MD = PAPER / "versions" / "direction-d-report-correctness-fault-injection.md"
3032

3133

3234
@dataclass(frozen=True)

scripts/util/run_pr_checks.py

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,62 @@ def run_optional(cmd: list[str], cwd: Path, required_path: Path, label: str) ->
3131
print(f"SKIP {label}: missing private/local paper data at {required_path}")
3232

3333

34+
def run_optional_min_files(cmd: list[str], cwd: Path, files: list[Path], min_files: int, label: str) -> None:
35+
if len(files) >= min_files:
36+
run(cmd, cwd)
37+
return
38+
print(f"SKIP {label}: found {len(files)} reviewer file(s), need {min_files}")
39+
40+
3441
def main() -> None:
3542
repo_root = Path(__file__).resolve().parents[2]
3643
python_executable = sys.executable
37-
paper_data = repo_root / "papers" / "diffaudit-evidence-paper" / "data"
44+
paper_root = Path(os.environ.get("DIFFAUDIT_EVIDENCE_PAPER_DIR", repo_root / "papers" / "diffaudit-evidence-paper")).resolve()
45+
paper_data = paper_root / "data"
3846
claim_trace = paper_data / "claim_trace.csv"
47+
preflight_dir = repo_root / "docs" / "internal" / "e2-n50-freeze-preflight-2026-06-06"
48+
e2q005_review_files = sorted(preflight_dir.glob("e2q005_external_style_review_[A-Z]_2026_06_06.csv"))
49+
e2_freeze_ledger_input = preflight_dir / "e2_high_value_public_asset_delta_refresh_late_2026_06_09.csv"
50+
e2_false_promotion_queue_input = preflight_dir / "e2_n50_public_surface_metadata_refresh.csv"
51+
e2_freeze_preflight_input = preflight_dir / "e2_n50_freeze_review_decisions_v1.csv"
52+
false_promotion_bundle_input = preflight_dir / "e2sct004_genai_confessions_public_surface_check_2026_06_06.md"
53+
false_promotion_bundle_zip = paper_root / "build" / "diffaudit-false-promotion-review-bundle.zip"
3954

4055
run([python_executable, "scripts/util/run_docs_checks.py"], repo_root)
4156
run([python_executable, "scripts/paper/render_admitted_risk_card.py", "--check"], repo_root)
4257
run_optional([python_executable, "scripts/e2/build_claim_gate_recode_packet.py", "--check"], repo_root, claim_trace, "claim-gate recode packet")
4358
run_optional([python_executable, "scripts/paper/evaluate_report_correctness_faults.py", "--check"], repo_root, claim_trace, "report-correctness faults")
44-
run_optional([python_executable, "scripts/e2/aggregate_e2q005_external_review.py", "--min-reviewers", "3"], repo_root, claim_trace, "E2Q-005 review aggregation")
59+
run_optional_min_files(
60+
[python_executable, "scripts/e2/aggregate_e2q005_external_review.py", "--min-reviewers", "3"],
61+
repo_root,
62+
e2q005_review_files,
63+
3,
64+
"E2Q-005 review aggregation",
65+
)
4566
run_optional([python_executable, "scripts/e2/aggregate_false_promotion_external_review.py", "--check"], repo_root, claim_trace, "false-promotion review aggregation")
46-
run_optional([python_executable, "scripts/e2/build_e2_public_freeze_ledger.py", "--check"], repo_root, claim_trace, "E2 public freeze ledger")
47-
run_optional([python_executable, "scripts/e2/build_e2_false_promotion_expansion_queue.py", "--check"], repo_root, claim_trace, "false-promotion expansion queue")
48-
run_optional([python_executable, "scripts/e2/check_e2_freeze_preflight.py"], repo_root, claim_trace, "E2 freeze preflight")
49-
run_optional([python_executable, "scripts/paper/check_paper_release_packet.py"], repo_root, claim_trace, "paper release packet")
67+
run_optional([python_executable, "scripts/e2/build_e2_public_freeze_ledger.py", "--check"], repo_root, e2_freeze_ledger_input, "E2 public freeze ledger")
68+
run_optional(
69+
[python_executable, "scripts/e2/build_e2_false_promotion_expansion_queue.py", "--check"],
70+
repo_root,
71+
e2_false_promotion_queue_input,
72+
"false-promotion expansion queue",
73+
)
74+
run_optional([python_executable, "scripts/e2/check_e2_freeze_preflight.py"], repo_root, e2_freeze_preflight_input, "E2 freeze preflight")
75+
run_optional([python_executable, "scripts/paper/check_paper_release_packet.py", "--profile", "phase-g"], repo_root, claim_trace, "paper release packet")
5076
run_optional([python_executable, "scripts/paper/export_paper_supplement.py", "--check"], repo_root, claim_trace, "paper supplement export")
5177
run_optional([python_executable, "scripts/paper/export_paper_supplement.py", "--check-output"], repo_root, claim_trace, "paper supplement output")
52-
run_optional([python_executable, "scripts/e2/export_false_promotion_review_bundle.py", "--check"], repo_root, claim_trace, "false-promotion review bundle")
53-
run_optional([python_executable, "scripts/e2/export_false_promotion_review_bundle.py", "--check-output"], repo_root, claim_trace, "false-promotion review bundle output")
78+
run_optional(
79+
[python_executable, "scripts/e2/export_false_promotion_review_bundle.py", "--check"],
80+
repo_root,
81+
false_promotion_bundle_input,
82+
"false-promotion review bundle",
83+
)
84+
run_optional(
85+
[python_executable, "scripts/e2/export_false_promotion_review_bundle.py", "--check-output"],
86+
repo_root,
87+
false_promotion_bundle_zip,
88+
"false-promotion review bundle output",
89+
)
5490
run(
5591
[
5692
python_executable,

0 commit comments

Comments
 (0)