You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ruleset pr-quality parameter require_last_push_approval has drifted from the codified standard: expected true, actual false. The codified JSON (standards/rulesets/pr-quality.json) is the source of truth (#575/#580); run scripts/apply-rulesets.sh --repo petry-projects/markets to converge.
The codified standard is already correct: .github/scripts/apply-pr-quality-ruleset.sh sets require_last_push_approval: true, and its bats test asserts it.
The livepr-quality ruleset (id 14592512) has drifted: require_last_push_approval: false (also require_code_owner_review and dismiss_stale_reviews_on_push are false, tracked by their own findings).
Make the self-heal's silent authentication failure loud and actionable so the missing-secret root cause is discoverable and the drift stops recurring unnoticed. (The codified ruleset value already matches the standard; the blocker is operational, not the payload.)
Implementation Checklist
Add a preflight step to .github/workflows/apply-repo-settings.yml that fails visibly (GitHub ::error annotation + $GITHUB_STEP_SUMMARY) with actionable remediation when GH_TOKEN_ADMIN is unset.
Tests to Write
Extend .github/scripts/tests/apply-repo-settings-workflow.bats with assertions that the preflight step exists, references GH_TOKEN_ADMIN, and surfaces the failure loudly.
Converging the live ruleset requires administration:write. The correct, idempotent tool is the codified self-heal — which only needs the missing GH_TOKEN_ADMIN secret to be provisioned by an org/repo admin. A full-script re-apply would also drop the live RepositoryRole bypass actor (3 live vs 2 codified), which is out of scope for this finding, so live convergence is intentionally left to a scoped admin apply once the secret exists.
The codified standard was already correct — .github/scripts/apply-pr-quality-ruleset.sh sets require_last_push_approval: true and its bats test asserts it. The drift is on the live ruleset, and it kept recurring (#325 → #403 → #420) for one reason:
That secret is not configured in this repo. Every run — including the scheduled run 31363226949 on 2026-08-10 — dies immediately with ERROR: GH_TOKEN is required with administration:write scope, buried in the step log.
Confirmed live state of ruleset pr-quality (id 14592512): require_last_push_approval: false (also require_code_owner_review: false, dismiss_stale_reviews_on_push: false — separate findings).
Plan Execution
Investigated codified standard vs. live ruleset and the self-heal run history
Identified the missing GH_TOKEN_ADMIN secret as the recurrence root cause
TDD: added failing bats assertions for a loud preflight, then implemented it
Full bats suite (41 tests) + dev-lead-lint + shellcheck of the embedded step all pass
Test Results
1..12
ok 1 workflow file exists
ok 2 workflow is valid YAML
ok 3 workflow declares a schedule trigger with a cron entry (issue #403 drift self-heal)
ok 4 workflow preserves the workflow_dispatch trigger
ok 5 workflow preserves the push trigger on main touching the ruleset scripts
ok 6 workflow has a preflight step that verifies GH_TOKEN_ADMIN before applying (issue #420)
ok 7 preflight step surfaces the missing secret loudly and actionably (issue #420)
ok 8 preflight runs before the apply-repo-settings step (issue #420)
ok 9 script exists and is executable
ok 10 script uses set -euo pipefail
ok 11 script targets petry-projects/markets repo
ok 12 script generates correct ruleset payload
Files Changed
.github/workflows/apply-repo-settings.yml: added a Verify admin token is configured preflight step that fails visibly (GitHub ::error annotation + $GITHUB_STEP_SUMMARY with remediation) when GH_TOKEN_ADMIN is unset — converting a silent, buried self-heal failure into a discoverable, actionable one.
.github/scripts/tests/apply-repo-settings-workflow.bats: added 3 regression tests pinning that the preflight exists, surfaces the failure loudly (error annotation + job summary + non-zero exit), and runs before the apply step.
What this does NOT do (and why)
It does not flip the live require_last_push_approval boolean. Converging the live ruleset needs administration:write; the correct idempotent tool is the existing self-heal, which only needs GH_TOKEN_ADMIN provisioned. A one-off full-script re-apply would also drop the live RepositoryRole bypass actor (3 live actors vs 2 codified), which is out of scope for this finding.
Remediation to fully close the finding
Provision the GH_TOKEN_ADMIN secret (repo or org admin token, administration:write). Once set, the weekly self-heal converges the ruleset automatically and this drift stops recurring. Until then, the preflight will make each failed run say exactly this.
Or run a scoped admin apply of the pr-quality ruleset once (preserving the current bypass actors).
Notes
Phase 2 (TDD) was followed: new tests failed red (steps 6–8) before the workflow change, then passed green. No live infrastructure was mutated.
Activity
don-petry commentedon Aug 14, 2026
Dev-Lead Implementation Plan
Issue: #420 — Compliance: ruleset-drift-pr-quality-require_last_push_approval
Root-cause investigation (before writing code)
.github/scripts/apply-pr-quality-ruleset.shsetsrequire_last_push_approval: true, and its bats test asserts it.pr-qualityruleset (id14592512) has drifted:require_last_push_approval: false(alsorequire_code_owner_reviewanddismiss_stale_reviews_on_pusharefalse, tracked by their own findings).apply-repo-settings.yml, weeklyschedule) fails on every run — including the scheduled run on 2026-08-10 — withERROR: GH_TOKEN is required. TheGH_TOKEN_ADMINsecret it authenticates with is not configured in this repo. That is why the drift recurs Compliance: ruleset-drift-pr-quality-require_last_push_approval #325 → Compliance: ruleset-drift-pr-quality-require_last_push_approval #403 → Compliance: ruleset-drift-pr-quality-require_last_push_approval #420 despite the schedule fix: the self-heal has never actually converged.Scope
Make the self-heal's silent authentication failure loud and actionable so the missing-secret root cause is discoverable and the drift stops recurring unnoticed. (The codified ruleset value already matches the standard; the blocker is operational, not the payload.)
Implementation Checklist
.github/workflows/apply-repo-settings.ymlthat fails visibly (GitHub::errorannotation +$GITHUB_STEP_SUMMARY) with actionable remediation whenGH_TOKEN_ADMINis unset.Tests to Write
.github/scripts/tests/apply-repo-settings-workflow.batswith assertions that the preflight step exists, referencesGH_TOKEN_ADMIN, and surfaces the failure loudly.Test Command
npx bats .github/scripts/tests/apply-repo-settings-workflow.batsNote on live convergence
Converging the live ruleset requires
administration:write. The correct, idempotent tool is the codified self-heal — which only needs the missingGH_TOKEN_ADMINsecret to be provisioned by an org/repo admin. A full-script re-apply would also drop the liveRepositoryRolebypass actor (3 live vs 2 codified), which is out of scope for this finding, so live convergence is intentionally left to a scoped admin apply once the secret exists.don-petry commentedon Aug 14, 2026
Dev-Lead: Implementation Complete
Root cause
The codified standard was already correct —
.github/scripts/apply-pr-quality-ruleset.shsetsrequire_last_push_approval: trueand its bats test asserts it. The drift is on the live ruleset, and it kept recurring (#325 → #403 → #420) for one reason:apply-repo-settings.yml(weeklyschedule, added for Compliance: ruleset-drift-pr-quality-require_last_push_approval #403) authenticates withsecrets.GH_TOKEN_ADMIN.31363226949on 2026-08-10 — dies immediately withERROR: GH_TOKEN is required with administration:write scope, buried in the step log.Confirmed live state of ruleset
pr-quality(id14592512):require_last_push_approval: false(alsorequire_code_owner_review: false,dismiss_stale_reviews_on_push: false— separate findings).Plan Execution
GH_TOKEN_ADMINsecret as the recurrence root causedev-lead-lint+ shellcheck of the embedded step all passTest Results
Files Changed
.github/workflows/apply-repo-settings.yml: added a Verify admin token is configured preflight step that fails visibly (GitHub::errorannotation +$GITHUB_STEP_SUMMARYwith remediation) whenGH_TOKEN_ADMINis unset — converting a silent, buried self-heal failure into a discoverable, actionable one..github/scripts/tests/apply-repo-settings-workflow.bats: added 3 regression tests pinning that the preflight exists, surfaces the failure loudly (error annotation + job summary + non-zero exit), and runs before the apply step.What this does NOT do (and why)
require_last_push_approvalboolean. Converging the live ruleset needsadministration:write; the correct idempotent tool is the existing self-heal, which only needsGH_TOKEN_ADMINprovisioned. A one-off full-script re-apply would also drop the liveRepositoryRolebypass actor (3 live actors vs 2 codified), which is out of scope for this finding.Remediation to fully close the finding
GH_TOKEN_ADMINsecret (repo or org admin token,administration:write). Once set, the weekly self-heal converges the ruleset automatically and this drift stops recurring. Until then, the preflight will make each failed run say exactly this.Notes
Phase 2 (TDD) was followed: new tests failed red (steps 6–8) before the workflow change, then passed green. No live infrastructure was mutated.
feat: implement issue #420 — Compliance: ruleset-drift-pr-quality-req…