Summary
issues.solved_by_pr can remain stale when a PR’s closing references change after initial merge-time linkage.
Problem
In FetchProcessor.handlePrMetadata():
- when PR is
MERGED, it sets solved_by_pr = prNumber for all current closingIssueNumbers
- but there is no cleanup path for previously linked issues if:
- PR linkage changes on later
edited events (close keywords removed/changed),
- PR is reopened / transitions away from merged semantics,
- solving relationship should move to another PR
IssueHandler only clears solved_by_pr when an issue is reopened (state = OPEN), which does not address stale closed issues.
Expected behavior
solved_by_pr should reflect current canonical solver linkage:
- remove stale mappings when PR no longer closes an issue
- avoid leaving closed issues permanently linked to outdated PRs
Actual behavior
solved_by_pr is write-only on merge linkage and can become stale indefinitely.
Why this matters
Downstream scoring APIs use solved_by_pr/solving_pr to attribute issue-solving credit. Stale links can misattribute rewards and produce inconsistent validator/miner views.
Reproduction idea
- Create PR A with
Fixes #123, merge it.
- Metadata job sets issue
#123.solved_by_pr = A.
- Edit PR A body to remove/alter closing reference (or otherwise make linkage stale).
- Trigger
pull_request.edited metadata refresh.
- Observe
closingIssueNumbers on PR changes, but issues.solved_by_pr remains pointing to A.
Inspection points
packages/das/src/queue/fetch.processor.ts (handlePrMetadata)
packages/das/src/webhook/handlers/issue.handler.ts (only clears on OPEN issues)
packages/das/src/api/miners/miners.service.ts (solving_pr resolution from issues.solved_by_pr)
Suggested fix direction
On each PR metadata refresh:
- read prior linked issue set for that PR
- compute diff against new
closingIssueNumbers
- for removed links currently pointing to this PR, clear
solved_by_pr
- for added/current links, set
solved_by_pr = prNumber when PR is merged
Optionally enforce stronger invariants with periodic reconciliation/backfill.
Summary
issues.solved_by_prcan remain stale when a PR’s closing references change after initial merge-time linkage.Problem
In
FetchProcessor.handlePrMetadata():MERGED, it setssolved_by_pr = prNumberfor all currentclosingIssueNumberseditedevents (close keywords removed/changed),IssueHandleronly clearssolved_by_prwhen an issue is reopened (state = OPEN), which does not address stale closed issues.Expected behavior
solved_by_prshould reflect current canonical solver linkage:Actual behavior
solved_by_pris write-only on merge linkage and can become stale indefinitely.Why this matters
Downstream scoring APIs use
solved_by_pr/solving_prto attribute issue-solving credit. Stale links can misattribute rewards and produce inconsistent validator/miner views.Reproduction idea
Fixes #123, merge it.#123.solved_by_pr = A.pull_request.editedmetadata refresh.closingIssueNumberson PR changes, butissues.solved_by_prremains pointing to A.Inspection points
packages/das/src/queue/fetch.processor.ts(handlePrMetadata)packages/das/src/webhook/handlers/issue.handler.ts(only clears on OPEN issues)packages/das/src/api/miners/miners.service.ts(solving_prresolution fromissues.solved_by_pr)Suggested fix direction
On each PR metadata refresh:
closingIssueNumberssolved_by_prsolved_by_pr = prNumberwhen PR is mergedOptionally enforce stronger invariants with periodic reconciliation/backfill.