20260519_2 收紧CCR/CIR四文件分诊

This commit is contained in:
2026-05-20 07:07:13 +08:00
parent 8c6fb44352
commit fcd0bac070
11 changed files with 618 additions and 748 deletions

View File

@@ -4,8 +4,8 @@
"experiments": [
{
"id": "sync-ours-rsync-only",
"left": { "rpKind": "ours", "mode": "standard", "protocol": "rrdp+rsync" },
"right": { "rpKind": "ours", "mode": "standard", "protocol": "rsync-only" }
"left": { "rpKind": "ours", "mode": "standard", "protocol": "rrdp+rsync", "rsyncScope": "module-root" },
"right": { "rpKind": "ours", "mode": "standard", "protocol": "rsync-only", "rsyncScope": "module-root" }
},
{
"id": "sync-rpki-client-rsync-only",

View File

@@ -302,7 +302,28 @@ def build_tool_binaries() -> None:
],
cwd=REPO_ROOT,
)
run_local(["make", "-j2"], cwd=PORTABLE_ROOT)
rpki_client_bin = PORTABLE_ROOT / "src" / "rpki-client"
if not rpki_client_bin.is_file():
run_local(["make", "-j2"], cwd=PORTABLE_ROOT)
smoke = run_local(
[str(rpki_client_bin), "-T", "invalid"],
capture=True,
check=False,
)
if "--ta-fixture requires <tal>:<path>" not in (smoke.stderr + smoke.stdout):
cache_bin = DEV_ROOT / ".cache" / "rpki-client-9.8-cir" / "rpki-client"
cache_smoke = run_local(
[str(cache_bin), "-T", "invalid"],
capture=True,
check=False,
) if cache_bin.is_file() else None
if cache_smoke and "--ta-fixture requires <tal>:<path>" in (cache_smoke.stderr + cache_smoke.stdout):
shutil.copy2(cache_bin, rpki_client_bin)
else:
raise SystemExit(
"rpki-client binary lacks local TA fixture support (-T); "
"switch to feature/cir-output-for-rp-compare and rebuild or restore the cached CIR+TA-fixture binary"
)
def build_fixture_proof(run_root: Path, rirs: list[str]) -> Path:
@@ -398,6 +419,9 @@ def build_side_command(
)
if side["protocol"] == "rsync-only":
argv.append("--disable-rrdp")
rsync_scope = side.get("rsyncScope")
if rsync_scope:
argv.extend(["--rsync-scope", str(rsync_scope)])
if side["mode"] == "strict-name":
argv.extend(["--strict", "name"])
elif side["mode"] == "strict-cms-der":
@@ -426,8 +450,6 @@ def build_side_command(
str(run_dir / "vrps.csv"),
"--vaps-csv-out",
str(run_dir / "vaps.csv"),
"--compare-view-trust-anchor",
compare_view_trust_anchor(rirs),
]
)
return "cd {run_dir} && {prefix} /usr/bin/time -v -o process-time.txt -- {cmd} > stdout.log 2> stderr.log".format(
@@ -505,139 +527,6 @@ def cir_tal_uri_for_rir(rir: str) -> str:
}[rir]
def compare_view_trust_anchor(rirs: list[str]) -> str:
return "all5" if len(rirs) > 1 else rirs[0]
def sanitize_run_meta(
run_root: Path,
exp_id: str,
side_label: str,
step: str,
rp_kind: str,
rp_mode: str,
protocol: str,
strict_policies: str,
rirs: list[str],
run_dir: Path,
fixture_proof: Path,
result_ccr: Path,
result_cir: Path,
report_json: Path,
stage_timing_json: Path,
process_time: Path,
stdout_log: Path,
stderr_log: Path,
exit_code: int,
counts: dict[str, Any],
time_info: dict[str, Any],
fixture_pinned: bool,
) -> Path:
repo_root = run_root
run_meta_path = run_dir / "run-meta.json"
run_meta_args = [
sys.executable,
str(FEATURE_BUNDLE),
"run-meta",
"--out",
str(run_meta_path),
"--repo-root",
str(repo_root),
"--experiment-id",
exp_id,
"--side",
"left" if side_label == "A" else "right",
"--side-label",
side_label,
"--step",
step,
"--run-id",
f"{side_label}-{step}",
"--rp-kind",
rp_kind,
"--rp-binary",
"bin/rpki" if rp_kind == "ours" else "bin/rpki-client",
"--rp-version",
"portable" if rp_kind == "rpki-client" else "ours",
"--rp-mode",
rp_mode,
"--protocol-mode",
protocol,
"--strict-policies",
strict_policies,
"--rirs",
",".join(rirs),
"--argv-json",
json.dumps([]),
"--env-json",
json.dumps({}),
"--cwd",
str(run_root),
"--reset-before-run",
"--state-root",
str(run_dir.parent / "state"),
"--db",
str(run_dir.parent / "state" / "work-db"),
"--repo-bytes-db",
str(run_dir.parent / "state" / "repo-bytes.db"),
"--raw-store-db",
str(run_dir.parent / "state" / "raw-store.db"),
"--rsync-mirror-root",
str(run_dir.parent / "state" / "rsync-mirror"),
"--cache-root",
str(run_dir.parent / "state" / ("cache" if rp_kind == "rpki-client" else "work-db")),
"--ccr",
str(result_ccr),
"--cir",
str(result_cir),
"--fixture-proof",
str(fixture_proof),
"--fixture-proof-summary-json",
json.dumps(
{
"taFixturePinned": fixture_pinned,
"taOnlineFetchObserved": False,
"trustAnchorCount": len(rirs),
}
),
"--report-json",
str(report_json),
"--stage-timing-json",
str(stage_timing_json),
"--stdout-log",
str(stdout_log),
"--stderr-log",
str(stderr_log),
"--process-time",
str(process_time),
"--exit-code",
str(exit_code),
"--wall-ms",
str(time_info.get("wallMs", 0)),
"--max-rss-kb",
str(time_info.get("maxRssKb", 0)),
"--vrps",
str(counts.get("vrps", 0)),
"--vaps",
str(counts.get("aspas", 0)),
"--publication-points",
str(counts.get("publicationPoints", counts.get("repositories", 0))),
"--warnings",
str(counts.get("warnings", 0)),
"--cir-object-count",
str(counts.get("cirObjectCount", 0)),
"--cir-reject-count",
str(counts.get("cirRejectCount", 0)),
"--cir-trust-anchor-count",
str(counts.get("cirTrustAnchorCount", len(rirs))),
"--host",
os.uname().nodename,
"--platform",
sys.platform,
]
run_local(run_meta_args)
return run_meta_path
def run_remote_step(
ssh_target: str,
@@ -686,6 +575,9 @@ def run_remote_step(
)
if side["protocol"] == "rsync-only":
argv.append("--disable-rrdp")
rsync_scope = side.get("rsyncScope")
if rsync_scope:
argv.extend(["--rsync-scope", str(rsync_scope)])
if side["mode"] == "strict-name":
argv.extend(["--strict", "name"])
elif side["mode"] == "strict-cms-der":
@@ -714,8 +606,6 @@ def run_remote_step(
str(run_dir / "vrps.csv"),
"--vaps-csv-out",
str(run_dir / "vaps.csv"),
"--compare-view-trust-anchor",
compare_view_trust_anchor(rirs),
]
)
else:
@@ -880,7 +770,7 @@ def generate_run_meta(
"--rp-mode",
side["mode"],
"--protocol-mode",
side["protocol"],
side["protocol"] + (f"/rsync-scope:{side['rsyncScope']}" if side.get("rsyncScope") else ""),
"--strict-policies",
strict_policies,
"--rirs",
@@ -1046,20 +936,14 @@ def run_experiment(
str(local_exp_root / "A" / step / "result.ccr"),
"--left-cir",
str(local_exp_root / "A" / step / "result.cir"),
"--left-meta",
str(local_exp_root / "A" / step / "run-meta.json"),
"--right-ccr",
str(local_exp_root / "B" / step / "result.ccr"),
"--right-cir",
str(local_exp_root / "B" / step / "result.cir"),
"--right-meta",
str(local_exp_root / "B" / step / "run-meta.json"),
"--out-dir",
str(compare_dir),
"--sample-limit",
"200",
"--compare-view-trust-anchor",
compare_view_trust_anchor(rirs),
]
run_local(triage_cmd, cwd=local_exp_root)