perf(build): tiered validation harness to cut PR-drain wall time#288
Merged
Conversation
Add `just validate <fmt|check|test|full>` and `just changed-crates`, backed by scripts/validate.py, so a PR-drain lane runs the cheapest sufficient validation tier scoped to the crates that own the files changed vs a base ref, on a persistent per-lane target dir. - check/test auto-scope to changed crates, so unrelated crates and their oversized aggregate test binaries are no longer compiled for a scoped change. - Scoping auto-escalates to the whole workspace when a workspace-root manifest/config changes or a codex-rs file is not attributable to a crate, so nothing is silently under-validated. - --rdeps expands to workspace dependents (offline, from cargo metadata). - Each lane gets its own CARGO_TARGET_DIR so parallel lanes stay warm and never contend on one target lock. Document the T0-T3 tiers in CODEWITH.md and the codewith-rust-test-speed skill.
andrei-hasna
marked this pull request as ready for review
July 21, 2026 05:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build-time: tiered validation harness to cut PR-drain wall time
Task:
OPE2-00008/0d6f8638— "Build-time: reduce validation wall time by 90 percent"(plan
3ee01025, pr-drain).Problem
PR-drain lanes validate one PR at a time. The fast primitives already exist
(
check-fast,test-fast,test,test-fast-target), but nothing ties themtogether: a lane either hand-picks crates or falls back to a whole-workspace
just test, which compiles and links every crate's aggregate test binaryeven when a single crate changed — the dominant wall-time cost.
The
test-fast-target -pforwarding bug that previously blocked per-lane targetdirs was already fixed upstream (
9bb896d5e, inmain); GitHub full-CI alreadybuilds a nextest archive once and shards it 4 ways. The remaining gap is the
fleet pr-drain local validation.
Change (additive tooling only — no Rust, no existing recipe changed)
A single tiered entry point that runs the cheapest sufficient validation on a
persistent per-lane target dir, auto-scoped to the crates that own changed files.
just validate fmtformat.py --checkjust validate checkcargo check --testson changed cratesjust validate testcargo nextest runon changed cratesjust validate fullcargo nextest runwhole workspacemanifest/config changes or a
codex-rsfile can't be attributed to a crate.--rdepsexpands to workspace dependents (offline,cargo metadata).CARGO_TARGET_DIR(branch-derived, overridable) so parallel lanesstay warm and never contend on one target lock.
just changed-crates [--rdeps]prints the resolved-pselection.Files:
scripts/validate.py(stdlib-only orchestrator;--base/--rdeps/--target-dir/--print-crates/--dry-run/-- <extra>),justfile(2 additive recipes),.codewith/CODEWITH.md,.codewith/skills/codewith-rust-test-speed/SKILL.md.Measured impact (E2B
codewith-pr-drain, 8 vCPU, cold dev builds, warm cargo registry)check—codex-app-server-protocol(commonly-touched mid crate), coldcheck, coldcheck—codex-tui(near-root crate), coldHonest interpretation. The reduction comes from (a) not compiling unrelated
crates' test binaries and (b) reusing a warm per-lane target:
check~73% faster; re-runs ~99% faster.first cold build (codex-tui alone ≈ whole workspace) — those are correctly
the T3 tier; the warm rerun still saves ~99%.
So ≥90% is real in the warm/steady-state and common mid-crate case; it is not
a flat 90% for a first cold build of a top-of-graph crate. Reported figures are
measured, not estimated.
Incidental finding: whole-workspace
cargo checkonmaincurrently fails tocompile (
codex-thread-manager-sample:error[E0063]: missing field tools_policy) — an unrelated stale sample bin. Scoped validation sidesteps it;377.5s is time-to-near-complete before that error.
Verification
just validate/just changed-cratesexercised throughjust(scoping,--rdeps→ codex-tui+cli+cloud-tasks,--target-dir,--passthrough,cwd-independence) via
--dry-run; realjust validate fmtend-to-end (exit 0).--checkon representative crates:codex-app-server-protocolPASS(102.2s),
codex-tuiPASS (372.6s). (codex-tuitest build hit an E2B disklimit
os error 28, unrelated to these changes.)ruff format/ruff check+just --fmt --checkpass; secrets scan 0 findingsin changed files;
gitleaks protect --stagedclean.Draft until a reviewer confirms the tier contract; behavior is verified.