fix(newsletter): render Prompt custom sections#5884
Merged
Conversation
bokelley
marked this pull request as ready for review
July 16, 2026 23:54
There was a problem hiding this comment.
Clean fix. Custom sections were persisted by the editor but never consumed by the generated-content render paths — this closes that gap across all four surfaces and consolidates scheduled publishing onto the canonical Prompt markdown builder.
Things I checked
- Tracking-id stability (
server/src/addie/templates/weekly-digest.ts:148-156):indexis captured via.map((section, index) => ({ section, index }))before the placement.filter, so IDs stay stable and non-colliding across thebefore/afterpasses. Test assertscustom_1_1andcustom_2_1— only passes if the index precedes the filter. Right shape. - Placement logic is consistent across all four paths — email HTML, plain text, Slack, and perspective markdown all treat position
0as before generated content and position>0as after. Matches The Build's existing behavior. - digest-publisher refactor (
server/src/addie/services/digest-publisher.ts):buildFullMarkdown(74 lines) deleted, the single caller now takes amarkdownparam, andDigestContentis still load-bearing viaextractTags/openingTake— no dead import, no orphaned caller. The scheduled path and test/admin sends can no longer diverge. - Non-blocking failure handling preserved (
server/src/addie/jobs/weekly-digest.ts:337):void (async () => { ... })().catch(...)keeps publishing off the critical path;import()andbuildMarkdownthrows are caught. Happy path is unchanged. - No changeset, correctly. No file touches
static/schemas/source/**,docs/reference/**,mintlify-docs/reference/**, or the schema-build pipeline. Nothing on the wire. MUST FIX #6 doesn't fire.
Minor nits (non-blocking)
positiondoc comment now overstates its role.server/src/newsletters/config.tsdocumentsCustomSection.positionas an insertion index, but the placement model is binary (0= before,>0= after) — sections at positions1and5render in array order, not position order. Intentional (matches The Build), but worth tightening the comment to "0 = before generated content, >0 = after."- Dynamic import intent. The
import('../../newsletters/the-prompt/index.js')inside the IIFE atweekly-digest.ts:337is presumably breaking a circular import. A one-line comment saying so keeps a future maintainer from "cleaning it up" into a static import and reintroducing the cycle.
code-reviewer: ready to push — no blockers, no majors. Note that the reviewer's environment blocked the PR-branch fetch, so the suite wasn't run locally; confirm CI is green before merge.
LGTM. Follow-ups noted below.
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.
Summary
Root cause
The admin editor persisted custom sections, but The Prompt's normal generated-content render paths did not consume them. Scheduled perspective publishing also used a separate legacy markdown builder, so it could diverge from test sends and admin-triggered sends.
Impact
Custom text blocks saved in the newsletter editor now appear in test sends, scheduled delivery, Slack, web previews, and published perspectives. Position
0renders before generated sections and positive positions render after them, matching The Build's existing behavior.Closes #5873.
Validation
npm run typecheckgit diff --checkNo changeset is required because this is server-side newsletter behavior only.