Skip to content

Bug fix/Source control download screen data fix#4169

Merged
Maheshkale447 merged 4 commits into
Releases/Betafrom
BugFix/SourceControlDownlaodScreenData
Apr 8, 2025
Merged

Bug fix/Source control download screen data fix#4169
Maheshkale447 merged 4 commits into
Releases/Betafrom
BugFix/SourceControlDownlaodScreenData

Conversation

@GokulBothe99

@GokulBothe99 GokulBothe99 commented Apr 8, 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

  • Bug Fixes
    • Improved source control connection details to ensure valid branch information is always displayed.
    • Refined retrieval of source control properties and tracking of recent solutions for consistent display.
    • Streamlined credential management during solution loading to ensure settings are saved correctly.
    • Enhanced error logging for better troubleshooting of source control issues.
    • Updated credential retrieval logic to ensure the correct source is used for user credentials.
    • Enhanced text retrieval from browser elements for more reliable interaction.

@coderabbitai

coderabbitai Bot commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request modifies the source control configuration and credential management logic. The branch setting logic now checks if the branch value is empty and retrieves the current branch when needed. Conditions in retrieving source control properties have been updated to support single solutions, and error logging is added for repository URL retrieval. Additionally, the credential saving process is refined by introducing a control variable and updating the key used to fetch credentials from the Windows Credential Manager.

Changes

File(s) Change Summary
Ginger/.../SourceControlConnDetailsPage.xaml.cs Updated branch display logic in SetSourceControlDetailsFromUserProfile to fetch the current branch if empty; minor formatting adjustment.
Ginger/.../UserProfile.cs
Ginger/.../WorkSpace.cs
Revised source control property retrieval in GetSourceControlPropertyFromUserProfileUsingURL (condition updated to support a single solution) with added error logging in repository URL retrieval.
Ginger/.../CLIHelper.cs
Ginger/.../UserProfileOperations.cs
Adjusted credential management by introducing the DoNotSaveCredentialsOnUserProfile variable in the solution load process and changing the credentials retrieval key.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLIHelper
    participant WS as WorkSpace
    participant UP as UserProfile
    participant SC as SourceControlIntegration
    participant Reporter as Reporter

    CLI->>WS: LoadSolutionAsync (captures DoNotSaveCredentialsOnUserProfile)
    WS->>WS: OpenSolution()
    WS->>WS: Set Solution property
    alt If solution has SourceControl
        WS->>UP: GetSourceControlPropertyFromUserProfileUsingURL(solution.SourceControl, solution.Guid)
    end
    WS->>SC: SetSourceControlDetailsFromUserProfile (check Branch property)
    alt Branch is null/empty
        SC->>SC: GetCurrentBranchForSolution()
        SC-->>SC: Return current branch
    else Branch exists
        SC-->>SC: Use provided branch
    end
    WS->>Reporter: Log error if repository URL retrieval fails
Loading

Possibly related PRs

  • Feature/Git Structure Changes #4137: The changes in the main PR are related to the modifications in the SourceControlInfo class, specifically the handling of the Branch property, which is also referenced in the retrieved PR's updates to the UserProfile class where source control properties are restructured.

Suggested reviewers

  • Maheshkale447

Poem

I'm a little rabbit, hopping with code delight,
Branches now shine whether empty or bright.
With credentials managed and errors logged just right,
Our code garden grows in the soft moonlight.
ASCII hops and happy days—let’s celebrate tonight! 🐇


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3b35789 and 7f24403.

