Skip to content

Five gh verbs publish text through no table, and the flag that would name them means two things #80

Description

@HackingGate

The gh shim names the verbs it stands in front of, deliberately -- the test says why: "Named rather than pattern-matched: a shim that guesses which subcommands carry text is one release away from missing a new one in silence."

Five verbs that carry text are not named, and the flag half is worse than the verb half.

The verbs

invocation what it publishes matched today
gh issue close -c/--comment a closing comment no
gh pr close -c/--comment a closing comment no
gh issue reopen -c/--comment a reopening comment no
gh pr reopen -c/--comment a reopening comment no
gh pr merge -b/--body, -F/--body-file, -t/--subject the merge commit message no

pr:merge is the cheap one: -b, -F and -t are already in text_flags/file_flags and mean the same thing there, so naming the verb closes it with no other change.

The flag half cannot be fixed the same way

-c is not one flag:

  • gh pr review -c, --comment is a boolean -- "Comment on a pull request"
  • gh issue close -c, --comment string takes a value -- "Leave a closing comment"

pr:review is already matched. So adding -c to the shared text_flags makes the shim read gh pr review -c -b "text" as -c consuming -b as its argument, and the body it should be checking goes unread. That is a false negative introduced into a seam that exists to prevent exactly that, in exchange for closing a gap.

text_flags is per-command. gh's flag meanings are per-verb. Those two facts cannot both hold for -c.

The workaround that is not one

Declaring a second [[shim]] for gh with its own text_flags is the obvious shape, and until #79 it silently dropped one of the two tables. #79 refuses it rather than fixing it, because merging the vocabularies is the same guess in a different place.

So the open question is whether text_flags should be declarable per match entry:

[[shim]]
command = "gh"
match = ["pr:create", "pr:edit", "pr:review"]
text_flags = ["-t", "--title", "-b", "--body"]

  [[shim.verbs]]
  match = ["issue:close", "pr:close", "issue:reopen", "pr:reopen"]
  text_flags = ["-c", "--comment"]

Shape is illustrative. What matters is that one command can carry more than one flag vocabulary, because the command it stands in front of does.

Why this is worth more than its size

Every consumer transcribes its own [[shim]], because a set may not install one -- "a program standing in front of gh is not something to acquire by inheriting a name", which is the right call. The consequence is that a gap in the shim declaration is a gap in every consumer at once, and there is no central place to fix it. Measured across one workspace: 82 policies declare a gh shim, and 82 of them are missing these verbs.

That is the same asymmetry #50 recorded from the other side -- rules that a set ships and consumers transcribe anyway. Here the transcription is mandatory and the drift is the default.

Recorded honestly

gh issue close --comment was used four times in the session that found this, against private repositories, so nothing leaked. It was also not checked, and nothing said so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions