Skip to content

Conversation

@AndriiFilippov
Copy link
Collaborator

@AndriiFilippov AndriiFilippov commented Oct 23, 2025

Description

Added Clangd path and query driver paths verification in the Clangd preference page.

Fixes # (IEP-XXX)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • Tests

    • Explicitly verify clangd path and query driver updates for new projects.
    • Simplified flows by removing multi-step target-change and rebuild sequences for clearer, faster checks.
    • Renamed and refocused tests for clarity and maintainability.
  • Chores

    • Cleaned up test fixture setup by removing obsolete target-selector initialization, dialogs and helper utilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@AndriiFilippov AndriiFilippov self-assigned this Oct 23, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 2025

Walkthrough

Updated a UI test: renamed the main test and helper methods, removed LaunchBar target-selector and target-change/build flows, and replaced per-target driver assertions with direct clangd path and query-driver assertions.

Changes

Cohort / File(s) Summary
Test refactor
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java
Renamed main test and several helpers; removed LaunchBarTargetSelector field and its initialization; deleted target-dialog/selection helpers and target-change/build steps; replaced driver validations with direct clangd path and query-driver assertions via new helpers (thenCompareActualClangdPathWithExpected(), thenCompareActualQueryDriversWithExpected()); removed obsolete methods/fields and adjusted labels/strings accordingly.

Sequence Diagram(s)

(omitted — changes are test refactor only, no runtime control-flow changes warranting a diagram)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review focus: the single modified test file, renamed helpers, removed selector/dialog flows, and correctness of new assertion helpers.

Possibly related PRs

Suggested reviewers

  • sigmaaa
  • kolipakakondal
  • alirana01

Poem

🐇 I hopped through tests and trimmed the trail,
Old targets furl, new paths set sail.
Clangd and queries now neatly paired,
Quiet checks where fuss once flared,
Nibble, tidy — code well aired.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: updated Clangd test case based on latest changes' accurately reflects the main change—a test case refactoring to align with updated clangd driver verification logic.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch IEP-1640

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b0a16a and af90f61.

📒 Files selected for processing (1)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java (2)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java (1)
  • Fixture (78-251)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java (1)
  • Fixture (193-444)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_macos
  • GitHub Check: build
🔇 Additional comments (3)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java (3)

126-126: LGTM: Test method renamed to reflect simplified flow.

The new name accurately describes the test's purpose without implying build or target-change operations that are no longer part of the flow.


437-437: Verify the intent of using "Cancel" instead of "Apply and Close".

The button was changed from "Apply and Close" to "Cancel". Using "Cancel" is appropriate if the test only reads preference values without making changes. However, ensure this doesn't inadvertently skip any initialization logic that might be triggered by the "Apply" action.


129-130: Verify that clangd and query driver paths are populated without a build step.

The test now reads clangd and query driver paths directly from Eclipse preferences immediately after project creation. However, based on code analysis:

  • updateClangdPath() is only called from ToolsActivationJob, which is triggered manually via UI wizards/tool manager, not automatically on project creation
  • The original test included a build step, which may have been necessary to trigger path population
  • Without this step, the preferences dialog may not contain the expected paths

Confirm that either:

  1. Paths are auto-populated during project creation through a mechanism not yet located in the codebase
  2. The test setup or fixture properly initializes these paths before the assertions
  3. Default values from IDFClangdMetadataDefaults are sufficient for the test to pass

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java (1)

126-131: Consider renaming the test to better reflect its behavior.

The test method name givenNewProjectIsCreatedThenClangdAndQueryDriversPathsAreUpdated implies verification that an update occurred, but the test only checks the current state of the paths without verifying that any update action triggered them. Consider renaming to givenNewProjectIsCreatedThenClangdAndQueryDriversPathsAreSet or similar to more accurately reflect the test's behavior.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a93af6e and c563b4d.

📒 Files selected for processing (1)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java (1)
  • Fixture (193-444)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: build_macos
🔇 Additional comments (3)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java (3)

126-131: Verify whether clangd behavior on target changes needs test coverage.

The test simplification is confirmed: it no longer builds the project or performs explicit target selection using LaunchBarTargetSelector. The method names thenClangdPathUpdateOnSelectedTarget() and thenQueryDriversUpdateOnSelectedTarget() are misleading—they merely verify that preferences contain expected values after project creation, not that paths update when targets change.

If clangd path updates on target selection is a supported feature, this test coverage gap should be addressed. No evidence in the codebase suggests target-change behavior is tested for clangd elsewhere.


434-439: Use "OK" or "Apply and Close" instead of "Cancel" for closing a read-only preferences dialog.

The button was changed from "Apply and Close" to "Cancel". While this works functionally since no preferences are modified at that point (the method only reads values after thenCompare* operations), semantically "Cancel" implies discarding changes. The standard pattern in this codebase is "Apply and Close" (as seen in setupAutoSave()). Even for read-only closes, use "OK" or "Apply and Close" to avoid confusion for future maintainers.


126-131: Verify that clangd and query driver paths are initialized without a build or explicit target selection.

The test creates a project and checks IDE preferences for paths, but doesn't explicitly build the project or select a target (despite method names suggesting "OnSelectedTarget"). According to Espressif documentation, these paths are "configured based on the selected target and the project you're building." Verify that:

  1. Paths are populated with expected values immediately after project creation/selection alone
  2. No build or target selection is required for this verification to pass
  3. The method names accurately reflect what the test does

If paths require a build or explicit target selection, add these operations to the test.

Comment on lines +185 to 189
private static void thenClangdPathUpdateOnSelectedTarget() throws Exception
{
whenOpenClangdPreferences();
thenCompareActualClangdDriversWithExpected("NewProjectClangFilesTest6");
closePreferencesDialog();
thenCompareActualClangdPathWithExpected("NewProjectClangFilesTest6");
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Use the projectName field instead of hardcoding the project name.

Line 188 hardcodes "NewProjectClangFilesTest6" instead of using the projectName field available in the Fixture class. This makes the code brittle and violates the DRY principle.

Apply this diff to use the field:

-		thenCompareActualClangdPathWithExpected("NewProjectClangFilesTest6");
+		thenCompareActualClangdPathWithExpected(projectName);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private static void thenClangdPathUpdateOnSelectedTarget() throws Exception
{
whenOpenClangdPreferences();
thenCompareActualClangdDriversWithExpected("NewProjectClangFilesTest6");
closePreferencesDialog();
thenCompareActualClangdPathWithExpected("NewProjectClangFilesTest6");
}
private static void thenClangdPathUpdateOnSelectedTarget() throws Exception
{
whenOpenClangdPreferences();
thenCompareActualClangdPathWithExpected(projectName);
}
🤖 Prompt for AI Agents
In
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java
around lines 185–189, the call
thenCompareActualClangdPathWithExpected("NewProjectClangFilesTest6") uses a
hardcoded project name; replace the string literal with the projectName field
from the Fixture class (e.g.
thenCompareActualClangdPathWithExpected(Fixture.projectName)) so the test uses
the shared fixture value instead of a brittle hardcoded name.

Comment on lines +191 to 195
private static void thenQueryDriversUpdateOnSelectedTarget() throws Exception
{
Fixture.thenLaunchTargetIsSelectedFromLaunchTargets("esp32s2");
Fixture.closeTargetDialog();
thenCompareActualQueryDriversWithExpected("NewProjectClangFilesTest6");
closePreferencesDialog();
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Use the projectName field instead of hardcoding the project name.

Line 193 hardcodes "NewProjectClangFilesTest6" instead of using the projectName field. This creates unnecessary coupling and makes the method less reusable.

Apply this diff to use the field:

-		thenCompareActualQueryDriversWithExpected("NewProjectClangFilesTest6");
+		thenCompareActualQueryDriversWithExpected(projectName);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private static void thenQueryDriversUpdateOnSelectedTarget() throws Exception
{
Fixture.thenLaunchTargetIsSelectedFromLaunchTargets("esp32s2");
Fixture.closeTargetDialog();
thenCompareActualQueryDriversWithExpected("NewProjectClangFilesTest6");
closePreferencesDialog();
}
private static void thenQueryDriversUpdateOnSelectedTarget() throws Exception
{
thenCompareActualQueryDriversWithExpected(projectName);
closePreferencesDialog();
}

Comment on lines +400 to +406
private static void thenCompareActualQueryDriversWithExpected(String projectName) throws IOException
{
SWTBotShell prefrencesShell = bot.shell("Preferences");
String actualQueryDriversPath = prefrencesShell.bot().textWithLabel("Drivers").getText();
String expectedQueryDriversPath = "**";
assertEquals(expectedQueryDriversPath, actualQueryDriversPath);
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Remove unused parameter and clarify the expected value.

The method has two issues:

  1. The projectName parameter is declared but never used in the method body.
  2. The expected value "**" is a magic string without explanation. Add a comment or constant to clarify what this represents in the context of query drivers.

Apply this diff to remove the unused parameter:

-	private static void thenCompareActualQueryDriversWithExpected(String projectName) throws IOException
+	private static void thenCompareActualQueryDriversWithExpected() throws IOException
 	{
 		SWTBotShell prefrencesShell = bot.shell("Preferences");
 		String actualQueryDriversPath = prefrencesShell.bot().textWithLabel("Drivers").getText();
-		String expectedQueryDriversPath = "**";
+		// "**" matches all drivers in the query driver path
+		String expectedQueryDriversPath = "**";
 		assertEquals(expectedQueryDriversPath, actualQueryDriversPath);
 	}

And update the call site at line 193:

-	thenCompareActualQueryDriversWithExpected(projectName);
+	thenCompareActualQueryDriversWithExpected();

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java
around lines 400-406, remove the unused projectName parameter from
thenCompareActualQueryDriversWithExpected, update its signature to take no
parameters, and update the caller at line 193 to call the method with no
argument; replace the magic string "**" with a named constant (e.g.,
EXPECTED_QUERY_DRIVERS) declared at class scope with a short comment explaining
what "**" signifies in the query drivers context, and use that constant in the
assertion.

Comment on lines 408 to 414
private static void thenCompareActualClangdPathWithExpected(String projectName) throws IOException
{
SWTBotShell prefrencesShell = bot.shell("Preferences");
String actualDriversPath = prefrencesShell.bot().textWithLabel("Drivers").getText();
String expectedDriversPath = "**";
assertEquals(expectedDriversPath, actualDriversPath);
String actualClangdPath = prefrencesShell.bot().textWithLabel("Path").getText();
String expectedClangdPath = "bin\\clangd";
assertTrue(actualClangdPath.contains(expectedClangdPath));
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix platform-specific path separator and remove unused parameter.

The method has critical issues:

  1. Line 412 uses Windows-specific path separator \\, which will fail on Linux and macOS. The PR indicates testing was done on all platforms, but this hardcoded separator breaks cross-platform compatibility.
  2. The projectName parameter is unused.

Apply this diff to fix the path separator issue:

-	private static void thenCompareActualClangdPathWithExpected(String projectName) throws IOException
+	private static void thenCompareActualClangdPathWithExpected() throws IOException
 	{
 		SWTBotShell prefrencesShell = bot.shell("Preferences");
 		String actualClangdPath = prefrencesShell.bot().textWithLabel("Path").getText();
-		String expectedClangdPath = "bin\\clangd";
+		// Use platform-independent path matching
+		String expectedClangdPath = "clangd";
-		assertTrue(actualClangdPath.contains(expectedClangdPath));
+		assertTrue("Clangd path should contain 'clangd': " + actualClangdPath, 
+			actualClangdPath.contains(expectedClangdPath) && actualClangdPath.contains("bin"));
 	}

And update the call site at line 188:

-	thenCompareActualClangdPathWithExpected(projectName);
+	thenCompareActualClangdPathWithExpected();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private static void thenCompareActualClangdPathWithExpected(String projectName) throws IOException
{
SWTBotShell prefrencesShell = bot.shell("Preferences");
String actualDriversPath = prefrencesShell.bot().textWithLabel("Drivers").getText();
String expectedDriversPath = "**";
assertEquals(expectedDriversPath, actualDriversPath);
String actualClangdPath = prefrencesShell.bot().textWithLabel("Path").getText();
String expectedClangdPath = "bin\\clangd";
assertTrue(actualClangdPath.contains(expectedClangdPath));
}
private static void thenCompareActualClangdPathWithExpected() throws IOException
{
SWTBotShell prefrencesShell = bot.shell("Preferences");
String actualClangdPath = prefrencesShell.bot().textWithLabel("Path").getText();
// Use platform-independent path matching
String expectedClangdPath = "clangd";
assertTrue("Clangd path should contain 'clangd': " + actualClangdPath,
actualClangdPath.contains(expectedClangdPath) && actualClangdPath.contains("bin"));
}
🤖 Prompt for AI Agents
In
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectClangFilesTest.java
around lines 408-414, the helper thenCompareActualClangdPathWithExpected uses a
hardcoded Windows path separator ("bin\\clangd") and accepts an unused
projectName parameter; change the expected path to use File.separator (e.g.
"bin" + File.separator + "clangd") to be platform independent, remove the unused
projectName parameter from the method signature, and update its single call site
at line 188 to call the method without the removed argument.

@sigmaaa sigmaaa added this to the v4.0.0 milestone Nov 4, 2025
Copy link
Collaborator

@sigmaaa sigmaaa left a comment

Choose a reason for hiding this comment

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

LGTM

@AndriiFilippov AndriiFilippov merged commit ca94528 into master Nov 25, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants