Skip to content

feat: add PR review status evaluator (all 3 phases) - #2503

Merged
exploreriii merged 18 commits into
hiero-ledger:mainfrom
phillip-nyinomujuni:feat/pr-review-status-evaluator
Aug 13, 2026
Merged

exploreriii merged 18 commits into
hiero-ledger:mainfrom
phillip-nyinomujuni:feat/pr-review-status-evaluator

Conversation

@phillip-nyinomujuni

Copy link
Copy Markdown
Contributor

Summary

Implements a read-only PR review status evaluator: computes what stage of
review a PR is in, who's expected to review it, who it's still waiting on,
and the recommended next action — then logs it and exposes it via job
outputs / job summary. Covers all three phases of the task in one PR.

Changes

1. Review stage model (.github/scripts/shared/review-stages.js)

  • Stage constants: AWAITING_REVIEW, CHANGES_REQUESTED, APPROVED,
    AWAITING_TRIAGE (env-overridable, following the pattern in shared/labels.js)
  • Reviewer-type constants: TRIAGE, COMMITTER, MAINTAINER
  • getExpectedReviewers(labels) mapping skill labels to expected reviewer types

2. Evaluator script (.github/scripts/review-status-evaluator.js)

  • getPRLabels (REST, paginated), getReviewState (GraphQL reviewDecision),
    getDetailedReviews (REST, deduplicated to each reviewer's latest review) —
    following the existing patterns in bot-pr-draft-ready-reminder.js and
    bot-pr-draft-explainer.js
  • computeStatus(labels, reviewDecision, detailedReviews) — returns
    currentStage, expectedReviewers, waitingOn, nextAction, summary
  • evaluateReviewStatus(github, context) orchestrates the above; supports
    DRY_RUN env var

Note on waitingOn: GitHub returns reviews by username, not CODEOWNERS
role, so mapping a review to a reviewer type would need extra
team-membership API calls. Instead, expectedReviewers is treated as an
ordered list of sequential approval gates, and waitingOn is derived by
counting approvals received. This is an approximation — documented in the
file's header comment — not a true role-aware computation.

3. Workflow (.github/workflows/pr-review-status-evaluator.yml)

  • Triggers: pull_request (opened, synchronize, reopened, labeled,
    unlabeled, ready_for_review) and pull_request_review (submitted,
    dismissed)
  • Read-only permissions: contents: read, pull-requests: read
  • Concurrency group keyed on PR number
  • step-security/harden-runner with egress-policy: audit
  • Logs via core.info, sets outputs via core.setOutput, and writes a job
    summary via core.summary

Testing

  • npm run test:js — 184/184 tests pass (36 new across the two new test files)
  • uv run ruff check . / uv run ruff format --check . — clean

Notes

  • Test files live under __tests__/jest/ rather than co-located with their
    source modules, matching the existing convention (shared-labels.test.js
    for shared/labels.js).

Fixes #2247

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The PR adds configurable review stages, team-role roster parsing, a read-only GitHub review-status evaluator, workflow reporting, roster updates, and Jest coverage for API retrieval, status computation, formatting, and orchestration.

Changes

PR review status evaluation

Layer / File(s) Summary
Review stage and reviewer contracts
.github/scripts/shared/review-stages.js, .github/scripts/__tests__/jest/shared-review-stages.test.js
Defines configurable review stages, reviewer types, label-based reviewer selection, and tests for defaults, precedence, and environment overrides.
Team-role resolution
.github/scripts/shared/team-roles.js, docs/team.md, MAINTAINERS.md
Parses role rosters from docs/team.md and updates the triage, committer, maintainer, and active maintainer lists.
Review status evaluation
.github/scripts/review-status-evaluator.js, .github/scripts/__tests__/jest/review-status-evaluator.test.js
Retrieves paginated labels and reviews plus GraphQL reviewDecision, deduplicates reviews, computes role-aware status, formats results, and resolves PR numbers.
Workflow status reporting
.github/workflows/pr-review-status-evaluator.yml
Runs evaluation for pull request and review events, publishes logs and job-summary outputs, and fails when the roster is unavailable.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow
  participant evaluateReviewStatus
  participant GitHubAPI
  participant getTeamRoles
  participant computeStatus
  Workflow->>evaluateReviewStatus: resolve PR number
  evaluateReviewStatus->>GitHubAPI: fetch labels and reviews
  evaluateReviewStatus->>GitHubAPI: fetch reviewDecision
  evaluateReviewStatus->>getTeamRoles: load role roster
  GitHubAPI-->>evaluateReviewStatus: return review data
  getTeamRoles-->>evaluateReviewStatus: return roles and availability
  evaluateReviewStatus->>computeStatus: compute review status
  computeStatus-->>evaluateReviewStatus: return status
  evaluateReviewStatus-->>Workflow: publish formatted status
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding a PR review status evaluator covering all three phases.
Description check ✅ Passed The description accurately explains the evaluator, workflow, read-only behavior, reporting, testing, and reviewer-gate approximation.
Linked Issues check ✅ Passed The changes implement the read-only evaluator requested in issue #2247, including label and review-state reads, status reporting, and safe workflow execution.
Out of Scope Changes check ✅ Passed The changes remain within issue #2247; tests, team roster updates, and workflow hardening support the evaluator and its reviewer-role mapping.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #2247

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b308c9fd-59d9-4323-b295-3d0ce2da3d5a

📥 Commits

Reviewing files that changed from the base of the PR and between 1a859b3 and 309197c.

📒 Files selected for processing (5)
  • .github/scripts/__tests__/jest/review-status-evaluator.test.js
  • .github/scripts/__tests__/jest/shared-review-stages.test.js
  • .github/scripts/review-status-evaluator.js
  • .github/scripts/shared/review-stages.js
  • .github/workflows/pr-review-status-evaluator.yml

Comment thread .github/scripts/__tests__/jest/shared-review-stages.test.js Outdated
Comment thread .github/scripts/review-status-evaluator.js
Comment thread .github/scripts/review-status-evaluator.js
Comment thread .github/workflows/pr-review-status-evaluator.yml
@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels Aug 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/scripts/__tests__/jest/review-status-evaluator.test.js (1)

22-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Test multiple pagination pages.

Line 46 always yields one response. The tests cannot verify that getPRLabels and getDetailedReviews aggregate more than one page before processing results.

Extend createMockGithub to yield configured label and review pages. Add assertions for labels from later pages and for a reviewer whose latest submission is on a later review page.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 863b7128-0983-4045-aff7-0cab933f84cc

📥 Commits

Reviewing files that changed from the base of the PR and between 309197c and 0a7e12b.

📒 Files selected for processing (4)
  • .github/scripts/__tests__/jest/review-status-evaluator.test.js
  • .github/scripts/__tests__/jest/shared-review-stages.test.js
  • .github/scripts/review-status-evaluator.js
  • .github/workflows/pr-review-status-evaluator.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 143da594-e088-40e5-b5e3-46ae0c31b687

📥 Commits

Reviewing files that changed from the base of the PR and between 0a7e12b and 6fc6e42.

📒 Files selected for processing (1)
  • .github/scripts/__tests__/jest/review-status-evaluator.test.js

Comment thread .github/scripts/__tests__/jest/review-status-evaluator.test.js
Comment thread .github/scripts/__tests__/jest/review-status-evaluator.test.js Outdated

@exploreriii exploreriii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @phillip-nyinomujuni

I have some questions regarding the maintenance burden for this PR since it duplicates some content, want to hear your thoughts

Comment thread .github/scripts/review-status-evaluator.js Outdated
Comment thread .github/workflows/pr-review-status-evaluator.yml Outdated
Comment thread .github/scripts/shared/review-stages.js
@exploreriii
exploreriii marked this pull request as draft August 5, 2026 18:08
@exploreriii exploreriii removed queue:junior-committer PR awaiting initial quality review open to community review PR is open for community review and feedback labels Aug 5, 2026
@phillip-nyinomujuni

Copy link
Copy Markdown
Contributor Author

Hey @exploreriii, thanks for the review. My thoughts on each:

  1. DRY_RUN - fair point, it's not doing anything. This script only reads data and logs, no writes anywhere, so the flag is pointless. I'll remove it.

  2. runs-on - my bad, didn't realize we use custom runners here. I'll switch it to hl-sdk-py-lin-md. Should be fine since this job only checks out the base branch, never the PR's own code, so there's no risk running it on our runner.

  3. Duplicate logic - you're right, this overlapped with permissions.js. I don't think we need the API calls that file makes though, since MAINTAINERS.md already has a clean list of maintainers I can just read directly. That fixes the maintainer check properly.

Only catch: there's no similar file for committers, just the GitHub team in CODEOWNERS, and reading team membership needs an API call. So committer/triage matching stays approximate for now, I'll leave a comment explaining that in the code. Let me know if you want a COMMITTERS.md added later to close that gap too, or if this is fine as is.

Will make these changes when you confirm they are the better choices. Thank you.

@exploreriii

Copy link
Copy Markdown
Contributor

Sure please review, if the option isn't appropriate, can always create the committer/triage list

@phillip-nyinomujuni

Copy link
Copy Markdown
Contributor Author

I pushed the fixes for all 3 points. One more thing I noticed while working on the committer/triage check: docs/team.md and MAINTAINERS.md don't fully agree on who's a maintainer. rbair23 is listed in MAINTAINERS.md but not in docs/team.md. I used docs/team.md since it has triage and committer too, not just maintainers, but wanted to flag the mismatch in case one of them needs updating.

@phillip-nyinomujuni
phillip-nyinomujuni marked this pull request as ready for review August 5, 2026 22:33

@exploreriii exploreriii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, maybe all those can be updated as part of the PR here is the accurate list:

  - name: hiero-sdk-python-committers
    maintainers:
      - exploreriii
      - manishdait
    members:
      - aceppaluni
      - Adityarya11
      - Akshat8510
      - AntonioCeppellini
      - Dosik13
      - parvninama
      - danielmarv
      - Mounil2005
  - name: hiero-sdk-python-maintainers
    maintainers:
      - exploreriii
      - manishdait
    members:
      - MonaaEid
  - name: hiero-sdk-python-triage
    maintainers:
      - exploreriii
      - manishdait
    members:
      - cheese-cakee
      - prajeeta15
      - tech0priyanshu

source https://github.com/hiero-ledger/governance/blob/main/config.yaml

@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels Aug 5, 2026
@phillip-nyinomujuni

Copy link
Copy Markdown
Contributor Author

Updated docs/team.md to match that list exactly. Two quick checks before I push further:

  1. Your yaml has separate "maintainers" and "members" fields per team. I combined both into one flat list per role since both get the same repo access either way - let me know if you wanted them kept separate instead.

  2. I left MAINTAINERS.md as is for now. It lists people from the tsc and github-maintainers teams too, not just hiero-sdk-python-maintainers, so replacing it with just your list could drop people like rbair23. Did you want that updated too, or is it fine as is since it covers a wider scope?

@exploreriii

Copy link
Copy Markdown
Contributor

rbair23 is not a maintainer, the governance repo is the legit source of who has permissions in this repo

@phillip-nyinomujuni

Copy link
Copy Markdown
Contributor Author

Pushed the update - MAINTAINERS.md and docs/team.md now match the governance list exactly. Let me know if all is settled.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pr-review-status-evaluator.yml (1)

51-78: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move reporting logic into a dedicated script.

This inline block selects the no-status behavior, publishes five outputs, and builds the job summary. Move this logic to an exported reporter under .github/scripts/. Keep this workflow step limited to calling that function.

As per path instructions, “YAML should orchestrate execution — not implement business logic” and “Non-trivial logic belongs in dedicated scripts under .github/scripts/.”

Source: Path instructions


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2e06b405-9f0e-460f-b454-1bb72959d1c2

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc6e42 and 03b91ba.

📒 Files selected for processing (5)
  • .github/scripts/review-status-evaluator.js
  • .github/scripts/shared/team-roles.js
  • .github/workflows/pr-review-status-evaluator.yml
  • MAINTAINERS.md
  • docs/team.md

Comment thread .github/scripts/shared/team-roles.js
@github-actions github-actions Bot added the skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues label Aug 8, 2026
@exploreriii
exploreriii requested a review from parvninama August 10, 2026 21:48

@exploreriii exploreriii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @phillip-nyinomujuni
Key questions I have is how much already existing logic can we use, and what do we need to build truly as new? if so, what can be done as an easy to maintain function or component, rather than a hardcoded insertion that will become hard to maintain over time

Currently, the PR status will just log to the action logs - this isn't really easily contributor facing, what are your thoughts on creating a comment in the pr

Comment thread docs/team.md
Comment thread .github/scripts/review-status-evaluator.js
Comment thread .github/scripts/__tests__/jest/review-status-evaluator.test.js Outdated
Comment thread .github/scripts/shared/review-stages.js
@exploreriii
exploreriii marked this pull request as draft August 11, 2026 09:55
@exploreriii exploreriii removed queue:junior-committer PR awaiting initial quality review open to community review PR is open for community review and feedback labels Aug 11, 2026
@phillip-nyinomujuni

Copy link
Copy Markdown
Contributor Author

Hey @exploreriii , good questions. I went and looked into this more and you're right, I was overcomplicating it.

Turns out review-sync/helpers/permissions.js already has getPermissionLevel(), which does live role checks (admin/maintain/write/triage) for the queue label bot. I didn't realize triage was an actual GitHub permission level until I checked bot-intermediate-assignment.yml, it uses it too. So there was no reason for me to build a separate docs/team.md roster parser to answer basically the same question ("what role does this person have").

I ripped that out and switched to using getPermissionLevel() directly. Bonus: this also kills the parse bug you found — there's no file to parse anymore, so it can't silently break like that again. And since nothing reads docs/team.md in this evaluator now, the CODEOWNERS ask for it doesn't really apply to this PR anymore (might still be worth doing for other reasons, just not blocking this one).

Also fixed the hardcoded labels in the tests, pulling from shared/labels.js like you said.

On the PR comment idea, I like it, but I'd rather leave it out of this PR. Posting a comment needs issues: write, and the original issue was pretty explicit about keeping v1 read-only/non-enforcing. The job summary already covers "contributor can see the status somewhere" without needing write access. Could do a comment mode as a fast follow if people want it, let me know what you think.

Pushed the changes, should be ready for another look.

… yet

Signed-off-by: NYINOMUJUNI PHILLIP <phillipnyinomujini@gmail.com>
@phillip-nyinomujuni
phillip-nyinomujuni force-pushed the feat/pr-review-status-evaluator branch from 496fab9 to 3639804 Compare August 11, 2026 19:40
@phillip-nyinomujuni
phillip-nyinomujuni marked this pull request as ready for review August 11, 2026 19:42
@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels Aug 11, 2026
@github-actions

Copy link
Copy Markdown

Hello, this is the OfficeHourBot.

This is a reminder that the Hiero Python SDK Office Hours will begin in approximately 3 hours and 38 minutes (14:00 UTC).

This session provides an opportunity to ask questions regarding this Pull Request.

Details:

Disclaimer: This is an automated reminder. Please verify the schedule here for any changes.

From,
The Python SDK Team

@AntonioCeppellini AntonioCeppellini left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrerovee can you take a look as you are a js dragon?

@aceppaluni aceppaluni added the status: update branch developer needs to click update branch label Aug 12, 2026
@hiero-ledger hiero-ledger deleted a comment from github-actions Bot Aug 12, 2026
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
exploreriii
exploreriii previously approved these changes Aug 13, 2026

@exploreriii exploreriii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @phillip-nyinomujuni I added some of the prior requested feedback e.g. codeowners/hardcoding etc, should be good to try this out and see the results to the review process

Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
danielmarv
danielmarv previously approved these changes Aug 13, 2026
@exploreriii
exploreriii dismissed stale reviews from danielmarv and themself via ee29daf August 13, 2026 17:04
@exploreriii
exploreriii merged commit 63b2af0 into hiero-ledger:main Aug 13, 2026
14 of 15 checks passed
@exploreriii

Copy link
Copy Markdown
Contributor

Thank you @phillip-nyinomujuni

@github-actions

Copy link
Copy Markdown

👋 Hi @phillip-nyinomujuni! Great work completing a Beginner issue! 🎉

Thanks for your contribution! 🚀

Here are some issues you might want to explore next:

🌟 Stay connected:

Happy coding! 🚀
— Hiero Python SDK Team

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

Labels

open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues status: Needs Developer Revision Author needs to apply suggested changes/improvements status: update branch developer needs to click update branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore read-only review status evaluator for PRs

6 participants