Skip to content

fix: enqueue PR files refresh on base-branch edits#64

Open
jakearmstrong59 wants to merge 1 commit into
entrius:testfrom
jakearmstrong59:fix/pr-edited-base-retarget-refresh-files
Open

fix: enqueue PR files refresh on base-branch edits#64
jakearmstrong59 wants to merge 1 commit into
entrius:testfrom
jakearmstrong59:fix/pr-edited-base-retarget-refresh-files

Conversation

@jakearmstrong59
Copy link
Copy Markdown

@jakearmstrong59 jakearmstrong59 commented May 13, 2026

Summary

The pull_request webhook handler enqueues a PR_FILES job on opened, synchronize, and merged closed, but not on edited. When a maintainer retargets a PR's base branch, GitHub fires pull_request.edited with changes.base populated and a new pr.base.sha. Today the handler writes the new baseSha onto the PR row but leaves pr_files, pr_file_contents, and merge_base_sha pinned to the previous base — and scoring_data_stored stays true, falsely advertising the bundle as current.

This change detects base retargets on pull_request.edited (via payload.changes?.base), clears scoring_data_stored, and enqueues the same PR_FILES job the synchronize path uses. The job's deterministic prFilesJobId(repo, pr, headSha, baseSha) naturally dedupes against any in-flight fetch for the new generation, and fetchAndStorePrFiles already
recomputes the merge-base and re-upserts file content on every run, so no fetcher changes are required.

Title/body edits are untouched — they don't set changes.base, so they keep running only the existing PR_METADATA job.

Related Issues

Fixes #62

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

Verified via live webhook against a test repo:

  1. Open a PR against main; wait for pr_files / pr_file_contents to populate and scoring_data_stored to flip to true.
  2. Retarget the PR's base branch (GitHub UI → Edit → change base).
  3. Observe in logs: PR_FILES job enqueued for the new (headSha, newBaseSha) generation; scoring_data_stored momentarily false, then true once the new fetch completes.
  4. Confirm merge_base_sha is recomputed and pr_file_contents.base_content reflects blobs from the new base branch.
  5. Edit only the PR title/body (no base change) and confirm no PR_FILES job is enqueued (only PR_METADATA).

Also ran npm run format:check, npm run lint, and npm run build in packages/das/ — all pass.

Checklist

  • I have read the Contributing Guide
  • Code builds without errors
  • New and existing tests pass (if applicable) — repo has no automated test suite; manual webhook verification used per project convention (commit 76fd0a8)
  • Documentation updated (if applicable) — no public API change
  • No unnecessary dependencies added

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 13, 2026
@jakearmstrong59 jakearmstrong59 force-pushed the fix/pr-edited-base-retarget-refresh-files branch from 6fdaea7 to 897c2ac Compare May 13, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PR base-branch edits do not refresh stored file scoring data

1 participant