Say why Akismet turned a comment away - #181
Merged
Merged
Conversation
Akismet answers every comment check with HTTP 200 and puts the reason in the x-akismet-debug-help header, so a rejected key looked like nothing worse than "unexpected response \"invalid\"" in the logs while every comment, spam included, quietly fell back to pending. Read that header and carry it into the error. Body "invalid" now maps to a ConfigError, which the comment handler logs at ERROR because nothing is being filtered until an operator fixes the key or the blog URL; transient failures keep their warning. Account alerts, which ride along with a good verdict to flag a plan that does not cover this site, are logged without disturbing the verdict. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A spam comment sat in Pending after Akismet was switched on. Akismet was working as designed — it was rejecting our key, and the client had no way to say so.
Akismet answers every comment check with HTTP 200 and explains itself in the
x-akismet-debug-helpheader, never in the body. All the log had was:The actual reason (
Empty "api_key" value) only came out of a manual curl against the API from Delta. Meanwhile every comment, spam included, was falling back topending— safe, but silently unfiltered.Changes
x-akismet-debug-helpand carry it into the error text, on both the HTTP-status and unreadable-body paths.invalidto a newakismet.ConfigError(withIsConfigError), separating "the key or blog URL is wrong" from a timeout.pending.x-akismet-alert-code/-msg. These accompany a successful verdict to flag account problems, notably a plan that does not cover a commercial site. The verdict is returned unchanged.Testing
Four new tests cover the config-error mapping, debug help on both error paths, and a verdict surviving an account alert.
go vet ./...andgo test ./...pass.The production key has since been replaced; a guaranteed-spam probe against the current key returns
truewith no alert header.Note:
/etc/triangle-cms/cms.envis read at container create time, so key changes need a recreate, not a restart.🤖 Generated with Claude Code