Skip to content

Conversation

@senithkay
Copy link
Contributor

@senithkay senithkay commented Dec 23, 2025

Purpose

Fix the issue where in clause editor fieldTypes were incorrectly set after the refactor of the property model/

Summary by CodeRabbit

  • Enhancements
    • Expanded form field type support to enable enhanced query clause editing with additional field configuration options.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Walkthrough

The pull request extends the form field input type union with two new options (ENUM and DM_JOIN_CLAUSE_RHS_EXPRESSION) and updates corresponding form field configurations in the query clause editor to utilize these new types.

Changes

Cohort / File(s) Summary
Type Definition Updates
workspaces/ballerina/ballerina-core/src/interfaces/bi.ts
Extended FormFieldInputType union to include "ENUM" and "DM_JOIN_CLAUSE_RHS_EXPRESSION" alongside existing "RECORD_MAP_EXPRESSION"
Form Field Configuration Updates
workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx
Updated DMFormField fieldType mappings: expressionField (IDENTIFIER→EXPRESSION), orderField (IDENTIFIER→ENUM), lhsExpressionField (IDENTIFIER→EXPRESSION), rhsExpressionField (IDENTIFIER→DM_JOIN_CLAUSE_RHS_EXPRESSION)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through types so neat,
Adding ENUM makes fields complete,
DM_JOIN_CLAUSE joins the fray,
Form fields dance in new ways today! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides only the Purpose section with minimal detail. Most required sections (Goals, Approach, UI Component Development, Icons, User stories, Release note, Documentation, Training, Certification, Marketing, Tests, Security, Samples, Related PRs, Migrations, Test environment, Learning) are entirely missing or incomplete. Expand the description to include Goals explaining what the fix achieves, Approach describing the implementation details, Release note summarizing the fix, and relevant sections like Documentation and Test environment where this was tested.
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 (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: fixing incorrect field types in the clause editor, which directly matches the changeset's primary purpose.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 034ceeb and 638641b.

📒 Files selected for processing (2)
  • workspaces/ballerina/ballerina-core/src/interfaces/bi.ts
  • workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-11-27T07:59:33.534Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 897
File: workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx:50-59
Timestamp: 2025-11-27T07:59:33.534Z
Learning: In workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx, the `clause.properties.expression` property in the `fillDefaults` function does not require defensive null/undefined checks because it's a required property enforced by form validation in ClauseEditor.

Applied to files:

  • workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx
📚 Learning: 2025-11-20T11:04:33.712Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 898
File: workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx:38-38
Timestamp: 2025-11-20T11:04:33.712Z
Learning: In workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx, the use of `useDMQueryClausesPanelStore.getState()` to access `clauseToAdd` and `setClauseToAdd` (instead of the hook subscription pattern) is intentional to prevent re-renders when these state values change.

Applied to files:

  • workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx
📚 Learning: 2025-11-24T14:51:49.267Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 998
File: workspaces/ballerina/data-mapper/src/components/DataMapper/Header/ExpressionBar.tsx:113-132
Timestamp: 2025-11-24T14:51:49.267Z
Learning: In workspaces/ballerina/data-mapper/src/components/DataMapper/Header/ExpressionBar.tsx, if `textFieldRef.current` is not undefined, `textFieldRef.current.inputElement` is guaranteed to exist. If `inputElement` doesn't exist when `current` exists, it's a fatal error that should reach the error boundary rather than being handled with defensive null checks.

Applied to files:

  • workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx
🔇 Additional comments (2)
workspaces/ballerina/ballerina-core/src/interfaces/bi.ts (1)

147-149: LGTM! Type union correctly extended.

The addition of ENUM and DM_JOIN_CLAUSE_RHS_EXPRESSION to the FormFieldInputType union properly supports the field type corrections in ClauseEditor.tsx, ensuring type safety across the form field definitions.

workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx (1)

90-90: LGTM! Field type consistency restored.

All four field type corrections properly align the fieldType in the types array with their corresponding type property:

  • expressionField and lhsExpressionField: Both now use "EXPRESSION"
  • orderField: Now uses "ENUM" (matching the new union type in bi.ts)
  • rhsExpressionField: Now uses "DM_JOIN_CLAUSE_RHS_EXPRESSION" (matching the new union type in bi.ts)

This restores the consistency pattern observed in other fields like nameField and typeField, fixing the issue introduced by the property model refactor.

Also applies to: 102-102, 115-115, 127-127


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.

@kanushka kanushka changed the base branch from main to bi-1.6.x December 23, 2025 11:40
@kanushka kanushka merged commit 91fb79d into wso2:bi-1.6.x Dec 23, 2025
6 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.

2 participants