Skip to content

Conversation

@davemarco
Copy link
Contributor

@davemarco davemarco commented Aug 29, 2025

Description

Adds a new npm script to start with guided mode option (phase 2). This allows the phase 1 webui to not offer guided mode until phase II is fully complete (in case we want to release phase 1). It also adds guided mode button so we can start phase 2.

can start phase II UI with

npm run guided

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Summary by CodeRabbit

  • New Features

    • Toggle between Guided and Freeform SQL interfaces in Presto search (visible when Guided UI is enabled).
    • The selected interface is retained for the session; Freeform is the default.
  • Style

    • Search Controls layout refined: status separated from actions with a dedicated button group.
    • Buttons now have consistent width and spacing for a cleaner, more predictable appearance.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 29, 2025

Walkthrough

Adds a guided vs freeform Presto SQL interface toggle behind VITE_GUIDED_DEV, a PRESTO_SQL_INTERFACE enum, a Zustand store hook for sqlInterface, Guided/Freeform button components and wrapper, layout/CSS updates in SearchControls, and an npm script to launch guided mode.

Changes

Cohort / File(s) Summary
Guided dev script
components/webui/client/package.json
Adds script "guided": "VITE_GUIDED_DEV=true npm run start".
Presto search state
components/webui/client/src/pages/SearchPage/SearchState/Presto/typings.ts, components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx
Adds PRESTO_SQL_INTERFACE enum (GUIDED, FREEFORM) and a Zustand store hook usePrestoSearchState with sqlInterface and setSqlInterface; exports PRESTO_SEARCH_STATE_DEFAULT (named) and usePrestoSearchState (default).
SQL interface buttons
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/index.tsx, components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/index.module.css, components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/GuidedButton/index.tsx, components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/FreeformButton/index.tsx
New SqlInterfaceButton wrapper reads sqlInterface and conditionally renders GuidedButton or FreeformButton. GuidedButton and FreeformButton call setSqlInterface(...). CSS module adds .sqlInterfaceButton width styling.
SearchControls integration and styles
components/webui/client/src/pages/SearchPage/SearchControls/index.tsx, components/webui/client/src/pages/SearchPage/SearchControls/index.module.css
Adds feature-flag check isGuidedEnabled from VITE_GUIDED_DEV; conditionally renders SqlInterfaceButton alongside existing SqlSearchButton. Renames/restructures layout classes (buttonAndStatusRowstatusAndButtonsRow, adds .buttons) and updates markup for button grouping.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant SearchControls
  participant SqlInterfaceButton
  participant PrestoStore
  participant UI

  Note over SearchControls: Render when VITE_GUIDED_DEV === "true"
  SearchControls->>SqlInterfaceButton: mount
  SqlInterfaceButton->>PrestoStore: read sqlInterface

  rect rgba(220,240,255,0.35)
    Note right of User: Select "Guided"
    User->>SqlInterfaceButton: click Guided
    SqlInterfaceButton->>PrestoStore: setSqlInterface(GUIDED)
    PrestoStore-->>UI: state { sqlInterface: GUIDED }
    UI-->>SqlInterfaceButton: re-render (shows Freeform)
  end

  rect rgba(220,255,220,0.35)
    Note right of User: Select "Freeform"
    User->>SqlInterfaceButton: click Freeform
    SqlInterfaceButton->>PrestoStore: setSqlInterface(FREEFORM)
    PrestoStore-->>UI: state { sqlInterface: FREEFORM }
    UI-->>SqlInterfaceButton: re-render (shows Guided)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • hoophalab
  • kirkrodrigues
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco marked this pull request as ready for review August 29, 2025 20:50
@davemarco davemarco requested a review from a team as a code owner August 29, 2025 20:50
@davemarco davemarco requested a review from hoophalab August 29, 2025 20:50
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: 15

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/GuidedButton/index.tsx (1)

1-35: Show the other mode’s button, not the active one. In components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/index.tsx, you currently render GuidedButton when sqlInterface === PRESTO_SQL_INTERFACE.GUIDED (and FreeformButton otherwise), so clicking the visible button does nothing. Swap the branches—or switch to an Antd Segmented control—so users see and can click the opposite mode’s button.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9f87a42 and 05b9f93.

