Skip to content

fix(slack): keep a label's escaped closing bracket when shortening local paths - #52292

Merged
AmethystLiang merged 1 commit into
mainfrom
AmethystLiang/item-972
Nov 29, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
AmethystLiang/item-972

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca shortens a local file path inside a Markdown link label before sharing to Slack, it could drop a backslash that was escaping the label's closing bracket. That turned text that was meant to be literal into a live link or image.

What Changed

  • Before: [C:\Users\ada\proj\](https://e.test/x) became [proj](https://e.test/x), which is now a working link (and ![…\](…png) became a rendered remote image).
  • After: it becomes [proj\](https://e.test/x), so the escape survives and the text stays literal.
  • Mechanism: labels that are written back inside brackets are now redacted as if their closing ] followed them. That reuses the existing rule that keeps a trailing backslash when it escapes the next punctuation character. Links to local targets still collapse to plain words, unchanged.
  • Tests pin the existing trailing-separator prose behavior (see C:\Users\ada\proj\) now → see proj\) now) and the label \* escape. Before this PR, no test covered either.

Why

Redaction output must not change Markdown meaning. Reusing the existing bare-path escape rule keeps one consistent behavior instead of adding a second label-specific parser. Checked against how comparable products handle this.

Linked Issue

Maintainer follow-up; no issue.

Visual Proof

N/A: text-transformation logic with no UI change; covered by unit tests.

Testing

  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

Escaping is a security boundary, so tests are committed. The 5 new label cases fail before the fix and pass after. The 2 pinned cases fail if the existing escape rule is reverted. Every case also checks that redacting the output again changes nothing. The targeted test file passes locally (77/77), and a Linux gate passed on a branch that contains this commit.

Performance

By code reasoning: one extra string copy per redacted label (label + ]), whose content is already scanned in full. No new I/O, index, or repeated scan, so total work stays linear in the input.

Risk

Level: Low. The only output change is a kept trailing backslash in a bracketed label when it escapes ]. Every private path segment is still removed. Back out with a plain revert.

Gaps: macOS and Windows are not separately verified (the logic is platform-independent string processing), and the local gate ran on a stacked branch containing this commit rather than this exact head; hosted CI covers the exact head.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…cal paths

A remote-link or image label ending in a local path whose last backslash
escaped the closing ] lost that escape, turning literal text into a live
link. Redact labels as they sit before their ], reusing the bare-path
escape rule, and pin the trailing-separator prose behavior.
@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

Preserves a trailing backslash when shortening local paths inside kept Markdown link and image labels.

  • Slack labels keep escapes when local paths are shortened.

Reviews (1) · Last reviewed commit: "fix(slack): keep a label's escaped closi..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Markdown label redaction now includes the closing bracket when processing nonlocal image and link labels and Markdown URL labels. Regression tests cover escaped delimiters in local paths and verify that a second redaction pass leaves the result unchanged.

Merge Risk: Minimal · up to 46660

This fixes local path shortening in Slack Markdown link and image labels so an escaped closing bracket is no longer dropped, which previously could turn literal text into an active link or image. No concrete risk was found, and the change appears safe to merge once CI passes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a Markdown label's escaped closing bracket is kept when local paths are shortened in the Slack connector. It matches the raw summary and objectives. It uses the conven…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template closely. It covers ELI5, What Changed (before/after with a concrete example and mechanism), Why, Visual Proof (N/A with reason), Testing (checkboxes and…
Full details: Title check

Explanation

The title names the main change: a Markdown label's escaped closing bracket is kept when local paths are shortened in the Slack connector. It matches the raw summary and objectives. It uses the conventional fix(slack) prefix and is 78 characters, slightly long but readable.

Full details: Description check

Explanation

The description follows the repository template closely. It covers ELI5, What Changed (before/after with a concrete example and mechanism), Why, Visual Proof (N/A with reason), Testing (checkboxes and test evidence), Performance (a concrete one-line rationale), Risk (Level Low, known gaps, and a revert plan), the Agent skill upstream boundary, and the Checklist. Two items are weak. The Linked Issue section reads "Maintainer follow-up; no issue" and does not contain the required "Fixes #" link. The template says an issue should always exist for outside contributors, and this author may be a maintainer, so the gap is a judgment call. The AI Disclosure section is absent from the description, and the template says to fill it in unless the author is a StablyAI team member. The Review and Notes sections are also not addressed. These gaps are non-critical in most cases, so the check passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 49181f2e-d4d7-4462-8901-5e8118a405f5
Commits

Reviewing files that changed from the base of the PR and between f82ba7e and 46660d8.

Files selected for processing: 2

  • src/shared/connectors/slack-local-paths.test.ts
  • src/shared/connectors/slack-local-paths.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@AmethystLiang
AmethystLiang merged commit 825ae5d into main Nov 29, 2026
100 of 102 checks passed
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