From 972d88c1089b751c5a33597c19a3b1cd96c1535b Mon Sep 17 00:00:00 2001 From: Kevin Turcios Date: Thu, 23 Apr 2026 02:27:49 -0500 Subject: [PATCH 1/2] chore: require PRs to link an issue or discussion - Add PR template with required linked issue/discussion section - Add check-linked-issue CI job that validates PR body contains a reference (#123, Closes/Fixes/Relates, GitHub URL, or CF-# ticket) - Wire into required-checks-passed gate so it blocks merge - Update CONTRIBUTING.md with the policy and motivation --- .github/PULL_REQUEST_TEMPLATE.md | 18 +++++++++++ .github/workflows/ci.yaml | 52 ++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 3 +- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..bc1771f57 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,18 @@ +## Linked issue or discussion + + + + + + + + +**Required:** + +## What changed + + + +## Test plan + + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3b5b1c74c..0997305b6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,6 +22,57 @@ concurrency: cancel-in-progress: true jobs: + # --------------------------------------------------------------------------- + # Linked issue check — every PR must reference an issue or discussion. + # Skipped on push to main and workflow_dispatch. + # --------------------------------------------------------------------------- + check-linked-issue: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - name: Check PR body for linked issue or discussion + env: + PR_BODY: ${{ github.event.pull_request.body }} + PR_AUTHOR: ${{ github.event.pull_request.user.login }} + run: | + # Skip for bots (dependabot, renovate, github-actions) + if [[ "$PR_AUTHOR" == *"[bot]"* || "$PR_AUTHOR" == "dependabot" ]]; then + echo "Bot PR — skipping linked issue check." + exit 0 + fi + + if [ -z "$PR_BODY" ]; then + echo "::error::PR body is empty. Every PR must link an issue or discussion." + echo "Use 'Closes #', 'Fixes #', 'Relates to #', or include a discussion URL." + exit 1 + fi + + # Match: #123, GH-123, org/repo#123, Closes/Fixes/Relates/Resolves #123, + # or a github.com URL to an issue or discussion + if echo "$PR_BODY" | grep -qiP '(close[sd]?|fix(e[sd])?|relate[sd]?\s+to|resolve[sd]?)\s+#\d+'; then + echo "Found linked issue keyword." + exit 0 + fi + if echo "$PR_BODY" | grep -qP '#\d+'; then + echo "Found issue reference." + exit 0 + fi + if echo "$PR_BODY" | grep -qiP 'github\.com/[^\s]+/(issues|discussions)/\d+'; then + echo "Found GitHub issue/discussion URL." + exit 0 + fi + if echo "$PR_BODY" | grep -qiP 'CF-#?\d+'; then + echo "Found Linear ticket reference." + exit 0 + fi + + echo "::error::No linked issue or discussion found in PR body." + echo "Every PR must reference an issue or discussion. See CONTRIBUTING.md for details." + echo "Use 'Closes #', 'Fixes #', 'Relates to #', or include a discussion URL." + exit 1 + # --------------------------------------------------------------------------- # Change detection — decides which downstream jobs actually run. # On push/workflow_dispatch every flag is true so all jobs execute. @@ -506,6 +557,7 @@ jobs: name: required checks passed if: always() needs: + - check-linked-issue - unit-tests - type-check - prek diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eb0f8cadc..830c3d393 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -101,10 +101,11 @@ The full ruleset is in [`.claude/rules/code-style.md`](.claude/rules/code-style. ## Branches, commits, and pull requests +- **Every PR must link an issue or discussion.** Use `Closes #`, `Fixes #`, or `Relates to #` in the PR body. CI will fail if no linked issue or discussion is found. For trivial fixes (typos, formatting), open a lightweight issue first — it only takes a moment and keeps the history traceable. The goal is to have a conversation before the code — discussing the approach on an issue or discussion helps maintainers point you in the right direction early, so your implementation fits the project's needs and you don't spend time on work that gets reworked. - Create a feature branch off an up-to-date `main`. Never commit directly to `main`. - Use conventional-commit prefixes: `fix:`, `feat:`, `refactor:`, `docs:`, `test:`, `chore:`. Keep commit messages concise (1-2 sentence body max). - Keep commits atomic - one logical change per commit. -- PR titles also use the conventional format. The PR body should be short and link any related issues. +- PR titles also use the conventional format. The PR body should be short and link the related issue. - If the change corresponds to a Linear ticket, include `CF-#` in the PR body. - Run `uv run prek` (or `uv run prek run --from-ref origin/main`) before pushing. CI will block merge if hooks fail. From 9d9e7cd0ee644c54e5ffc397daa7cdb15b049914 Mon Sep 17 00:00:00 2001 From: Kevin Turcios Date: Thu, 23 Apr 2026 02:55:05 -0500 Subject: [PATCH 2/2] chore: add CODEOWNERS based on git history Assigns per-directory code ownership to current org members based on full commit history analysis, so PRs automatically request reviews from the right people. --- .github/CODEOWNERS | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..8f67fd9ea --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,38 @@ +# Default fallback +* @KRRT7 + +# Java +/codeflash/languages/java/ @mashraf-222 @HeshamHM28 @misrasaurabh1 + +# JavaScript / TypeScript +/codeflash/languages/javascript/ @Saga4 @mohammedahmed18 @KRRT7 + +# Python language support +/codeflash/languages/python/ @KRRT7 + +# Core pipeline +/codeflash/optimization/ @KRRT7 @aseembits93 @misrasaurabh1 +/codeflash/verification/ @KRRT7 @misrasaurabh1 +/codeflash/benchmarking/ @KRRT7 +/codeflash/discovery/ @KRRT7 @misrasaurabh1 + +# CLI & setup +/codeflash/cli_cmds/ @KRRT7 @misrasaurabh1 + +# LSP +/codeflash/lsp/ @mohammedahmed18 + +# API +/codeflash/api/ @KRRT7 @aseembits93 + +# Tracing & entry points +/codeflash/tracing/ @misrasaurabh1 @KRRT7 +/codeflash/main.py @misrasaurabh1 @KRRT7 +/codeflash/tracer.py @misrasaurabh1 @KRRT7 + +# Shared utilities +/codeflash/code_utils/ @KRRT7 @aseembits93 @misrasaurabh1 +/codeflash/models/ @KRRT7 + +# CI / workflows +/.github/ @KRRT7