Skip to content

Feat(select): Grant pre-commit edits by label - #233

Merged
ModeSevenIndustrialSolutions merged 2 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-231
Nov 23, 2026
Merged

ModeSevenIndustrialSolutions merged 2 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-231

Conversation

@lf-releng-code-monkey-bot

@lf-releng-code-monkey-bot lf-releng-code-monkey-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #231

Authored by an AI agent; human review required
Command Exit
uv run python -B -m unittest discover -s tests 0
AISLOP_NO_TELEMETRY=1 aislop scan --json --base 0e1191599bebbf5ceae7a25c724cd76a00875a39 0
zizmor --persona auditor .github/workflows/ 0
uv run python -B -m unittest discover -s tests 0
prek run --files $(git diff --name-only 0e1191599bebbf5ceae7a25c724cd76a00875a39 HEAD) 0

The github-code-monkey-bot workflow 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-ok label that grants edits to the root .pre-commit-config.yaml, built on the workflow_grant mechanism #225 added for workflow-edits-ok (#231).

What it does

  • scripts/workflow_grant.py serves both grants through one Kind (label, fields, wording): attach(), read() and report_lines() take it. WORKFLOWS keeps workflow-edits-ok; PRECOMMIT adds precommit-edits-ok.
  • The select job records allow_precommit_config_edits and precommit_edits_label per entry. A revision round takes the label alone, and the run-wide switch never widens a round. The selection records the configured label.
  • The matrix carries the grant to the author job. Its runtime-context line now comes from the entry.
  • workflow_gate.Context carries a pre-commit Grant in place of the boolean. Each grant unlocks only its own paths, a rejection names the label the file lacks, and only a JSON true turns a grant on.
  • The check summary, the Lint gate provenance line, the issue comment and the run report name the label when it granted the change.
  • README, docs/DESIGN.md and prompt/revise.md document the label.

Two commits: expected-fail tests first, then the feature, which removes the markers.

This round

The Audit changes check failed on an aislop complexity/file-too-large finding: the feature commit had grown scripts/proposal_check.py from 440 to 441 lines. The feature commit now moves the manifest's commands parsing out of proposal_check.read_manifest into hook_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 and diagnostics is empty. Before the fix, it reported the finding.
  • zizmor --persona auditor .github/workflows/: no findings.

For the reviewer

  • Check that hook_runs.read_commands keeps the old bounds: 50 entries, each command cut to 200 characters, and exit_code set to None unless it is an integer.

Copilot AI 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.

🟢 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

lf-releng-code-monkey-bot Bot and others added 2 commits November 23, 2026 13:07
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>

Copilot AI 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.

🟢 Approval recommended

No active review issues are reported for the per-issue pre-commit edit grant changes.

No open issues 🎉

Review effort: Balanced

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 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.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit 0275c0b into lfreleng-actions:main Nov 23, 2026
36 checks passed
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions deleted the code-monkey/issue-231 branch November 23, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat(select): Grant pre-commit edits by label

2 participants