perf(prepush): key the pro-test gate on its own inputs, not the whole tree (#6765) - #6875
perf(prepush): key the pro-test gate on its own inputs, not the whole tree (#6765)#6875yzxcj797 wants to merge 2 commits into
Conversation
… tree (koala73#6765) The green-tree cache keys every gate on one whole-tree hash, so a merge, conflict re-resolve, amend, or regenerated-artifact commit — each a new HEAD^{tree} — invalidates gates whose inputs did not change. In the Canada merge campaign that was 10 cache writes and 0 observable hits across 66 pushes, median 45.6s, worst 216.5s. This adds a per-gate cache alongside the whole-tree one, starting with the most expensive gate: the pro-test bundle freshness check (54.9s cold, 7.1s warm). The entry hashes the gate's INPUTS (sources, lockfile, package/vite/ tsconfig, catalog, generator) AND its VERIFIED OUTPUTS (generated config, tiers, locales, public/pro/) straight from HEAD's tree — blob hashes, so it costs path lookups rather than file reads. Outputs are part of the key on purpose: an amend that swaps verified-good bundle bytes for stale ones under identical inputs must not ride a hit minted against the good bytes. Reads and writes go through two new prepush-attest.sh modes with the same three-valued exit discipline as the whole-tree primitives. Writes refuse a non-attestable worktree (the hash names HEAD bytes; a drifted worktree proving something else must not stamp it), and the hook only reaches for a read while ATTESTABLE=true. On the merge-loop shape the whole-tree cache structurally cannot serve — a docs-only amend after a green run — the rebuild is now skipped entirely.
|
@yzxcj797 is attempting to deploy a commit to the World Monitor Team on Vercel. A member of the Team first needs to authorize it. |
Review — head
|
koala73
left a comment
There was a problem hiding this comment.
Review (not ready)
Per-gate cache logic looks sound (inputs+verified outputs in the hash; refuse to write when the worktree is not HEAD).
Required variant-smoke-full did not pass on this head (cancelled → gate red). Please re-run the Test workflow until that job completes green. I will not put this on the merge list while a required gate is red.
Vercel fork-auth is not a required gate.
|
@yzxcj797 pls don't forget this one - you are churning a lot of PRs, but I want to close the older ones first |
Status after #6909 (2026-08-18)Keep this PR. Do not merge it as written. #6909 ( What still holdsThe whole-tree green cache still keys on one The What #6909 made stale#6909 stopped committing This head still:
The old “outputs in the key so a stale committed bundle cannot ride a hit” rationale died with #6909. Remaining verified outputs are the generated config files, not #6853 already shared npm/Vite caches across worktrees, so the leftover cost is smaller than the original 54.9s cold figure. The skip is still worth doing; it has to wrap today’s gate. Rebase checklist
Not merge-ready until that rebase. Not a close. |
Closes #6765 (framework + the highest-payoff gate; the remaining gates from the issue's starting set can adopt the same two attest modes incrementally).
The structural miss
The green-tree cache keys every gate on one whole-tree hash. In the merge / amend / re-push loop that is a new
HEAD^{tree}on literally every push — 10 cache writes, 0 observed hits across the Canada campaign's 66 pushes, median 45.6s, worst 216.5s. A docs-only amend after a red CI run re-pays the full suite, including gates whose inputs did not change.This PR
A per-gate cache alongside (not replacing) the whole-tree one, starting with the most expensive gate — the pro-test bundle freshness check (54.9s cold / 7.1s warm):
pro-test/src, lockfile,package.json,vite.config.ts,tsconfig.json, product catalog, generator) and its VERIFIED OUTPUTS (src/config/*.generated.ts,public/pro/), computed straight fromHEAD's tree viagit ls-tree -r | git hash-object --stdin— blob hashes, so it costs path lookups, not file reads.gate-cache-read <dir> <gate> <hash>/gate-cache-write <dir> <gate> <hash> <attestable>, with the same three-valued exit discipline as the existing primitives (0 hit/written, 3 miss/refused, 2 usage). One file per gate holding a single hash line an operator can inspect and clear.ATTESTABLE=true.Tests
Verified locally: no outcome changes relative to a clean checkout on either suite (17 pre-existing Windows-path failures identical before and after; green on CI's Linux).