Skip to content

fix: [AI-1759] target selector affects query execution and shows current target#1849

Open
ralphstodomingo wants to merge 1 commit intomasterfrom
fix/1759-target-selector
Open

fix: [AI-1759] target selector affects query execution and shows current target#1849
ralphstodomingo wants to merge 1 commit intomasterfrom
fix/1759-target-selector

Conversation

@ralphstodomingo
Copy link
Copy Markdown
Contributor

@ralphstodomingo ralphstodomingo commented Mar 25, 2026

Summary

  • Pass selectedTarget to the target picker command so the current target is shown first with a "(current)" label
  • Sort picker items to place the active target at the top of the list
image

Context

Fixes #1759

The target selector QuickPick always showed the first target (usually dev) as highlighted, regardless of which target was actually active. This made it unclear which target was currently selected.

Companion PR: AltimateAI/altimate-dbt-integration#37 (passes target_name to Python bridge for query execution)

Test plan

  • Target picker shows current target first with "(current)" label
  • Switching targets updates the status bar
  • Diagnostics confirm target change propagates correctly

🤖 Generated with Claude Code

…current target

- Pass `selectedTarget` to the target picker so the current target
  is shown first with a "(current)" label
- Sort picker items to place the active target at the top

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

Walkthrough

The dbtPowerUser.openTargetSelector command handler now accepts an optional currentTarget parameter. When provided, the target selection UI sorts the targets list to prioritize the current target, labels it as (current) in the quick-pick items, and derives the selected target from the item's label rather than directly from the raw targets array.

Changes

Cohort / File(s) Summary
Command Handler Enhancement
src/commands/index.ts
Updated command handler signature to accept optional currentTarget?: string parameter. Implemented sorting logic to place current target first and modified quick-pick item construction to label the current target as (current). Changed target selection derivation from raw targets array to selected item label.
Command Invocation Update
src/statusbar/targetStatusBar.ts
Extended command arguments passed to dbtPowerUser.openTargetSelector to include selectedTarget alongside targets, currentProject, and status bar instance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Support target selector #1424: Directly expands on the same command handler, modifying dbtPowerUser.openTargetSelector to accept and highlight the currently selected target in the target selection UI.

Suggested reviewers

  • anandgupta42
  • AdiGajbhiye
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request description provides a clear summary, context with issue reference, and a test plan, but does not follow the repository's template structure. Reformat the description to match the required template: add 'Overview' section with 'Problem' and 'Solution' subsections, include 'Screenshot/Demo' section, and use the checklist format specified in the template.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: fixing the target selector to affect query execution and display the current target with proper labeling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1759-target-selector

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.

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.

switch target not working - always takes the target from dbt_profiles.yml

1 participant