Updated Magic Net package and Account report APIs#4293
Conversation
WalkthroughUpdated ImageMagick package references to 14.8.2 in three projects, adapted ImageMagick Compare calls to the new overload returning an IMagickImage and out percentage, and changed AccountReport API route constants to HtmlReport with a volatile _isRunSetDataSent flag gating subsequent send operations. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant ApiHandler as AccountReportApiHandler
participant HtmlReport as HtmlReport API
rect rgba(220,240,255,0.5)
note over Caller,ApiHandler: Retrieval paths moved to HtmlReport endpoints
Caller->>ApiHandler: Request validation / execution data
ApiHandler->>HtmlReport: GET /api/HtmlReport/...
HtmlReport-->>ApiHandler: 200 / error
ApiHandler-->>Caller: Response
end
sequenceDiagram
autonumber
participant Sender
participant Handler as AccountReportApiHandler
participant Central as Central DB/API
rect rgba(240,230,220,0.45)
note over Sender,Handler: RunSet send gated by _isRunSetDataSent
Sender->>Handler: Send RunSet (publish start / update)
alt publish start (non-update)
Handler->>Handler: _isRunSetDataSent = true
else update
Handler->>Handler: if _isRunSetDataSent == false -> return
end
Handler->>Central: POST runset data
Central-->>Handler: success / failure
Handler->>Handler: set _isRunSetDataSent true/false accordingly
end
sequenceDiagram
autonumber
participant Caller
participant Magick as Magick.NET
participant Processor
Caller->>Magick: Compare(base, target, metric, Channels, out pct)
Magick-->>Caller: returns diffImage (IMagickImage) + out pct
Caller->>Processor: Convert diffImage -> bytes/bitmap, compute pct*100 and round
Processor-->>Caller: Save diff file, return comparison result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2025-09-05T10:50:57.651ZApplied to files:
📚 Learning: 2025-09-05T10:53:38.131ZApplied to files:
🧬 Code graph analysis (1)Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (1)
🔇 Additional comments (7)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (2)
273-299: Validation should fail closed: don’t return true on request failure.Current logic returns true when the call errors, which could allow invalid execution IDs.
Use strict parse and fail closed:
- RestResponse response = restClient.Execute(restRequest); - if (response.IsSuccessful) - { - Reporter.ToLog(eLogLevel.DEBUG, $"Successfully validated execution id {message}"); - return Convert.ToBoolean(response.Content); - } - else - { - Reporter.ToLog(eLogLevel.ERROR, $"Failed to validate {message} Response: {response.Content}"); - } + RestResponse response = restClient.Execute(restRequest); + if (response.IsSuccessful && bool.TryParse(response.Content, out var isValid)) + { + Reporter.ToLog(eLogLevel.DEBUG, $"Successfully validated execution id {message}"); + return isValid; + } + Reporter.ToLog(eLogLevel.ERROR, $"Failed to validate {message} Response: {response.Content}"); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Exception while validating execution id {message}", ex); } - return true; + return false;
65-71: TLS disabled: RemoteCertificateValidationCallback always returns true.This bypasses HTTPS validation and is a security risk. Only allow in dev via config or remove override.
Example hardening:
- RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true, + // Use default validation; if you must allow insecure for dev, gate it behind a config flag. + // RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => sslPolicyErrors == System.Net.Security.SslPolicyErrors.None,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
Ginger/Ginger/Ginger.csproj(1 hunks)Ginger/GingerCoreNET/GingerCoreNET.csproj(1 hunks)Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs(1 hunks)Ginger/GingerTest/GingerTest.csproj(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-25T08:48:11.915Z
Learnt from: AmanPrasad43
PR: Ginger-Automation/Ginger#4281
File: Ginger/GingerCore/GingerCore.csproj:538-538
Timestamp: 2025-08-25T08:48:11.915Z
Learning: In the Ginger codebase, the OWASPZAPDotNetAPI package reference in GingerCore.csproj is required for architectural reasons, even when direct usage is not immediately visible in the codebase. This was confirmed by AmanPrasad43 during the security testing feature implementation.
Applied to files:
Ginger/GingerTest/GingerTest.csproj
🔇 Additional comments (4)
Ginger/Ginger/Ginger.csproj (1)
740-740: Magick.NET upgraded to 14.8.2 – confirm CI tests on both platforms
- Verified no csproj still references 13.x (all three projects now use 14.8.2).
- Run/confirm smoke tests on Windows and Linux runners to ensure native dependencies and APIs function as expected.
Ginger/GingerCoreNET/GingerCoreNET.csproj (1)
296-296: Magick.NET version alignment confirmed; run smoke tests.
No csproj references to 13.x remain—every project now uses 14.8.2. Please execute image-processing smoke tests to validate the upgrade.Ginger/GingerTest/GingerTest.csproj (1)
23-23: Run tests to confirm compatibility with Magick.NET-Q16-AnyCPU 14.8.2
Replace the echo in the verification script with actual execution, for example:fd -a GingerTest.csproj | xargs -I{} dotnet test "{}" -c Release --nologoEnsure the tests pass locally and on CI.
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (1)
50-55: Confirm backend routing parity between HtmlReport GET and AccountReport POST/PUT.All GET calls now point to api/HtmlReport (AccountReportApiHandler.cs lines 50–55); no api/AccountReport GET references remain. Verify the server exposes these HtmlReport GET routes and returns identical models to the existing AccountReport POST/PUT endpoints.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/MagickAnalyzer.cs (2)
42-56: Dispose MagickImage/diff and avoid use-after-dispose on Bitmap.
- MagickImage and the IMagickImage returned from Compare are IDisposable; not disposing them leaks native memory.
- Inside the using block, ImgToSave is disposed, yet you assign and pass it (mAct.CompareResult, AddScreenShot). That creates a disposed reference risk.
Apply the refactor below to scope-dispose Magick images/diff and hand off live Bitmap instances to mAct:
- MagickImage magickBaseImg = new MagickImage(General.ImageToByteArray(mAct.baseImage, System.Drawing.Imaging.ImageFormat.Bmp));//Not tested after code change - MagickImage magickTargetImg = new MagickImage(General.ImageToByteArray(mAct.targetImage, System.Drawing.Imaging.ImageFormat.Bmp));//Not tested after code change - - double percentageDifference; + using (var magickBaseImg = new MagickImage(General.ImageToByteArray(mAct.baseImage, System.Drawing.Imaging.ImageFormat.Bmp))) // Not tested after code change + using (var magickTargetImg = new MagickImage(General.ImageToByteArray(mAct.targetImage, System.Drawing.Imaging.ImageFormat.Bmp))) // Not tested after code change + { + double percentageDifference; - ErrorMetric eErrorMetric = ErrorMetric.Fuzz; - Enum.TryParse<ErrorMetric>(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ErrorMetric).Value, out eErrorMetric); - IMagickImage diffImg = magickBaseImg.Compare(magickTargetImg, eErrorMetric, Channels.Red, out percentageDifference); - percentageDifference = percentageDifference * 100; - percentageDifference = Math.Round(percentageDifference, 2); + ErrorMetric eErrorMetric = ErrorMetric.Fuzz; + Enum.TryParse<ErrorMetric>(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ErrorMetric).Value, true, out eErrorMetric); + using (IMagickImage diffImg = magickBaseImg.Compare(magickTargetImg, eErrorMetric, Channels.Red, out percentageDifference)) + { + percentageDifference = Math.Round(percentageDifference * 100, 2); - TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap)); - using (Bitmap ImgToSave = (Bitmap)tc.ConvertFrom(diffImg.ToByteArray())) - { - mAct.CompareResult = ImgToSave;//Not tested after code change - - mAct.AddOrUpdateReturnParamActual("Percentage Difference", percentageDifference + ""); - - mAct.AddScreenShot(ImgToSave, "Compare Result"); - } + TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap)); + using (Bitmap imgToSave = (Bitmap)tc.ConvertFrom(diffImg.ToByteArray(MagickFormat.Png))) + { + // Hand off owned clones to mAct; keep local disposed. + mAct.CompareResult = (Bitmap)imgToSave.Clone(); // Not tested after code change + mAct.AddOrUpdateReturnParamActual("Percentage Difference", percentageDifference.ToString(System.Globalization.CultureInfo.InvariantCulture)); + mAct.AddScreenShot((Bitmap)imgToSave.Clone(), "Compare Result"); + } + } + }
55-62: Persist a live Bitmap; don’t assign a disposed instance.If CompareResult or AddScreenShot retain the reference, the current using block disposes it prematurely.
Covered by the refactor above (clone before leaving the using block).
Ginger/GingerTest/GeneralLib/VisualCompare.cs (3)
107-121: Dispose MagickImage/diff and the Bitmap; specify a stable output format.Avoid native leaks and ensure converter recognizes bytes by specifying MagickFormat.
- MagickImage magickBaseImg = new MagickImage(BaseImageFileName); - MagickImage magickTargetImg = new MagickImage(TargetImageFileName); + using (var magickBaseImg = new MagickImage(BaseImageFileName)) + using (var magickTargetImg = new MagickImage(TargetImageFileName)) + { - double percentageDifference; + double percentageDifference; ErrorMetric EM = ErrorMetric.Fuzz; // Fuzz !? - IMagickImage diffImg = magickBaseImg.Compare(magickTargetImg, EM, Channels.Red, out percentageDifference); - percentageDifference = percentageDifference * 100; - percentageDifference = Math.Round(percentageDifference, 2); + using (IMagickImage diffImg = magickBaseImg.Compare(magickTargetImg, EM, Channels.Red, out percentageDifference)) + { + percentageDifference = Math.Round(percentageDifference * 100, 2); - TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap)); - Bitmap ImgToSave = (Bitmap)tc.ConvertFrom(diffImg.ToByteArray()); - ImgToSave.Save(ResultFileName); + TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap)); + using (Bitmap imgToSave = (Bitmap)tc.ConvertFrom(diffImg.ToByteArray(MagickFormat.Png))) + { + imgToSave.Save(ResultFileName); + } + } + }
122-129: Simplify boolean return.Minor readability tweak.
- if (percentageDifference == 0) - { - return true; - } - else - { - return false; - } + return percentageDifference == 0;
72-73: Typo in public method names (“Equel”). Consider adding correctly named wrappers.Leaving old methods for back-compat; add new IsVisualEqual/IsBitmapEqual and mark old as [Obsolete].
I can draft the wrappers if you want this in the same PR.
Also applies to: 105-106
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/MagickAnalyzer.cs(1 hunks)Ginger/GingerTest/GeneralLib/VisualCompare.cs(1 hunks)
🔇 Additional comments (1)
Ginger/GingerTest/GeneralLib/VisualCompare.cs (1)
114-116: Channel selection sanity-check.Using Channels.Red restricts comparison to the red channel. If unintended, switch to Channels.Composite/All or make it configurable.
Would you like me to parameterize the channel selection alongside ErrorMetric?
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (1)
281-306: ExecutionIdValidation returns true on error paths — this defeats validationOn network error or non-success HTTP status, the method logs an error but returns
true. That can allow invalid executions to pass checks and cascade failures later.Apply:
@@ public bool ExecutionIdValidation(Guid executionId) - try + try { RestResponse response = restClient.Execute(restRequest); if (response.IsSuccessful) { Reporter.ToLog(eLogLevel.DEBUG, $"Successfully validated execution id {message}"); return Convert.ToBoolean(response.Content); } else { Reporter.ToLog(eLogLevel.ERROR, $"Failed to validate {message} Response: {response.Content}"); - } + return false; + } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Exception while validating execution id {message}", ex); - } - return true; + return false; + }
♻️ Duplicate comments (1)
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (1)
50-54: Normalize HtmlReport GET endpoints; remove leading slash to avoid base-URL resetAll new GET constants look good, but
GET_ACCOUNT_HTML_REPORTstarts with “/” while others don’t. With RestSharp, a leading “/” can discard any base-path segment in the client’s BaseUrl, yielding wrong URLs. Align it with the others.Apply:
- private const string GET_ACCOUNT_HTML_REPORT = "/api/HtmlReport/GetAccountHtmlReport/"; + private const string GET_ACCOUNT_HTML_REPORT = "api/HtmlReport/GetAccountHtmlReport/";Verification (optional):
#!/bin/bash # 1) Check for any remaining endpoint constants starting with a leading slash rg -nP '^\s*private\s+const\s+string\s+\w+\s*=\s*"/api/' --type cs # 2) Find any hard-coded "/api/HtmlReport" usages that may still bypass the base path rg -nP '"/api/HtmlReport' --type cs
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs(12 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (1)
Ginger/GingerCoreCommon/ReporterLib/Reporter.cs (1)
Reporter(28-357)
🔇 Additional comments (1)
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (1)
320-331: No fallback needed—GingerCoreNET.csproj uses<LangVersion>previewso collection expressions ([]) are supportedLikely an incorrect or invalid review comment.
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/MagickAnalyzer.cs (2)
42-63: Dispose Magick.NET images and avoid assigning a disposed Bitmap (plus safer parsing and culture-stable output).Unmanaged resources are leaked (
MagickImage/IMagickImagenot disposed). Also,mAct.CompareResultis set to a Bitmap that is disposed at the end of theusingblock, risking later ObjectDisposedException. Patch also trims/null-guards enum parsing and emits the percentage using invariant culture.Apply this diff:
- MagickImage magickBaseImg = new MagickImage(General.ImageToByteArray(mAct.baseImage, System.Drawing.Imaging.ImageFormat.Bmp));//Not tested after code change - MagickImage magickTargetImg = new MagickImage(General.ImageToByteArray(mAct.targetImage, System.Drawing.Imaging.ImageFormat.Bmp));//Not tested after code change - - double percentageDifference; - - ErrorMetric eErrorMetric = ErrorMetric.Fuzz; - Enum.TryParse<ErrorMetric>(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ErrorMetric).Value, true, out eErrorMetric); - - IMagickImage diffImg = magickBaseImg.Compare(magickTargetImg, eErrorMetric, Channels.Red, out percentageDifference); - percentageDifference = percentageDifference * 100; - percentageDifference = Math.Round(percentageDifference, 2); - - TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap)); - using (Bitmap ImgToSave = (Bitmap)tc.ConvertFrom(diffImg.ToByteArray())) - { - mAct.CompareResult = ImgToSave;//Not tested after code change - - mAct.AddOrUpdateReturnParamActual("Percentage Difference", percentageDifference + ""); - - mAct.AddScreenShot(ImgToSave, "Compare Result"); - } + using (MagickImage magickBaseImg = new MagickImage(General.ImageToByteArray(mAct.baseImage, System.Drawing.Imaging.ImageFormat.Bmp))) + using (MagickImage magickTargetImg = new MagickImage(General.ImageToByteArray(mAct.targetImage, System.Drawing.Imaging.ImageFormat.Bmp))) + { + double percentageDifference; + ErrorMetric eErrorMetric = ErrorMetric.Fuzz; + Enum.TryParse<ErrorMetric>(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ErrorMetric).Value?.Trim() ?? string.Empty, true, out eErrorMetric); + + using (IMagickImage diffImg = magickBaseImg.Compare(magickTargetImg, eErrorMetric, Channels.Red, out percentageDifference)) + { + // Ensure a decoder-friendly format for GDI+ + diffImg.Format = MagickFormat.Png; + + percentageDifference = Math.Round(percentageDifference * 100, 2); + + TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap)); + using (Bitmap resultBmp = (Bitmap)tc.ConvertFrom(diffImg.ToByteArray())) + { + // Keep an owned copy beyond this scope + mAct.CompareResult = (Bitmap)resultBmp.Clone(); + mAct.AddOrUpdateReturnParamActual("Percentage Difference", percentageDifference.ToString(System.Globalization.CultureInfo.InvariantCulture)); + mAct.AddScreenShot(resultBmp, "Compare Result"); + } + } + }
19-24: Add missing import for CultureInfo.Required by the invariant ToString used in the diff above.
using ImageMagick; using System; +using System.Globalization; using System.ComponentModel; using System.Drawing;Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (2)
326-336: Avoid C# 12 collection expressions unless LangVersion ≥ 12.Use explicit List for broader compatibility.
Apply:
- List<string> temp = []; + var temp = new List<string>(); ... - temp = []; + temp = new List<string>();
401-413: Avoid C# 12 collection expressions unless LangVersion ≥ 12.Use explicit List for compatibility.
Apply:
- List<ArtifactDetails> temp = []; + var temp = new List<ArtifactDetails>(); ... - temp = []; + temp = new List<ArtifactDetails>();
♻️ Duplicate comments (14)
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/MagickAnalyzer.cs (2)
50-62: Add tests for the new Compare overload flow.At least 1 identical-images case (0%), 1 non-identical (>0%), and assert that the returned diff image is valid/usable.
I can add unit tests under GingerCoreNET covering these cases if you want.
48-49: Trim/null-guard ErrorMetric parsing.Prevents silent fallback on whitespace or null inputs.
- Enum.TryParse<ErrorMetric>(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ErrorMetric).Value, true, out eErrorMetric); + Enum.TryParse<ErrorMetric>(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ErrorMetric).Value?.Trim() ?? string.Empty, true, out eErrorMetric);Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (12)
174-194: Log when publish is skipped due to closed gate.Downstream methods no-op silently; add skip log.
Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping Runner publish for '{accountReportRunner?.Name}': restClient null or RunSet not sent."); + }
198-210: Add skip log for BusinessFlow send.Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping Business Flow publish for '{accountReportBusinessFlow?.Name}': restClient null or RunSet not sent."); + }
215-235: Add skip log for ActivityGroup send.Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping Activity Group publish for '{accountReportActivityGroup?.Name}': restClient null or RunSet not sent."); + }
240-259: Add skip log for Activity send.Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping Activity publish for '{accountReportActivity?.Name}': restClient null or RunSet not sent."); + }
264-283: Add skip log for Action send.Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping Action publish for '{accountReportAction?.Name}': restClient null or RunSet not sent."); + }
316-352: Add skip log for screenshots send.Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping screenshots upload for Execution Id '{executionId}': restClient null or RunSet not sent."); + }
357-387: Add skip log for UploadImageAsync.Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping screenshot upload for Execution Id '{executionId}': restClient null or RunSet not sent."); + }
391-434: Add skip log for artifacts send.Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping artifacts upload for Execution Id '{executionId}': restClient null or RunSet not sent."); + }
439-469: Add skip log for UploadArtifactsAsync.Apply:
- if (restClient != null && _isRunSetDataSent) + if (restClient != null && _isRunSetDataSent) { ... } + else + { + Reporter.ToLog(eLogLevel.INFO, $"Skipping artifact upload for Execution Id '{executionId}': restClient null or RunSet not sent."); + }
50-54: Normalize GET_ACCOUNT_HTML_REPORT (remove leading slash).One constant still has a leading “/” unlike the others; this can break base-URL joins.
Apply:
- private const string GET_ACCOUNT_HTML_REPORT = "/api/HtmlReport/GetAccountHtmlReport/"; + private const string GET_ACCOUNT_HTML_REPORT = "api/HtmlReport/GetAccountHtmlReport/";
127-127: Don’t open the gate at publish start.Set false at start; only set true after success.
Apply:
- _isRunSetDataSent = true; //Resetting the flag again + _isRunSetDataSent = false; // reset; open only after success
131-136: Emit explicit log before returning when update is blocked.Helps triage why finish-update didn’t run.
Apply:
- if (!_isRunSetDataSent) + if (!_isRunSetDataSent) { - // If this is an update and the RunSet was not previously sent successfully, - // do not allow finishing update. + // If this is an update and the RunSet was not previously sent successfully, do not allow finishing update. + Reporter.ToLog(eLogLevel.INFO, $"Skipping RunSet update for '{accountReportRunSet?.Name}' because initial RunSet publish has not succeeded yet."); return false; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/MagickAnalyzer.cs(1 hunks)Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs(13 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-14T09:40:41.306Z
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4226
File: Ginger/GingerCoreCommon/Functionalities/FindAndReplaceUtils.cs:457-461
Timestamp: 2025-06-14T09:40:41.306Z
Learning: In the ReplaceItemEnhanced method in FindAndReplaceUtils.cs, the Enum.TryParse call is intentionally case-sensitive (without the ignoreCase parameter), which is the expected behavior as confirmed by the user.
Applied to files:
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/MagickAnalyzer.cs
📚 Learning: 2025-08-29T09:35:46.020Z
Learnt from: AmanPrasad43
PR: Ginger-Automation/Ginger#4286
File: Ginger/GingerCoreNET/External/ZAP/ZapProxyService.cs:287-309
Timestamp: 2025-08-29T09:35:46.020Z
Learning: In Ginger ZAP security testing, alert names should preserve their original formatting with spaces and hyphens. When comparing alert names in EvaluateScanResultAPI and similar methods, use StringComparison.OrdinalIgnoreCase for case-insensitive matching but do not normalize by removing spaces or hyphens, as alert names like "False Positive" need to remain as separate words. Confirmed by AmanPrasad43 in PR #4286.
Applied to files:
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/MagickAnalyzer.cs
🧬 Code graph analysis (2)
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/MagickAnalyzer.cs (1)
Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/ActVisualTesting.cs (1)
ActVisualTesting(36-635)
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (1)
Ginger/GingerCoreCommon/ReporterLib/Reporter.cs (1)
Reporter(28-357)
🔇 Additional comments (2)
Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportApiHandler.cs (2)
151-161: LGTM: gate transitions only on actual result.Setting true on success and false on failure is correct.
594-606: Confirm path join after constant normalization.Once GET_ACCOUNT_HTML_REPORT is normalized (no leading “/”), this usage remains correct.
Thank you for your contribution.
Before submitting this PR, please make sure:
Summary by CodeRabbit
Refactor
Chores
Misc