The Universe of Disco


Tue, 27 Aug 2019

Workarounds for semantic problems

At work we have a Git repostory hook (which I wrote) that prevents people from pushing changes to sensitive code without having it reviewed first. But there is an escape hatch for emergencies: if your commit message contains a certain phrase, the hook will allow it anyway. The phrase is:

    Craig said I could do this

(Craig is the CTO.)

Recently we did have a semi-emergency situation, and my co-worker Nimrod was delayed because nobody was awake to approve his code. In the discussion after, I mentioned the magic escape phrase. He objected that he could not have used it, because he would have been unwilling to wake up Craig to get the go-ahead. I was briefly puzzled. I hadn't said anything about waking up Craig; all you have to do is put a key phrase in your commit message. Nimrod eventually got me to understand the issue:

Nimrod: what does the phrase Craig said I could do this imply?

I had been thinking of the message as being communicated only to the Git hook. The Git hook thinks you mean only that it should allow the commit into the repo without review, which is true. But Nimrod is concerned about how it will be received by other humans, and to these people he would appear to be telling a lie. Right!

Nimrod had previously suggested a similar feature that involved the magic phrase “I solemnly swear I'm up to no good”.

Me: It seems to me that the only thing lacking from the current feature set is that you want the magic phrase to be I solemnly swear I'm up to no good instead of Craig said I could do this. Is that correct? It seems to me that alternate universe Nimrod might reasonably object that he may not force a commit unless he can really swear that he is up to no good.

So in this case that wouldn't have helped you. Or so I assume.

(I don't know, maybe he really was up to no good? But he did deny it.)

Nimrod: true enough! but it seems less likely to be taken seriously than having to swear that you have Craig's approval…

 

Me: Perhaps the magic phrase should be I request that this commit be exempt from review.

It would take a very subtle alternate-universe Nimrod to claim that he was too truthful to invoke that magic phrase just because he wanted his commit to be exempt from review.

Nimrod liked that okay, but then I had a better idea:

My suggestion, for the next time this comes up, is that you include the following wording in your commit message:

    My mention here of the magic phrase “Craig said I could do this” is not
    intended to aver that Craig did, in fact, say that I could do this.

The Git hook does not understand the use-mention distinction and you can then enable the feature without uttering a falsehood.

Problem solved!

(This reminds me a little bit of those programs that Philippe Bruhat writes that can be interpreted either as Perl or as PostScript, depending on how you understand the quoting and commenting conventions.)

[ Addendum: The actual magic phrase is not “Craig said I could do this”. ]

[ Addendum 20190829: There is a followup article. ]


[Other articles in category /tech] permanent link