Skip to content

ci: label the bot version PR at creation with its risk level - #17

Merged
bketelsen merged 2 commits into
mainfrom
lucilla/bot-pr-labels
Nov 11, 2026
Merged

bketelsen merged 2 commits into
mainfrom
lucilla/bot-pr-labels

Conversation

@frostyard-machines

Copy link
Copy Markdown
Contributor

Summary

The weekly Check Upstream Versions workflow opens its upstream bump PR with peter-evans/create-pull-request and GITHUB_TOKEN. GitHub starts no pull_request_target run for a PR that GITHUB_TOKEN opens, so the PR triage caller never runs and the PR gets no level:L* label and no risk:high, though it changes an L1 path (frostyard/core#233; seen on frostyard/bootc-debian#24).

This PR labels the bot PR at creation:

  • .github/workflows/check-dependencies.yml: the create-pull-request step gets add-paths: download/checksums.json (the only file the bot writes, so the PR content does not change) and labels: level:L1, risk:high. download/** is L1 in .github/risk-paths.json, and L1 takes risk:high (pr-triage spec).
  • tests/check-baseline.sh, new section "B12 bot labels": reads the add-paths and labels inputs of the single create-pull-request step (plain value or literal | block; block scalars such as the PR body and comments are skipped), computes the level of the add-paths from .github/risk-paths.json with core's matcher port and the org floors (risk-paths spec rules D and G), and fails when the level:*/risk:high labels differ from that level. A missing input, a glob or non-file add-path, an expression, a quoted, folded or flow value, or a second create-pull-request step also fails.
  • tests/check-baseline-test.sh: 11 failing and 2 passing cases for the new section.
  • AGENTS.md: 1 rule; .memory/corrections.jsonl: 1 line.

This is a per-repository mitigation. A fleet-wide fix (a GitHub App or machine token for bot PRs, or a scheduled triage sweep) is not decided; see frostyard/core#233.

Risk tier

Risk tier: 3 — touches .github/workflows/** (L1) and tests/** (L2).

Matched risk paths and why the change is safe:

  • .github/workflows/check-dependencies.yml (.github/workflows/**, L1, publication): adds 2 inputs to the create-pull-request step and a comment. No permission, token, trigger, action pin or other step changes. add-paths limits the commit to download/checksums.json, which the bot already writes as its only change (it writes tmp.json and moves it over that file). labels only adds labels; the job already has pull-requests: write, and the labels exist in the repository.
  • tests/check-baseline.sh, tests/check-baseline-test.sh (tests/**, L2, governance): a new check and its negative tests. Every earlier check is unchanged.

Verification

  • make verify green
  • make ci green: all baseline cases ok, ok - baseline: ... bot labels level:L1, tests/run.sh all tests passed
  • Risk path touched: the PR body names each matched path and why the change is safe
  • Revert test: in a scratch worktree at the PR head, git checkout HEAD~1 -- .github/workflows/check-dependencies.yml && tests/check-baseline.sh exits 1 with not ok - the create-pull-request step has no add-paths input; with only the 3 labels lines removed it exits 1 with not ok - the create-pull-request step has no labels input.
  • Workflows changed: every action is SHA-pinned with # vX.Y.Z, permissions: {}, and persist-credentials: false (unchanged)

Not checked: a real bot run on GitHub. The next scheduled run (Monday 08:00 UTC) or a manual run of the workflow shows the labels on the bot PR.

A PR that GITHUB_TOKEN opens starts no pull_request_target run, so the
PR triage caller never adds the level label or risk:high to the version
PR (frostyard/core#233). The create-pull-request step now limits the
commit to download/checksums.json with add-paths and sets level:L1 and
risk:high, the level of that file in .github/risk-paths.json (core
docs/specs/pr-triage.md).

tests/check-baseline.sh computes the level of the add-paths from the
list and core's org floors and fails when the labels differ; the
negative tests in tests/check-baseline-test.sh cover each failure.
@github-actions github-actions Bot added level:L1 Read every line risk:high Touches a path in .github/risk-paths.json (core ADR-0068) labels Nov 11, 2026
Rule D of core docs/specs/risk-paths.md gives a path the strictest level
of its matching globs and uses default_level only when no glob matches.
The bot labels check started from default_level, so a matching L4 entry
under an L3 default read as L3. New cases cover an L4 entry with L4 and
L3 labels and an add-path that no glob matches.
@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Cross-review record

  • Reviewer: openai/gpt-6.1-sol (read-only). Coder: deepseek/deepseek-flash.
  • Initial review: base 6aff8a244c8e009035d2e89f1162a1df99797cf6, head 46314bc9132ba36cc1439ce933c2fd3fdef2c402. Finding 1 (medium, blocking): the bot labels check used default_level as a floor; core risk-paths spec rule D uses it only when no glob matches. Accepted.
  • Fix: f1d73993b0abedde065bcdacfede4bc9b487269b computes the strictest matching glob level first and reads default_level only when no glob matches; 3 new cases (b12_bot_risk_l4_ok, b12_bot_risk_l4_labels_l3, b12_bot_default_level) and 1 .memory/corrections.jsonl line. The L4 ok case fails with the old function and passes with the fix.
  • Re-review 1 of 46314bc9132ba36cc1439ce933c2fd3fdef2c402..f1d73993b0abedde065bcdacfede4bc9b487269b: no new findings, finding 1 resolved. Ready, Blocking: none at head f1d73993b0abedde065bcdacfede4bc9b487269b.
  • Checks: make ci exit 0 locally at the head, 0 not ok. Revert test: with the workflow restored from the base, tests/check-baseline.sh fails (no add-paths input); with only the labels lines removed, it fails (no labels input).

@bketelsen
bketelsen merged commit b8c6008 into main Nov 11, 2026
9 checks passed
@frostyard-machines
frostyard-machines deleted the lucilla/bot-pr-labels branch November 11, 2026 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L1 Read every line ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json (core ADR-0068)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants