Skip to content

fix(slack): keep bold and strike markers inside inline code - #27600

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
crew/conductor/slack-inline-code-z1b
Nov 2, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
crew/conductor/slack-inline-code-z1b

Conversation

@RohanK6

@RohanK6 RohanK6 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Slack shows inline code exactly as written, with ** and ~~ intact.

Slack mrkdwn conversion turned ** into * and ~~x~~ into ~x~ across the whole line. Inside backticks that altered code: `f(**kwargs)` showed as `f(*kwargs)`.

Why it matters

Python kwargs, globs and diff snippets in inline code reach Slack readers wrong, and a copied snippet no longer runs. This is the same bug #27260 fixed for previews.

Not a goal

  • Links, headings or any other inline conversion.
  • Inline code handling on other channels.

What changed (motivation → approach → change)

_convert_inline in slack/format.py swaps each inline code span for a placeholder token, runs the bold and strike passes, then puts the spans back. Emphasis that wraps a code span still converts. A line that already holds a NUL character skips the swap, so input text can never pose as a token.

Spans come from _code_spans in messaging/tables.py, the pairing the table renderer uses. It read a backslash as an escape inside a span too, so `C:\` paired with the next span. A backslash escapes a backtick only outside a span, as CommonMark says, and a table cell holding `C:\` keeps its column too.

Backwards compatibility

Compatible: text outside inline code converts exactly as before.

Removes nothing: no key, path or function is taken away.

Tests

test/test_slack_handler_rendering.py pins ** and ~~ kept inside code, emphasis around a span, a backslash inside code, and an escaped backtick outside code. test/test_messaging_tables.py pins a `C:\` cell.

Proof: PROVEN test/test_messaging_tables.py::TestEscapedPipesAndInlineCode::test_a_backslash_inside_code_closes_on_its_own_backtick, test/test_slack_handler_rendering.py::TestToSlackMrkdwnInlineCode::test_bold_and_strike_markers_inside_inline_code_are_kept (head 18a61c5)

Determinism: pure string functions, no clock, IO or randomness. The two touched test classes ran 20 times with their node ids in shuffled order: 20 of 20 green.

Manual verification

N/A — unit coverage sufficient: the change is a pure string transform, pinned byte for byte.

Related Issues

Fixes #27590

Sibling sweep

Swept: git grep -nE "replace("**", "*")|_STRIKE_RE.sub" -- src/
Sibling: src/kiro_crew/preview_text.py:228 -- not affected -- inline code is protected there since #27260
Sibling: src/kiro_crew/messaging/tables.py:510 -- changed here

Pattern harvest

Rule candidate: review-prompt
Pattern: an emphasis rewrite run over a whole line without first protecting inline code spans

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners November 2, 2026 01:13
@RohanK6
RohanK6 requested a review from cruisercohen November 2, 2026 01:13
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 18a61c5dba1180d084f8dcab288a4c1a4bb42ed3 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 18a61c5dba1180d084f8dcab288a4c1a4bb42ed3 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the change protects code spans before the emphasis passes run, and it reuses the table renderer's existing CommonMark pairing instead of adding a third parser.

Notes

  • preview_text._protect_inline_code (fix(preview): keep markdown markers inside inline code and ~~~ fences #27260) is now a second, separate protect/restore for code spans. A later fix that lands in only one of the two will make previews and Slack disagree. Fold it onto _code_spans in a follow-up.
  • The _code_spans backslash change also changes how table cells split, not only Slack. The description says so, but any table test that relied on the old escape-inside-span pairing will now fail. Check for one before merging.

[DESIGN-REVIEWED] 18a61c5

Description read

[DESCRIPTION-READ] 867361f63dc4134ff01523e455bedbef5b7746efe96fc789e8486de932ef12d4

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 18a61c5dba1180d084f8dcab288a4c1a4bb42ed3 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Both changes trace to #27590: the code-span protection, and the backslash fix to _code_spans. The protection pass reuses the existing _code_spans instead of adding a second backtick-pairing routine.

Notes

  • Item 5 — rides along, undeclared: _code_spans now finds a closer by grouping backtick runs by length and searching with bisect, where it used to scan linearly. The backslash fix needs only the outside bound and the parity check, and the description names no cost that the lookup rewrite removes. Subtraction: keep the original next(...) closer scan and drop by_length and import bisect.

What this change ships

Inventory (5 items) — 4 justified

Intent: Slack readers see inline code exactly as written. FIX.

  1. ** inside backticks stays ** in Slack. — justified
  2. ~~ inside backticks stays ~~ in Slack. — justified
  3. A backslash inside a code span no longer escapes its closing backtick, in Slack and in table cells. — justified
  4. A line that already holds a NUL character skips the code-span swap. — justified
  5. _code_spans now finds a closer through a by-length index and bisect. — rides along, undeclared

[FIRST-PRINCIPLES-REVIEWED] 18a61c5

Description read

[DESCRIPTION-READ] cc5f9405fdc11d58a5d289cd1b5455f34ac02c0bd86e40406632215486bd86c8

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 18a61c5dba1180d084f8dcab288a4c1a4bb42ed3 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 18a61c5

Verdict parsed from the review's SHA-scoped output markers for commit 18a61c5dba1180d084f8dcab288a4c1a4bb42ed3.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 18a61c5dba1180d084f8dcab288a4c1a4bb42ed3 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 18a61c5dba1180d084f8dcab288a4c1a4bb42ed3 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 18a61c5

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 18a61c5dba1180d084f8dcab288a4c1a4bb42ed3 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 2, 2026
@RohanK6
RohanK6 force-pushed the crew/conductor/slack-inline-code-z1b branch from b50b2f4 to 7eaccb6 Compare November 2, 2026 01:46
@RohanK6

RohanK6 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author
  • span=5b0c8916cb29 A trailing backslash makes code protection swallow following prose

fixed in 7eaccb6: tables._code_spans reads a backslash as an escape only outside a span, so C:\ closes on its own backtick.
test_a_backslash_inside_code_does_not_reach_past_the_span pins the reported line.

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Nov 2, 2026
@RohanK6
RohanK6 force-pushed the crew/conductor/slack-inline-code-z1b branch from 7eaccb6 to 0845eca Compare November 2, 2026 03:14
@RohanK6

RohanK6 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #27599 merged: import conflict in slack/format.py resolved; CI re-running.

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 2, 2026
@RohanK6

RohanK6 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #27598 merged: test conflict in test/test_messaging_tables.py resolved by keeping both test sets; CI re-running.

@RohanK6
RohanK6 force-pushed the crew/conductor/slack-inline-code-z1b branch from 0845eca to 18a61c5 Compare November 2, 2026 04:17
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 2, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 2, 2026 12:07

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: fix (4 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: bug fix: keeps bold and strike markers inside inline code in Slack rendering, and a backslash inside a code span no longer reaches past it; with tests.

@KiroCrewCaptain
KiroCrewCaptain merged commit e88244e into main Nov 2, 2026
99 of 131 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the crew/conductor/slack-inline-code-z1b branch November 2, 2026 12:08
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 2, 2026
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.

Slack mrkdwn rewrites ** and ~~ inside inline code

2 participants