Skip to content

Q.a - #55

Merged
v-Kaefer merged 32 commits into
mainfrom
Q.A
Aug 11, 2026
Merged

Q.a#55
v-Kaefer merged 32 commits into
mainfrom
Q.A

Conversation

@v-Kaefer

@v-Kaefer v-Kaefer commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Linked Issue

  • Closes #

Milestone

Summary

How to test

  • Test type: automated | smoke | manual
  • Steps:

Evidence

  • Screenshot/GIF attached when applicable
  • Log/output attached when applicable
  • Manual checklist executed when applicable

Known risks

DoD checklist

  • Scope implemented as defined
  • Tests executed and documented
  • Evidence attached when applicable
  • No known critical breakage introduced

Summary by CodeRabbit

  • New Features

    • Improved pull request governance automation with clearer validation, synchronization, and lifecycle handling.
    • Added English and Portuguese documentation describing the pull request governance process and security safeguards.
  • Bug Fixes

    • Improved handling of live pull request data during metadata validation and synchronization.
    • Prevented workflows from processing untrusted pull requests.
  • Tests

    • Expanded coverage for workflow triggers, metadata autofill ordering, validation, and pull request state handling.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@v-Kaefer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb648a44-977d-4978-8a47-e1a9a5daf123

📥 Commits

Reviewing files that changed from the base of the PR and between 86d1f8e and baab072.

📒 Files selected for processing (15)
  • .github/pull_request_template.md
  • .github/workflows/pr-metadata.yml
  • .github/workflows/pr-sync.yml
  • .github/workflows/qa-live.yml
  • docs/repo/pr-governance-architecture.md
  • docs/repo/pr-governance-architecture.pt-BR.md
  • docs/repo/pr-sync.md
  • docs/repo/pr-sync.pt-BR.md
  • project_setup.json
  • project_setup/pr_sync_router.py
  • project_setup/related_prs.py
  • tests/qa/cleanup_deployments.py
  • tests/qa/live_pr_sync.py
  • tests/test_qa_workflows.py
  • tests/test_related_prs.py
📝 Walkthrough

Walkthrough

PR metadata validation now runs directly on trusted pull request events. Autofill runs before validation. PR Sync handles selected lifecycle events and successful validation completions, then synchronizes live pull request context.

Changes

PR governance workflows

Layer / File(s) Summary
Direct pull request guardrails
.github/workflows/pr-metadata.yml, tests/test_pr_sync.py, tests/test_pr_sync_autofill.py, tests/test_qa_workflows.py
Metadata validation uses pull_request_target, trusted base commits, write permissions, direct pull request fields, and ordered autofill. Live-QA and cleanup use the same direct context.
Lifecycle and workflow-run synchronization
.github/workflows/pr-sync.yml, tests/test_pr_sync.py
PR Sync handles selected lifecycle events and successful metadata-validation completions. Event-specific guards, checkout references, and live GitHub API context retrieval are tested.
Architecture contract
docs/repo/pr-governance-architecture.md, docs/repo/pr-governance-architecture.pt-BR.md
The governance flow, workflow responsibilities, live-state refetching, authentication boundaries, security invariants, and regression contract are documented in English and Brazilian Portuguese.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant PRMetadata
  participant PRSync
  participant GitHubAPI
  PullRequest->>PRMetadata: trigger pull_request_target
  PRMetadata->>PRMetadata: autofill and validate metadata
  PRMetadata-->>PRSync: report successful validation
  PRSync->>GitHubAPI: fetch live pull request context
  PRSync->>PRSync: synchronize live pull request context
Loading

Possibly related issues

  • v-Kaefer/Github-Project-Automation issue 52: This PR implements the governance-order change by moving autofill and live validation into Guardrails before PR Sync.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description reproduces the template but leaves all required issue, summary, testing, evidence, risk, and DoD fields incomplete. Complete each required section with the linked issue, milestone, change summary, test steps, evidence, risks, and DoD status.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title “Q.a” is too vague and does not identify the PR governance, workflow, or testing changes. Replace the title with a concise summary, such as “Refine PR governance workflows and add architecture documentation”.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Q.A

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

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-metadata.yml:
- Around line 12-15: Update the qa-live caller workflow to pass
github.event.pull_request.head.sha as checkout_ref, remove secrets: inherit, and
restrict the caller job permissions to contents: read. Add contract assertions
verifying the checkout_ref value, absence of inherited secrets, and the caller
permissions.

