Skip to content

blacklake support#15

Merged
Fesenko-A merged 6 commits into
mainfrom
develop
Jul 9, 2026
Merged

blacklake support#15
Fesenko-A merged 6 commits into
mainfrom
develop

Conversation

@Fesenko-A

Copy link
Copy Markdown
Contributor

Blacklake support

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mathijs-bb, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dd629109-a124-480a-8a46-ac3919d7fc1c

📥 Commits

Reviewing files that changed from the base of the PR and between c04308a and cf820ed.

📒 Files selected for processing (8)
  • Apps.GitLab/Actions/CommitActions.cs
  • Apps.GitLab/Actions/RepositoryActions.cs
  • Apps.GitLab/Apps.GitLab.csproj
  • Apps.GitLab/Extensions/TransformationExtensions.cs
  • Apps.GitLab/Models/Respository/Requests/GetFileRequest.cs
  • Apps.GitLab/Utils/File/DownloadedFile.cs
  • Apps.GitLab/Utils/File/FileHelper.cs
  • Tests.GitLab/CommitActionTests.cs

Walkthrough

This PR refactors GitLab commit and repository file actions to share new file-processing utilities (FileHelper, DownloadedFile, UploadedFile, ProcessedUploadedFile/ProcessedDownloadedFile), adds transformation metadata extensions, new client methods (GetProject, GetFileInfo, ExecuteWithErrorHandling), updated response models, and returns UploadFileResponse from commit actions instead of CommitDto.

Changes

File Processing and Transformation Support

Layer / File(s) Summary
File data records
Apps.GitLab/Utils/File/DownloadedFile.cs, .../UploadedFile.cs, .../ProcessedDownloadedFile.cs, .../ProcessedUploadedFile.cs, Apps.GitLab/Models/Commit/Responses/UploadFileResponse.cs
New immutable records model raw and processed file payloads and the commit upload response bundling CommitDto and FileReference.
FileHelper processing logic
Apps.GitLab/Utils/File/FileHelper.cs
ProcessDownloadedFile and ProcessUploadFile convert raw file bytes via MIME detection, base64 decoding, and transformation load/source/target handling, throwing PluginMisconfigurationException on transformation failures.
Transformation metadata extensions
Apps.GitLab/Extensions/TransformationExtensions.cs
AddSourceMetadata/AddTargetMetadata build GitLab blob/edit URLs and populate source/target system references and languages on a Transformation.

GitLab Client and Action Integration

Layer / File(s) Summary
Client API additions
Apps.GitLab/BlackbirdGitLabClient.cs
Adds ExecuteWithErrorHandling, GetProject, GetFileInfo, and updates PushChanges to resolve branch via GetProject default branch when unspecified.
Response model updates
Apps.GitLab/Models/Respository/Responses/RepositoryFileResponse.cs
Adds FilePath/FileName JSON-mapped properties alongside Content.
Commit actions refactor
Apps.GitLab/Actions/CommitActions.cs
PushFile/UpdateFile use primary constructor, resolve branch, check file existence via CheckFileExists, and delegate to a new shared CommitFile helper returning UploadFileResponse.
Repository actions refactor
Apps.GitLab/Actions/RepositoryActions.cs, Tests.GitLab/RepositoryActionTests.cs
GetFile (renamed from "Get repository file" to "Download file") now fetches file info via RestClient and processes it with FileHelper; other actions updated to primary-constructor field usage; new test added.
Project metadata and docs
Apps.GitLab/Apps.GitLab.csproj, README.md
Version bump to 1.0.16, adds Blackbird.Filters dependency, reorganizes embedded resources, renames actions in README.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CommitActions
  participant RestClient
  participant FileHelper
  participant FileManagementClient

  CommitActions->>RestClient: CheckFileExists (HEAD request)
  RestClient-->>CommitActions: exists / not found
  CommitActions->>FileManagementClient: download input file
  CommitActions->>FileHelper: ProcessUploadFile
  FileHelper-->>CommitActions: ProcessedUploadedFile
  CommitActions->>RestClient: PushChanges
  RestClient-->>CommitActions: CommitDto
  opt transformation present
    CommitActions->>RestClient: GetFileInfo
    CommitActions->>FileManagementClient: UploadAsync(transformed)
  end
  CommitActions-->>CommitActions: UploadFileResponse
