Skip to content

Conversation

@ktx-vaidehi
Copy link
Collaborator

@ktx-vaidehi ktx-vaidehi commented Sep 12, 2025

PR Type

Bug fix


Description

  • Make stream field validation case-insensitive

  • Prevent false errors for camelCase vs snake_case


Diagram Walkthrough

flowchart LR
  A["Query field names"] -- "toLowerCase()" --> B["Normalized names"]
  C["Available stream fields"] -- "toLowerCase()" --> D["Normalized fields"]
  B -- "compare" --> D
  E["Errors array"] -- "only push if unmatched" --> F["Accurate validation"]
Loading

File Walkthrough

Relevant files
Bug fix
convertDataIntoUnitValue.ts
Case-insensitive comparison for stream field validation   

web/src/utils/dashboard/convertDataIntoUnitValue.ts

  • Compare field names using toLowerCase().
  • Avoid mismatch when cases differ (e.g., camelCase).
  • Update filter predicate for custom X field errors.
+4/-1     

@github-actions
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Null Safety

The new case-insensitive comparison assumes i.name and it.column are always strings. If either can be null/undefined or non-string, calling toLowerCase() will throw. Consider guarding or coercing to string before comparing.

(it: any) =>
  !allStreamFields.find(
    (i: any) => i.name.toLowerCase() == it.column.toLowerCase(),
  ),
Locale Sensitivity

Using toLowerCase() can have locale-specific edge cases (e.g., Turkish dotted I). If identifiers are ASCII-only, clarify; otherwise consider toLocaleLowerCase('en-US') or a stricter normalization.

(it: any) =>
  !allStreamFields.find(
    (i: any) => i.name.toLowerCase() == it.column.toLowerCase(),
  ),

@github-actions
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add null-safe normalization

Guard against null or undefined values before calling toLowerCase to prevent runtime
errors. Normalize both sides safely and compare using strict equality.

web/src/utils/dashboard/convertDataIntoUnitValue.ts [1200-1203]

-(it: any) =>
-  !allStreamFields.find(
-    (i: any) => i.name.toLowerCase() == it.column.toLowerCase(),
-  ),
+(it: any) => {
+  const name = (i: any) => (typeof i?.name === 'string' ? i.name.toLowerCase() : '');
+  const col = (c: any) => (typeof c === 'string' ? c.toLowerCase() : '');
+  return !allStreamFields.find((i: any) => name(i) === col(it?.column));
+},
Suggestion importance[1-10]: 7

__

Why: The code currently calls toLowerCase on potentially undefined values, risking runtime errors; adding null-safe checks improves robustness without changing logic. The improved code correctly mirrors the original intent while safeguarding against non-string inputs.

Medium

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR addresses a case sensitivity issue in dashboard field validation by implementing case-insensitive comparison for stream field names. The change modifies the validateCustomQueryFields function in web/src/utils/dashboard/convertDataIntoUnitValue.ts to use toLowerCase() comparison when validating X-axis fields against the available stream fields.

The core problem being solved is when dashboard panels have field names configured with different casing than what exists in the actual stream schema (e.g., 'fieldName' vs 'fieldname'). This mismatch would previously cause validation errors even when the fields were semantically the same. The case-insensitive comparison allows the validation to be more flexible and accommodating of these naming variations.

The change specifically updates the X-axis field validation logic from i.name == it.column to i.name.toLowerCase() == it.column.toLowerCase(), which enables matching regardless of case differences. This fits into the broader dashboard validation system that ensures panel configurations reference valid fields from the underlying data streams.