In `@docs/repo/pr-governance-architecture.md`:
- Around line 17-21: The Mermaid Guardrails flow currently places PR metadata
validation before Autofill; reorder the sequence so Autofill precedes live PR
state validation and the branch/body validity decision. Apply the same
correction in docs/repo/pr-governance-architecture.md lines 17-21 and
docs/repo/pr-governance-architecture.pt-BR.md lines 17-21, keeping both
architecture diagrams consistent.

In `@docs/repo/pr-governance-architecture.pt-BR.md`:
- Line 44: Adicione uma vírgula após “Por isso” na frase sobre o GPA não usar o
body do evento original, preservando o restante do texto.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cce4cde6-568e-4ad4-9926-8e90e79bfa75

📥 Commits

Reviewing files that changed from the base of the PR and between b0941f0 and 86d1f8e.

📒 Files selected for processing (7)
  • .github/workflows/pr-metadata.yml
  • .github/workflows/pr-sync.yml
  • docs/repo/pr-governance-architecture.md
  • docs/repo/pr-governance-architecture.pt-BR.md
  • tests/test_pr_sync.py
  • tests/test_pr_sync_autofill.py
  • tests/test_qa_workflows.py

Comment on lines 12 to +15
permissions:
contents: read
issues: write
pull-requests: read
pull-requests: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify the reusable workflow's declared secret inputs and checkout use.
rg -n -C 4 'workflow_call:|secrets:|permissions:|checkout_ref|actions/checkout' \
  .github/workflows/pr-metadata.yml \
  .github/workflows/qa-live.yml \
  tests/test_qa_workflows.py

Repository: v-Kaefer/Github-Project-Automation

Length of output: 7133


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- pr-metadata.yml ---'
cat -n .github/workflows/pr-metadata.yml

printf '%s\n' '--- qa-live.yml ---'
cat -n .github/workflows/qa-live.yml

printf '%s\n' '--- related workflow tests ---'
cat -n tests/test_qa_workflows.py

printf '%s\n' '--- secret and token usage in the relevant workflows ---'
rg -n -C 3 '\bsecrets\b|GITHUB_TOKEN|github\.token|token:|pull_request_target|validate-pr|checkout_ref' \
  .github/workflows tests

Repository: v-Kaefer/Github-Project-Automation

Length of output: 35037


🌐 Web query:

GitHub Actions reusable workflow permissions caller called workflow workflow-level permissions secrets inherit environment secrets official documentation

💡 Result:

In GitHub Actions, reusable workflows interact with permissions and secrets in specific, well-defined ways to ensure security and flexibility. Permissions Inheritance Reusable workflows do not have their own independent permissions for the GITHUB_TOKEN; instead, they operate based on the permissions granted by the calling workflow [1][2]. - If you do not specify explicit permissions in the calling job (using jobs.<job_id>.permissions), the called workflow uses the default GITHUB_TOKEN permissions [1][3]. - Permissions can only be maintained or downgraded (made more restrictive) by the called workflow; they cannot be elevated [1][2][3]. - In nested workflow chains (e.g., A calls B, which calls C), this rule applies throughout the entire chain [4][5]. - It is a security best practice to explicitly define permissions in the calling job to ensure the called workflow does not receive broader access than intended [6]. Secrets Inheritance To provide secrets to a reusable workflow, you can either pass them explicitly or use the inheritance keyword [4][7]. - secrets: inherit: By adding secrets: inherit to the job configuration in the calling workflow, all secrets available to the calling workflow are automatically passed to the called reusable workflow [4][8][7]. - Explicit Passing: Alternatively, you can use the secrets key to pass specific, named secrets to the reusable workflow [4][5]. - Reference: Once secrets are inherited or passed, they can be referenced within the reusable workflow as secrets.NAME [7][9]. - Chain Behavior: When using chained reusable workflows, secrets are only passed to the directly called workflow [4][5]. For example, in a chain A > B > C, workflow B must explicitly pass the secrets to C, even if A passed them to B [4][5]. Environment Secrets Environment secrets are associated with specific environments [9]. For a reusable workflow to access environment secrets, the job within the reusable workflow must explicitly declare the environment using the environment keyword [9]. The workflow job will then have access to the secrets defined for that environment [9]. Top_results: [1][4][8][7][9][6]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import re

metadata = Path(".github/workflows/pr-metadata.yml").read_text(encoding="utf-8")
live = Path(".github/workflows/qa-live.yml").read_text(encoding="utf-8")
tests = Path("tests/test_qa_workflows.py").read_text(encoding="utf-8")

checks = {
    "caller uses mutable QA branch ref": "checkout_ref: refs/heads/Q.A" in metadata,
    "caller inherits all secrets": "secrets: inherit" in metadata,
    "called workflow uses QA project secret": "secrets.QA_PROJECT_SETUP_PAT" in live,
    "called workflow declares workflow_call secrets": bool(
        re.search(r"workflow_call:.*?secrets:", live, re.S)
    ),
    "called workflow restricts token to contents read": bool(
        re.search(r"permissions:\s*\n\s+contents:\s+read", live)
    ),
    "caller passes event head SHA": "github.event.pull_request.head.sha" in metadata,
    "existing test checks only reusable input wiring": (
        "ref: ${{ inputs.checkout_ref }}" in tests
        and "github.event.pull_request.head.sha" not in tests
    ),
}
for name, value in checks.items():
    print(f"{name}: {value}")
PY

Repository: v-Kaefer/Github-Project-Automation

Length of output: 490


Check out the pull request commit and remove inherited secrets.

Pass ${{ github.event.pull_request.head.sha }} as checkout_ref so qa-live cannot run code from a later Q.A push. Remove secrets: inherit; qa-live reads QA_PROJECT_SETUP_PAT from its protected qa environment. Set permissions: contents: read on the qa-live caller job and add contract assertions for both changes.

🧰 Tools
🪛 zizmor (1.29.0)

[error] 14-14: overly broad permissions (excessive-permissions): issues: write is overly broad at the workflow level

(excessive-permissions)


[error] 15-15: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-metadata.yml around lines 12 - 15, Update the qa-live
caller workflow to pass github.event.pull_request.head.sha as checkout_ref,
remove secrets: inherit, and restrict the caller job permissions to contents:
read. Add contract assertions verifying the checkout_ref value, absence of
inherited secrets, and the caller permissions.

Source: Linters/SAST tools

Comment thread docs/repo/pr-governance-architecture.md Outdated

Payloads de `pull_request_target` são snapshots. Se o Autofill altera o body de um PR e uma etapa de sincronização logo depois usa o payload original do evento, essa etapa pode consumir metadata antiga.

Por isso o GPA não usa o body do evento original como mecanismo de passagem de estado entre Autofill e PR Sync.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Adicione uma vírgula após Por isso.

Altere a frase para Por isso, o GPA não usa....

The supplied LanguageTool hint reports this punctuation issue.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~44-~44: Encontrada possível ausência de vírgula.
Context: ...apa pode consumir metadata antiga. Por isso o GPA não usa o body do evento original...

(AI_PT_HYDRA_LEO_MISSING_COMMA)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/repo/pr-governance-architecture.pt-BR.md` at line 44, Adicione uma
vírgula após “Por isso” na frase sobre o GPA não usar o body do evento original,
preservando o restante do texto.

Source: Linters/SAST tools

fix: make QA deployment cleanup import reliably
fix: promote reliable QA cleanup to Q.A
@v-Kaefer
v-Kaefer merged commit d1e61e8 into main Aug 11, 2026
16 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.

1 participant