Skip to content

Clear base manifest snapshot on PR synchronize events#12923

Draft
ericholscher wants to merge 4 commits intoclaude/improve-stale-branch-diffs-7xCbHfrom
claude/clear-snapshot-on-rebase
Draft

Clear base manifest snapshot on PR synchronize events#12923
ericholscher wants to merge 4 commits intoclaude/improve-stale-branch-diffs-7xCbHfrom
claude/clear-snapshot-on-rebase

Conversation

@ericholscher
Copy link
Copy Markdown
Member

Summary

  • Clear the base manifest snapshot when a PR receives new commits (synchronize/update events), so the next build creates a fresh snapshot against the current base
  • Handles all three webhook paths: GitHub App, GitHub legacy, and GitLab legacy
  • Adds clear_base_manifest_snapshot() helper and two tests for it
  • Removes the TODO comment from the parent PR that this implements

Follows up on #12922 which introduced the snapshot mechanism but left the clear-on-rebase wiring as a TODO.

Test plan

  • Verify clear_base_manifest_snapshot deletes the snapshot file
  • Verify it's a no-op when no snapshot exists
  • Verify GitHub App synchronize action clears the snapshot before triggering a build
  • Verify GitHub legacy synchronize action clears the snapshot
  • Verify GitLab update action clears the snapshot

Refs: readthedocs/addons#643, #12232

https://claude.ai/code/session_01FgTyr1d9mpwms8emHGNAQf

@ericholscher ericholscher force-pushed the claude/clear-snapshot-on-rebase branch from 57c349c to c6920b8 Compare April 9, 2026 06:24
@ericholscher ericholscher force-pushed the claude/improve-stale-branch-diffs-7xCbH branch from 3c12320 to 17ea144 Compare April 9, 2026 06:26
@ericholscher ericholscher force-pushed the claude/clear-snapshot-on-rebase branch from c6920b8 to 34dec1e Compare April 9, 2026 06:27
claude added 4 commits April 10, 2026 07:06
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
@ericholscher ericholscher force-pushed the claude/clear-snapshot-on-rebase branch from 09cf89a to 8446712 Compare April 10, 2026 07:08
@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.

2 participants