Confidence score: 2/5

  • This PR introduces an inconsistency that will likely cause confusion and potential bugs in production
  • Score reflects the incomplete implementation where only X-axis validation uses case-insensitive comparison while Y-axis validation remains case-sensitive
  • Pay close attention to the Y-axis validation logic on line 1218 which still uses case-sensitive comparison

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Sep 12, 2025
@ktx-kirtan ktx-kirtan force-pushed the fix/dashboard/camel-case branch from 96e845e to 155746d Compare September 14, 2025 18:38
@ktx-vaidehi ktx-vaidehi force-pushed the fix/dashboard/camel-case branch from 5f47344 to fc2535d Compare September 15, 2025 04:23
@ktx-vaidehi ktx-vaidehi force-pushed the fix/dashboard/camel-case branch from fc2535d to fd7ba69 Compare September 15, 2025 05:20
@ktx-vaidehi ktx-vaidehi merged commit 5b81317 into main Sep 15, 2025
28 checks passed
@ktx-vaidehi ktx-vaidehi deleted the fix/dashboard/camel-case branch September 15, 2025 06:05
ktx-vaidehi added a commit that referenced this pull request Sep 15, 2025
…lidation for camelCase (#8424)

### **PR Type**
Bug fix


___

### **Description**
- Make stream field validation case-insensitive

- Prevent false errors for camelCase vs snake_case


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["Query field names"] -- "toLowerCase()" --> B["Normalized names"]
  C["Available stream fields"] -- "toLowerCase()" --> D["Normalized fields"]
  B -- "compare" --> D
  E["Errors array"] -- "only push if unmatched" --> F["Accurate validation"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>

<summary><strong>convertDataIntoUnitValue.ts</strong><dd><code>Case-insensitive
comparison for stream field validation</code>&nbsp; &nbsp;
</dd></summary>
<hr>

web/src/utils/dashboard/convertDataIntoUnitValue.ts

<ul><li>Compare field names using toLowerCase().<br> <li> Avoid mismatch
when cases differ (e.g., camelCase).<br> <li> Update filter predicate
for custom X field errors.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8424/files#diff-14c6fe442ef231566ec411f9e0262cdd24ec912fc67b9154eec743282ab7211a">+4/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: ktx-akshay <[email protected]>
ktx-vaidehi added a commit that referenced this pull request Sep 15, 2025
…lidation for camelCase (#8424)

### **PR Type**
Bug fix


___

### **Description**
- Make stream field validation case-insensitive

- Prevent false errors for camelCase vs snake_case


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["Query field names"] -- "toLowerCase()" --> B["Normalized names"]
  C["Available stream fields"] -- "toLowerCase()" --> D["Normalized fields"]
  B -- "compare" --> D
  E["Errors array"] -- "only push if unmatched" --> F["Accurate validation"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>

<summary><strong>convertDataIntoUnitValue.ts</strong><dd><code>Case-insensitive
comparison for stream field validation</code>&nbsp; &nbsp;
</dd></summary>
<hr>

web/src/utils/dashboard/convertDataIntoUnitValue.ts

<ul><li>Compare field names using toLowerCase().<br> <li> Avoid mismatch
when cases differ (e.g., camelCase).<br> <li> Update filter predicate
for custom X field errors.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8424/files#diff-14c6fe442ef231566ec411f9e0262cdd24ec912fc67b9154eec743282ab7211a">+4/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: ktx-akshay <[email protected]>
ktx-vaidehi added a commit that referenced this pull request Sep 15, 2025
…lidation for camelCase (#8424) (#8428)

…lidation for camelCase (#8424)

### **PR Type**
Bug fix


___

### **Description**
- Make stream field validation case-insensitive

- Prevent false errors for camelCase vs snake_case


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["Query field names"] -- "toLowerCase()" --> B["Normalized names"]
  C["Available stream fields"] -- "toLowerCase()" --> D["Normalized fields"]
  B -- "compare" --> D
  E["Errors array"] -- "only push if unmatched" --> F["Accurate validation"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>


<summary><strong>convertDataIntoUnitValue.ts</strong><dd><code>Case-insensitive
comparison for stream field validation</code>&nbsp; &nbsp;
</dd></summary>
<hr>

web/src/utils/dashboard/convertDataIntoUnitValue.ts

<ul><li>Compare field names using toLowerCase().<br> <li> Avoid mismatch
when cases differ (e.g., camelCase).<br> <li> Update filter predicate
for custom X field errors.</ul>


</details>


  </td>
<td><a

href="https://github.com/openobserve/openobserve/pull/8424/files#diff-14c6fe442ef231566ec411f9e0262cdd24ec912fc67b9154eec743282ab7211a">+4/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: ktx-akshay <[email protected]>
ktx-vaidehi added a commit that referenced this pull request Sep 15, 2025
…lidation for camelCase (#8424) (#8429)

### **PR Type**
Bug fix


___

### **Description**
- Make stream field validation case-insensitive

- Prevent false errors for camelCase vs snake_case


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["Query field names"] -- "toLowerCase()" --> B["Normalized names"]
  C["Available stream fields"] -- "toLowerCase()" --> D["Normalized fields"]
  B -- "compare" --> D
  E["Errors array"] -- "only push if unmatched" --> F["Accurate validation"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>


<summary><strong>convertDataIntoUnitValue.ts</strong><dd><code>Case-insensitive
comparison for stream field validation</code>&nbsp; &nbsp;
</dd></summary>
<hr>

web/src/utils/dashboard/convertDataIntoUnitValue.ts

<ul><li>Compare field names using toLowerCase().<br> <li> Avoid mismatch
when cases differ (e.g., camelCase).<br> <li> Update filter predicate
for custom X field errors.</ul>


</details>


  </td>
<td><a

href="https://github.com/openobserve/openobserve/pull/8424/files#diff-14c6fe442ef231566ec411f9e0262cdd24ec912fc67b9154eec743282ab7211a">+4/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: ktx-akshay <[email protected]>
hengfeiyang pushed a commit that referenced this pull request Sep 15, 2025
…lidation for camelCase (#8424) (#8428)

…lidation for camelCase (#8424)

### **PR Type**
Bug fix


___

### **Description**
- Make stream field validation case-insensitive

- Prevent false errors for camelCase vs snake_case


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["Query field names"] -- "toLowerCase()" --> B["Normalized names"]
  C["Available stream fields"] -- "toLowerCase()" --> D["Normalized fields"]
  B -- "compare" --> D
  E["Errors array"] -- "only push if unmatched" --> F["Accurate validation"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>


<summary><strong>convertDataIntoUnitValue.ts</strong><dd><code>Case-insensitive
comparison for stream field validation</code>&nbsp; &nbsp;
</dd></summary>
<hr>

web/src/utils/dashboard/convertDataIntoUnitValue.ts

<ul><li>Compare field names using toLowerCase().<br> <li> Avoid mismatch
when cases differ (e.g., camelCase).<br> <li> Update filter predicate
for custom X field errors.</ul>


</details>


  </td>
<td><a

href="https://github.com/openobserve/openobserve/pull/8424/files#diff-14c6fe442ef231566ec411f9e0262cdd24ec912fc67b9154eec743282ab7211a">+4/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: ktx-akshay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants