Skip to content

Conversation

@KCSAbeywickrama
Copy link
Contributor

@KCSAbeywickrama KCSAbeywickrama commented Dec 2, 2025

Purpose

$subject

Summary by CodeRabbit

  • Bug Fixes
    • Fixes focus-input behavior in the data mapper so focus is applied only for fields inside sequence contexts, preventing unintended focus in other areas.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 2, 2025

Walkthrough

processTypeFields in the data-mapper utils now applies focus-input replacement only when the field is in a sequence context (requires isSeq true and model.focusInputs). No other control flow or error handling changes.

Changes

Cohort / File(s) Summary
Data Mapper Utilities
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
processTypeFields: focus-input replacement now gated by isSeq && model.focusInputs (applies only in sequence contexts); no other functional or error-handling changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the isSeq && model.focusInputs check correctly restricts focus-member replacements to sequence contexts.
  • Confirm any callers/consumers relying on prior focus behavior still function as intended.
  • Check for commented-out lines or leftover artifacts that should be cleaned or clarified.

Suggested reviewers

  • hevayo
  • gigara
  • kanushka

Poem

🐰 In a meadow of code I hop and peep,
Focus narrowed where sequences sleep.
A tidy tweak, no thunder or clatter,
Small bits align — does it truly matter? ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is severely incomplete. It only contains the Purpose section with a placeholder '$subject' and is missing all other required template sections including Goals, Approach, User stories, Release notes, Documentation, and others. Complete the PR description by filling out all required template sections, starting with replacing the '$subject' placeholder with a clear description of the purpose, and adding Goals, Approach, and other mandatory sections.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing the condition for processing focus inputs in the processTypeFields function, which aligns with the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40237c4 and 44a799b.

📒 Files selected for processing (1)
  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 969
File: workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts:23-44
Timestamp: 2025-11-20T06:44:07.498Z
Learning: In the data mapper node-utils.ts, when `lastViewIndex == 0`, the code is at the root view and should NOT use `focusInputRootMap` for fallback input node resolution. The truthiness check on `lastViewIndex` is intentional to skip the fallback at the root level.
📚 Learning: 2025-11-26T06:34:09.752Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 653
File: workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts:128-134
Timestamp: 2025-11-26T06:34:09.752Z
Learning: In workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts, the goPrevViewBreadcrumb() method is only called when in a focused view, ensuring breadcrumbs are always present. No guard for empty breadcrumbs is needed.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 Learning: 2025-11-26T07:49:56.428Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 653
File: workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts:136-141
Timestamp: 2025-11-26T07:49:56.428Z
Learning: In workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts, the goPrevViewBackButton() method is only called when in a focused view, ensuring breadcrumbs are always present. No guard for empty breadcrumbs is needed.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 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/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 Learning: 2025-11-26T06:37:07.886Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 653
File: workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/dm-data/array-inner/inline/map3.bal.txt:6-8
Timestamp: 2025-11-26T06:37:07.886Z
Learning: In workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/dm-data/ directories, BAL test data files (such as those in array-inner/inline/, array-root/inline/, basic/inline/, and their reusable counterparts) may intentionally contain type errors and other violations. These are comparison files used to test data mapper functionality and error handling, so such errors should not be flagged as issues.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 Learning: 2025-11-26T06:35:19.217Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 653
File: workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts:173-178
Timestamp: 2025-11-26T06:35:19.217Z
Learning: In workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts, the commented-out debugging block in the verifyFileContent function (lines 172-177 containing console.log, page.pause, and updateDataFileSync) is intentionally kept as a developer utility for updating test data files when needed. It should not be removed.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 Learning: 2025-11-26T06:33:22.950Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 653
File: workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts:86-112
Timestamp: 2025-11-26T06:33:22.950Z
Learning: In workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts, empty catch blocks around progress ring waitForSelector calls (state: 'attached' and 'detached') are intentional. The progress ring duration depends on machine performance and may appear very briefly, causing the wait to miss the event. The try-catch allows the test to proceed gracefully regardless of timing.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 Learning: 2025-11-20T06:44:07.498Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 969
File: workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts:23-44
Timestamp: 2025-11-20T06:44:07.498Z
Learning: In the data mapper node-utils.ts, when `lastViewIndex == 0`, the code is at the root view and should NOT use `focusInputRootMap` for fallback input node resolution. The truthiness check on `lastViewIndex` is intentional to skip the fallback at the root level.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
🔇 Additional comments (1)
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts (1)

