Skip to content

[scanner] human-merge pin-only exception: config schema + pure pin-only diff classifier #16262

Closed

Description

@hivecommons-hive

Goal

Add the configuration schema and a pure, side-effect-free classifier for a bounded pin-only exception to auto_merge.human_merge_paths. No gate wiring in this child — it only provides the building blocks the relay and sweep children consume.

Config (additive, src/pkg/config/config.go)

New key auto_merge.human_merge_pin_only (map owner/repo → block), next to HumanMergePaths:

auto_merge:
  human_merge_pin_only:
    owner/repo:
      enabled: true
      paths: [".github/workflows/*.yml", "Containerfile"]   # must be a subset of human_merge_paths globs' matches
      kinds: [action-sha, image-digest, version-pin]
      trusted_authors: [login1, login2]                       # explicit allowlist; empty = exception never applies
  • Accessor AutoMergeConfig.HumanMergePinOnlyFor(repo) (PinOnlyException, bool) matching repo case-insensitively like HumanMergePathsFor.
  • Validation: unknown kinds rejected; enabled: true with empty paths, kinds or trusted_authors rejected.
  • Absent / enabled: false → accessor returns false; nothing else changes.

Changed-file patches

intent.ChangedFile gains Patch string (and a PatchMissing bool if useful). github.ListPRChangedFiles and automerge.ListChangedFiles populate it from the files API patch field. Existing callers are unaffected.

Classifier (new file, e.g. src/pkg/intent/pin_only.go)

ClassifyPinOnly(files []ChangedFile, matches []string, ex PinOnlySpec) (ok bool, reason string):

  • Every matched file must be in ex.paths, status modified, and have a non-empty patch (GitHub omits patch for large/binary diffs → reject, fail closed).
  • Every hunk must be a 1:1 replacement: each - line paired with exactly one + line, identical after masking the pinned reference of an allowed kind:
    • action-sha: uses: owner/repo[/path]@<40-hex> (same owner/repo/path; trailing # vX comment may change)
    • image-digest: image@sha256:<64-hex> / FROM ...@sha256: (same image name)
    • version-pin: a version literal in an otherwise identical line
  • Reject any pure addition/removal, any line whose non-pin text differs, and anything touching permissions, secrets., env, run:, with: keys, id-token, cosign/attest/provenance, CODEOWNERS/owners. Unknown → reject.
  • Returns a short reason naming the first rejecting file/line.

Tests (table-driven, follow intent test style)

pure action-SHA bump → ok; pure digest bump → ok; pin bump + one added step line → reject; pin bump + permissions: change → reject; missing patch → reject; added file → reject; path outside paths → reject; kind not enabled → reject; config absent → accessor false; validation errors.

Docs: add the key to src/docs/hive-merge.md / src/docs/operator-reference/README.md marked "not yet enforced" until the wiring children land. Changelog fragment changelog.d/added-pin-only-human-merge-config.md.

Part of #16242

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Activity

  1. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    agent/scannerCreated or modified by the scanner agent
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/scannerCreated or modified by the scanner agenthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions