Repository navigation
Feat(select): Grant pre-commit edits by label - #233
ModeSevenIndustrialSolutions merged 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the per-issue pre-commit authorization change.
No open issues 🎉
What changed in this PR
Extends the workflow-edit grant mechanism from #225 with precommit-edits-ok, addressing #231 by allowing maintainers to authorize root pre-commit configuration changes per issue rather than across an entire run.
Changes:
- Generalizes grant handling and records per-entry permissions for new proposals and revision rounds.
- Passes grants into author context and publisher checks while keeping workflow and pre-commit permissions independent.
- Adds label attribution to review outputs, regression coverage, and documentation.
| File | Description |
|---|---|
tests/test_workflow.py |
Checks that author context receives the per-entry grant. |
tests/test_workflow_gate.py |
Covers label grants, revision rules, strict booleans, and protected-file boundaries. |
tests/test_select_issues.py |
Tests per-issue selection, case-insensitive labels, and matrix propagation. |
tests/test_publish.py |
Tests pre-commit label attribution in issue comments. |
tests/test_merge_state.py |
Tests the pre-commit grant report section. |
scripts/workflow_grant.py |
Generalizes shared grant handling for workflows and pre-commit configuration. |
scripts/workflow_gate.py |
Enforces and attributes each grant for its own paths. |
scripts/selection_outputs.py |
Adds the pre-commit grant to author matrix entries. |
scripts/selection_document.py |
Records both configured grant labels. |
scripts/select_issues.py |
Attaches both grants to selected entries. |
scripts/publish.py |
Carries pre-commit label attribution into publish results. |
scripts/proposal_report.py |
Includes report sections for both grant kinds. |
scripts/proposal_model.py |
Models the pre-commit grant and exposes its attribution. |
scripts/proposal_check.py |
Reads both grants and forwards pre-commit provenance. |
scripts/issue_comment.py |
Names granting labels in issue comments. |
README.md |
Documents per-issue pre-commit authorization and its limits. |
prompt/revise.md |
Explains label-authorized edits while retaining hook restrictions. |
docs/DESIGN.md |
Updates grant rules, data contracts, reporting, and revision behavior. |
.github/workflows/code-monkey.yaml |
Uses the matrix grant in author context and documents the label. |
Review effort: Balanced
Issue lfreleng-actions#231 asks for a precommit-edits-ok label that grants one issue, and its revision rounds, the root .pre-commit-config.yaml without the run-wide allow_precommit_config_edits switch, through the mechanism the workflow-edits-ok label added. These tests pin that behaviour before the change lands, each marked expected to fail: - the selector grants the labelled issue alone, in any case, and a round takes the label but never the run's switch; - the matrix carries each entry's grant to the author job, and the Assemble prompt step reads it from there; - the publisher's gate passes a labelled entry with the switch off, rejects an entry whose own grant is false or not a JSON true, names the label in a rejection, and lets a labelled round change the file its pull request leaves alone; - the issue comment, the check summary, the provenance block and the run report name the label when it granted the change. Tests that already pass guard the grants' independence: workflow-edits-ok never unlocks the pre-commit configuration, and precommit-edits-ok never unlocks a workflow file or any other protected file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
The run-wide allow_precommit_config_edits switch lets every issue in a run change the root .pre-commit-config.yaml, and a revision round may never change it unless its pull request already does. An issue whose fix needs a hook change waited for a hand dispatch that then applied to every other issue in it. Generalise scripts/workflow_grant.py so one mechanism serves two grants: a Kind names each grant's label, fields and wording, and attach(), read() and report_lines() take it. WORKFLOWS keeps the workflow-edits-ok label; PRECOMMIT adds precommit-edits-ok. The select job records each entry's allow_precommit_config_edits and precommit_edits_label as it does the workflow grant, a round taking the label alone, and the selection records the configured label. The matrix carries the grant to the author job, whose runtime context line now comes from the entry, and a labelled round learns it may change the file. workflow_gate.Context carries a precommit Grant in place of the allow_precommit_edits boolean. check_new_proposal() and check_round() apply each grant to its own paths, so neither label unlocks the other's files or any other protected file, and a rejection names the label its file lacks. Only a JSON true turns a grant on; only an absent field takes the run's switch. The check summary, the provenance block's Lint gate line, the issue comment and the run report name precommit-edits-ok when it granted the change. README, DESIGN.md and the revise prompt describe the label; the tests from the previous commit now pass without their markers. The manifest's commands parsing moves from proposal_check.read_manifest to hook_runs.read_commands, beside the code that reads that record, so proposal_check.py stays under aislop's file-too-large limit; the review round's Audit changes check failed on that finding. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
dd7841d to
a596c9a
Compare
There was a problem hiding this comment.
🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.
No actionable defects found. The per-issue pre-commit grant is consistently propagated through selection, prompts, enforcement and reporting, while preserving independent workflow protection and revision limits.
Antagonistic round 1 of 3.
Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.
0275c0b
into
lfreleng-actions:main
Closes #231
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI0e1191599bebbf5ceae7a25c724cd76a00875a39uv run python -B -m unittest discover -s testsAISLOP_NO_TELEMETRY=1 aislop scan --json --base 0e1191599bebbf5ceae7a25c724cd76a00875a39zizmor --persona auditor .github/workflows/uv run python -B -m unittest discover -s testsprek run --files $(git diff --name-only 0e1191599bebbf5ceae7a25c724cd76a00875a39 HEAD)The
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.
Round 1 of revision, on its base. It set out to fix the failing checks: Audit changes.
Adds a per-issue
precommit-edits-oklabel that grants edits to the root.pre-commit-config.yaml, built on theworkflow_grantmechanism #225 added forworkflow-edits-ok(#231).What it does
scripts/workflow_grant.pyserves both grants through oneKind(label, fields, wording):attach(),read()andreport_lines()take it.WORKFLOWSkeepsworkflow-edits-ok;PRECOMMITaddsprecommit-edits-ok.allow_precommit_config_editsandprecommit_edits_labelper entry. A revision round takes the label alone, and the run-wide switch never widens a round. The selection records the configured label.workflow_gate.Contextcarries a pre-commitGrantin place of the boolean. Each grant unlocks only its own paths, a rejection names the label the file lacks, and only a JSONtrueturns a grant on.docs/DESIGN.mdandprompt/revise.mddocument the label.Two commits: expected-fail tests first, then the feature, which removes the markers.
This round
The
Audit changescheck failed on an aislopcomplexity/file-too-largefinding: the feature commit had grownscripts/proposal_check.pyfrom 440 to 441 lines. The feature commit now moves the manifest'scommandsparsing out ofproposal_check.read_manifestintohook_runs.read_commands, next to the code that reads that record. The behaviour is unchanged, and the file now has 428 lines.Checks run
uv run python -B -m unittest discover -s tests: 1730 tests, OK.prek run --files <all files the branch changes>: every hook passed, including aislop.aislop scan --json --base <base>with ruff on PATH: all engines ran anddiagnosticsis empty. Before the fix, it reported the finding.zizmor --persona auditor .github/workflows/: no findings.For the reviewer
hook_runs.read_commandskeeps the old bounds: 50 entries, each command cut to 200 characters, andexit_codeset toNoneunless it is an integer.