Warning
Review limit reached
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 28 seconds.
View limit details
Limit details: You’ve used all 10 included reviews currently available.
Review configuration:
Run configuration
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 220eb73
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ac7742fc-7248-4ba8-acbd-7a1266b75a91
Commits
Reviewing files that changed from the base of the PR and between aa951bbf37a683784135ee540d09ee9d94650665 and 562d11f9c8d53561c8930e4e840360641fe79bc8.
Files selected for processing: 24
apps/mobile/src/components/FilePreviewModal.tsxapps/mobile/src/components/FilePreviewModal.types.tsapps/mobile/src/components/VideoPreviewModal.ios.tsxapps/mobile/src/components/VideoPreviewModal.tsxapps/mobile/src/features/pull-requests/PullRequestMedia.tsxapps/mobile/src/features/pull-requests/pullRequestMediaSource.test.tsapps/mobile/src/features/pull-requests/pullRequestMediaSource.tsapps/mobile/src/lib/mediaPreviewUri.tsapps/mobile/src/lib/videoPreviewSource.tsapps/mobile/src/state/assets.test.tsapps/mobile/src/state/assets.tsapps/web/src/components/ChatMarkdown.tsxapps/web/src/components/chat/ChatMarkdownMedia.browser.test.tsxapps/web/src/components/chat/ChatMarkdownMedia.tsxapps/web/src/components/chat/ExpandedImageDialog.tsxapps/web/src/components/chat/ExpandedImagePreview.test.tsapps/web/src/components/chat/ExpandedImagePreview.tsxapps/web/src/components/chat/markdownImageGallery.tsapps/web/src/components/pullRequest/PullRequestMarkdown.tsxpackages/source-control-bitbucket/src/server/BitbucketApi.test.tspackages/source-control-bitbucket/src/server/BitbucketApi.tspackages/source-control-bitbucket/src/server/driver.tspackages/source-control-bitbucket/src/shared/definition.test.tspackages/source-control-bitbucket/src/shared/definition.ts
Walkthrough
The change adds Bitbucket download URL recognition and media fetching. Web and mobile preview paths now pass media context, preserve source fragments, and use fallback URIs when asset URL resolution fails.
Changes: Bitbucket media previews
Layer / File(s) Summary Bitbucket media URL recognition and fetching
packages/source-control-bitbucket/src/shared/definition.ts,packages/source-control-bitbucket/src/shared/definition.test.ts,packages/source-control-bitbucket/src/server/BitbucketApi.ts,packages/source-control-bitbucket/src/server/BitbucketApi.test.ts,packages/source-control-bitbucket/src/server/driver.tsSupported Bitbucket download URLs map to API download URLs and sanitized filenames. The Bitbucket driver exposes media fetching with origin-scoped credentials, validated redirects, and timeout handling. Web Markdown media context and gallery sources
apps/web/src/components/ChatMarkdown.tsx,apps/web/src/components/chat/ChatMarkdownMedia.tsx,apps/web/src/components/chat/markdownImageGallery.ts,apps/web/src/components/chat/ChatMarkdownMedia.browser.test.tsxMarkdown rendering passes environment and working-directory context to previews and galleries. Gallery items retain URL fragments and can use Bitbucket media resources for linked images. Web preview resolution and fallback rendering
apps/web/src/components/chat/ExpandedImagePreview.tsx,apps/web/src/components/chat/ExpandedImagePreview.test.ts,apps/web/src/components/chat/ExpandedImageDialog.tsx,apps/web/src/components/chat/ChatMarkdownMedia.tsx,apps/web/src/components/pullRequest/PullRequestMarkdown.tsxPreview resolution can fetch Bitbucket media as an asset and fall back to the direct URI when that fetch fails. Expanded image and video rendering uses resolved or fallback sources, with Bitbucket-specific retry behavior. Mobile Bitbucket media sources and URI fragments
apps/mobile/src/features/pull-requests/PullRequestMedia.tsx,apps/mobile/src/features/pull-requests/pullRequestMediaSource.ts,apps/mobile/src/features/pull-requests/pullRequestMediaSource.test.ts,apps/mobile/src/lib/mediaPreviewUri.ts,apps/mobile/src/lib/videoPreviewSource.tsPull-request media sources retain the original Bitbucket URL as a fallback and store the source fragment. Shared preview URI handling applies the fragment to resolved URLs. Mobile asset refresh and preview fallbacks
apps/mobile/src/state/assets.ts,apps/mobile/src/state/assets.test.ts,apps/mobile/src/components/FilePreviewModal.tsx,apps/mobile/src/components/FilePreviewModal.types.ts,apps/mobile/src/components/VideoPreviewModal.tsx,apps/mobile/src/components/VideoPreviewModal.ios.tsxThe asset refresh hook accepts an optional fallback URI. Pull-request, file, and video previews use it when asset URL creation fails and preserve source fragments in preview URLs. Priority: Pending latest changes
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Bug fix
Sequence Diagram(s)
mermaid1 sequenceDiagram 2 participant BitbucketApi 3 participant ConfiguredAPIOrigin 4 participant SignedObjectHost 5 BitbucketApi->>ConfiguredAPIOrigin: GET with credentials for the configured origin 6 ConfiguredAPIOrigin-->>BitbucketApi: Redirect to signed object URL 7 BitbucketApi->>SignedObjectHost: GET without Bitbucket credentials 8 SignedObjectHost-->>BitbucketApi: Media response Possibly related issues
- pingdotgg/t3code#19828 — The PR adds credentialed media loading for supported Bitbucket download URLs in pull-request media paths.
- pingdotgg/t3code#11412 — The PR applies credentialed Bitbucket media loading to private source-control media in pull-request descriptions.
Suggested labels:
bugfixSuggested reviewers:
juliusmarminge
Merge Risk: Low · up to aa951
Private Bitbucket videos may not recover from a transient signing failure when retried inline; reopening the preview remains a workaround. The remaining risk is bounded, but both retry paths should be fixed.
Security architecture risk: Low · up to 64c10
Private media now uses environment credentials through a signed, expiring access path. URL validation and origin-specific authorization constrain credential exposure. No introduced security violation was established, but cleanup of interrupted upstream streams remains unverified.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
- observed — The new authority is environment-wide Bitbucket download access: callers with orchestration-read permission can request downloads from any repository readable by the configured credential. Issuance does not establish repository membership. Resulting asset URLs are bearer capabilities accepted until expiry under the existing signed-asset model.
Trust Boundaries and Controls
- observed — Authored URLs are constrained to Bitbucket download paths and canonicalized to the HTTPS API endpoint. Redirects are limited to three followed hops and must remain HTTPS, but are not restricted to Bitbucket hosts. Each target receives a fresh authorization decision based on exact configured-origin equality; the streaming regression checks that an object-store redirect receives no authorization header.
Resilience and Maintainability Implications
- inferred — Per-hop response-header acquisition is bounded to 30 seconds, while body streaming is outside that timeout. The code uses a scoped HTTP client, but inspected evidence does not establish transport cleanup after downstream cancellation, timeout, or abandoned redirect/error bodies. This is a failure-containment uncertainty, not an observed resource leak; the base GitHub handler already delegated streaming and unconsumed-response cleanup to the HTTP implementation.
Pre-merge checks: 3 · 1
Failed checks: 1 warning
Check name Status Explanation Resolution Description check The description follows the repository template closely. It has a Problem statement (private Bitbucket Downloads fail without credentials), a Change explanation (use the environment's signed media API… Add a Scope and approval section. Link the triaged bug issue, or the discussion that contains explicit maintainer approval of the direction and scope, and include the approval comment link. If no prior issue exists, explain why this focused… Passed checks: 3 passed
Check name Status Explanation Title check The title follows conventional commit format and names the main change: Bitbucket private downloads now load with environment credentials. The changeset adds a Bitbucket media fetch path through the e… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
Explanation
The title follows conventional commit format and names the main change: Bitbucket private downloads now load with environment credentials. The changeset adds a Bitbucket media fetch path through the environment's signed media API, which matches the title. The title does not cover fallback URIs, fragment preservation, or GitHub behavior, but it does not need to cover every detail.
Full details: Description check
Explanation
The description follows the repository template closely. It has a Problem statement (private Bitbucket Downloads fail without credentials), a Change explanation (use the environment's signed media API, attach credentials only to the configured API origin, per-hop header timeout), and a Verification section with specific focused tests, observed results, red/green evidence, and items not verified. The Scope and approval section is missing. The description does not link a triaged bug issue or maintainer approval comment, and it does not explain why the fix qualifies without prior approval. The PR objectives mention a maintainer takeover and comments, but the description does not reference that approval. The Problem heading is also not explicitly labeled as such in a sentence-level statement of expected behavior and reproduction steps, though the first paragraph covers the failure. Overall the description is mostly complete, with one required section (Scope and approval) missing its linked approval.
Resolution
Add a Scope and approval section. Link the triaged bug issue, or the discussion that contains explicit maintainer approval of the direction and scope, and include the approval comment link. If no prior issue exists, explain why this focused fix of an obvious bug qualifies without prior approval. Also state the reproduction steps or environment for the private Bitbucket download failure in the Problem section.
Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.