Repository navigation
fix(compliance): remove dev-lead workflow manipulation from re-trigger sweep (Step 1 is out of scope) #438
Copy link
Copy link
Closed
Labels
automationAutomation improvements and gapsAutomation improvements and gapsbugBug reportsBug reportsciCI/CD pipeline issuesCI/CD pipeline issuesdev-leadFor dev-lead agent pickupFor dev-lead agent pickup
Description
Summary
The daily re-trigger sweep (scripts/compliance-retrigger.sh) does more than re-trigger stale issues: Step 1 (check_devlead_workflows) inspects every fleet repo's dev-lead.yml and silently re-enables it if it finds the workflow disabled_manually or disabled_inactivity. This is out of scope for a re-trigger sweep and should be removed.
Evidence
scripts/compliance-retrigger.sh (on main):
check_devlead_workflows()— defined at line 92; called frommain()at line 359.- It enables workflows via the API at line 116:
gh api -X PUT "repos/$ORG/$repo/actions/workflows/$wf_id/enable" - The summary even reports it:
Workflows re-enabled: ${WORKFLOWS_DISABLED}(lines 132, 332, 345).
The job declares permissions: contents: read (.github/workflows/compliance-retrigger.yml:31) but performs this mutation through the ORG_SCORECARD_TOKEN PAT, bypassing the workflow's stated least-privilege boundary.
Why this is invalid
- Separation of concerns. A "re-trigger stale issues" sweep should re-fire
issues:labeledevents — nothing more. Mutating the enablement state of another workflow is a different responsibility with a different owner. - Overrides deliberate intent. If a maintainer disables
dev-leadin a repo on purpose (incident response, a noisy/looping agent, a repo being wound down), the next daily sweep silently turns it back on within 24h — an unwanted, surprising side effect. - Least-privilege violation. The job advertises
contents: readbut performsactions: write-class mutations via a PAT. The visible permission contract understates what the job actually does. - Hidden cross-repo writes. A governance sweep quietly changing config across the whole fleet is hard to audit and easy to forget exists.
Recommended Actions
- Remove
check_devlead_workflows()and its call site fromscripts/compliance-retrigger.sh, along with theWORKFLOWS_DISABLED/WORKFLOWS_ENABLEDcounters and their summary lines (console + step summary). - Keep the sweep focused solely on Step 2 (re-trigger stale issues, one engagement per repo per run).
- If "dev-lead must stay enabled fleet-wide" is a real requirement, move that enforcement to a dedicated, clearly-named workflow (e.g.
dev-lead-workflow-health) that:- declares the permission it actually needs,
- logs/justifies each enable as its own auditable action,
- and ideally reports a disabled workflow rather than auto-overriding a maintainer's deliberate disable.
- Update the script header docstring (the "What it does" section) to drop Step 1.
Acceptance Criteria
compliance-retrigger.shno longer reads or modifies any repo'sdev-lead.ymlenablement state.- The sweep's behaviour is unchanged for issue re-triggering.
- Dry-run output and step summary no longer mention "workflows re-enabled".
Context
Identified while documenting the daily sweep (follow-up to #431 / PR #432). Part of the Compliance program initiative (GH Project #1 Initiatives).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
automationAutomation improvements and gapsAutomation improvements and gapsbugBug reportsBug reportsciCI/CD pipeline issuesCI/CD pipeline issuesdev-leadFor dev-lead agent pickupFor dev-lead agent pickup
Activity
don-petry commentedon Jun 10, 2026
Dev-Lead Implementation Plan
Issue: #438 — fix(compliance): remove dev-lead workflow manipulation from re-trigger sweep (Step 1 is out of scope)
Scope
Remove
check_devlead_workflows()and all associated state (WORKFLOWS_DISABLED,WORKFLOWS_ENABLED) fromscripts/compliance-retrigger.shso the sweep only re-triggers stale issues and never reads or modifies workflow enablement state.Implementation Checklist
scripts/compliance-retrigger.sh: removecheck_devlead_workflows()function (lines 92–133)scripts/compliance-retrigger.sh: removecheck_devlead_workflowscall frommain()(line 359)scripts/compliance-retrigger.sh: removeWORKFLOWS_DISABLED=0andWORKFLOWS_ENABLED=0counters (lines 57–58)scripts/compliance-retrigger.sh: removeWORKFLOWS_DISABLED/WORKFLOWS_ENABLEDlines fromprint_summary()(console + GITHUB_STEP_SUMMARY sections)scripts/compliance-retrigger.sh: update header docstring (remove Step 1 description, update one-liner)Tests to Write
test/scripts/compliance-retrigger/helpers/setup.bash— test setup helperstest/scripts/compliance-retrigger/stubs/gh— smart gh stub routing responses by endpointtest/scripts/compliance-retrigger/workflow-health.bats:check_devlead_workflowsno longer defined in scriptWORKFLOWS_DISABLEDcounter no longer referencedWORKFLOWS_ENABLEDcounter no longer referenceddev-lead.ymlno longer referenced (no workflow state reads)Test Command
bats test/scripts/compliance-retrigger/workflow-health.batsdon-petry commentedon Jun 10, 2026
Dev-Lead: Implementation Complete
Plan Execution
scripts/compliance-retrigger.sh: removedcheck_devlead_workflows()function (was lines 92–133)scripts/compliance-retrigger.sh: removedcheck_devlead_workflowscall frommain()scripts/compliance-retrigger.sh: removedWORKFLOWS_DISABLED=0andWORKFLOWS_ENABLED=0countersscripts/compliance-retrigger.sh: removed workflow count lines fromprint_summary()(console + GITHUB_STEP_SUMMARY)scripts/compliance-retrigger.sh: updated header docstring (removed Step 1, updated one-liner)test/scripts/compliance-retrigger/helpers/setup.bash: created test setup helperstest/scripts/compliance-retrigger/stubs/gh: created smart routing gh stubtest/scripts/compliance-retrigger/workflow-health.bats: 8 tests covering static and behavioral assertionsTest Results
All 164 tests pass. ShellCheck lint passes clean.
Files Changed
scripts/compliance-retrigger.sh: removedcheck_devlead_workflows(), its call frommain(),WORKFLOWS_DISABLED/WORKFLOWS_ENABLEDcounters, and all summary lines referencing workflow counts; updated docstringtest/scripts/compliance-retrigger/helpers/setup.bash: new — test helpers following the compliance-remediate patterntest/scripts/compliance-retrigger/stubs/gh: new — smart gh stub that routes responses by endpoint and logs workflow enable calls separatelytest/scripts/compliance-retrigger/workflow-health.bats: new — 8 tests (4 static, 4 behavioral) verifying the issue acceptance criteriaNotes
feat: implement issue #438 — fix(compliance): remove dev-lead workflo…