Skip to content

[Bug] Label actor roles ignore stored maintainer review and comment evidence #13

@bitloi

Description

@bitloi

Description

The pr_labels_by_actor and issue_labels_by_actor views expose actor_association for label events, but they resolve that role only through contributor_repo_roles. Today contributor_repo_roles is built solely from PR and issue authors.

The service already stores maintainer association evidence from submitted PR reviews and issue/PR thread comments:

  • reviews.reviewer_association
  • comments.author_association

If a maintainer reviews or comments in a repository, then applies a label, but has not authored a recent PR or issue in that repository, the label actor can be exposed with actor_association=null even though authoritative role evidence is already stored.

This matters because validators can use label actor attribution to decide whether a scoring label was maintainer-applied.

Steps to Reproduce

  1. Store a PR review row for actor 42 in reviews with reviewer_association='MEMBER'.
  2. Store a label_events row where actor 42 applies a label to a PR in the same repository.
  3. Do not store any PR or issue authored by actor 42 in that repository.
  4. Query pr_labels_by_actor for that PR.
  5. Repeat the same shape with comments.author_association='OWNER' and issue_labels_by_actor.

Expected Behavior

Label actor role resolution should use all stored GitHub association evidence for the actor in the repository:

  • PR authors
  • issue authors
  • submitted reviews
  • issue/PR thread comments

The label row should return the latest known non-null association for the actor and repository, for example MEMBER or OWNER.

Actual Behavior

The label views only use PR/issue author evidence through contributor_repo_roles. A maintainer who has review or comment evidence but no authored PR/issue row can be returned with actor_association=null.

Environment

  • OS: Any server environment
  • Runtime/Node version: Node 20, as used by CI
  • Browser (if applicable): N/A

Additional Context

Affected code paths:

  • packages/db/20_view_contributor_repo_roles.sql
  • packages/db/24_view_pr_labels_by_actor.sql
  • packages/db/25_view_issue_labels_by_actor.sql
  • packages/das/src/webhook/handlers/review.handler.ts
  • packages/das/src/webhook/handlers/comment.handler.ts
  • packages/das/src/api/miners/miners.service.ts

The downstream gittensor mirror scorer treats actor_association as a trust signal for scoring labels on repositories that do not opt into a trusted label pipeline. Missing maintainer attribution can therefore suppress valid maintainer-applied scoring labels.

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