Skip to content

fix(web): support ports in chat file references - #1565

Merged
brendan-kellam merged 3 commits into
mainfrom
brendan/fix-SOU-1929
Aug 10, 2026
Merged

fix(web): support ports in chat file references#1565
brendan-kellam merged 3 commits into
mainfrom
brendan/fix-SOU-1929

Conversation

@brendan-kellam

@brendan-kellam brendan-kellam commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Fixes SOU-1929

Summary

  • allow numeric ports in repository names parsed from chat file references
  • update positional capture consumers, including Mermaid-composed matching
  • add a regression test for git.example.com:8080/org/repo

Testing

  • yarn workspace @sourcebot/web test src/features/chat/utils.test.ts --run
  • yarn workspace @sourcebot/web test src/features/chat --run
  • yarn workspace @sourcebot/web test src/ee/features/chat/useExtractReferences.test.ts src/ee/features/chat/skills/commandResolution.test.ts src/ee/features/chat/skills/components/skillInstructionsEditor.test.ts --run
  • targeted ESLint on all changed TypeScript files

Note

Low Risk
Localized regex and capture-index updates in chat file-reference handling, with a targeted regression test; no auth or data-layer changes.

Overview
Fixes Ask Sourcebot file citations when the repository identifier includes a host port (e.g. git.example.com:8080/org/repo). Previously, FILE_REFERENCE_REGEX treated the first : as the separator between repo and path, so citations were parsed with the wrong repo/path and line ranges.

The shared FILE_REFERENCE_REGEX now allows an optional :digits segment inside the repo portion before the :: path delimiter. Every consumer that reads regex capture groups was updated to account for the extra capture (markdown rendering, reference extraction, skill instructions, panel interleaving with Mermaid, portable markdown export). A regression test asserts round-trip parsing for a port-bearing repo.

Reviewed by Cursor Bugbot for commit 8d8b900. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed Ask Sourcebot file-reference citations for repositories hosted on URLs with port numbers.
    • Corrected file paths, repository details, and line ranges when displaying cited code.
    • Preserved existing Mermaid diagram and markdown rendering behavior.
    • Improved citation handling across chat responses and source panels.
  • Tests

    • Added regression coverage for repository URLs containing ports.

@mintlify

mintlify Bot commented Aug 10, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
sourcebot 🟢 Ready View Preview Aug 10, 2026, 10:03 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The chat file-reference regex now supports repository URLs with numeric ports. All affected citation, extraction, instruction, and command parsing paths use the updated capture-group positions. A regression test and changelog entry document the fix.

Changes

Port-qualified chat file references

Layer / File(s) Summary
Regex contract and citation parsing
packages/web/src/features/chat/constants.ts, packages/web/src/features/chat/utils.ts, packages/web/src/ee/features/chat/...
The regex accepts optional repository ports. Citation rendering and extraction paths use the shifted capture groups.
Regression coverage and release note
packages/web/src/features/chat/utils.test.ts, CHANGELOG.md
The test covers ranged references with ports. The changelog records the citation fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding support for ports in web chat file references.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch brendan/fix-SOU-1929

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/web/src/features/chat/utils.test.ts`:
- Around line 137-152: Add assertions in the fileReferenceToString port-matching
test for FILE_REFERENCE_REGEX captures match?.[2] through match?.[5], verifying
the expected port, path, start line, and end line values alongside the existing
repository assertion.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 17027e64-1d33-440c-b183-44b20692dc11

📥 Commits

Reviewing files that changed from the base of the PR and between 427b534 and c709984.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • packages/web/src/ee/features/chat/components/chatThread/markdownRenderer.tsx
  • packages/web/src/ee/features/chat/skills/commandResolution.ts
  • packages/web/src/ee/features/chat/skills/components/skillInstructionsEditor.tsx
  • packages/web/src/ee/features/chat/useExtractPanelItems.ts
  • packages/web/src/ee/features/chat/useExtractReferences.ts
  • packages/web/src/features/chat/constants.ts
  • packages/web/src/features/chat/utils.test.ts
  • packages/web/src/features/chat/utils.ts

Comment thread packages/web/src/features/chat/utils.test.ts
@brendan-kellam
brendan-kellam merged commit b931ca7 into main Aug 10, 2026
13 checks passed
@brendan-kellam
brendan-kellam deleted the brendan/fix-SOU-1929 branch August 10, 2026 22:24
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