Description
In das-github-mirror, pull request file scoring data is refreshed on opened, synchronize, and merged closed events. However, GitHub sends a pull_request.edited event when a PR's base branch is changed.
The current handler updates PR metadata, including baseSha, during edited, but does not enqueue a PR_FILES job. That can leave pr_files and scoringDataStored tied to the old base while the pull request row now points at the new base SHA.
Affected code:
packages/das/src/webhook/handlers/pull-request.handler.ts
packages/das/src/webhook/github-fetcher.service.ts
Steps to Reproduce
- Open a pull request against branch
main.
- Let the mirror fetch and store its PR files.
- Edit the pull request base branch from
main to another branch without pushing a new commit.
- Process the resulting
pull_request.edited webhook.
- Query the stored PR row and PR files.
Expected Behavior
When the PR base branch changes, the mirror should treat the stored file scoring data as stale and enqueue a fresh PR file fetch using the new base/head SHAs.
Actual Behavior
The PR row is updated, but no PR file refresh is queued for the edited event. Existing stored file contents can remain based on the previous base branch.
Environment
- OS: Any server environment
- Runtime/Node version: Node 20, as used by CI
- Browser (if applicable): N/A
Additional Context
The file fetch path recomputes merge-base/base content from the stored PR SHA fields, so base retargets affect scoring inputs even when the PR head commit does not change.
A narrow fix would detect base changes on pull_request.edited, clear scoringDataStored, and enqueue the same PR_FILES job used for normal PR file refreshes.
Description
In
das-github-mirror, pull request file scoring data is refreshed onopened,synchronize, and mergedclosedevents. However, GitHub sends apull_request.editedevent when a PR's base branch is changed.The current handler updates PR metadata, including
baseSha, duringedited, but does not enqueue aPR_FILESjob. That can leavepr_filesandscoringDataStoredtied to the old base while the pull request row now points at the new base SHA.Affected code:
packages/das/src/webhook/handlers/pull-request.handler.tspackages/das/src/webhook/github-fetcher.service.tsSteps to Reproduce
main.mainto another branch without pushing a new commit.pull_request.editedwebhook.Expected Behavior
When the PR base branch changes, the mirror should treat the stored file scoring data as stale and enqueue a fresh PR file fetch using the new base/head SHAs.
Actual Behavior
The PR row is updated, but no PR file refresh is queued for the
editedevent. Existing stored file contents can remain based on the previous base branch.Environment
Additional Context
The file fetch path recomputes merge-base/base content from the stored PR SHA fields, so base retargets affect scoring inputs even when the PR head commit does not change.
A narrow fix would detect base changes on
pull_request.edited, clearscoringDataStored, and enqueue the samePR_FILESjob used for normal PR file refreshes.