Skip to content

chore(ci): add PR checks and merge risk guidance - #30

Merged
serabi merged 2 commits into
mainfrom
chore/pr-ci-merge-risk
Nov 7, 2026
Merged

serabi merged 2 commits into
mainfrom
chore/pr-ci-merge-risk

Conversation

@serabi

@serabi serabi commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Why

zmx has no build CI today. Add fast Zig checks and bring over awesoMux's shorter PR template, metadata check, size labels, and merge-risk guidance.

What's Included

  • Run formatting, unit tests, and PR automation tests on Linux with Zig 0.16.0 and Node 24.
  • Check PR descriptions with trusted code from the default branch. Add informational size labels that recognize test/.
  • Preserve human comments and existing contributor checklist confirmations.
  • Add the approved zmx merge-risk skill and short contributor guidance. Keep runtime source and upstream structure unchanged.

UI / UX

Not applicable. No terminal behavior or app UI changes.

Notes

Models: gpt-6.1-sol

Merge risk: medium. Core CI passed at 912a9fb, but PR hygiene and size first run from trusted main after merge. A workflow bug could block PRs or mislabel them. Recovery: revert this change; existing labels and comments may need cleanup.

Local Zig 0.16 formatting and unit tests pass. All six PR automation tests, workflow lint, and diff checks pass. The comment regression tests fail against the inherited workflow behavior and pass with these fixes.

Reviewed with sol-loop: 2 rounds with gpt-6.1-sol. Sol verdict: APPROVE. Both findings are fixed. A later focused regression test also caught Kody summaries filling author sections; the validator now ignores that managed summary. All six automation tests and Zig checks pass locally and in hosted CI at 912a9fb. Kody's unmatched-marker finding was checked with four rejected examples and resolved with the results.

PR hygiene and size workflows use the trusted default branch, so their first hosted runs follow this merge. The new core CI runs on this PR. No repository settings or branch protection changes are included.

Sarah approved the full merge-risk skill wording before publication. She chose core CI now and attach CI after #29 merges, because main does not yet have test-replay or test/attach_scrollback.py. PRs #22, #28, and #29 are untouched; they will need the new description sections at their next edit or push after this merges.

Hosted proof: https://github.com/Interactive-Buffoonery/zmx/actions/runs/42338591720

Created with gpt-6.1-sol in Codex.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Why

Adds automated PR hygiene and review guidance to the fork: a PR template, a description validator that runs as a required check, size labeling, an external-contributor checklist, a ci.yml running Zig format/unit tests plus the new script tests, and an advisory merge-risk skill with matching CONTRIBUTING.md guidance. The goal is to keep PRs reviewable and consistent with upstream while avoiding any new merge permissions or repository protection changes.

What's Included

Security posture (workflows)

  • Both pull_request_target workflows check out the trusted default branch, not the PR head, and pin every action to a commit SHA with persist-credentials: false.
  • pr-size.yml fetches the PR head as passive Git data, expanding GH_TOKEN only inside the credential-helper subprocess, and aborts if the fetched SHA does not match the event SHA.
  • Managed comments and labels are matched by bot identity (user.login == github-actions[bot] and user.type == Bot), so a human cannot spoof a marker to suppress or hijack automation.
  • ci.yml uses permissions: contents: read; validators and the checklist only ever read the PR body and file list.
  • No workflow runs untrusted fork code with secrets, and no protection rules are changed.

PR description validation

  • validate-pr-body.mjs requires the template sections (Why, What's Included, UI / UX, Notes), allowing docs-only PRs to omit UI / UX.
  • Rejects empty sections, leftover template placeholder comments, and a blank Models: line; honors None as a valid value.
  • Strips managed footers (codesmith and kody summaries) before validation so bot content cannot satisfy author sections.
  • Posts/updates a single bot comment on failure and deletes it once valid; the workflow fails the check when invalid.

Size labeling

  • Computes effective changed lines from git diff --numstat --ignore-all-space --ignore-blank-lines, excluding test files when non-test changes exist, and maps to size:XS … size:XXL.
  • ensure-repository-label.sh creates or reconciles label color/description, handling the already_exists race.
  • Only one managed size label is kept; other managed labels are removed. size:XXL adds an informational, non-blocking comment.

Contributor and agent guidance

  • .github/pull_request_template.md with Why, What's Included, UI / UX, and Notes (including Models: and Merge risk:).
  • CONTRIBUTING.md documents the fork workflow, required local checks, size-label semantics, and that CI covers Linux unit tests only.
  • .agents/skills/merge-risk/SKILL.md (symlinked from .claude/skills/merge-risk) defines a read-only, advisory risk assessment: evidence requirements, a risk-by-touched-area table, levels, and a one-line report. It grants no merge authority.
  • .gitignore keeps only the shared merge-risk skill while ignoring other local agent state.

Tests and CI

  • ci.yml runs on PR, main push, and manual dispatch with cancel-in-progress concurrency, a 15-minute timeout, Zig 0.16.0, Node 24, zig fmt --check, zig build test, and node --test .github/scripts/test/*.test.mjs.
  • Tests cover missing headings, placeholders, blank Models:, untouched template, empty bodies, kody-summary isolation, bot-only comment lookup, and checklist preservation.

UI / UX

Not applicable — CI, documentation, and agent guidance only; no visible product change.

Notes

Models: None

Merge risk: medium. These workflows first take effect after merge, so trusted-base behavior and the new required check are only proven in hosted runs on main. Assessment logic is advisory only and no protection rules changed.

Review finding to address before merge

  • [medium] .github/scripts/validate-pr-body.mjs:11 — the kody-summary strip regex requires a matching start and end marker, so a body with an unmatched marker is not stripped. Content inside a malformed summary can then count as author-authored text and satisfy sections, defeating the "Kody summaries cannot fill or replace author sections" test intent. Suggest stripping start/end markers independently (and ignoring orphan markers) so the guard cannot be sidestepped.

Excess / cleanup opportunities

  • The comment_id="$( gh api --paginate … )" lookup block is duplicated in three places (pr-template.yml twice, pr-size.yml once) with only the marker differing. A single helper script taking the marker as an argument would be DRYer and keep the bot-identity check in one audited place.
  • ensure-repository-label.sh parses the HTTP status with awk 'NR == 1 { print $2 }' on --include output; that is brittle if response framing changes. gh api --jq plus exit status would be simpler.
  • ensure-repository-label.sh is only exercised indirectly; there is no test for its 404/422 already_exists/reconcile paths despite them being the most error-prone logic.
  • hasTemplatePlaceholder matches prose fragments such as "required for visible ui" anywhere in any comment, which can reject legitimate comments on unrelated content; anchoring to the template's exact placeholder text would be more precise.

Performance impact

None to the shipped binary. Workflows use per-PR concurrency groups with cancel-in-progress, a 15-minute CI timeout, and single-pass diffs; label reconciliation issues one lookup plus at most one write per label, and comment sync updates in place rather than accumulating comments.

Port PR metadata and size checks from awesoMux and add Zig 0.16
unit and automation checks. Preserve human comments and checklist
confirmations when workflows reconcile their own comments.

Add the approved fork-specific merge-risk skill. Defer attach CI
until the regression harness lands through PR #29.
@kody-ai

This comment has been minimized.

@kody-ai

kody-ai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

​

Comment thread .github/scripts/validate-pr-body.mjs Resolved
@serabi
serabi merged commit 089fe95 into main Nov 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant