Skip to content

Conversation

@EnxDev
Copy link
Contributor

@EnxDev EnxDev commented Dec 24, 2025

User description

SUMMARY

When creating a dataset and being redirected to /chart/add?dataset=flights, the page was incorrectly selecting fake_flights instead of flights because the API used ct (contains) operator which matches any dataset containing "flights" and results are sorted alphabetically, so fake_flights comes before flights.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

  • Before
before.mp4
  • After
after.mp4

TESTING INSTRUCTIONS

  • All tests should pass
  • See the video above for the reproduction steps

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API
    es new feature or API
  • Removes existing feature or API

CodeAnt-AI Description

Use exact dataset name when loading dataset from URL and keep contains for dropdown search

What Changed

  • When the page is opened with ?dataset=, the dataset lookup uses an exact match so the correct dataset is selected instead of a partial alphabetic match
  • Typing into the Dataset dropdown still uses a "contains" search so results match substrings during user search
  • Added tests that verify the exact-match URL behavior, the contains behavior for dropdown search, and correct handling of URL-encoded special characters in dataset names

Impact

✅ Fewer incorrect dataset selections when opening chart creation via URL
✅ Clearer behavior for dataset lookup with special characters in URL
✅ Reduced chance of selecting the wrong dataset after redirect

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

h of your code repository, visit our dashboard at [https://app.codeant.ai](https://app.codeant.ai). This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health. of code health.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Dec 24, 2025

Code Review Agent Run #ad8855

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 85f9fc1..bcfd463
    • superset-frontend/src/pages/ChartCreation/ChartCreation.test.tsx
    • superset-frontend/src/pages/ChartCreation/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the change:frontend Requires changing the frontend label Dec 24, 2025
@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:L This PR changes 100-499 lines, ignoring generated files label Dec 24, 2025
@codeant-ai-for-open-source
Copy link
Contributor

Sequence Diagram

Shows the change where ChartCreation uses an exact (eq) API filter when a dataset is provided via the URL, while keeping the contains (ct) operator for interactive dropdown searches. This ensures the correct dataset is selected on page load.

sequenceDiagram
    participant Browser
    participant ChartCreation (frontend)
    participant Dataset API

    Browser->>ChartCreation (frontend): GET /chart/add?dataset=flights (page load)
    ChartCreation (frontend)->>Dataset API: GET /api/v1/dataset?q=... filters: table_name opr:eq "flights"
    Dataset API-->>ChartCreation (frontend): 200 OK (matching dataset)
    ChartCreation (frontend)-->>Browser: set datasource & show success toast

    Browser->>ChartCreation (frontend): User opens Dataset dropdown and types "test"
    ChartCreation (frontend)->>Dataset API: GET /api/v1/dataset?q=... filters: table_name opr:ct "test"
    Dataset API-->>ChartCreation (frontend): 200 OK (search results)
    ChartCreation (frontend)-->>Browser: show dropdown matches
Loading

Generated by CodeAnt AI

@codeant-ai-for-open-source
Copy link
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Error handling / defensive response parsing
    loadDatasources directly maps response.json.result without validating response shape or handling request failures. Network or server errors or unexpected response shapes can cause runtime errors. Also, returning an empty, predictable structure on failure will make callers more robust.

  • Missing result guard
    componentDidMount assumes the dataset lookup returns at least one result and immediately reads r.data[0] and sets state. If the API returns an empty list (no match) this will set datasource to undefined and still show a success toast. The flow should verify a result exists and handle the "not found" / error cases (avoid showing a success toast when nothing was loaded).

  • Flaky override of window.location
    Tests override window.location using Object.defineProperty but restore it later. If an assertion or render throws, the restore code may not run, leaving global state mutated for subsequent tests and causing flakiness. Wrap overrides in try/finally or use utilities that restore globals automatically.

  • Special-character handling verification
    The test for special characters asserts only presence of opr:eq in any call. It should also assert that the encoded dataset name is included (or parse query params) to ensure correct behavior for URL-encoded characters.

  • Weak fetch assertion
    Several tests validate the fetch request by checking substrings in the raw URL (e.g., opr:ct / opr:eq). This can lead to false positives/negatives if multiple requests are made or encoding differs. Prefer parsing the request URL or using a regex that verifies both operator and encoded dataset value to make the assertion robust.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend size/L size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant