Skip to content

Snapshot base manifest on first PR build to fix stale branch diffs#12922

Open
ericholscher wants to merge 3 commits intomainfrom
claude/improve-stale-branch-diffs-7xCbH
Open

Snapshot base manifest on first PR build to fix stale branch diffs#12922
ericholscher wants to merge 3 commits intomainfrom
claude/improve-stale-branch-diffs-7xCbH

Conversation

@ericholscher
Copy link
Copy Markdown
Member

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

@ericholscher ericholscher requested a review from a team as a code owner April 9, 2026 05:49
@ericholscher ericholscher requested a review from humitos April 9, 2026 05:49
@ericholscher ericholscher force-pushed the claude/improve-stale-branch-diffs-7xCbH branch 2 times, most recently from 63e60e9 to 3c12320 Compare April 9, 2026 06:02
@ericholscher ericholscher force-pushed the claude/improve-stale-branch-diffs-7xCbH branch from 3c12320 to 17ea144 Compare April 9, 2026 06:26
@ericholscher ericholscher requested review from Copilot and stsewd April 9, 2026 13:48

This comment was marked as low quality.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

claude added 3 commits April 10, 2026 07:08
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
@ericholscher ericholscher force-pushed the claude/improve-stale-branch-diffs-7xCbH branch from 852b496 to 1bc8478 Compare April 10, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants