Design decisions

23. Validation scoreboard and friction summary (scripts/scoreboard.py, 2026-11-21)

  • 23.1 One unified scoreboard over auto-discovered ports. scripts/scoreboard.py discovers every *.cp port with a sibling *_orig.cpp under proto/ports/ecnerwala/ (and any future Rust-era port directory under proto/ports/ that follows the same layout, excluding retired scout_batch_*, blind_critic_*, hillclimb_*, sim3, before directories). Concurrent port waves are picked up automatically with no manifest to edit. How to reverse: pass --dirs or change discover_ports in scripts/scoreboard.py.
  • 23.2 Contestant-written token counting. Both .cp and _orig.cpp are tokenized by language-aware lexers that strip comments and whitespace; _orig.cpp also reports a library-stripped token count using bench/corpus_registry.py's auto_strip (or a sibling .strip file when present) so template headers and hand-rolled standard structures do not inflate the C++ baseline. Both raw and stripped ratios are recorded. How to reverse: swap tokenize_cp / tokenize_cpp or point to cpl lexer output.
  • 23.3 Adaptive max-size input probing for runtime and peak RSS. When a port has a judge-limit generator in bench/corpus_generators.py or bench/rust_max_n_audit.py, the scoreboard uses it. Otherwise it probes gen/NAME.py 1 <SIZE> upward (8 -> 40 -> 200 -> 1000 -> 5000 -> 25000), stopping when the original exceeds the probe budget (~0.25 s) or the input saturates/caps, falling back to the largest samples/NAME.*.in. This gives a real max-size measurement for every newly pushed port without hanging on super-linear problems. How to reverse: change MAX_SIZE_STEPS or add explicit specs to bench/corpus_generators.py.
  • 23.4 Baseline diff and --fast mode. research/scoreboard.json is the committed baseline. --fast runs cpl check, cpl fmt --check, cpl lint, cpl build (emitted bytes <= 64 KB), token counts, friction_lint, and the research/frictions/*.md summary in a few seconds so scripts/check.sh --fast can gate every push. --check fails on gate regressions (any passing or new port failing), emitted files over 64 KB or growing > 5% and > 1,024 B, median token ratio regressions (> +0.02), wa_trap regressions, open blocker friction increases, and (in full mode) p50/p95 runtime or RSS regressions (> 1.10x baseline). How to reverse: adjust threshold constants at the top of scripts/scoreboard.py.
  • 23.5 Custom checker hook checkers/NAME.py INPUT OUTPUT ANSWER for constructive ports. Matches the cpl stress (crates/cpl-stress/src/judge.rs) and testlib argument order: INPUT test file, OUTPUT candidate stdout, ANSWER original C++ stdout; exit 0 accepts, non-zero rejects with reason on stderr. Both proto/ports/ecnerwala/gate.sh and scripts/scoreboard.py sanity-check orig against itself before judging the C++ build and interpreter, and scripts/scoreboard.py tracks checker_ports in totals. How to reverse: remove the CHECKER branch in gate.sh and run_checker/judge_output in scripts/scoreboard.py.
  • 23.6 gen/NAME.py --max, per-port >10% runtime ratchet, dream-gap metrics, and PORTS.md runtime column. generate_max_input prefers gen/NAME.py --max (when --max appears in the generator) over explicit specs and adaptive probing so judge-limit worst-case inputs live beside each port. Full-mode --check ratchets any port with max(cpp_ms, orig_ms) >= 10 ms whose time_ratio regresses by > 10% against research/scoreboard.json, reports p50 <= 1.1x / max <= 1.5x goal status, and prints the worst 10 runtime ratios. measure_tokens and compute_totals track dream/NAME.cp (dream_tokens, dream_ratio, dream_gap_tokens, aggregate median/p90/max). scripts/ports-page.py reads cached time_ratio values from research/scoreboard.json into the Runtime column of research/PORTS.md without re-running. How to reverse: adjust TIME_P50_GOAL, TIME_MAX_GOAL, PERF_FLOOR_MS, or PERF_REGRESSION_RATIO in scripts/scoreboard.py or remove the Runtime column in scripts/ports-page.py.
  • 23.7 Interpreter-vs-C++ ratio ratchet, strict cp/dream ratchet, and research/reviews/ taste-score integration. In full mode, scripts/scoreboard.py times cpl run and the compiled -O2 C++ binary on the same input (using max_inp when cpp_ms <= 250 ms, else the largest diff case), reporting ratio_p50/ratio_max against INTERP_RATIO_BAR = 10.0 and INTERP_RATIO_NORTH_STAR = 5.0 (with a 20 ms floor to avoid startup noise) and failing --full --check on > 10% regressions in p50 or any port >= 20 ms. In both --fast and --full, any increase in a port's cp/dream token ratio (dream_ratio) fails --check. parse_review_score reads 1–5 scores from research/reviews/<name>.md into totals.taste and the Taste column of research/PORTS.md. How to reverse: adjust INTERP_RATIO_BAR, INTERP_RATIO_NORTH_STAR, INTERP_FLOOR_MS, or the dream_ratio check in scripts/scoreboard.py.
  • 23.8 Friction metadata gate + 10-area stdlib routing, P0 bug-replay & revision goal tests, and worst-20 dream-gap leaderboard. Normalized all research/frictions/*.md reports to canonical Severity (blocker|high|medium|low) and Goal it hurts values (0 schema warnings), gated warning growth in scripts/scoreboard.py --check, and added route_friction_area mapping every friction to one of the 10 stdlib areas (graphs, trees, ranges, strings, math, flows, containers, geometry, dp, seq) or core (printed as per-area owner queues in --frictions and as an Areas column on research/PORTS.md). Added two live goal-test suites under bench/goal_tests/: (a) bug_replay/ (12 P0 contest bug classes classified empirically via cpl check + cpl run as prevented, caught_on_run, or left_to_diagnose, ratcheted at >= 90% handled and no per-case downgrade); (b) revision/ (2 unseen problems + 1 changed requirement each, verified via cpl run, ratcheting lines_touched against baseline). Added a worst-20 cp/dream token-ratio leaderboard to scripts/ports-page.py -> research/PORTS.md so the polish lane works worst-first. How to reverse: adjust _AREA_KEYWORDS, BUG_REPLAY_BAR_PCT, or the suites in bench/goal_tests/.
  • 23.9 63-case P0 bug-replay suite (per-class rates), 10-problem revision suite, and ratcheted spelling-drift metric. Expanded bench/goal_tests/bug_replay/ from 12 to 63 cases (>= 5 per P0 class across all 11 AGENTS.md bug classes), evaluating cpl check + cpl lint (prevented) and cpl run (caught_on_run vs left_to_diagnose) in parallel with per-class rates (59/63 = 93.7%, 4 honest left_to_diagnose gaps). Expanded bench/goal_tests/revision/ from 2 to 10 unseen problems + 1 requirement change each (10/10 ok, 95 lines touched). Added measure_spelling_drift over proto/ports/**/*.cp (tracking both all files and non-retired active+dream files) for constructs with multiple spellings (multitest, sum, first, sort), ratcheted strictly downward against research/scoreboard.json so codemods visibly drive drift to 0. Canonical forms live in SPELLING_DRIFT_SPECS (@!multitest per §20; method forms xs.sum(), xs.first(...), xs.sort(...) per §49). How to reverse: flip any construct's "canonical" value in SPELLING_DRIFT_SPECS (1-line edit) or adjust cases under bench/goal_tests/.
  • 23.10 Active spelling-drift zero gate, dream-score ratchet, and check.sh --fast <= 180s wall-time budget. Aligned measure_spelling_drift with §53.1 by exempting canonical free-form generator calls (sum(f(x) for x in xs), first(i for i in ... if ...)), added scripts/fix-spelling-drift.py to rewrite non-canonical multitest dividers (@multitest, --- multitest ---, --- with multitest() --- -> @!multitest) across active and dream files (driving active/dream drift to 0), and gated active_non_canonical == 0 in --fast --check. Added totals.dream_scores (parsing Dream: N/5 from research/reviews/*.md) with a baseline ratchet failing on median drop or under-4 growth. Added opt-level = 1 in Cargo.toml [profile.dev.package] for cpl-syntax, cpl-check, cpl-ir, and cpl-codegen (matching cpl-interp) and overlapped recovery_scoreboard with the post-nextest checks in scripts/check.sh, cutting scripts/check.sh --fast wall time from 249s to 84s, recorded in target/gate-fast-time.json / totals.gate_fast and gated at <= 180s. How to reverse: remove the [profile.dev.package] opt-level = 1 entries in Cargo.toml, adjust GATE_FAST_BUDGET_S, or relax the active-drift / dream-score checks in diff_against_baseline.
  • 23.11 Attributable gate ratchets, merge-safe .ports.jsonl baseline (--update PORT...), and expanded ratchets. diff_against_baseline now takes a git scope (detect_change_scope) so a commit fails only for regressions in ports/files it changed, or in ports whose emitted C++/perf/dreams changed because of a crates/ or stdlib/ diff (naming the port and cause); unrelated drift is reported as a warning instead of blocking other lanes. Replaced the global new_under_4_max quota in scripts/review-check.py with per-change attribution: new or changed ports require a review file (Score: N/5 or Score: pending), while scores < 4 are tracked and non-blocking. Split research/scoreboard.json into compact summary JSON plus sorted 1-line-per-port research/scoreboard.ports.jsonl and added --update PORT... to update only named port lines without touching summary JSON, so concurrent lanes rebase cleanly. Added strict ratchets for interpreter ratio p50 and >10x count (bar <= 10x, north star <= 5x), dream-compile count (never fewer), and construct-split spelling drift (getter_parens, where_filter, dot_pow, multitest, turbofish, plus sum/first/sort). How to reverse: pass scope=None to diff_against_baseline, restore new_under_4_max in scripts/review-check.py, or inline ports back into research/scoreboard.json.
  • 23.12 Input-hash caching + parallel post-nextest tracks in scripts/check.sh --fast, plus .githooks/pre-push. Added scripts/check_cache.py (deterministic SHA-256 over sorted input paths, stored under target/check-cache/<step>.sha256, disabled via --no-cache or CHECK_NO_CACHE=1 or --full) to cache unchanged clippy, cpl_build, nextest_doc, stdlib_test, recovery, scoreboard_fast, site_bundle, and docs_site steps without dropping coverage, and ran validation scoreboard in parallel with site/bundle.py -> docs gate + site tests and recovery_scoreboard. Cold --fast wall time dropped from 188s to 163s (<= 180s budget), and unchanged/rebased reruns complete in ~1.3s. Added .githooks/pre-push to reject merge conflict markers, invalid changed JSON/JSONL, and broken cargo check --workspace --all-targets after rebases (which skip pre-commit). How to reverse: pass --no-cache / remove scripts/check_cache.py calls in scripts/check.sh, or delete .githooks/pre-push.