730-746: Restricting focus-input handling to sequence context is correct and safer

Gating the focus-input replacement and focusInputRootMap updates behind if (isSeq && model.focusInputs) makes the sequence semantics clearer: focus inputs are only applied when a groupById is present and the field is in that sequence context, while still unmarking the group-by key itself via the fieldId === model.groupById check. This also keeps focusInputRootMap from being populated for non-sequence/root contexts, which matches the intended usage patterns noted elsewhere. Based on learnings, this looks like the right fix with no regressions in the surrounding logic.


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
Contributor

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

🧹 Nitpick comments (2)
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts (2)

730-747: Seq‑gated focus processing logic looks consistent but is quite subtle

Tying focus member resolution to isSeq (derived from groupById) plus keeping focusInputRootMap updates inside that guard matches the idea that focus inputs should only apply in sequence/group‑by contexts, and avoids incorrectly mirroring focus for non‑seq fields. The extra if (fieldId === model.groupById) { isSeq = false; } is a bit non‑obvious though; consider a short comment explaining why the group‑by field itself should not be treated as seq for future maintainers, since this is easy to regress. Based on learnings, this keeps focusInputRootMap semantics aligned with how focus views are resolved in the diagram layer.


748-757: Removing isFocused/isSeq from IOType changes its contract—confirm no remaining consumers

Commenting out the spread of isFocused and isSeq means these flags no longer appear on emitted IOType instances from processTypeFields. That’s fine if callers (e.g., the data‑mapper UI) have been updated to not rely on them, but it is a silent contract change; please double‑check there are no remaining usages expecting these properties. If they’re confirmed unused, you can follow up by removing the commented lines (and any now‑redundant plumbing) to keep this path lean.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a333bcf and 40237c4.

📒 Files selected for processing (1)
  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 969
File: workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts:23-44
Timestamp: 2025-11-20T06:44:07.498Z
Learning: In the data mapper node-utils.ts, when `lastViewIndex == 0`, the code is at the root view and should NOT use `focusInputRootMap` for fallback input node resolution. The truthiness check on `lastViewIndex` is intentional to skip the fallback at the root level.
📚 Learning: 2025-11-20T06:44:07.498Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 969
File: workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts:23-44
Timestamp: 2025-11-20T06:44:07.498Z
Learning: In the data mapper node-utils.ts, when `lastViewIndex == 0`, the code is at the root view and should NOT use `focusInputRootMap` for fallback input node resolution. The truthiness check on `lastViewIndex` is intentional to skip the fallback at the root level.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 Learning: 2025-11-26T06:34:09.752Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 653
File: workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts:128-134
Timestamp: 2025-11-26T06:34:09.752Z
Learning: In workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts, the goPrevViewBreadcrumb() method is only called when in a focused view, ensuring breadcrumbs are always present. No guard for empty breadcrumbs is needed.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 Learning: 2025-11-26T07:49:56.428Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 653
File: workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts:136-141
Timestamp: 2025-11-26T07:49:56.428Z
Learning: In workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts, the goPrevViewBackButton() method is only called when in a focused view, ensuring breadcrumbs are always present. No guard for empty breadcrumbs is needed.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
📚 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/ballerina-extension/src/rpc-managers/data-mapper/utils.ts

@KCSAbeywickrama KCSAbeywickrama changed the base branch from main to bi-1.5.x December 2, 2025 11:51
@kanushka kanushka merged commit a9fbac4 into wso2:bi-1.5.x Dec 3, 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