Loading
sequenceDiagram
  participant RepositoryActions
  participant RestClient
  participant FileHelper
  participant FileManagementClient

  RepositoryActions->>RestClient: GetProject / branch info
  RepositoryActions->>RestClient: GetFileInfo
  RestClient-->>RepositoryActions: RepositoryFileResponse
  RepositoryActions->>FileHelper: ProcessDownloadedFile
  FileHelper-->>RepositoryActions: ProcessedDownloadedFile
  RepositoryActions->>FileManagementClient: UploadAsync
  FileManagementClient-->>RepositoryActions: FileReference
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to describe the actual change and only says 'blacklake support'. Use a concise title that names the main change, such as adding Blacklake metadata support for GitLab file actions.
Description check ❓ Inconclusive The description is also too vague and does not explain what Blacklake support changes in the codebase. Add a short summary of the functional changes, such as the updated GitLab file actions, metadata handling, and new file response types.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

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

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (3)
Apps.GitLab/Actions/RepositoryActions.cs (1)

46-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Docs sync: action renamed to "Download file".

The action display name changed from "Get repository file" to "Download file". Please confirm README.md's Actions section reflects the new name (non-blocking).
As per path instructions: "When those attribute values are added, removed, or changed, check whether README.md reflects the update."

🤖 Prompt for 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.

In `@Apps.GitLab/Actions/RepositoryActions.cs` at line 46, The action display name
on RepositoryActions.Action was renamed to “Download file”, so update
README.md’s Actions section to match the new attribute value and ensure any
mention of the old “Get repository file” name is replaced. Check the action
entry that corresponds to the [Action] attribute in RepositoryActions so the
docs stay synchronized with the code.

Source: Path instructions

Apps.GitLab/Extensions/TransformationExtensions.cs (2)

3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Namespace casing inconsistent with rest of codebase.

Apps.Gitlab.Extensions (lowercase "Gitlab") diverges from the Apps.GitLab.* casing used elsewhere (e.g. Apps.GitLab.Utils.File, Apps.GitLab.Actions). Purely cosmetic since C# namespaces resolve case-sensitively and compile fine, but worth aligning for consistency.

🤖 Prompt for 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.

In `@Apps.GitLab/Extensions/TransformationExtensions.cs` at line 3, The namespace
declaration in TransformationExtensions should be aligned with the rest of the
codebase casing, as Apps.Gitlab.Extensions is inconsistent with the existing
Apps.GitLab.* pattern. Update the namespace on the TransformationExtensions type
to use the same GitLab capitalization as other namespaces so the codebase
remains consistent and easier to navigate.

13-45: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consolidate duplicated AddSourceMetadata/AddTargetMetadata logic.

Both methods are near-identical (build URLs, set language, set the four SystemReference fields) aside from which side (Source*/Target*) they populate. Extracting a shared private helper would reduce duplication and the risk of the two diverging.

♻️ Proposed refactor
+    private static void ApplyMetadata(SystemReference reference, out string language, string filePath, string fileName, string branchName, string repoWebUrl)
+    {
+        var (blobUrl, editUrl) = BuildUrls(filePath, branchName, repoWebUrl);
+        language = fileName.Split('.')[0];
+        reference.ContentId = blobUrl;
+        reference.AdminUrl = editUrl;
+        reference.ContentName = fileName;
+        reference.SystemName = "GitLab";
+        reference.SystemRef = "https://gitlab.com/";
+    }

Note: exact signature depends on Transformation's public shape (e.g., whether SourceSystemReference/TargetSystemReference share a common settable type) — adjust as needed.

🤖 Prompt for 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.

In `@Apps.GitLab/Extensions/TransformationExtensions.cs` around lines 13 - 45, The
AddSourceMetadata and AddTargetMetadata methods in TransformationExtensions
duplicate the same URL-building and metadata assignment logic, differing only in
whether they write to Source* or Target* fields. Refactor this by extracting a
shared private helper (for example, around BuildUrls and the common
SystemReference population) and have both public extension methods delegate to
it, using the appropriate SourceSystemReference or TargetSystemReference and
SourceLanguage or TargetLanguage.
🤖 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 `@Apps.GitLab/Actions/CommitActions.cs`:
- Line 260: `CommitFile`, `CheckFileExists`, `PushChanges`, and `GetFileInfo`
are using different path normalization rules, so a leading or trailing slash can
make the existence check and the actual file operations target different
resources. Normalize `input.DestinationFilePath` once in `CommitFile` using the
same trimming/escaping behavior as `CheckFileExists`, then reuse that normalized
value for both `RestClient.PushChanges` and `RestClient.GetFileInfo` so all
calls resolve the same path.
- Around line 208-210: The branch fallback in CommitActions should handle blank
or whitespace input, not just null. Update the branch selection logic in the
CommitActions flow so branchRequest.Name falls back to repository.DefaultBranch
when it is null, empty, or whitespace, and apply the same
string.IsNullOrWhiteSpace-based fallback in UpdateFile and
RepositoryActions.GetFile for consistency. Use the existing
branch/default-branch handling around repository.DefaultBranch and
branchRequest.Name to locate and update the affected assignments.

