Skip to content

Email: restore all-subscribers segment filter (fix Kit 422 at send) - #1978

Open
benbalter wants to merge 3 commits into
mainfrom
fix/email-broadcast-subscriber-filter
Open

Email: restore all-subscribers segment filter (fix Kit 422 at send)#1978
benbalter wants to merge 3 commits into
mainfrom
fix/email-broadcast-subscriber-filter

Conversation

@benbalter

Copy link
Copy Markdown
Owner

Real cause of the gif-or-jif broadcast 422

Follow-up to #1977. The media plugin was a legit inbox cleanup but not the cause. The actual cause, grounded in this script's own git history:

The payload omits subscriber_filter, and Kit v4 422s at send when it's omitted. The prior working code (32b47906) resolved a real "All subscribers" segment and referenced it, because Kit rejects both an omitted filter (422 at send) and an explicit all_subscribers type (422 at create). The public:false workaround (26789ebe) tore that segment logic out on an untested bet. The gif-or-jif post was the first real send since that workaround (every prior recent run was a "No new posts" no-op), so it was never caught.

Known-failing combinations

  • public:true + segment filter → 422 (the July all-subscribers regression)
  • public:false + no filter → 422 (omitted-filter, current main)

This PR

Restores segment targeting and keeps public:false — the union of both constraints, which was never actually run together. Segment id is resolved up front so a misconfiguration fails before rendering or sending.

Verification

🤖 Generated with Claude Code

The real cause of the gif-or-jif broadcast 422 (not the media tags): the
payload omits subscriber_filter. Kit v4 422s at send when it's omitted. The
prior working code resolved a real "All subscribers" segment and referenced it,
because Kit rejects BOTH an omitted filter and an explicit all_subscribers type.

The public:false workaround (26789eb) tore that segment logic out on an
untested bet that omitting the filter is valid at public:false. The gif-or-jif
post is the first new post since, so it was the first real send under that
workaround, and it failed exactly as the deleted comment warned.

Known-failing combinations:
- public:true + segment filter  -> 422 (the July all-subscribers regression)
- public:false + no filter       -> 422 (omitted-filter, current)

This restores segment targeting AND keeps public:false: the union of both
constraints (public:false to dodge the public-to-all 422, a real segment
reference to dodge the omitted-filter 422). Segment id is resolved up front so a
misconfiguration fails before rendering or sending anything.

Note: this combination has not yet been validated against the live API.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@benbalter
benbalter enabled auto-merge (squash) September 9, 2026 03:24
benbalter and others added 2 commits September 9, 2026 00:12
Per Kit v4 docs, a broadcast only *sends* when public:true with a send_at; a
public:false broadcast is just stored as a draft and never goes out. That was
the actual bug behind the whole run of 422s: every attempt was either
public:false (draft-only) or used a send_at of "now", which Kit rejects as a
past-dated schedule. Changing content, public flag, and subscriber_filter never
moved it because none of them was the cause.

Switch to public:true (the broadcast will appear in the Kit newsletter feed,
accepted tradeoff), keep the resolved all-subscribers segment filter, and set
send_at ~2 minutes in the future so the schedule is unambiguously valid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@benbalter
benbalter disabled auto-merge September 10, 2026 17:35
@benbalter

Copy link
Copy Markdown
Owner Author

On hold — do not merge yet.

Investigation confirmed this PR does not fix the broadcast failure. The 422 is the open, server-side Kit bug tracked in the support ticket: all-subscribers audience × full-size content 422s, invariant to public, subscriber_filter, and send_at. Verified 2026-09-09 by dispatching the real send three ways, all 422 (no emails sent):

  • public:false + segment filter → 422
  • public:true + segment filter + future send_at → 422 (segment #585086 resolved fine)
  • (plus the original public:false + no-filter → 422)

The only paths that currently deliver a full-size post: send to a tag covering all subscribers, or send via the Kit web UI. Auto-merge disabled. Revisit once Kit resolves the API bug (or repurpose this to tag-based sending).

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.

1 participant