Thunderbird Patch Review

Thunderbird内でメールからGitパッチをレビュー

Synopsis

A Thunderbird Add-on. Open a patch email, press Review, comment on hunks, send the review as a mailing-list reply, and apply the series to a local repository with git-am(1).

Screenshots

Fig: Patch button included in plugin
patch-button.png
Fig: Patch overview
thunderbird-patch-overview.png
Fig: Apply patches from the UI.
thunderbird-patch-success.png
Fig: Catch errors and send feedback.
thunderbird-patch-fail.png
Fig: Sourcehut integration.
srht-integration-thunderbird.png

Installation (source)

Package the extension source code as an .xpi and install it via the Add-ons Manager gear menu (Install Add-on From File...). To package it, run the following from the project root:

(cd extension && zip -qrX ../patch-review.xpi .)

At some point I will upload the add-on to Thunderbird.

Configuration

Open the extension's preferences:

Editor command

Run from the repository after a successful apply, with the changed files as arguments. Use a non-blocking GUI-capable command such as code -n or emacsclient -n; a bare terminal editor has no terminal to open in. Empty means $EDITOR.

Apply strategy

git am --3way (default) or plain git am.

Repository mappings

Substring matches against a patch's List-Id header or sender, mapped to an absolute repository path. When no mapping matches, the last path a series was applied to is used; it is remembered until changed.

Repository paths can be chosen with the Browse button, which opens Thunderbird's native directory chooser; the path field stays editable either way.

Permissions

messagesRead

Reads the selected message and its sibling patches in the same folder (subject, author, body) to build the review.

accountsRead

Resolves the default identity of the account that owns the reviewed message, for the From-address label and send-as.

storage

Persists draft comments (keyed by Message-ID) across restarts, plus the editor command, apply strategy, repo mappings, and the last applied repository path.

compose, (compose.send)

Opens reply-to-all compose windows from Send review and sends them in Send now mode. Without compose.send the review can only be previewed in compose, never sent.

downloads

Writes the Download patchset .mbox to disk.

tabs

Opens the review tab and removes it after a successful send.

The privileged Apply, Browse... , and Open editor code does not use a Mozilla permission: it is a WebExtension Experiment (experiment_apis.patchHost) shipped inside the XPI and runs only when the extension is loaded.

Sourcehut integration

When the series arrives via a sourcehut mailing list, an option to set the patch state header will appear when sending the review. It uses Sourcehut's email controls.

Caveats

Patches arriving as attachments, HTML-only mail, and reviewing from a git worktree preview are not supported yet. Series collection searches the folder of the opened message only.

See also

The introductory post contains a small snippet with motivation.

Disclaimer

This add-on was vibe coded using GLM5.2 and built to solve the needs of my team. I was hesitant to share it, as I generally do not like vibe-coded projects. However, given that a tool like this is sorely lacking from the ecosystem, I decided to share it anyway.

I have not reviewed the code line-by-line, but I designed the general approach the system should use, and focused on using as few dependencies as possible. I have also extensively Q&Ad the plugin manually alongside the test suite.

Contributing

Contributions and bug reports go to the mailing list: ~marcc/[email protected].

Author

Marc Coquand