Repository navigation
Catch the staleness the bundle guard could not see - #391
Merged
Merged
Conversation
The Stop-hook guard rebuilt web_ui/dist/app whenever the bundle was older than web_ui/src. That solves one staleness problem and is silent, by construction, about a second one. If the CHECKOUT is behind the branch work lands on, merged code is not in the working tree at all - so the bundle is perfectly consistent with the source, the mtime walk finds nothing newer, and the guard correctly says nothing while the running app is missing features that already shipped. A canvas went on spawning placeholder nodes on double-click for hours after the commit removing that gesture had merged, because the checkout sat five commits behind origin/main and every local file legitimately matched the bundle built from it. Two additions: - The bundle records the commit it was built from (dist/app/.built-from-commit) and is rebuilt when HEAD no longer matches it. A pull or branch switch that happens to leave mtimes alone is invisible to an mtime walk; a recorded HEAD is not. - When HEAD is behind origin/main the hook says so, naming the branch and the commit count, whether or not it also rebuilt. Reported, never auto-merged - the working tree belongs to the developer, and a Stop hook has no business rewriting it. It reads only already-fetched refs, so it never blocks on the network. Co-Authored-By: Claude <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The Stop-hook guard (
tools/rebuild-spa-if-stale.sh) rebuildsweb_ui/dist/appwhenever the bundle is older thanweb_ui/src. That solves one staleness problem and is silent, by construction, about a second one.If the checkout is behind the branch work lands on, merged code is not in the working tree at all. The bundle is then perfectly consistent with the source, the mtime walk finds nothing newer, and the guard correctly says nothing - while the running app is missing features that already shipped.
That is not hypothetical: a canvas went on spawning placeholder nodes on double-click for hours after the commit removing that gesture had merged, because the checkout sat five commits behind
origin/mainand every local file legitimately matched the bundle built from it.Change
dist/app/.built-from-commit") and is rebuilt whenHEAD` no longer matches it. A pull or branch switch that leaves mtimes alone is invisible to an mtime walk; a recorded HEAD is not.HEADis behindorigin/mainthe hook reports it - naming the branch and the commit count - whether or not it also rebuilt. Reported, never auto-merged: the working tree belongs to the developer and a Stop hook has no business rewriting it. It reads only already-fetched refs, so it never blocks on the network.Test plan
Exercised directly against a real checkout sitting five commits behind
origin/main:"rebuilt. BUT this checkout (ux/text-contrast-wcag-tiers) is 5 commit(s) behind origin/main...".origin/main: silent, exit 0.