Skip to content

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

@statxc

Description

@statxc

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

  1. Open a pull request against branch main.
  2. Let the mirror fetch and store its PR files.
  3. Edit the pull request base branch from main to another branch without pushing a new commit.
  4. Process the resulting pull_request.edited webhook.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions