Clear base manifest snapshot on PR synchronize events#12923
Draft
ericholscher wants to merge 4 commits intoclaude/improve-stale-branch-diffs-7xCbHfrom
Draft
Clear base manifest snapshot on PR synchronize events#12923ericholscher wants to merge 4 commits intoclaude/improve-stale-branch-diffs-7xCbHfrom
ericholscher wants to merge 4 commits intoclaude/improve-stale-branch-diffs-7xCbHfrom
Conversation
57c349c to
c6920b8
Compare
3c12320 to
17ea144
Compare
c6920b8 to
34dec1e
Compare
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
When a PR is updated with new commits (including rebases), the base manifest snapshot from the first build may no longer be the right baseline. Clear it on synchronize/update webhook events so the next build creates a fresh snapshot against the current base. Handles all three webhook paths: - GitHub App (oauth/tasks.py) — synchronize action - GitHub legacy (api/v2/views/integrations.py) — synchronize action - GitLab legacy (api/v2/views/integrations.py) — update action 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
09cf89a to
8446712
Compare
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.
Summary
clear_base_manifest_snapshot()helper and two tests for itFollows up on #12922 which introduced the snapshot mechanism but left the clear-on-rebase wiring as a TODO.
Test plan
clear_base_manifest_snapshotdeletes the snapshot filesynchronizeaction clears the snapshot before triggering a buildsynchronizeaction clears the snapshotupdateaction clears the snapshotRefs: readthedocs/addons#643, #12232
https://claude.ai/code/session_01FgTyr1d9mpwms8emHGNAQf