📒 Files selected for processing (9)
  • components/webui/client/package.json (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/FreeformButton/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/GuidedButton/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/index.module.css (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/index.module.css (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/index.tsx (3 hunks)
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/typings.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit configuration file

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/FreeformButton/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/typings.ts
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/GuidedButton/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx
🔇 Additional comments (4)
components/webui/client/src/pages/SearchPage/SearchControls/index.tsx (2)

61-63: Guardrail: toggle may be non-functional due to inverted logic in SqlInterfaceButton

As implemented, the switch renders the current mode’s button, which sets the state to the same value. This prevents switching. I’ve flagged and proposed a fix in Presto/SqlInterfaceButton/index.tsx.

After applying that fix, please click the toggle and confirm the interface actually flips modes.


56-64: CSS class definitions present.statusAndButtonsRow (line 16) and .buttons (line 23) are defined in index.module.css.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlInterfaceButton/FreeformButton/index.tsx (1)

21-27: No changes required – your project uses AntD v5.24.5, which (since v5.21.0) supports the Button variant and color props. (github.com)

components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx (1)

9-11: Sane default

Defaulting to FREEFORM looks right and aligns with current UI expectations.

Copy link
Contributor

@hoophalab hoophalab left a comment

Choose a reason for hiding this comment

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

looks good. There's one minor issue.

I think the icon position should probably stay fixed, but let's save all the small UI tweaks for Kirk at the end.

Validations: the toggle button works after the small fix.

@hoophalab
Copy link
Contributor

hoophalab commented Sep 2, 2025

How about this title:

feat(webui): Add guided mode button; Add a temporary switch to enable the guided UI mode.

…esto/SqlInterfaceButton/index.tsx

Co-authored-by: hoophalab <[email protected]>
@davemarco davemarco changed the title feat(webui): Add temporary switch to enable guided ui mode, and guided mode button. feat(webui): Add guided mode button; Add a temporary switch to enable the guided UI mode. Sep 2, 2025
coderabbitai[bot]

This comment was marked as off-topic.

@davemarco davemarco requested a review from hoophalab September 2, 2025 19:56
hoophalab
hoophalab previously approved these changes Sep 2, 2025
junhaoliao
junhaoliao previously approved these changes Sep 2, 2025
Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

deferring to @hoophalab 's review. for the title, maybe this is more clear:

feat(webui): Add guided query mode button; Add a temporary env var to enable the query mode.

@davemarco davemarco changed the title feat(webui): Add guided mode button; Add a temporary switch to enable the guided UI mode. feat(webui): Add guided query mode button; Add a temporary env var to enable the query mode. Sep 2, 2025
@davemarco davemarco changed the title feat(webui): Add guided query mode button; Add a temporary env var to enable the query mode. feat(webui): Add guided query mode button; Add a temporary env var to enable the guided query mode. Sep 2, 2025
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: 1

♻️ Duplicate comments (1)
components/webui/client/package.json (1)

11-11: Make the guided script cross-platform and call Vite directly.

Inline env vars break on Windows shells. Use cross-env and avoid the npm indirection.

   "scripts": {
     "build": "tsc -b && vite build",
     "lint:check": "eslint",
     "lint:fix": "eslint --fix",
     "start": "vite",
-    "guided": "VITE_GUIDED_DEV=true npm run start"
+    "guided": "cross-env VITE_GUIDED_DEV=true vite"
   },
@@
   "devDependencies": {
+    "cross-env": "^7.0.3",
     "@types/node": "22.15.31",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 306ef27 and 396fe26.

📒 Files selected for processing (1)
  • components/webui/client/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: package-image
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: lint-check (macos-15)

Comment on lines 7 to +11
"build": "tsc -b && vite build",
"lint:check": "eslint",
"lint:fix": "eslint --fix",
"start": "vite"
"start": "vite",
"guided": "VITE_GUIDED_DEV=true npm run start"
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Add a production build variant for the guided mode.

Ensure the flag is exercised in CI and producible bundles.

   "scripts": {
     "build": "tsc -b && vite build",
+    "build:guided": "cross-env VITE_GUIDED_DEV=true vite build",

Please confirm any runtime checks use string coercion, e.g., import.meta.env.VITE_GUIDED_DEV === "true".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build": "tsc -b && vite build",
"lint:check": "eslint",
"lint:fix": "eslint --fix",
"start": "vite"
"start": "vite",
"guided": "VITE_GUIDED_DEV=true npm run start"
"scripts": {
"build": "tsc -b && vite build",
"build:guided": "cross-env VITE_GUIDED_DEV=true vite build",
"lint:check": "eslint",
"lint:fix": "eslint --fix",
"start": "vite",
"guided": "VITE_GUIDED_DEV=true npm run start"
}
🤖 Prompt for AI Agents
In components/webui/client/package.json around lines 7 to 11, add a production
build variant for guided mode and ensure CI builds it using a string-typed env
flag; add a script such as "build:guided" that sets VITE_GUIDED_DEV=true and
runs the normal build, update CI to run that new script, and in runtime checks
ensure you compare import.meta.env.VITE_GUIDED_DEV === "true" (use strict string
coercion) wherever the guided flag is tested.

@davemarco davemarco dismissed stale reviews from junhaoliao and hoophalab via 0590636 September 4, 2025 13:31
@davemarco
Copy link
Contributor Author

@junhaoliao - can you re-review this? There was a minor build error, so i needed to commit something

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: 2

♻️ Duplicate comments (1)
components/webui/client/src/pages/SearchPage/SearchControls/index.tsx (1)

33-36: Feature flag: dot-access for tree-shaking + typed read + TODO with issue ID

Use dot access so Vite can constant-fold and DCE the flagged branch; tighten typing; add an issue ID to the TODO.

-    /* eslint-disable-next-line no-warning-comments */
-    // TODO: Remove flag and related logic when the new guide UI is fully implemented.
-    const isGuidedEnabled = "true" === import.meta.env[`VITE_GUIDED_DEV`];
+    /* eslint-disable-next-line no-warning-comments */
+    // TODO(GH-XXXX): Remove flag and related logic when the new guided UI is fully implemented.
+    const isGuidedEnabled = "true" === (import.meta.env.VITE_GUIDED_DEV as string | undefined);

Optional (outside this file) to lock types:

// env.d.ts
interface ImportMetaEnv {
  readonly VITE_GUIDED_DEV?: "true" | "false";
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 396fe26 and 0590636.

📒 Files selected for processing (1)
  • components/webui/client/src/pages/SearchPage/SearchControls/index.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit configuration file

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/webui/client/src/pages/SearchPage/SearchControls/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: package-image
  • GitHub Check: lint-check (macos-15)
  • GitHub Check: lint-check (ubuntu-24.04)
🔇 Additional comments (1)
components/webui/client/src/pages/SearchPage/SearchControls/index.tsx (1)

56-64: No issues found: CSS classes and guided script verified
Both .statusAndButtonsRow and .buttons exist in index.module.css, and the guided script (VITE_GUIDED_DEV=true npm run start) is defined in package.json.

} from "../../../config";
import Dataset from "./Dataset";
import styles from "./index.module.css";
import SqlInterfaceButton from "./Presto/SqlInterfaceButton";
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Code-split the guided button

Avoid loading guided-mode UI when the flag is false by lazy-loading the component.

-import SqlInterfaceButton from "./Presto/SqlInterfaceButton";
+import { lazy, Suspense } from "react";

Outside the selected range, add the lazy binding near the imports:

const SqlInterfaceButton = lazy(() => import("./Presto/SqlInterfaceButton"));
🤖 Prompt for AI Agents
In components/webui/client/src/pages/SearchPage/SearchControls/index.tsx around
line 9, the guided-mode SqlInterfaceButton is always imported; change to
code-split it by replacing the static import with a lazy dynamic import and
render it inside a Suspense boundary only when the guided-mode flag is true. Add
the lazy binding near the other imports (e.g. const SqlInterfaceButton = lazy(()
=> import("./Presto/SqlInterfaceButton"))) and ensure you import React.lazy and
Suspense (or use an existing Suspense) and conditionally render <Suspense
fallback={...}><SqlInterfaceButton .../></Suspense> only when the feature flag
enables guided mode.

Comment on lines +60 to +63
<div className={styles["buttons"]}>
{isGuidedEnabled && <SqlInterfaceButton/>}
<SqlSearchButton/>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Wrap lazy component in Suspense

Pairing with the lazy import above.

-                                {isGuidedEnabled && <SqlInterfaceButton/>}
-                                <SqlSearchButton/>
+                                {isGuidedEnabled && (
+                                    <Suspense fallback={null}>
+                                        <SqlInterfaceButton/>
+                                    </Suspense>
+                                )}
+                                <SqlSearchButton/>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className={styles["buttons"]}>
{isGuidedEnabled && <SqlInterfaceButton/>}
<SqlSearchButton/>
</div>
<div className={styles["buttons"]}>
{isGuidedEnabled && (
<Suspense fallback={null}>
<SqlInterfaceButton/>
</Suspense>
)}
<SqlSearchButton/>
</div>
🤖 Prompt for AI Agents
In components/webui/client/src/pages/SearchPage/SearchControls/index.tsx around
lines 60-63, the lazily imported SqlInterfaceButton must be rendered inside a
React.Suspense boundary; wrap the conditional isGuidedEnabled &&
<SqlInterfaceButton/> with <Suspense fallback={/* small fallback e.g. null or a
spinner */}>...</Suspense>, ensure Suspense is imported from React (or use
React.Suspense), and keep SqlSearchButton outside or inside the same boundary as
desired so lazy loading is handled without throwing during render.

Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

deferring to @hoophalab 's review

@davemarco davemarco merged commit 9dde8f8 into y-scope:main Sep 4, 2025
20 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.

3 participants