📒 Files selected for processing (1)
  • Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (2 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (2)
Ginger/GingerCoreNET/UserCofig/UserProfileOperations.cs (1)
  • UserProfile (285-316)
Ginger/GingerCoreCommon/UserCofig/IUserProfileOperations.cs (1)
  • UserProfile (32-32)
🔇 Additional comments (2)
Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (2)

542-545: Adds source control URL-based property retrieval

This addition is beneficial as it retrieves source control properties using URL matching, which complements the existing GUID-based property retrieval at line 612. This change ensures that source control configurations are properly migrated from old formats where they might be stored with empty GUIDs.


619-622: Improves error logging for source control URL retrieval

This is a good enhancement that adds proper error logging when source control repository URL retrieval fails. Previously, any errors during URL retrieval would be silently ignored, making troubleshooting difficult.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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: 5

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 04cfeb8 and 13cd1d7.

📒 Files selected for processing (5)
  • Ginger/Ginger/SourceControl/SourceControlConnDetailsPage.xaml.cs (2 hunks)
  • Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (2 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs (2 hunks)
  • Ginger/GingerCoreNET/UserCofig/UserProfileOperations.cs (1 hunks)
  • Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
Ginger/GingerCoreNET/UserCofig/UserProfileOperations.cs (1)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/GingerCoreCommon/SourceControlLib/SourceControlBase.cs:58-59
Timestamp: 2025-04-08T10:41:31.325Z
Learning: Plain string storage for credentials in the SourceControlBase class is acceptable for now as confirmed by the developer. Security improvements for credential storage may be planned for a future iteration.
Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (1)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/GingerCoreCommon/UserCofig/UserProfile.cs:748-765
Timestamp: 2025-04-08T10:41:31.325Z
Learning: The GetSolutionSourceControlInfo method in UserProfile class, which retrieves or creates a GingerSolution entry for a specific solution GUID, has been confirmed by the developer to be working as expected without issues of duplicate entries.
🧬 Code Definitions (3)
Ginger/Ginger/SourceControl/SourceControlConnDetailsPage.xaml.cs (5)
Ginger/GingerCoreCommon/SourceControlLib/GingerSolution.cs (1)
  • SourceControlInfo (47-300)
Ginger/GingerCoreNET/SourceControl/SourceControlIntegration.cs (2)
  • SourceControlIntegration (37-718)
  • GetCurrentBranchForSolution (705-716)
Ginger/GingerCoreNET/SourceControl/GitSourceControlShellWrapper.cs (1)
  • GetCurrentBranchForSolution (98-101)
Ginger/GingerCoreNET/SourceControl/SVNSourceControlShellWrapper.cs (1)
  • GetCurrentBranchForSolution (105-108)
Ginger/GingerCoreNET/SourceControl/GITSourceControl.cs (1)
  • GetCurrentBranchForSolution (1778-1784)
Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs (3)
Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (2)
  • WorkSpace (62-1011)
  • OpenSolution (430-592)
Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (2)
  • UserProfile (82-1010)
  • UserProfile (326-391)
Ginger/GingerCoreCommon/UserCofig/IUserProfileOperations.cs (1)
  • UserProfile (32-32)
Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (3)
Ginger/GingerCoreNET/UserCofig/UserProfileOperations.cs (1)
  • UserProfile (285-316)
Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (3)
  • UserProfile (82-1010)
  • UserProfile (326-391)
  • GetSourceControlPropertyFromUserProfileUsingURL (886-912)
Ginger/GingerCoreCommon/ReporterLib/Reporter.cs (1)
  • Reporter (28-357)
🔇 Additional comments (8)
Ginger/GingerCoreNET/UserCofig/UserProfileOperations.cs (1)

352-352:

Details

❓ Verification inconclusive

Update to credential retrieval key

The credential retrieval key has been changed from the previous "Ginger_SourceControl_GIT" to "Ginger_SolutionSourceControl". This standardizes credential retrieval to work with a solution-specific naming convention.

Let me verify if there are any other places in the codebase that might still be using the old credential key format:


🏁 Script executed:

#!/bin/bash
# Search for any references to old credential key format
rg "Ginger_SourceControl_GIT" --type=cs

Length of output: 39


Credential Retrieval Key Update Confirmed – Please Manually Verify Remaining References

  • The credential key in Ginger/GingerCoreNET/UserCofig/UserProfileOperations.cs (line 352) has been updated from "Ginger_SourceControl_GIT" to "Ginger_SolutionSourceControl", standardizing the naming convention.
  • A search for occurrences of "Ginger_SourceControl_GIT" using ripgrep returned no results; however, the output was minimal, so please manually verify across the codebase to ensure no residual references remain.
Ginger/Ginger/SourceControl/SourceControlConnDetailsPage.xaml.cs (2)

118-125: Improved branch handling with fallback to current branch

This change ensures that when the branch information is missing in the user profile, the system attempts to retrieve the current branch dynamically. This improves the data display in the source control download screen.


137-137: Minor formatting improvement

Added a space after the assignment operator for better code readability.

Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (1)

903-904: Set the recent download solution GUID before saving

Added setting of RecentDownloadedSolutionGuid to ensure proper tracking of the solution before invoking SetSourceControlPropertyOnUserProfile. This maintains consistent state tracking.

Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (2)

542-545: Enhanced source control property initialization

Added logic to retrieve source control properties from the user profile when opening a solution with source control. This improves the integration between the user profile and source control systems.


614-617: Added error logging for repository URL retrieval issues

Enhanced error handling by adding logging when there's an error during repository URL retrieval. This helps with diagnosing source control connection issues.

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

291-294: Fixed credential saving logic.

The condition now properly uses the captured original value of DoNotSaveCredentialsOnUserProfile instead of the temporarily modified value, ensuring that credentials are only saved if the original user setting allows it.


306-306: Removed unnecessary conditional check.

The code now always proceeds with saving source control parameters on the user profile when called from LoadSolutionAsync, as the conditional check has been moved to the caller.

Comment thread Ginger/GingerCoreCommon/UserCofig/UserProfile.cs Outdated
Comment thread Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs Outdated
Comment thread Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs
Comment thread Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs
Comment thread Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs

@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

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

284-288: 🧹 Nitpick (assertive)

Improved credential handling with state preservation.

Created a variable to store the original DoNotSaveCredentialsOnUserProfile state and temporarily modifies it to ensure proper solution loading. This approach preserves the user's original preference while allowing the necessary operations to complete.

Consider using a try-finally block to ensure the original state is always restored, even if an exception occurs during solution loading:

var DoNotSaveCredentialsOnUserProfile = WorkSpace.Instance.UserProfile.DoNotSaveCredentialsOnUserProfile;
+bool originalValue = WorkSpace.Instance.UserProfile.DoNotSaveCredentialsOnUserProfile;
+try {
    if (WorkSpace.Instance.UserProfile.DoNotSaveCredentialsOnUserProfile)
    {
        WorkSpace.Instance.UserProfile.DoNotSaveCredentialsOnUserProfile = false;                    
    }
    var result = OpenSolution();
    if (result && !DoNotSaveCredentialsOnUserProfile)
    {
        SetSourceControlParaOnUserProfile();
    }
    return result;
+}
+finally {
+    WorkSpace.Instance.UserProfile.DoNotSaveCredentialsOnUserProfile = originalValue;
+}

290-293: 🧹 Nitpick (assertive)

Updated condition for saving source control properties.

Modified the condition to use the stored DoNotSaveCredentialsOnUserProfile variable instead of directly accessing the property, ensuring the original user preference is respected.

Add a comment explaining the credential handling strategy for better readability:

var result = OpenSolution();
+// Only save source control parameters if solution loaded successfully and original preference allows saving
if (result && !DoNotSaveCredentialsOnUserProfile)
{
    SetSourceControlParaOnUserProfile();
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 13cd1d7 and ce0bbb7.

📒 Files selected for processing (3)
  • Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (2 hunks)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs (1 hunks)
  • Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (1)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/GingerCoreCommon/UserCofig/UserProfile.cs:748-765
Timestamp: 2025-04-08T10:41:31.325Z
Learning: The GetSolutionSourceControlInfo method in UserProfile class, which retrieves or creates a GingerSolution entry for a specific solution GUID, has been confirmed by the developer to be working as expected without issues of duplicate entries.
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs (1)
Learnt from: IamRanjeetSingh
PR: Ginger-Automation/Ginger#4128
File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs:322-325
Timestamp: 2025-04-08T10:41:40.827Z
Learning: For text length calculation in Ginger Automation's Web driver, only the value attribute should be used without any fallbacks to text content or inner text.
🧬 Code Definitions (2)
Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (1)
Ginger/GingerCoreCommon/SourceControlLib/GingerSolution.cs (1)
  • GingerSolution (6-45)
Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs (3)
Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs (1)
  • WorkSpace (62-1011)
Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (2)
  • UserProfile (82-1010)
  • UserProfile (326-391)
Ginger/GingerCoreNET/UserCofig/UserProfileOperations.cs (1)
  • UserProfile (285-316)
🔇 Additional comments (3)
Ginger/GingerCoreCommon/UserCofig/UserProfile.cs (2)

891-891: Fix source control property retrieval for single solution.

Changed the condition to check if there's at least one solution in the collection (Count > 0) instead of more than one solution. This ensures the method can handle the case when there's only one solution available in the GingerSolutions collection.


903-904: Ensure proper tracking of the recent solution GUID.

Added the assignment of solutionGuid to RecentDownloadedSolutionGuid before calling SetSourceControlPropertyOnUserProfile. This ensures that the recent solution GUID is properly tracked when working with source control.

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

305-305: Removed unnecessary credential check in SetSourceControlParaOnUserProfile.

The check for DoNotSaveCredentialsOnUserProfile has been removed from this method as it's now handled at the caller level. This simplifies the method and centralizes the credential saving logic.

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

♻️ Duplicate comments (1)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs (1)

321-337: Enhanced text retrieval logic for text length calculation.

The changes to GetTextLengthAsync method now attempt to retrieve text from multiple sources (TextContent, InnerText, InputValue), providing better support for different types of elements.

I can see this approach aligns with your learning about improving capabilities to read text length from various element types. This is a good enhancement for flexibility.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ce0bbb7 and 3b35789.

📒 Files selected for processing (1)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs (2)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4169
File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs:321-336
Timestamp: 2025-04-08T12:31:45.924Z
Learning: The GetTextLengthAsync method in Ginger Automation's Web driver should attempt to retrieve text from multiple sources (TextContent, InnerText, InputValue) to calculate text length, providing enhanced capabilities to read text length from different types of elements.
Learnt from: IamRanjeetSingh
PR: Ginger-Automation/Ginger#4128
File: Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs:322-325
Timestamp: 2025-04-08T10:41:40.827Z
Learning: For text length calculation in Ginger Automation's Web driver, only the value attribute should be used without any fallbacks to text content or inner text.
🔇 Additional comments (1)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/ActionHandlers/ActUIElementHandler.cs (1)

337-337: Improved error message for missing text.

The error message has been updated to "Text value not found" which more accurately describes the issue when no text can be retrieved from any source.

@Maheshkale447
Maheshkale447 merged commit ce34ba8 into Releases/Beta Apr 8, 2025
@Maheshkale447
Maheshkale447 deleted the BugFix/SourceControlDownlaodScreenData branch April 8, 2025 13:47
@coderabbitai coderabbitai Bot mentioned this pull request Apr 10, 2025
15 tasks
@coderabbitai coderabbitai Bot mentioned this pull request May 26, 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.

2 participants