microsoft / microsoft/FluidFramework

[code-simplifier] Simplify PR review proposal script utilities

Open
#27,171 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

agentic-workflows automation code-quality refactoring
Dominant language
TypeScript
Stars
4.9k
Forks
586
Avg merge
1d 15h
Merged PRs (30d)
146

Description

Overview

This PR refines recently-added PR review proposal utilities to make the script easier to use and less error-prone, while preserving existing behavior.

Files Simplified
  • .github/scripts/pr_review_propose.py
    • Added two small, focused subcommands that were already implied by the surrounding workflow/tests (build-qa-context, render-qa-prompt).
    • Made parse-checkboxes read files explicitly as UTF-8 for consistency.
Improvements Made
  1. Enhanced clarity & completeness
    • Exposed helpers as first-class subcommands instead of ad-hoc usage.
  2. More robust IO
    • Explicit UTF-8 reads for comment bodies and templates.
Testing
  • python -m compileall -q .github/scripts
  • Manual smoke checks:
    • build-comment, parse-checkboxes, format-names, build-qa-context, render-qa-prompt
Context

Changes are based on recent additions in the last 24h window (including #27168).

References:

Generated by Code Simplifier ·

To install this agentic workflow, run

gh aw add github/gh-aw/.github/workflows/code-simplifier.md@94662b1dee8ce96c876ba9f33b3ab8be32de82a4
  • expires on Apr 26, 2026, 7:47 AM UTC

[!NOTE]
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch code-simplifier/pr-review-propose-qa-context-9c93ec0e5afbaec5.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests.

Show patch preview (106 of 106 lines)
From f183bfcf498583800ea222363788a97fbc01907b Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
 <41898282+github-actions[bot]@users.noreply.github.com>
Date: Sat, 25 Apr 2026 07:45:22 +0000
Subject: [PATCH] chore: improve pr review proposal script

Add QA-context and prompt-render helpers and make checkbox parsing read UTF-8 consistently.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .github/scripts/pr_review_propose.py | 48 +++++++++++++++++++++++++---
 1 file changed, 44 insertions(+), 4 deletions(-)

diff --git a/.github/scripts/pr_review_propose.py b/.github/scripts/pr_review_propose.py
index 7ae6633..691766e 100644
--- a/.github/scripts/pr_review_propose.py
+++ b/.github/scripts/pr_review_propose.py
@@ -2,20 +2,25 @@
 """Utilities for the PR review proposal flow.
 
 Subcommands:
-  build-comment    Build the markdown proposal comment body.
-  parse-checkboxes Read a comment body file and emit the checked reviewer IDs as JSON.
-  format-names     Convert a JSON reviewer-ID array to a display-name string.
+  build-comment     Build the markdown proposal comment body.
+  parse-checkboxes  Read a comment body file and emit the checked reviewer IDs as JSON.
+  format-names      Convert a JSON reviewer-ID array to a display-name string.
+  build-qa-context  Render a short reviewer-selection context block.
+  render-qa-prompt  Substitute environment variables into a prompt template.
 
 Usage:
   python pr_review_propose.py build-comment --reviewer-count 3 --lines 247 --files 8
   python pr_review_propose.py parse-checkboxes comment.txt
   python pr_review_propose.py format-names '["correctness","security"]'
+  python pr_review_propose.py build-qa-context '["correctness","security"]'
+  python pr_review_propose.py render-qa-prompt qa-template.md
 """
 
 from __future__ import annotations
 
 import argparse
 import json
+import os
 import re
 import sys
 from typing import NamedTuple
@@ -93,7 +98,7 @@ def cmd_parse_checkboxes(args: arg
... (truncated)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .github/scripts/pr_review_propose.py and review the existing subcommands alongside the documented manual smoke checks. Run python -m compileall -q .github/scripts, then exercise build-comment, parse-checkboxes, format-names, build-qa-context, and render-qa-prompt; done means the utilities preserve existing behavior and handle UTF-8 input consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, tooling
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.