Fix revision lookup for builds moved to the extra build directory - #14
Merged
Merged
Conversation
samth
force-pushed
the
drdr-archived-build-paths
branch
from
August 17, 2026 12:36
011aa28 to
fcfa33c
Compare
Callers that move a path between build roots explode both paths, compare the first elements, and strip them. This helper does that once, and the next commits use it.
An archive records the root its build had when the archive was created. `archive-extract-path` dropped as many leading elements from a query as that root has, without comparing them, so a query under any other root of the same length resolved to an entry at the wrong level. A build that has aged out to the extra build directory lives under such a root. Compare the prefix instead, and add a `#:base` argument so that a caller that knows where the build lives now can say so. cache.rkt passes the build's current directory. Primary builds behave as before. Archived builds still fail, as they do today, because `path->revision` cannot parse their paths; the next commit fixes that.
`path->revision` indexed into an exploded path at the length of the primary build directory. Builds that have aged out live under the extra build directory, which is one element shorter in production, so the index landed on "logs" and `string->number` returned #f, breaking the function's contract. `cached-directory-exists?` caught that exception and reported the build as absent, so `find-previous-rev` walked backwards one revision at a time, and every other archive lookup during a render failed the same way. A page for an archived revision spent about 42 seconds of CPU to conclude "Not Found"; with this change it renders in about 0.2 seconds. Because every file page links to "next change" for its revision, those pages also trapped crawlers: for an archived revision the link redirected back to the page itself. Match a root prefix against either build directory instead.
archive-repair looked up a build's current directory inside its archive, but the archive names its contents by the directory the build had when the archive was created. For a build that has moved to the extra build directory the two differ, and the repair failed. Pass the current directory as `#:base`.
samth
force-pushed
the
drdr-archived-build-paths
branch
from
September 23, 2026 20:01
fcfa33c to
2cdaead
Compare
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.
Pages for revisions that have aged out to the extra build directory took about 42 seconds of CPU to conclude "Not Found", and their "next change" links redirected back to the page itself, which trapped crawlers.
path->revisionindexed into the exploded path at the length of the primary build directory. That index is wrong for the shorter extra root, and archive lookups stripped a root prefix without checking it.Each commit can be reviewed on its own:
path-prefix-split, a helper with tests.#:baseso callers can name the build's current directory. Primary builds behave as before.path->revisionfor both build roots. This is the actual fix.#:base, so it works for moved builds.On hurin I compared the patched renderer against the deployed one. Live pages are identical. An archived file page (55390 rss.xml) now renders in 0.14–0.26s instead of showing "Not Found" after 4–5s (with a warm cache), and next-change for it redirects to 55400 instead of looping.
The exception-reporting changes that used to be in this PR are now in a separate PR stacked on this one. The scrub, log-baseline and Cloudflare-IP changes are in three independent PRs.