Skip to content

fix(buttondown): include Buttondown's bounded reason when it refuses a request - #2534

Merged
modelmirror merged 1 commit into
stagingfrom
fix/buttondown-error-detail
Oct 18, 2026
Merged

modelmirror merged 1 commit into
stagingfrom
fix/buttondown-error-detail

Conversation

@modelmirror-agent

Copy link
Copy Markdown
Contributor

The first live post-public-update run on main failed with creating the draft returned 422 and nothing else. The lookups before the create succeeded, so the key and the network path work; Buttondown refused the create itself. Buttondown's docs don't say what a 422 means on that endpoint, and the client discarded the response body that would.

Change: when Buttondown refuses a GET or the draft POST, the error now carries Buttondown's own reason, taken from the JSON body: code / detail / message if present, otherwise the JSON itself. It is collapsed to one line and capped at 300 characters, and a body that isn't JSON adds nothing. 5xx and 429 still go to the retry path and are never logged.

Why it's safe to log (the repo's Actions logs are public): the key travels only in the Authorization header. Everything else the request sends is the public update (subject, markdown, the tag-id filter). Retry-path bodies are not logged.

Checked: two new tests, 19 in all. One covers a refusal's reason, bounded and on one line, with the key absent; the other covers a refusal without JSON, which reports the status alone. scripts/gate.sh lint types is clean.

Review: security-reviewer found no blockers and called it safe to merge. I took its nit on the docstring, which now states that headers aren't echoed as an assumption, with the 300-character cap as the backstop. One recommendation is left as is: logging only code on 401/403. An account or plan refusal could name the account's sending address or username, but both are already public on the newsletter.

Left for the maintainer rather than self-merged: it changes what a credentialed job writes to a public log.

Effect check after promotion: re-dispatch gh workflow run post-public-update.yml --ref main -f week=2026-W41. If it still fails, the step log line now reads creating the draft returned 422: <Buttondown's reason>.


Generated by Claude Code

…a request

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wn5rjyY9Z7Vhoc9QyGXToG
@modelmirror
modelmirror enabled auto-merge October 18, 2026 13:33
@modelmirror
modelmirror merged commit bc6a1d2 into staging Oct 18, 2026
7 checks passed
@modelmirror
modelmirror deleted the fix/buttondown-error-detail branch October 18, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants