Skip to content

Promote test -> main#56

Merged
anderdc merged 8 commits into
mainfrom
test
May 12, 2026
Merged

Promote test -> main#56
anderdc merged 8 commits into
mainfrom
test

Conversation

@anderdc

@anderdc anderdc commented May 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Promotes 7 commits from test to main:

Prod schema migration (runbook)

packages/db/ is only applied to fresh volumes, so prod needs the following SQL applied manually after merge. Both changes are idempotent on a clean prod (no existing constraint, no schema drift on the view).

From #8pull_requests gains a CHECK that MERGED rows have a merged_at. If any prod row violates it, backfill before adding (or use NOT VALID + VALIDATE CONSTRAINT after backfill).

From #14contributor_repo_roles view now unions reviews and comments alongside PRs/issues, and orders by observed_at, source_rank, source_key so reviewer/commenter associations contribute to the latest known role.

BEGIN;

-- From #8: enforce merged_at on MERGED pull_requests
ALTER TABLE pull_requests
    ADD CONSTRAINT pull_requests_merged_has_merged_at
        CHECK (state != 'MERGED' OR merged_at IS NOT NULL);

-- From #14: rewrite contributor_repo_roles to include reviews + comments
CREATE OR REPLACE VIEW contributor_repo_roles AS
SELECT DISTINCT ON (repo_full_name, author_github_id)
    repo_full_name,
    author_github_id,
    author_login,
    author_association
FROM (
    SELECT
        repo_full_name,
        author_github_id,
        author_login,
        author_association,
        created_at AS observed_at,
        10 AS source_rank,
        'pr:' || pr_number::text AS source_key
    FROM pull_requests
    WHERE author_github_id IS NOT NULL
      AND author_github_id <> ''
      AND author_association IS NOT NULL

    UNION ALL

    SELECT
        repo_full_name,
        author_github_id,
        author_login,
        author_association,
        created_at AS observed_at,
        10 AS source_rank,
        'issue:' || issue_number::text AS source_key
    FROM issues
    WHERE author_github_id IS NOT NULL
      AND author_github_id <> ''
      AND author_association IS NOT NULL

    UNION ALL

    SELECT
        repo_full_name,
        reviewer_github_id AS author_github_id,
        reviewer_login AS author_login,
        reviewer_association AS author_association,
        submitted_at AS observed_at,
        20 AS source_rank,
        'review:' || pr_number::text || ':' || submitted_at::text AS source_key
    FROM reviews
    WHERE reviewer_github_id IS NOT NULL
      AND reviewer_github_id <> ''
      AND reviewer_association IS NOT NULL

    UNION ALL

    SELECT
        repo_full_name,
        author_github_id,
        author_login,
        author_association,
        COALESCE(updated_at, created_at) AS observed_at,
        30 AS source_rank,
        'comment:' || comment_id::text AS source_key
    FROM comments
    WHERE author_github_id IS NOT NULL
      AND author_github_id <> ''
      AND author_association IS NOT NULL
) combined
ORDER BY repo_full_name, author_github_id, observed_at DESC, source_rank DESC, source_key DESC;

COMMIT;

24_view_pr_labels_by_actor.sql changed in #14 but only in comments — no DDL to apply.

Test plan

  • Merge PR
  • Run the SQL block above against prod from psql inside a transaction
  • Verify \d pull_requests shows pull_requests_merged_has_merged_at
  • Verify contributor_repo_roles returns rows for a known reviewer-only or commenter-only contributor

anderdc and others added 7 commits April 28, 2026 15:25
When `since` is provided, behavior is unchanged: OPEN created on/after,
CLOSED closed on/after — the scoring window.

When `since` is omitted, the response now returns all currently-OPEN
issues with no time bound and no CLOSED history. Callers asking for
"current open-issue load" no longer need a synthetic epoch-since
workaround that pulls a full all-time payload.

Lets the validator's open-issue spam-multiplier count old still-open
issues that fall outside the scoring lookback window — the gap called
out in entrius/gittensor#929 / PR #930.

Co-authored-by: anderdc <me@alexanderdc.com>
* Fix stale PR file fetch completion

* Fix stale PR file write race

* Run tests before DAS build

* Drop contributor test artifacts

* Slim stale PR file completion fix

---------

Co-authored-by: mkdev11 <MkDev11@users.noreply.github.com>
* Fix label actor role evidence

* Run tests before DAS build

* Drop contributor DB view tests

---------

Co-authored-by: mkdev11 <MkDev11@users.noreply.github.com>
* Fetch base content for deleted PR files

* Tighten deleted file content regression

* Strengthen deleted file content coverage

* Drop contributor fetcher test

---------

Co-authored-by: mkdev11 <MkDev11@users.noreply.github.com>
@LandynDev LandynDev mentioned this pull request May 12, 2026
2 tasks
Branch protection on main requires a 'pr-source-check' status, but no
workflow was publishing it — leaving PRs into main perma-blocked.
Mirror the workflow used in entrius/gittensor and entrius/gittensor-ui:
enforce that PRs into main originate from 'test'.
@anderdc anderdc merged commit 4381f81 into main May 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants