Snapshot base manifest on first PR build to fix stale branch diffs#12922
Open
ericholscher wants to merge 3 commits intomainfrom
Open
Snapshot base manifest on first PR build to fix stale branch diffs#12922ericholscher wants to merge 3 commits intomainfrom
ericholscher wants to merge 3 commits intomainfrom
Conversation
63e60e9 to
3c12320
Compare
5 tasks
3c12320 to
17ea144
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5 tasks
When a PR is based on an old commit, the base version (latest) moves forward over time. The current tip-to-tip manifest comparison then shows bogus file changes the PR didn't make. Fix: on the first PR build, copy the base version's manifest as base_manifest_snapshot.json in the PR's storage. get_diff() uses this snapshot instead of the live base manifest for external versions, falling back to the live manifest if no snapshot exists yet. This is write-once per PR — the snapshot pins the baseline at PR creation time. A clear_base_manifest_snapshot() helper is provided but not yet wired up; a follow-up should call it on rebase/synchronize webhook events so the snapshot refreshes when the PR is rebased. Refs: readthedocs/addons#643, #12232 https://claude.ai/code/session_01FgTyr1d9mpwms8emHGNAQf
… accuracy - Refactor get_manifest/write_manifest to use shared _get_storage_path() helper instead of inlining the same get_storage_path() call (single source of truth) - Fix comment to say "first PR build" instead of "PR creation time" (more accurate) - Rename loop variable `hash` to `content_hash` to avoid shadowing builtin https://claude.ai/code/session_01FgTyr1d9mpwms8emHGNAQf
The write-once guard in snapshot_base_manifest() was opening and JSON-parsing the snapshot file just to check if it exists. Use build_media_storage.exists() (S3 HEAD request) instead — cheaper and clearer intent. https://claude.ai/code/session_01FgTyr1d9mpwms8emHGNAQf
852b496 to
1bc8478
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.
When a PR is based on an old commit, the base version (latest) moves
forward over time. The current tip-to-tip manifest comparison then shows
bogus file changes the PR didn't make.
Fix: on the first PR build, copy the base version's manifest as
base_manifest_snapshot.json in the PR's storage. get_diff() uses this
snapshot instead of the live base manifest for external versions, falling
back to the live manifest if no snapshot exists yet.
This is write-once per PR — the snapshot pins the baseline at PR creation
time. A clear_base_manifest_snapshot() helper is provided but not yet
wired up; a follow-up should call it on rebase/synchronize webhook events
so the snapshot refreshes when the PR is rebased.
Refs: readthedocs/addons#643, #12232
https://claude.ai/code/session_01FgTyr1d9mpwms8emHGNAQf