In `@Apps.GitLab/Extensions/TransformationExtensions.cs`:
- Line 21: The SourceLanguage derivation in TransformationExtensions is too
naive because fileName.Split('.')[0] uses the first token and breaks for
multi-dot names like messages.en.json or non-language files. Update the
transformation logic to use a safer language-token parser or require an explicit
language code input before assigning SourceLanguage and TargetLanguage, and keep
the fix localized around the code path that sets t.SourceLanguage.

In `@Apps.GitLab/Utils/File/FileHelper.cs`:
- Around line 14-25: The FileHelper content-loading path currently calls
Convert.FromBase64String(downloadedFile.Content) directly, which can throw a raw
FormatException and bypass the plugin’s required error handling. Update the
logic around the transformation setup in FileHelper to catch malformed base64
input and rethrow it using PluginApplicationException (or
PluginMisconfigurationException if that better matches the failure), preserving
the filename/context from downloadedFile.Path and the Transformation.Load flow.

---

Nitpick comments:
In `@Apps.GitLab/Actions/RepositoryActions.cs`:
- Line 46: The action display name on RepositoryActions.Action was renamed to
“Download file”, so update README.md’s Actions section to match the new
attribute value and ensure any mention of the old “Get repository file” name is
replaced. Check the action entry that corresponds to the [Action] attribute in
RepositoryActions so the docs stay synchronized with the code.

In `@Apps.GitLab/Extensions/TransformationExtensions.cs`:
- Line 3: The namespace declaration in TransformationExtensions should be
aligned with the rest of the codebase casing, as Apps.Gitlab.Extensions is
inconsistent with the existing Apps.GitLab.* pattern. Update the namespace on
the TransformationExtensions type to use the same GitLab capitalization as other
namespaces so the codebase remains consistent and easier to navigate.
- Around line 13-45: The AddSourceMetadata and AddTargetMetadata methods in
TransformationExtensions duplicate the same URL-building and metadata assignment
logic, differing only in whether they write to Source* or Target* fields.
Refactor this by extracting a shared private helper (for example, around
BuildUrls and the common SystemReference population) and have both public
extension methods delegate to it, using the appropriate SourceSystemReference or
TargetSystemReference and SourceLanguage or TargetLanguage.
🪄 Autofix (Beta)

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: d4f59d60-232e-49e6-abef-ee2ed1ffbe49

📥 Commits

Reviewing files that changed from the base of the PR and between 741b970 and c04308a.

📒 Files selected for processing (14)
  • Apps.GitLab/Actions/CommitActions.cs
  • Apps.GitLab/Actions/RepositoryActions.cs
  • Apps.GitLab/Apps.GitLab.csproj
  • Apps.GitLab/BlackbirdGitLabClient.cs
  • Apps.GitLab/Extensions/TransformationExtensions.cs
  • Apps.GitLab/Models/Commit/Responses/UploadFileResponse.cs
  • Apps.GitLab/Models/Respository/Responses/RepositoryFileResponse.cs
  • Apps.GitLab/Utils/File/DownloadedFile.cs
  • Apps.GitLab/Utils/File/FileHelper.cs
  • Apps.GitLab/Utils/File/ProcessedDownloadedFile.cs
  • Apps.GitLab/Utils/File/ProcessedUploadedFile.cs
  • Apps.GitLab/Utils/File/UploadedFile.cs
  • README.md
  • Tests.GitLab/RepositoryActionTests.cs

Comment thread Apps.GitLab/Actions/CommitActions.cs
Comment thread Apps.GitLab/Actions/CommitActions.cs Outdated
Comment thread Apps.GitLab/Extensions/TransformationExtensions.cs Outdated
Comment thread Apps.GitLab/Utils/File/FileHelper.cs
@Fesenko-A Fesenko-A requested a review from RiabushenkoA July 3, 2026 14:31
Comment thread Apps.GitLab/Extensions/TransformationExtensions.cs Outdated
Comment thread Apps.GitLab/Utils/File/FileHelper.cs Outdated
@Fesenko-A Fesenko-A requested a review from mathijs-bb July 7, 2026 07:38
@Fesenko-A Fesenko-A merged commit a3659f4 into main Jul 9, 2026
2 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.

3 participants