Skip to content

feat(webui): Set up guided UI for query submission; Remove testing inputs.#1361

Merged
davemarco merged 16 commits into
y-scope:mainfrom
davemarco:state
Oct 2, 2025
Merged

feat(webui): Set up guided UI for query submission; Remove testing inputs.#1361
davemarco merged 16 commits into
y-scope:mainfrom
davemarco:state

Conversation

@davemarco

@davemarco davemarco commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Description

Connects to new UI components to zustand states, and sets up the new components and run button to submit injected queries to the server.

Does not include timeline support

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

Queries run using new guided ui

Summary by CodeRabbit

  • New Features

    • Added dedicated Guided and Freeform Run buttons with validation, disabled states and tooltips.
    • Guided controls (Select, From, Where, Order By, Limit, Timestamp Key) now sync with the Presto search state.
  • Style

    • Reduced max width of the time range picker for a more compact layout.
  • Chores

    • Removed the experimental SQL testing panel and its export to simplify the Search controls.

@coderabbitai

coderabbitai Bot commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Removes a testing inputs component, expands Presto search state (select, from, where, orderBy, limit), converts multiple guided controls to controlled components bound to state, refactors Run button to select between freeform and guided modes and adds dedicated RunButton components, and tweaks TimeRange input CSS width.

Changes

Cohort / File(s) Summary
Remove testing inputs
components/webui/client/src/pages/SearchPage/SearchControls/Presto/BuildSqlTestingInputs.tsx
Deleted test-only SQL input builder and its schemas/handlers. Removed export BuildSqlTestingInputs.
Guided controls wired to state
components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.tsx, .../GuidedControls/Limit.tsx, .../GuidedControls/OrderBy.tsx, .../GuidedControls/Select.tsx, .../GuidedControls/TimestampKey/index.tsx, .../GuidedControls/Where.tsx
Converted presentational components to controlled ones using usePrestoSearchState. Read values from state and update via new updater methods. No layout changes.
Run button split and mode-driven render
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/index.tsx, .../RunButton/FreeformRunButton.tsx, .../RunButton/GuidedRunButton.tsx
Introduced FreeformRunButton and GuidedRunButton. index.tsx now selects button by sqlInterface (PRESTO_SQL_INTERFACE). Guided builds query from state/time range and submits; Freeform submits raw query.
Search controls container cleanup
components/webui/client/src/pages/SearchPage/SearchControls/index.tsx
Removed import/rendering of deleted BuildSqlTestingInputs. Consolidated to a single form.
Presto search state expansion
components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx
Added fields: from, limit, orderBy, select, where. Added updaters: updateFrom, updateLimit, updateOrderBy, updateSelect, updateWhere. Updated defaults and exported hook/types.
Time range UI tweak
components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/index.module.css
Reduced .rangePicker max-width from 320px to 220px.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant RunButton as RunButton (index)
  participant Store as usePrestoSearchState
  participant Freeform as FreeformRunButton
  participant Guided as GuidedRunButton
  Note over RunButton,Store: Render time
  User->>RunButton: Open Search Controls
  RunButton->>Store: read sqlInterface
  alt sqlInterface == GUIDED
    RunButton-->>User: Render GuidedRunButton
  else
    RunButton-->>User: Render FreeformRunButton
  end
Loading
sequenceDiagram
  autonumber
  actor User
  participant Guided as GuidedRunButton
  participant PStore as Presto Search State
  participant UIStore as Search UI State (time, pending)
  participant Builder as buildSearchQuery
  participant Submit as handlePrestoQuerySubmit
  User->>Guided: Click Run
  Guided->>PStore: read select, from, where, orderBy, limit, timestampKey
  Guided->>UIStore: read start/end, pending
  alt Not ready or pending
    Guided-->>User: Disabled / Tooltip
  else
    Guided->>Builder: build({selectItemList, databaseName, booleanExpression, sortItemList, limitValue, timestampKey, startTimestamp, endTimestamp})
    Builder-->>Guided: queryString
    Guided->>Submit: handlePrestoQuerySubmit(queryString)
    Submit-->>Guided: result / error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The pull request title accurately captures the main changes by highlighting the addition of a guided UI for query submission and the removal of testing inputs, and it follows a concise, imperative style consistent with Conventional Commits.
✨ 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

Comment @coderabbitai help to get the list of available commands and usage tips.

@davemarco davemarco requested a review from hoophalab October 1, 2025 18:19
@davemarco davemarco marked this pull request as ready for review October 1, 2025 18:19
@davemarco davemarco requested a review from a team as a code owner October 1, 2025 18:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce98ad2 and 3d1008d.

📒 Files selected for processing (17)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/BuildSqlTestingInputs.tsx (0 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Limit.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/OrderBy.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Select.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/TimestampKey/index.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Where.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/FreeformRunButton.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/index.module.css (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx (2 hunks)
  • components/webui/client/src/sql-parser/index.ts (2 hunks)
  • components/webui/client/src/sql-parser/typings.ts (1 hunks)
  • components/webui/server/settings.json (1 hunks)
  • tools/yscope-dev-utils (1 hunks)
💤 Files with no reviewable changes (1)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/BuildSqlTestingInputs.tsx
🧰 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/GuidedControls/TimestampKey/index.tsx
  • components/webui/client/src/sql-parser/typings.ts
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Select.tsx
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/FreeformRunButton.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/OrderBy.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Limit.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Where.tsx
  • components/webui/client/src/sql-parser/index.ts
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/index.tsx
🧬 Code graph analysis (2)
components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx (1)
components/webui/common/src/utility-types.ts (1)
  • Nullable (3-3)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (3)
components/webui/client/src/sql-parser/index.ts (1)
  • buildSearchQuery (193-193)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/presto-search-requests.ts (1)
  • handlePrestoQuerySubmit (112-112)
components/webui/client/src/pages/SearchPage/SearchState/typings.ts (1)
  • SEARCH_UI_STATE (31-31)
🪛 GitHub Actions: clp-rust-checks
tools/yscope-dev-utils

[error] 1-1: cp: cannot stat '/home/runner/work/clp/clp/tools/yscope-dev-utils/exports/lint-configs/.rustfmt.toml': No such file or directory

⏰ 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). (2)
  • GitHub Check: package-image
  • GitHub Check: antlr-code-committed (macos-15)
🔇 Additional comments (18)
components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/index.module.css (1)

15-15: LGTM!

The reduced max-width tightens the layout of the range picker component, aligning with the broader UI refinements in this PR.

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

11-17: LGTM!

The default values for the new Presto search state fields are reasonable and well-chosen:

  • from: null appropriately indicates no table selection yet
  • limit: 10 provides a safe default to prevent unbounded queries
  • select: "*" follows standard SQL convention
  • Empty strings for orderBy and where correctly represent no ordering/filtering

21-54: LGTM!

The interface additions are well-documented and type-safe. Field types align with the defaults, and the use of Nullable<string> for from correctly models optional table selection.


70-87: LGTM!

The zustand store updater implementations are straightforward and consistent. The methods directly update state without validation, which is appropriate for a presentation-layer store. Input validation (e.g., ensuring limit > 0) can be handled at the component or submission level if needed.

components/webui/server/settings.json (1)

21-21: No issues found with “clp-s” engine configuration
“clp-s” is defined in the CLP_QUERY_ENGINES enum (components/webui/common/src/config.ts:6), included in build/taskfiles and CMake targets, and covered by unit and integration tests. The server’s search route handles it via generic job submission. Ensure the deployment environment includes the clp-s binary.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/TimestampKey/index.tsx (1)

12-28: LGTM! Controlled input pattern correctly implemented.

The component properly reads from and writes to the centralized Presto search state. The controlled input pattern with value and onChange is correctly wired.

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

40-42: LGTM! Simplified render structure.

The removal of BuildSqlTestingInputs aligns with the PR objective to remove testing inputs. The simplified structure is cleaner and maintains the same functional behavior.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Limit.tsx (1)

21-38: LGTM! Controlled Select properly wired to state.

The component correctly implements the controlled input pattern, binding the Select's value to state and wiring onChange to the state updater. The antd Select component will handle edge cases appropriately.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Where.tsx (1)

12-28: LGTM! Controlled SqlInput with proper null handling.

The component correctly implements the controlled input pattern with appropriate fallback handling for falsy values (value || ""), ensuring the state updater receives a valid string.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/Select.tsx (1)

12-28: LGTM! Controlled SqlInput with consistent null handling.

The component correctly implements the controlled input pattern, consistent with the Where component. The fallback to empty string (value || "") ensures proper handling of falsy values.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/OrderBy.tsx (1)

13-26: LGTM – controlled ORDER BY wiring looks solid.

State read/write flows cleanly through the store and keeps SqlInput controlled.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.tsx (1)

13-27: LGTM – FROM selector now shares central state.

DatasetSelect is properly controlled through the store updater; matches the new guided pattern.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/index.tsx (1)

13-17: LGTM – interface switch yields the right run button.

The render split on PRESTO_SQL_INTERFACE keeps guided/freeform flows isolated cleanly.

components/webui/client/src/sql-parser/index.ts (2)

109-115: LGTM: Guard logic updated to match required field types.

The changes correctly shift from checking undefined to checking empty strings for optional clauses, and LIMIT is now always appended using the required numeric limitValue. This aligns with the updated BuildSearchQueryProps interface.


153-155: Align booleanExpression guard with its optional type
Ripgrep found no internal calls to buildTimelineQuery; please verify whether booleanExpression can ever be undefined at runtime. If it can, update the guard to handle both undefined and "" (for example, if (!booleanExpression) …), or tighten BuildTimelineQueryProps so booleanExpression is always a non-empty string.

components/webui/client/src/sql-parser/typings.ts (1)

4-6: LGTM: Type signature updates enforce explicit values.

The changes require callers to provide explicit values for booleanExpression, sortItemList, and limitValue (which is now numeric). Empty strings serve as sentinel values for omitted clauses, improving type safety over optional/undefined.

Note: This is a breaking change for existing callers of buildSearchQuery.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/FreeformRunButton.tsx (2)

20-32: LGTM: Component logic is clean and correct.

The button correctly disables when the query string is empty or a query is pending, and displays appropriate tooltip feedback. The callback properly submits the query string.


33-49: LGTM: Button rendering is correct.

The JSX properly wires up the disabled state, tooltip, styling, and click handler. The button is appropriately disabled when the query is empty or pending.

Comment on lines +38 to +66
const handleClick = useCallback(() => {
if (null === from) {
console.error("Cannot build guided query: from input is missing");

return;
}

if (null === timestampKey) {
console.error("Cannot build guided query: timestampKey input is missing");

return;
}

try {
const queryString = buildSearchQuery({
booleanExpression: where.trim(),
databaseName: from,
endTimestamp: endTimestamp.unix(),
limitValue: limit,
selectItemList: select.trim(),
sortItemList: orderBy.trim(),
startTimestamp: startTimestamp.unix(),
timestampKey: timestampKey,
});

handlePrestoQuerySubmit({queryString});
} catch (err) {
console.error("Failed to build guided query:", err);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider surfacing query build errors to the user.

The error handling logs failures to the console but doesn't notify the user. Consider displaying an error message or toast notification when query construction fails, so users understand why their query didn't run.

Example approach:

         } catch (err) {
             console.error("Failed to build guided query:", err);
+            // Consider adding user-facing error notification here
+            // e.g., message.error("Failed to build query. Please check your inputs.");
         }
📝 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
const handleClick = useCallback(() => {
if (null === from) {
console.error("Cannot build guided query: from input is missing");
return;
}
if (null === timestampKey) {
console.error("Cannot build guided query: timestampKey input is missing");
return;
}
try {
const queryString = buildSearchQuery({
booleanExpression: where.trim(),
databaseName: from,
endTimestamp: endTimestamp.unix(),
limitValue: limit,
selectItemList: select.trim(),
sortItemList: orderBy.trim(),
startTimestamp: startTimestamp.unix(),
timestampKey: timestampKey,
});
handlePrestoQuerySubmit({queryString});
} catch (err) {
console.error("Failed to build guided query:", err);
}
const handleClick = useCallback(() => {
if (null === from) {
console.error("Cannot build guided query: from input is missing");
return;
}
if (null === timestampKey) {
console.error("Cannot build guided query: timestampKey input is missing");
return;
}
try {
const queryString = buildSearchQuery({
booleanExpression: where.trim(),
databaseName: from,
endTimestamp: endTimestamp.unix(),
limitValue: limit,
selectItemList: select.trim(),
sortItemList: orderBy.trim(),
startTimestamp: startTimestamp.unix(),
timestampKey: timestampKey,
});
handlePrestoQuerySubmit({queryString});
} catch (err) {
console.error("Failed to build guided query:", err);
// Consider adding user-facing error notification here
// e.g., message.error("Failed to build query. Please check your inputs.");
}
}, [from, timestampKey, where, select, orderBy, startTimestamp, endTimestamp, limit, handlePrestoQuerySubmit]);

Comment on lines +86 to +87
disabled={!isQueryReady ||
searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Apply coding guideline: prefer false == over negation.

Line 86 uses !isQueryReady which violates the coding guideline preferring false == <expression> over !<expression>.

As per coding guidelines, apply this diff:

-                disabled={!isQueryReady ||
+                disabled={false == isQueryReady ||
                     searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING}
📝 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
disabled={!isQueryReady ||
searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING}
disabled={false == isQueryReady ||
searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING}
🤖 Prompt for AI Agents
In
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx
around lines 86-87, the disabled prop uses the negation `!isQueryReady`; replace
that with the coding-guideline preferred form `false == isQueryReady` so the
prop becomes disabled={false == isQueryReady || searchUiState ===
SEARCH_UI_STATE.QUERY_ID_PENDING}; keep the rest of the expression unchanged and
ensure spacing/parentheses match project style.

Comment on lines +57 to +62
updateFrom: (database: Nullable<string>) => void;
updateLimit: (value: number) => void;
updateOrderBy: (items: string) => void;
updateSelect: (items: string) => void;
updateTimestampKey: (key: Nullable<string>) => void;
updateWhere: (expression: string) => void;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

LGTM!

The updater method signatures follow consistent conventions and type-safe patterns. Minor observation: the parameter name database in updateFrom might be slightly misleading since SQL FROM clauses typically reference table names, but this is a pedantic detail.

🤖 Prompt for AI Agents
In components/webui/client/src/pages/SearchPage/SearchState/Presto/index.tsx
around lines 57 to 62 the updateFrom parameter is named `database`, which is
misleading for an SQL FROM clause; rename the parameter to `table` or
`tableName` (and update its Nullable<string> type if needed), update the
function signature and all internal references and call sites across the
codebase to use the new name, and run type checks/compile to ensure no broken
references remain.

Comment thread tools/yscope-dev-utils Outdated
@@ -1 +1 @@
Subproject commit f1202b9c21dac05d77632e4d3e1768b11e0dcf47
Subproject commit b965f19f3e11c548f32bf7ab8e28ff38906be018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Restore exported lint config path

Updating the submodule pointer drops tools/yscope-dev-utils/exports/lint-configs/.rustfmt.toml, which the clp-rust-checks Action copies during formatting. The CI job now fails (cp: cannot stat .../.rustfmt.toml). Please either restore the missing file in the new submodule commit or revert to a commit that still provides it so the formatter can run again.

🧰 Tools
🪛 GitHub Actions: clp-rust-checks

[error] 1-1: cp: cannot stat '/home/runner/work/clp/clp/tools/yscope-dev-utils/exports/lint-configs/.rustfmt.toml': No such file or directory

hoophalab
hoophalab previously approved these changes Oct 1, 2025

@hoophalab hoophalab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm. some nitpicks

Comment thread components/webui/server/settings.json Outdated
Comment thread components/webui/client/src/sql-parser/typings.ts Outdated
Co-authored-by: hoophalab <200652805+hoophalab@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (2)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (2)

29-32: Ensure from and timestampKey are non-empty strings.

The readiness check only guards against null but permits empty strings. If from or timestampKey are empty strings, the query will fail at build time or produce invalid SQL.

Apply this diff to validate non-empty strings:

     const isQueryReady =
         "" !== select.trim() &&
-        null !== from &&
-        null !== timestampKey;
+        null !== from && "" !== from.trim() &&
+        null !== timestampKey && "" !== timestampKey.trim();

88-89: Apply coding guideline: prefer false == over negation.

Line 88 uses !isQueryReady, which violates the coding guideline preferring false == <expression> over !<expression>.

As per coding guidelines.

Apply this diff:

-                disabled={!isQueryReady ||
+                disabled={false === isQueryReady ||
                     searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d1008d and ded4014.

📒 Files selected for processing (3)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (1 hunks)
  • components/webui/client/src/sql-parser/index.ts (2 hunks)
  • components/webui/client/src/sql-parser/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/sql-parser/index.ts
  • components/webui/client/src/sql-parser/typings.ts
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx
🧠 Learnings (1)
📚 Learning: 2025-09-17T22:51:15.765Z
Learnt from: hoophalab
PR: y-scope/clp#1304
File: components/webui/client/src/sql-parser/index.ts:98-115
Timestamp: 2025-09-17T22:51:15.765Z
Learning: In the CLP webui codebase, when designing APIs that accept optional string parameters, developers should omit the value (pass undefined) rather than pass empty strings. The API contract should be clear that empty strings are not valid inputs - only undefined should be used to indicate omission of optional clauses.

Applied to files:

  • components/webui/client/src/sql-parser/typings.ts
🧬 Code graph analysis (1)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (3)
components/webui/client/src/sql-parser/index.ts (1)
  • buildSearchQuery (193-193)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/presto-search-requests.ts (1)
  • handlePrestoQuerySubmit (112-112)
components/webui/client/src/pages/SearchPage/SearchState/typings.ts (1)
  • SEARCH_UI_STATE (31-31)
🔇 Additional comments (4)
components/webui/client/src/sql-parser/index.ts (2)

109-114: LGTM: Undefined checks correctly handle optional parameters.

The guards now properly check for undefined rather than relying on implicit falsy checks, which aligns with the API contract that optional parameters should be undefined rather than empty strings.

Based on learnings.


115-115: LGTM: LIMIT clause is now always appended.

The LIMIT clause is consistently included in all search queries, which aligns with the change making limitValue a required parameter in the typings.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (1)

53-63: Well-structured query building with proper optional parameter handling.

The getUndefinedIfEmpty helper correctly converts empty strings to undefined for optional SQL clauses, aligning with the API contract that optional parameters should be undefined rather than empty strings. The conversion of limit to a string (line 58) properly handles the required limitValue parameter.

Based on learnings.

components/webui/client/src/sql-parser/typings.ts (1)

6-6: No issues with making limitValue required. The only call to buildSearchQuery is in GuidedRunButton.tsx (lines 54–63), and it always supplies a string for limitValue, so requiring it poses no breakages.

Comment thread components/webui/client/src/sql-parser/index.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (3)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (3)

29-32: Verify that from and timestampKey cannot be empty strings.

The readiness check validates that from and timestampKey are not null, but doesn't verify they are non-empty strings. If these can be empty strings, the query will fail at build time. Consider adding trim checks: from?.trim() !== "" and timestampKey?.trim() !== "".


68-70: Consider surfacing query build errors to the user.

The error handling logs failures to the console but doesn't notify the user. Consider displaying an error message or toast notification when query construction fails.


90-91: Apply coding guideline: prefer false == over negation.

Line 90 uses !isQueryReady which violates the coding guideline preferring false == <expression> over !<expression>.

As per coding guidelines, apply this diff:

-                disabled={!isQueryReady ||
+                disabled={false == isQueryReady ||
                     searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ded4014 and 3a8da52.

📒 Files selected for processing (1)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (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/SqlSearchButton/RunButton/GuidedRunButton.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). (5)
  • GitHub Check: package-image
  • GitHub Check: rust-checks (ubuntu-24.04)
  • GitHub Check: rust-checks (macos-15)
  • GitHub Check: rust-checks (ubuntu-22.04)
  • GitHub Check: lint-check (macos-15)

return (
<Tooltip title={tooltipTitle}>
<Button
className={styles["runButton"] || ""}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Simplify className assignment.

The || "" fallback is unnecessary since className accepts undefined.

Apply this diff:

-                className={styles["runButton"] || ""}
+                className={styles["runButton"]}
📝 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
className={styles["runButton"] || ""}
className={styles["runButton"]}
🤖 Prompt for AI Agents
In
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx
around line 85, the className is assigned with an unnecessary fallback using `||
""`; remove the fallback so className is set directly to styles["runButton"]
(allowing undefined) to simplify the code.

@davemarco

Copy link
Copy Markdown
Contributor Author

@hoophalab rereview

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (4)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (4)

29-32: Empty string validation still needed for from and timestampKey.

The readiness check validates select is non-empty but only checks that from and timestampKey are not null. Empty strings would pass this check but cause query build failures. Consider updating to also verify these fields are non-empty trimmed strings.

Apply this diff to strengthen the validation:

-    const isQueryReady =
-        "" !== select.trim() &&
-        null !== from &&
-        null !== timestampKey;
+    const isQueryReady =
+        "" !== select.trim() &&
+        null !== from &&
+        "" !== from.trim() &&
+        null !== timestampKey &&
+        "" !== timestampKey.trim();

68-70: Consider surfacing query build errors to the user.

Query construction failures are logged to the console but not shown to users. Consider displaying an error notification so users understand why their query didn't run.


85-85: Simplify className assignment.

The || "" fallback is unnecessary since className accepts undefined.

Apply this diff:

-                className={styles["runButton"] || ""}
+                className={styles["runButton"]}

90-91: Apply coding guideline: prefer false == over negation.

The disabled prop uses !isQueryReady which violates the coding guideline preferring false == <expression> over !<expression>.

As per coding guidelines, apply this diff:

-                disabled={!isQueryReady ||
+                disabled={false == isQueryReady ||
                     searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a8da52 and e31a20f.

📒 Files selected for processing (1)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (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/SqlSearchButton/RunButton/GuidedRunButton.tsx
🧬 Code graph analysis (1)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (3)
components/webui/client/src/sql-parser/index.ts (1)
  • buildSearchQuery (195-195)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/presto-search-requests.ts (1)
  • handlePrestoQuerySubmit (112-112)
components/webui/client/src/pages/SearchPage/SearchState/typings.ts (1)
  • SEARCH_UI_STATE (31-31)
⏰ 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). (6)
  • GitHub Check: package-image
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: lint-check (macos-15)
  • GitHub Check: rust-checks (ubuntu-22.04)
  • GitHub Check: rust-checks (ubuntu-24.04)
  • GitHub Check: rust-checks (macos-15)
🔇 Additional comments (3)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/GuidedRunButton.tsx (3)

1-14: LGTM!

Import statements are clean and all dependencies are utilized appropriately in the component.


34-36: LGTM!

Tooltip logic correctly follows the coding guideline by using false === isQueryReady instead of negation.


100-100: LGTM!

Component export is correct.

hoophalab
hoophalab previously approved these changes Oct 1, 2025

@hoophalab hoophalab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm. Validation: the query is correctly submitted to the server.
How about this title

feat(webui): Set up guided UI for query submission; Remove testing inputs.

@hoophalab hoophalab requested a review from junhaoliao October 1, 2025 20:33
@hoophalab hoophalab dismissed their stale review October 1, 2025 20:51

more comments

@junhaoliao junhaoliao left a comment

Copy link
Copy Markdown
Member

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

hoophalab
hoophalab approved these changes Oct 1, 2025
@davemarco davemarco changed the title feat(webui): Setup guided UI to submit queries to server; remove inputs from testing. feat(webui): Set up guided UI for query submission; Remove testing inputs. Oct 2, 2025
@davemarco davemarco merged commit 3f193e2 into y-scope:main Oct 2, 2025
23 checks passed
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
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