Skip to content

Fix/Bitbucket Integration Issues.#27

Open
Amazing-Stardom wants to merge 13 commits intoloc-pricingfrom
fix/github-connector
Open

Fix/Bitbucket Integration Issues.#27
Amazing-Stardom wants to merge 13 commits intoloc-pricingfrom
fix/github-connector

Conversation

@Amazing-Stardom
Copy link
Copy Markdown
Contributor

@Amazing-Stardom Amazing-Stardom commented Apr 11, 2026

Bitbucket Integrations Issues and Other Small Issues Fixed

Issues and Fixes Made

  1. Bitbucket PR review was not created because the repo URL is missing. Hence, it couldn't fetch PR details.
image Empty string passed to provider function. The function requires a repo URL. Fixed it by passing repo URL. image
  1. Comments were not posting due to an empty function. Missed during the last refactor of network unification.
image This is fixed by fetching from old commits.
  1. LLM response error directly posted to comment.
    Fixed it by adding more general content.
image image
  1. The reply to the Bitbucket comment was broken.
    fixed it by adding discussion ID
image
  1. Comments were not posting in deleted lines due to lineIsDeleted function not identifying it.
    Fixed and added simple test case.

  2. Added Gitea wiki documentation in the create connector UI.

image

Unification of Bitbucket Network

  1. As many function calls were missing in the Bitbucket comment posting. Most of these functions missed unification.
  2. Currently unified all the API calls. This is done based on rules defined for adding in to docs.

Critical Changes

  1. Fixing lineIsDeleted bug. This function was not identifying deleted line comments. Hence, causing issues in posting a comment in a deleted line.
    Here is the actual fix: internal/ai/langchain/provider.go

LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:3, coverage:40%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:4, coverage:69%)
LiveReview Pre-Commit Check: ran (iter:6, coverage:100%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:2, coverage:59%)
@Amazing-Stardom
Copy link
Copy Markdown
Contributor Author

Severity: info

Fix Bitbucket Diff Parsing and Centralize API Operations

Overview

This change fixes a critical bug in Bitbucket diff parsing for AI comments. It centralizes Bitbucket API network operations into a dedicated package. It also implements robust Bitbucket comment posting and improves context propagation.

Technical Highlights

  • internal/ai/langchain/provider.go: Refactor lineIsDeleted to parse 'OLD | NEW | CONTENT' diff format.
  • network/providers/bitbucket/http_client_ops.go: Introduce new package to centralize Bitbucket HTTP client operations.
  • internal/providers/bitbucket/bitbucket.go: Implement PostComment with inline fallback and context.Context propagation.
  • cmd/mrmodel/lib/bitbucket.go: Propagate context.Context to all Bitbucket API calls.
  • internal/api/unified_processor_v2.go: Dynamically fetch Bitbucket user email from metadata for authentication.
  • internal/review/factories.go: Enforce repo_url as a mandatory configuration for Bitbucket provider creation.

Impact

  • Functionality: AI-generated comments now accurately identify deleted lines in Bitbucket diffs. Bitbucket comment posting is robust, supporting inline comments with fallbacks. Bitbucket API calls are more reliable with proper context handling.
  • Risk: Inline comment fallback may result in general comments if line numbers are mismatched. New repo_url validation might break existing misconfigured Bitbucket providers.

Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread cmd/mrmodel/lib/bitbucket.go
Comment thread internal/ai/langchain/json_repair_integration_test.go
Comment thread internal/ai/langchain/provider.go Outdated
Comment thread internal/ai/langchain/provider.go Outdated
Comment thread internal/ai/langchain/provider.go
Comment thread internal/ai/langchain/provider.go Outdated
Comment thread internal/ai/langchain/provider.go Outdated
Comment thread internal/ai/langchain/provider.go Outdated
Comment thread internal/ai/langchain/provider.go Outdated
Comment thread internal/api/bitbucket_profile.go
Comment thread internal/api/bitbucket_profile.go
Comment thread internal/api/bitbucket_profile.go
Comment thread internal/api/bitbucket_profile.go Outdated
Comment thread internal/api/reviews_api.go
Comment thread internal/api/unified_processor_v2.go
Comment thread internal/api/unified_processor_v2.go
Comment thread internal/api/unified_processor_v2.go
Comment thread internal/providers/bitbucket/bitbucket.go Outdated
Comment thread network/providers/bitbucket/http_client_ops.go Outdated
Comment thread network/providers/bitbucket/http_client_ops.go Outdated
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:2, coverage:37%)
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