fix(sp): clamp generated posts to each platform's hard char limit - #34
Merged
Merged
Conversation
assemblePostText truncated only the rendered body against the soft cap,
then appended the URL and hashtags + newline separators that weren't
counted — so a Bluesky post rendered near the 280 soft cap ended up at
323 chars and was rejected ("Bluesky posts max 300 chars (got 323)").
Add a hardcoded PLATFORM_HARD_LIMIT map (the real per-platform maxima)
and a clampAssembled() that guarantees the final assembled string —
body + URL + hashtags + separators — fits the limit. The URL is always
preserved; hashtags are dropped before the URL is sacrificed; the body
is trimmed on a word boundary with an ellipsis. Covers every platform
that goes through the renderer (manual action + feed autopost).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
Add ability for project owners to invite teammates by email. Invitees receive a branded email with a secure token link; accepting creates a project_members row and grants full project read access via RLS. Co-Authored-By: Claude Sonnet 4.6 <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.
Problem
Generated social posts could exceed a platform's hard character limit and get rejected at post time:
assemblePostTexttruncated only the rendered body against the soft cap (280 for Bluesky), then appended the article URL and hashtags and newline separators — none of which were counted. So a body rendered near 280 + url +#tagslanded at 323.Fix
PLATFORM_HARD_LIMITmap (the real per-platform maxima — same values enforced inlib/sp/platforms/*and thepostViaAccountguard).clampAssembled()guarantees the final assembled string (body + url + hashtags + separators) fits the limit:/socialaction and feed autopost.Tests
Adds
tests/sp/render-post.test.ts(5 cases): short post untouched, over-limit Bluesky clamped ≤300, hashtags dropped under tight room, X clamped ≤280, long-form (LinkedIn) left intact.tsc --noEmitclean.🤖 Generated with Claude Code