Skip to content

PR-API channel for review comments and suggestion-accepts #5

Closed

Description

@mmcky

Squash merges hide in-PR human cleanup and closed-unmerged PRs carry review comments no commit records (QuantEcon/project-translation#22: 43 human inline comments across three repos, nine with suggestion fences). Add an optional gh-backed collector that records review comments and suggestion-accepts per document as a separate human-signal channel; never blended into blame.

Part of QuantEcon/project-translation#49 (lifecycle metrics, Stage 1). Method and limits: docs/method.md.

Activity

  1. added this to the wp8-stage1 milestone on Aug 25, 2026
  2. mmcky commented on Aug 28, 2026

    @mmcky
    ContributorAuthor

    Design note: the PR-API channel (#5)

    What it recovers, and why git cannot

    Two loss channels hide human signal from the scan. Squash merges collapse human commits inside a machine-drafted PR into one machine-authored commit — in programming.zh-cn, all six of Humphrey's genuine content edits were copilot-authored commits carrying his Co-authored-by, and only the trailer survives. Closed-unmerged PRs leave no commit at all — 3 of the 6 review-bearing programming.zh-cn PRs closed unmerged, and QuantEcon/project-translation#22 counted 43 human inline comments across the three zh-cn repos, nine with ```suggestion fences carrying exact before/after pairs. The editorial judgement in an accept/reject decision lives in the PR API and nowhere else.

    The determinism boundary

    AGENTS.md: the same checkout and config must produce the same artefacts, and the scan makes no network calls. The channel therefore splits into two halves:

    • textstrata collect-pr <config> [-o out_dir] — a new subcommand, requiring an authenticated gh. It queries the GitHub API and writes pr_channel.jsonl plus a pr_channel.json summary into the output directory. This is the only network-touching code in the package, and it lives in its own module the scan never imports.
    • scan stays byte-identical — it neither reads nor writes the channel artefacts. Nothing in run.json, blame, composition or churn changes. Reports join the two artefact sets on document path downstream. (Rejected alternative: letting scan fold in a pre-collected file when present — it makes run.json depend on whether a side file existed, which is exactly the config-invisible nondeterminism the contract forbids.)

    Collection is a full re-fetch each run, sorted by comment id, so the artefact is deterministic given the remote state at collection time; collected_at records when that was.

    What one record is

    One line per review comment on any PR (open, merged, or closed-unmerged) that touches the configured files glob:

    pr, pr_state, comment_id, document (the anchored path), line/original_line, author_login, roster_id + role (resolved via the roster's handles; unresolved logins recorded raw with role: null, never guessed), kind (comment | suggestion), bot (true for Copilot and other bot reviewers — collected, not dropped: their volume is context, 80/283/160 comments per #22, and they are separable by construction), created_at, body_chars, and for suggestion fences the extracted before (from the comment's diff hunk) / after (the fence body) pair.

    Suggestion-accepts: the accept event is a commit that git already sees (often "Apply suggestions from code review", sometimes under another identity), and the REST API does not link a suggestion to its accepting commit — so v1 records the suggestion side only, and the join to accept commits is left to reports (by document, line and fence content). No re-attribution happens in the scan, keeping "never blended into blame" literal.

    Non-goals for v1

    • No reconstruction of interior PR commits hidden by squash merges. #22's finding stands: commits are the wrong unit, comments are the right one; interior-commit archaeology is a separate, harder problem and would tempt re-attribution into blame.
    • No new tiers and no change to S1–S3/F1–F6. The channel is a parallel human-signal series; if it earns a metric row later (an F7: review comments and suggestion-accepts per document, by role), that lands with real data behind it.
    • No GraphQL dependency; plain REST via gh api with pagination, matching the org's tooling habits.

    Config

    pr_channel:
      repo: QuantEcon/lecture-python-programming.zh-cn   # slug, not the local checkout
      since: 2026-03-01          # optional; PRs updated on/after this date

    The slug is explicit because the local checkout's remote may be a fork or a mirror; files and the roster come from the existing config keys. Absent the block, collect-pr refuses to run and scan is unaffected — the channel is opt-in per edition.

    Validation

    Programming.zh-cn is the acceptance corpus: the channel must surface Humphrey's 13 inline comments (engine critique among them) and the nine suggestion fences #22 counted across the estate, and a closed-unmerged PR must contribute records. The regression suite gains no network tests; the collector gets unit tests over recorded API fixtures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions