Skip to content

Enhancement/MultiPOMUpdate_CLI#4188

Merged
Maheshkale447 merged 10 commits into
masterfrom
Enhancement/MultiPOMUpdateFromCLI_GB
Apr 29, 2025
Merged

Enhancement/MultiPOMUpdate_CLI#4188
Maheshkale447 merged 10 commits into
masterfrom
Enhancement/MultiPOMUpdateFromCLI_GB

Conversation

@GokulBothe99

@GokulBothe99 GokulBothe99 commented Apr 25, 2025

Copy link
Copy Markdown
Contributor

Thank you for your contribution.
Before submitting this PR, please make sure:

  • PR description and commit message should describe the changes done in this PR
  • Verify the PR is pointing to correct branch i.e. Release or Beta branch if the code fix is for specific release , else point it to master
  • Latest Code from master or specific release branch is merged to your branch
  • No unwanted\commented\junk code is included
  • No new warning upon build solution
  • Code Summary\Comments are added to my code which explains what my code is doing
  • Existing unit test cases are passed
  • New Unit tests are added for your development
  • Sanity Tests are successfully executed for New and Existing Functionality
  • Verify that changes are compatible with all relevant browsers and platforms.
  • After creating pull request there should not be any conflicts
  • Resolve all Codacy comments
  • Builds and checks are passed before PR is sent for review
  • Resolve code review comments
  • Update the Help Library document to match any feature changes

Summary by CodeRabbit

  • New Features

    • Introduced a new CLI operation to update multiple Page Object Models (POMs) with associated Runsets, including new command-line options for target applications, POMs, and Runsets.
    • Added a "Last Updated" timestamp column to the POM mapping grid for enhanced update tracking.
  • Improvements

    • Refined POM-to-Runset mapping and execution with asynchronous operations for improved performance and UI responsiveness.
    • Increased the wizard window’s default width for better usability.
    • Enhanced filtering and selection logic for POM models in the UI.
    • Improved UI state management during Runset execution with clearer control flow.
  • Bug Fixes

    • Fixed UI refresh and selection handling issues in the POM mapping workflow.
  • Chores

    • Removed unused code and imports to improve maintainability.

@coderabbitai

coderabbitai Bot commented Apr 25, 2025

Copy link
Copy Markdown
Contributor

"""

Walkthrough

This update introduces modularization and asynchronous execution to the logic for mapping Application POM Models to RunSetConfigs and running them, primarily within the POM wizard UI and CLI. The mapping logic is extracted into reusable methods, and RunSet execution is now handled asynchronously, with UI and CLI flows both updated to reflect these changes. Additional CLI options and operations are added for multi-POM updates. The UI grid now displays a "Last Updated" timestamp for each mapping, and the window width for the wizard is slightly increased. Several minor code cleanups and property signature adjustments are also included.

Changes

File(s) Change Summary
.../POMObjectMappingWithRunsetWizardPage.xaml.cs Refactored mapping and selection logic into GetSelectedRunsetList; added async RunSet execution via RunSelectedRunset; changed property and event handler implementations; renamed and enhanced grid refresh logic; added "Last Updated" column; removed redundant code.
.../UpdateMultiplePomConfigWizardPage.xaml.cs Cleaned up unused imports and whitespace; changed POM filtering in selection logic to use TargetApplicationKey.Guid; reset all POMs' Selected property after filtering.
.../WizardWindow.xaml Increased window width from 900 to 950 units.
.../RunSetConfig.cs Reformatted AutoUpdatedPOMList property to use multi-line auto-implemented property syntax.
.../MultiPomRunSetMapping.cs Added public property LastUpdatedTime for storing last update timestamp.
.../GeneralLib/General.cs Added methods for mapping POMs to RunSets (GetSelectedRunsetList), running selected RunSets asynchronously (RunSelectedRunset), loading RunSet configs, and executing RunSets; supports new multi-POM update flows.
.../CLILib/CLIHelper.cs Modified solution download logic to run synchronously in CLI run mode, otherwise asynchronously.
.../CLILib/DoOptions.cs Added MultiPOMUpdate operation to enum; added CLI options for target application, application models, and runsets.
.../CLILib/DoOptionsHanlder.cs Added handling for MultiPOMUpdate CLI operation; implemented methods to process multi-POM update, map POMs to RunSets, and run them asynchronously with status logging and error handling.
.../CLILib/RunOptions.cs Added two trailing blank lines after SourceApplicationUser property (no functional change).

Sequence Diagram(s)

sequenceDiagram
    participant User/UI
    participant POMWizardPage
    participant General
    participant CLI
    participant RunsetExecutor

    User/UI->>POMWizardPage: Select POMs and trigger RunSet execution
    POMWizardPage->>General: GetSelectedRunsetList(...)
    General-->>POMWizardPage: List<MultiPomRunSetMapping>
    User/UI->>POMWizardPage: Click "Run" for a mapping
    POMWizardPage->>General: RunSelectedRunset(mapping, ...)
    General->>RunsetExecutor: LoadRunsetConfigToRunsetExecutor(...)
    General->>RunsetExecutor: ExecuteRunSet()
    RunsetExecutor-->>General: Run completes
    General-->>POMWizardPage: Update statuses and refresh grid
Loading
sequenceDiagram
    participant CLI
    participant DoOptionsHandler
    participant General
    participant RunsetExecutor

    CLI->>DoOptionsHandler: Run with MultiPOMUpdate
    DoOptionsHandler->>General: GetSelectedRunsetList(...)
    General-->>DoOptionsHandler: List<MultiPomRunSetMapping>
    loop For each mapping
        DoOptionsHandler->>General: RunSelectedRunset(mapping, ...)
        General->>RunsetExecutor: LoadRunsetConfigToRunsetExecutor(...)
        General->>RunsetExecutor: ExecuteRunSet()
        RunsetExecutor-->>General: Run completes
        General-->>DoOptionsHandler: Update statuses
    end
    DoOptionsHandler-->>CLI: Log combined status
Loading

Possibly related PRs

Suggested reviewers

  • Maheshkale447

Poem

In the warren of code where the POMs all reside,
New mapping and running now hop side by side.
Async the journey, with timestamps in tow,
RunSets leap forward, their statuses aglow.
CLI and UI, both join in the fun—
A wizardly update, and now it’s all run!
🐇✨
"""

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@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: 13

🔭 Outside diff range comments (1)
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/UpdateMultiplePomConfigWizardPage.xaml.cs (1)

43-44: ⚠️ Potential issue

Possible compilation issue – C# 12 collection-expression used implicitly

PomSupportedPlatformsForMultiPOM = [ePlatformType.Web, ePlatformType.Mobile]; relies on the new collection-expression feature introduced in C# 12/.NET 8.
If the project is still compiled with an older language version/SDK (which is the default for most existing Ginger solutions), the build will fail with [] not being recognized.

-public static readonly List<ePlatformType> PomSupportedPlatformsForMultiPOM = [ePlatformType.Web, ePlatformType.Mobile];
+public static readonly List<ePlatformType> PomSupportedPlatformsForMultiPOM =
+    new() { ePlatformType.Web, ePlatformType.Mobile };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2889e5f and 876f5b6.

📒 Files selected for processing (10)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (7 hunks)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/UpdateMultiplePomConfigWizardPage.xaml.cs (3 hunks)
  • Ginger/Ginger/WizardLib/WizardWindow.xaml (1 hunks)
  • Ginger/GingerCoreCommon/Run/RunSetConfig.cs (1 hunks)
  • Ginger/GingerCoreNET/Application Models/Delta/PomDelta/MultiPomRunSetMapping.cs (1 hunks)
  • Ginger/GingerCoreNET/GeneralLib/General.cs (2 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs (1 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs (2 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (4 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/RunOptions.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
Ginger/GingerCoreCommon/Run/RunSetConfig.cs (1)
Learnt from: prashelke
PR: Ginger-Automation/Ginger#4150
File: Ginger/GingerCoreNET/Application Models/Delta/PomDelta/MultiPomRunSetMapping.cs:28-28
Timestamp: 2025-04-01T06:48:16.412Z
Learning: The property in MultiPomRunSetMapping class was renamed from 'runSetConfig' to 'RunSetConfig' to follow C# PascalCase naming conventions for public properties.
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (2)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:30.816Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:33.780Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Ginger/GingerCoreNET/GeneralLib/General.cs (2)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:33.780Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:30.816Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
🧬 Code Graph Analysis (1)
Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (4)
Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (1)
  • WorkSpace (61-1019)
Ginger/GingerCoreCommon/ReporterLib/Reporter.cs (1)
  • Reporter (28-357)
Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs (5)
  • AddCLIGitProperties (241-251)
  • SetWorkSpaceGitProperties (258-273)
  • SetEncryptionKey (774-777)
  • PasswordEncrypted (779-798)
  • Guid (389-394)
Ginger/GingerCoreNET/GeneralLib/General.cs (6)
  • List (58-66)
  • List (185-247)
  • General (54-1164)
  • ObservableList (312-317)
  • ObservableList (791-822)
  • ObservableList (943-1024)
🔇 Additional comments (7)
Ginger/GingerCoreNET/RunLib/CLILib/RunOptions.cs (1)

99-100: Style formatting change with no functional impact.

The addition of trailing blank lines after property declaration is a minor formatting change that doesn't affect functionality.

Ginger/Ginger/WizardLib/WizardWindow.xaml (1)

9-9: Window width increase accommodates new UI elements.

The window width has been increased from 900 to 950 units, which likely provides more space for the additional UI elements introduced in the multi-POM update workflow, such as the "Last Updated" column.

Ginger/GingerCoreNET/Application Models/Delta/PomDelta/MultiPomRunSetMapping.cs (1)

50-50: Enhances tracking with timestamp for POM updates.

The new LastUpdatedTime property enables tracking when each mapping was last updated, improving visibility and transparency in the multi-POM update workflow. This is a good addition that helps users understand the recency of changes.

Ginger/GingerCoreCommon/Run/RunSetConfig.cs (1)

524-526: Code style improvement without functional change.

Reformatting the AutoUpdatedPOMList property from a single-line to a multi-line format with explicit accessors improves code readability while maintaining the same functionality.

Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs (1)

629-638: Improved solution download handling based on CLI mode.

The change adds conditional execution of solution download based on the CLI mode, using synchronous execution for "run" mode and asynchronous for others. This enhances the multi-POM update workflow in CLI operations.

However, be cautious about using synchronous operations if this method could be called from a UI context, as it might cause responsiveness issues.

Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (1)

542-557: Platform hard-coded to Web – mobile POMs silently ignored

Where(x => WorkSpace.Instance.Solution.GetTargetApplicationPlatform(x.TargetApplicationKey) == ePlatformType.Web)
conflicts with the earlier constant PomSupportedPlatformsForMultiPOM which explicitly allows Web and Mobile.
If the intention is to support both, expand the predicate accordingly.

-.Where(x => WorkSpace.Instance.Solution.GetTargetApplicationPlatform(x.TargetApplicationKey) == ePlatformType.Web)
+.Where(x =>
+{
+    var platform = WorkSpace.Instance.Solution.GetTargetApplicationPlatform(x.TargetApplicationKey);
+    return platform == ePlatformType.Web || platform == ePlatformType.Mobile;
+})
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (1)

214-216: ⚠️ Potential issue

DateTime.ParseExact will throw for non-en-US cultures or different formats

LastUpdate is parsed using the hard-coded pattern "M/d/yyyy h:mm:ss tt".
If the repository header was saved under a different culture (e.g., 31/12/2025 13:45:00), this raises FormatException, breaking the entire grid refresh.

Recommendation:

- pom.LastUpdatedTime = DateTime.ParseExact(... , CultureInfo.InvariantCulture)
-                        .ToString("yyyy-MM-dd HH:mm:ss");
+ if (DateTime.TryParse(pom.ApplicationAPIModel.RepositoryItemHeader.LastUpdate.ToString(),
+                       CultureInfo.InvariantCulture,
+                       DateTimeStyles.None, out var ts))
+ {
+     pom.LastUpdatedTime = ts.ToString("yyyy-MM-dd HH:mm:ss");
+ }
+ else
+ {
+     pom.LastUpdatedTime = "<Unknown>";
+ }

Failing gracefully keeps the UI responsive.

⛔ Skipped due to learnings
Learnt from: Maheshkale447
PR: Ginger-Automation/Ginger#3637
File: Ginger/GingerCoreNET/Application Models/Execution/POM/POMExecutionUtils.cs:226-234
Timestamp: 2024-07-26T22:04:12.930Z
Learning: The `LastUpdatedTime` in the `POMExecutionUtils.cs` file of the Ginger project is always in the correct DateTime format, as confirmed by the user. This information is crucial for avoiding unnecessary error handling suggestions in future reviews.

Comment thread Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs
Comment thread Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs Outdated
Comment thread Ginger/GingerCoreNET/GeneralLib/General.cs
Comment thread Ginger/GingerCoreNET/GeneralLib/General.cs
Comment thread Ginger/GingerCoreNET/GeneralLib/General.cs
coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 25, 2025

@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: 3

🔭 Outside diff range comments (2)
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/UpdateMultiplePomConfigWizardPage.xaml.cs (1)

43-44: 🧹 Nitpick (assertive)

C# 12 list-literal may break builds on older toolchains

[ePlatformType.Web, ePlatformType.Mobile] requires C# 12.
If the rest of the solution still targets an earlier language version, the build will fail. To stay compatible, replace the list literal with an explicit constructor:

-public static readonly List<ePlatformType> PomSupportedPlatformsForMultiPOM = [ePlatformType.Web, ePlatformType.Mobile];
+public static readonly List<ePlatformType> PomSupportedPlatformsForMultiPOM =
+    new List<ePlatformType> { ePlatformType.Web, ePlatformType.Mobile };
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (1)

190-196: 🛠️ Refactor suggestion

RunSetComboBox_SelectionChanged may update the wrong row

The handler relies on the field-level variable mSelectedPomWithRunset, which is set only when a Run button is clicked. If a user changes the combo box on a different row first, the wrong mapping gets updated.

Bind directly to the combo’s DataContext:

-private void RunSetComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-{
-    if (mSelectedPomWithRunset != null)
-    {
-        mSelectedPomWithRunset.SelectedRunset = ((RunSetConfig)((ComboBox)sender).SelectedItem);
-        mSelectedPomWithRunset.RunsetName = ((RunSetConfig)((ComboBox)sender).SelectedItem).Name;
-    }
-}
+private void RunSetComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+{
+    if (sender is ComboBox cb && cb.DataContext is MultiPomRunSetMapping row && cb.SelectedItem is RunSetConfig rsc)
+    {
+        row.SelectedRunset = rsc;
+        row.RunsetName    = rsc.Name;
+    }
+}

This always updates the intended row and removes the hidden coupling.

♻️ Duplicate comments (6)
Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs (1)

98-118: Validate new CLI flags to prevent ambiguous usage

Validate() still checks only solution vs. useTempSolutionFolder.
With the newly-added targetApplication, applicationModels, and runSets flags, users can now pass illegal flag combinations (e.g., --applicationModels without --runSets). Extending Validate() exactly as suggested in the previous review avoids confusing runtime errors and gives immediate feedback to CLI users.

Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (2)

557-563: Inefficient string concatenation resurrected – switch back to string.Join

The earlier optimisation (using string.Join) was accepted, but this block re-introduces per-iteration += and leaves a trailing comma.

-var updatePOMNames = string.Empty;
-foreach (var item in multiPomRunSetMappingsList)
-{
-    await GingerCoreNET.GeneralLib.General.RunSelectedRunset(item, multiPomRunSetMappingsList, mCLIHelper);
-    updatePOMNames += $"{item.PomUpdateStatus},";
-}
-if (!string.IsNullOrEmpty(updatePOMNames))
-{
-    Reporter.ToLog(eLogLevel.INFO, $"POM Status: {updatePOMNames}");
-}
+foreach (var item in multiPomRunSetMappingsList)
+{
+    await GingerCoreNET.GeneralLib.General.RunSelectedRunset(item, multiPomRunSetMappingsList, mCLIHelper);
+}
+
+var statuses = multiPomRunSetMappingsList.Select(m => m.PomUpdateStatus);
+Reporter.ToLog(eLogLevel.INFO, $"POM Status: {string.Join(", ", statuses)}");

498-500: ⚠️ Potential issue

Possible NullReferenceException when TargetApplicationKey is missing

model.TargetApplicationKey.Guid is dereferenced without verifying that TargetApplicationKey is not null.
Legacy POMs saved before the Target-Application feature, or corrupt items, will crash the CLI.

-    .Where(model => model.TargetApplicationKey.Guid == targetApp.Guid)
+    .Where(model =>
+        model.TargetApplicationKey != null &&
+        model.TargetApplicationKey.Guid == targetApp.Guid)
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (1)

178-188: 🧹 Nitpick (assertive)

Disable UI while “Run All” is executing

TestAllRunSet fires each runset sequentially but leaves the grid and toolbar enabled. A user can press Run All again or edit the grid while executions are still in progress, causing re-entrancy issues.

Consider the same guard pattern used in TestElementButtonClicked:

+mWizard.ProcessStarted();
+xPomWithRunsetSelectionGrid.DisableGridColoumns();
 // Iterate through each item…
 foreach (MultiPomRunSetMapping item in mWizard.mMultiPomDeltaUtils.MultiPomRunSetMappingList)
 {
     await RunSelectedRunset(item);
 }
+// Re-enable UI
+xPomWithRunsetSelectionGrid.EnableGridColumns();
+mWizard.ProcessEnded();

Alternatively, a simple IsRunningAll flag or disabling the toolbar button would suffice.

Ginger/GingerCoreNET/GeneralLib/General.cs (2)

956-959: Null-check before Split('_') still missing
The locator values are dereferenced without guarding for null/empty, exactly as raised in a previous review. This will crash the whole LINQ query when an activity lacks a value.

Please add the guard, e.g.:

- actUIElement.ElementLocateValue.Split('_')[0] == applicationPOMModel.Guid.ToString()
+ !string.IsNullOrEmpty(actUIElement.ElementLocateValue) &&
+ actUIElement.ElementLocateValue.Split('_')[0] == applicationPOMModel.Guid.ToString()

Do the same for LocateValue.


1127-1150: Nested Task.Run adds needless thread-pool hop

ExecuteRunSet still wraps Execute in Task.Run for the non-CLI path, duplicating asynchronous work and complicating stack traces. Awaiting Execute directly is sufficient because RunRunset is already async.

Refactor as previously suggested to remove the outer Task.Run.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 876f5b6 and 45b81e4.

📒 Files selected for processing (5)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (5 hunks)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/UpdateMultiplePomConfigWizardPage.xaml.cs (3 hunks)
  • Ginger/GingerCoreNET/GeneralLib/General.cs (2 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs (2 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (4 hunks)
🧰 Additional context used
🧠 Learnings (4)
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/UpdateMultiplePomConfigWizardPage.xaml.cs (1)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Ginger/GingerCoreNET/GeneralLib/General.cs (4)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it imports the ObservableList<> class which is used throughout the file.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:33.780Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:30.816Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (3)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:30.816Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:33.780Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (2)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it imports the ObservableList<> class which is used throughout the file.
🔇 Additional comments (1)
Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (1)

542-545: runSetConfigList may contain null entries leading to later NREs

GetRepositoryItemByGuid<RunSetConfig> returns null for unknown GUIDs, but the result is added to the collection without filtering.
Filter out null to avoid surprises downstream:

-    RunsetGuidsList.Select(runsetGuid =>
-        WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid<RunSetConfig>(runsetGuid))
+    RunsetGuidsList
+        .Select(id => WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid<RunSetConfig>(id))
+        .Where(r => r != null)

Comment thread Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs Outdated

@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: 3

♻️ Duplicate comments (1)
Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (1)

526-531: Parsing GUIDs defensively – repeat of earlier feedback

Guid.Parse will throw and terminate the run if any token is malformed.
Use TryParse and skip/log invalid values instead.
(This was raised in a prior review and remains unresolved.)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45b81e4 and b3f5bdd.

📒 Files selected for processing (1)
  • Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (2)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it imports the ObservableList<> class which is used throughout the file.
🔇 Additional comments (1)
Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (1)

427-428: 💡 Verification agent

❓ Verification inconclusive

Persisting GingerCLIMode without restoration may introduce side-effects

WorkSpace.Instance.GingerCLIMode is flipped to run for the duration of the method, but never restored to its previous value.
If the current process continues to serve other CLI operations (or a UI session) after this method completes, the mutated global flag can lead to subtle behaviour changes elsewhere.

+var previousMode = WorkSpace.Instance.GingerCLIMode;
 WorkSpace.Instance.GingerCLIMode = eGingerCLIMode.run;
 ...
 finally
 {
+    WorkSpace.Instance.GingerCLIMode = previousMode;
 }

#!/bin/bash

Inspect context around GingerCLIMode assignment in DoOptionsHanlder.cs

rg -n "GingerCLIMode" -C3 Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs

List all assignments to GingerCLIMode across the codebase

rg -n "GingerCLIMode\s*=" -g '*.cs'


#!/bin/bash

Show 15 lines around the run-mode assignment for full method context

rg -n -C15 "GingerCLIMode = eGingerCLIMode.run" Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs

Check if there's any restoration of GingerCLIMode in that file

rg -n -C15 "GingerCLIMode" Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs


Preserve and restore the original GingerCLIMode to prevent side-effects

The global flag WorkSpace.Instance.GingerCLIMode is set to run but never reset, so subsequent CLI or UI operations may behave unexpectedly. Wrap the assignment in a try…finally and restore the previous value.

Locations to address:

  • Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs around line 427

Suggested change:

-   WorkSpace.Instance.GingerCLIMode = eGingerCLIMode.run;
+   var previousMode = WorkSpace.Instance.GingerCLIMode;
+   try
+   {
+       WorkSpace.Instance.GingerCLIMode = eGingerCLIMode.run;
        string solutionFolder = mOpts.Solution;
        …
-   }
+   }
+   finally
+   {
+       WorkSpace.Instance.GingerCLIMode = previousMode;
+   }

Likely an incorrect or invalid review comment.

Comment thread Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs
Comment thread Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs Outdated
Comment thread Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs Outdated

@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

🔭 Outside diff range comments (1)
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (1)

190-195: ⚠️ Potential issue

Combo-box handler can act on the wrong row

RunSetComboBox_SelectionChanged relies on the field mSelectedPomWithRunset, which is only set when the user previously clicked the “Run” button.
If the user changes the runset in the grid first (a common workflow), mSelectedPomWithRunset will be null, the assignment is skipped, and the new selection is lost.

Use the combo-box DataContext instead:

private void RunSetComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (sender is ComboBox cb && cb.DataContext is MultiPomRunSetMapping row && cb.SelectedItem is RunSetConfig rsc)
    {
        row.SelectedRunset = rsc;
        row.RunsetName     = rsc.Name;
    }
}

This keeps the source row in sync regardless of prior clicks.

♻️ Duplicate comments (2)
Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (2)

484-485: Case-sensitive app-name check will miss matches & hard-codes platform list
This LINQ predicate repeats an earlier issue: it compares AppName with == (case-sensitive) and excludes any future platform types.

.FirstOrDefault(ta => ta.AppName == targetApplication &&
                      (ta.Platform == ePlatformType.Web || ta.Platform == ePlatformType.Mobile));

Please use StringComparison.OrdinalIgnoreCase and/or make the allowed platforms configurable.


502-518: ⚠️ Potential issue

Potential NullReferenceException when TargetApplicationKey is null

Where(model => model.TargetApplicationKey.Guid == targetApp.Guid) is executed three times (lines 504, 512, 517).
If a legacy POM was saved before TargetApplicationKey was introduced, TargetApplicationKey will be null and the CLI will crash.

-.Where(model => model.TargetApplicationKey.Guid == targetApp.Guid)
+.Where(model => model.TargetApplicationKey != null &&
+               model.TargetApplicationKey.Guid == targetApp.Guid)

Also filter out null results when a GUID lookup fails:

-applicationPOMModels = POMGuidsList.Select(pomGuid => WorkSpace.Instance.SolutionRepository
-                                             .GetRepositoryItemByGuid<ApplicationPOMModel>(pomGuid))
-                                     .Where(model => model.TargetApplicationKey.Guid == targetApp.Guid)
-                                     .ToList();
+applicationPOMModels = POMGuidsList
+                       .Select(g => WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid<ApplicationPOMModel>(g))
+                       .Where(m => m != null &&
+                                   m.TargetApplicationKey != null &&
+                                   m.TargetApplicationKey.Guid == targetApp.Guid)
+                       .ToList();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3f5bdd and dadf077.

📒 Files selected for processing (3)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (5 hunks)
  • Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/UpdateMultiplePomConfigWizardPage.xaml.cs (3 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (4 hunks)
🧰 Additional context used
🧠 Learnings (3)
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/UpdateMultiplePomConfigWizardPage.xaml.cs (1)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs (2)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it imports the ObservableList<> class which is used throughout the file.
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/POMObjectMappingWithRunsetWizardPage.xaml.cs (4)
Learnt from: Maheshkale447
PR: Ginger-Automation/Ginger#3637
File: Ginger/GingerCoreNET/Application Models/Execution/POM/POMExecutionUtils.cs:226-234
Timestamp: 2024-07-26T22:04:12.930Z
Learning: The `LastUpdatedTime` in the `POMExecutionUtils.cs` file of the Ginger project is always in the correct DateTime format, as confirmed by the user. This information is crucial for avoiding unnecessary error handling suggestions in future reviews.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.041Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:30.816Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:33.780Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
🔇 Additional comments (1)
Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/UpdateMultipleWizard/UpdateMultiplePomConfigWizardPage.xaml.cs (1)

42-43:

Details

❓ Verification inconclusive

Unused field and C# 12-specific collection expression

  1. ObservableList<ApplicationPOMModel> POMModels; is never read after assignment-–the reference was removed when the logic was migrated to mWizard.mMultiPomDeltaUtils.mPOMModels. Please delete the field to avoid dead code.

  2. PomSupportedPlatformsForMultiPOM = [ePlatformType.Web, ePlatformType.Mobile]; uses the C# 12 “collection expression” syntax.
    • If the project is built with an older language version (≤ C# 11) the compilation will fail.
    • Consider reverting to the traditional initializer or explicitly setting <LangVersion>preview</LangVersion> in the project file.

-ObservableList<ApplicationPOMModel> POMModels;
-public static readonly List<ePlatformType> PomSupportedPlatformsForMultiPOM = [ePlatformType.Web, ePlatformType.Mobile];
+public static readonly List<ePlatformType> PomSupportedPlatformsForMultiPOM =
+    new() { ePlatformType.Web, ePlatformType.Mobile };

#!/bin/bash
# Confirm whether the field POMModels is referenced anywhere in the codebase
echo "=== Searching for references to 'POMModels' ==="
rg -n "POMModels" .

# Check for any explicit C# LangVersion settings in csproj/props files
echo "=== Checking for <LangVersion> in project files ==="
rg -n "<LangVersion>" -G "*.csproj" -G "*.props"

Remove unused field and update list initializer

  • The field ObservableList<ApplicationPOMModel> POMModels; isn’t referenced elsewhere and can be deleted to eliminate dead code.
  • The collection expression syntax [ePlatformType.Web, ePlatformType.Mobile] requires C# 12 preview. To maintain compatibility with C# 11 or earlier, replace it with a traditional initializer—or if you prefer the collection expression, ensure your project file specifies <LangVersion>preview</LangVersion>.

Suggested diff:

-        ObservableList<ApplicationPOMModel> POMModels;
-        public static readonly List<ePlatformType> PomSupportedPlatformsForMultiPOM = [ePlatformType.Web, ePlatformType.Mobile];
+        public static readonly List<ePlatformType> PomSupportedPlatformsForMultiPOM =
+            new() { ePlatformType.Web, ePlatformType.Mobile };

Comment thread Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs
@coderabbitai coderabbitai Bot mentioned this pull request Jul 30, 2025
15 tasks
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.

4 participants