Skip to content

merge.sh: no case holds the script or its refusals #49

Backlog

Description

@lneto

tools/merge.sh (#48) relies on three things in tools/checks/merge-guard.sh: it exits 2 on a refusal, it reads GH_TOKEN from the environment before the command (gh_token in commands.sh), and it reads MERGE_OK=1 in the command text alone. The script itself refuses at its usage line (exit 2) when an argument is not a repository name, a number and a full SHA, which keeps MERGE_OK=1 out of the command the guard reads, and it exits 1 when the guard refuses.

Its proof ran once over merge-guard.fixture.sh's gh stub, wrapped to log each -X PUT: #7, #10, #13 and #14 reached the stub, while #8, #8 with MERGE_OK=1 in the environment, MERGE_OK=1 in any argument (usage, exit 2), #9, #11, #15, #16 and a wrong or missing token never did. cases.sh runs hooks only, and the merge-guard cases hold the guard's verdict on the script's spelling, not the script. So nothing runs that proof again: deleting the argument check at tools/merge.sh:17-18 or the || exit 1 at line 25 fails nothing in CI. A change to the guard's exit code or to how it reads the token would make the script refuse every merge, and one that read MERGE_OK from the environment would make it fail open.

A case runner for merge.sh over the same fixture, run by the Checks workflow, would catch these.

Contract: .agents/rules/checks.md (this change): "the command it builds never carries MERGE_OK=1 ... and its arguments are held to a repository's name, a number and a full SHA". The rule's "A check ships proved, the way a test does" asks a kept case of a command guard, and merge.sh is not one.

Found while implementing #45.

Activity

  1. added
    severity: low
    on Nov 27, 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

    severity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions