Repository navigation
fix(slack): never cut a flag, emoji or accent between two posts - #37998
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The grapheme rule comes from the existing Inventory (3 items) — 3 justifiedIntent: when a long Slack reply is split into several posts, no flag, emoji or accented letter is broken at the seam between two posts. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 44b58d2 Description read[DESCRIPTION-READ] bb8e23cd57816cd91dd4b7e36d7711c9778cb5f31c1400e6872373a1ff8f9fc2 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: a hard cut that splits a grapheme is the real cause, and the fix reuses the shared grapheme rule rather than adding a new one. [DESIGN-REVIEWED] 44b58d2 Description read[DESCRIPTION-READ] 820b134446c38cd1b3365de68fb5e582d088f6bacaecd9a27635d73963e97e07 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
split_message cut a line too long for one post exactly at the limit, counting code points. That cut could land between a flag's two regional indicators, inside a ZWJ emoji, or before a combining accent or keycap, so one post ended with a broken glyph and the next began with a dangling mark. The shared splitter already refuses such a cut; Slack's separate-post cutter did not. The hard cut now moves left to the start of the visible character it would split, using the same messaging.graphemes rule.
4d7c5b9 to
44b58d2
Compare
Code change approver recommendation: ApproveWhy: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes.
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On head 44b58d2 the review checked these points. _hard_cut now steps the cut left while messaging.graphemes.joins_previous holds. It never goes back to past or before it, and it falls back to the limit when the whole reach is one run of joining marks. Both callers in _fenced_cut were traced. The new tests were rebuilt and run: all 40 seam cases pass on this head, and 25 fail on the merge base, with the cut inside a unit at offset 3884. Removing the fallback reds the joining-run test. A fuzz of 4,000 mixed texts produced no seam inside a grapheme, rejoined every text without loss, and kept every post within 3900 characters. The spec line is updated in the same commit.
Done well: the fix reuses the shared joins_previous rule instead of adding another grapheme check, and the no-boundary fallback has its own test.
Optional:
- Neither new test is fenced, so the
_hard_cut(text, chunk_limit, past=cut)path has no grapheme test. A probe shows it works today: no graphemes split on this head, against 34 of 90 on the base. A fenced case of the same parametrised units would pin it.
Problem / Motivation
Goal: A long Slack reply split into several posts never shows a flag, emoji or accented letter broken at the seam.
split_messagehard-cut a line too long for one post at the limit by code point. That cut could land inside a grapheme cluster, so one post ended with a lone regional indicator, a bare base or half a ZWJ emoji, and the next began with a dangling mark; every flag after a split one paired with the wrong neighbour.Why it matters
Slack's separate-post path (
render_for_slack: cron delivery, result posts, subagent replies, the dashboard's Slack mirror; and the native handler's final reply) is where long replies split. Emoji-heavy text and non-Latin scripts show the reader corrupted characters, or a different flag from the one written. The shared splitter already avoids this since #37119; Slack's own cutter was the gap.Not a goal
split_messagebreaks a line that has a usable line break.messaging.graphemesowns.What changed (motivation → approach → change)
Symptom: a flag, emoji or accent shows broken across two Slack posts. Cause:
_hard_cutinsrc/kiro_crew/slack/format.pystarted atchunk_limitwith no look at grapheme clusters. Change: it now steps the cut left whilemessaging.graphemes.joins_previoussays the cut would split a visible character, then applies its existing<...>token guard. It never steps back to or before a cut already ruled out (past), so the reopened-fence path keeps its progress. When the whole reach is one run of joining marks, with no boundary to step back to, the cut stays at the limit. The Slack gateway spec line on final-message splitting says so.Backwards compatibility
Compatible: every cut that split no visible character lands where it did; one that would have split one moves left by a few code points.
Removes nothing: the change only moves a hard cut earlier.
Tests
test/test_slack_render_pipeline.py::test_a_hard_cut_never_splits_a_visible_character(40 cases: flag, ZWJ family, combining accent, keycap at ten lead widths): the posts rejoin to the input and no seam falls inside a unit. 25 cases fail on main by assertion.test_a_line_of_joining_marks_longer_than_a_post_is_cut_at_the_limit(2 cases): a line holding more joining marks than one post is cut at the limit, so a 10,000-mark run stays a handful of posts instead of one mark per post. Both fail on4d7c5b97a3d9by assertion.test/test_slack*.py,test_messaging_split.py,test_messaging_import_purity.pyand the othersplit_messagecallers' tests pass (6,943 on an earlier base; the core Slack suites pass on this head).Manual verification
N/A — unit coverage sufficient:
split_messageis a pure function and the tests read its seams directly; I did not post to a live Slack workspace.Related Issues
Fixes #37996
Sibling sweep
Swept: git grep -n -E "def (split_message|_hard_cut|_lossless_blocks)(|joins_previous" -- src/kiro_crew
Sibling: src/kiro_crew/messaging/split.py:_safe_cut -- not affected -- it already checks joins_previous since #37119
Sibling: src/kiro_crew/slack/format.py:_lossless_blocks -- not affected -- its blocks are rejoined into one text before posting, so no seam is shown
Sibling: src/kiro_crew/imessage/plaintext.py:_grapheme_boundary -- not affected -- it already uses joins_previous
Pattern harvest
Not generalizable: the grapheme rule is shared in messaging.graphemes; this was the last hard cutter not calling it.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.