Skip to content

feat: refine CLI workflows for datasets, queries, auth, and help#100

Merged
nitisht merged 2 commits into
parseablehq:mainfrom
pratik50:fix/revampCmd
Jun 4, 2026
Merged

feat: refine CLI workflows for datasets, queries, auth, and help#100
nitisht merged 2 commits into
parseablehq:mainfrom
pratik50:fix/revampCmd

Conversation

@pratik50
Copy link
Copy Markdown
Contributor

@pratik50 pratik50 commented Jun 4, 2026

Summary

This PR improves the CLI experience across dataset management, SQL/PromQL workflows, auth/profile handling, and help.

Dataset management

  • Adds telemetry-aware dataset creation:
    • pb dataset add <name> opens a themed picker for logs, metrics, or traces
    • pb dataset add <name> --type logs|metrics|traces supports scripts
  • Sends the correct telemetry headers when creating metrics/traces datasets.
  • Adds a guarded remove flow:
    • pb dataset remove <name> --type logs|metrics|traces
    • refuses deletion if the existing dataset type does not match
  • Uses Prism home dataset API for type-aware dataset listing.
  • Shows dataset type correctly in dataset info.
  • Adds Linux-style aliases:
    • pb dataset ls
    • pb dataset stat

SQL workflow

  • Moves SQL to the top-level pb sql flow.
  • Adds pb sql save <query> for saving queries directly.
  • Adds default LIMIT 500 when a SQL query has no top-level limit.
  • Keeps user-provided limits unchanged.
  • Improves SQL query normalization for quoted streams/fields.
  • Improves saved query list behavior for empty/error responses.
  • Adds pb sql ls alias.

SQL interactive UI

  • Reworks the SQL interactive layout around editor, time range, dataset, columns, and results.
  • Adds an inline columns drawer with filtering and keyboard navigation.
  • Adds UTC/local time display controls.
  • Updates result timestamp rendering to follow the selected time display mode.
  • Improves time range formatting and picker behavior.
  • Keeps result/table area responsive when columns are hidden or unavailable.

PromQL workflow

  • Moves PromQL to the top-level pb promql run flow.
  • Updates examples/help text away from the old query subcommand path.
  • Reorders pb promql --help commands by priority, with run first.
  • Adds pb promql ps alias for active-queries.

PromQL interactive UI

  • Applies the same pane naming and border treatment as SQL.
  • Adds UTC/local time display support for PromQL results and charts.
  • Fixes time picker behavior for range and instant modes.
  • Prevents invalid/future time selections where applicable.
  • Keeps time changes cancellable until explicitly confirmed.

Auth and profiles

  • Validates pb login credentials before saving a profile.
  • Shows a clear login failure when credentials are invalid.
  • Improves pb logout confirmation messaging.
  • Handles default profile fallback after logout:
    • auto-selects the only remaining profile
    • opens a picker when multiple profiles remain
    • supports recovery when no default profile is currently set
  • Makes auth/runtime errors cleaner by avoiding usage spam on list commands.

Users and roles

  • Improves pb user list and pb role list readability with aligned table output.
  • Adds muted dotted leaders so users/roles are easier to scan.
  • Adds Linux-style aliases:
    • pb user ls
    • pb role ls

Command help and aliases

  • Adds grouped root help output.
  • Adds Linux-style aliases:
    • pb profile ls
    • pb dataset ls
    • pb dataset stat
    • pb user ls
    • pb role ls
    • pb sql ls
    • pb promql ps
  • Keeps existing command names intact.

Summary by CodeRabbit

  • New Features

    • Dataset-type aware commands with interactive type selection.
    • Save and manage SQL queries via new save/apply commands.
    • Short ls aliases added for profile, user, role, and saved-query listing.
    • Time-display mode (UTC/local) toggle across PromQL and SQL UIs.
  • Improvements

    • Consolidated query UX under pb sql and updated CLI examples.
    • Interactive PromQL defaults and improved SQL interactive behavior.
    • Confirm-on-logout and smarter default-profile handling.
    • Better table/text rendering and clearer auth error messages.
  • Tests

    • Expanded unit tests for datasets, SQL normalization, PromQL, time inputs, and status handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR renames and reorganizes query commands under sql/promql, adds typed dataset fetching and dataset-type-aware CLI flows, introduces local/UTC time display modes and segmented datetime editing in TUIs, improves SQL quoting and default LIMIT insertion, rewrites fetch streaming/error handling, and refactors CLI help/analytics and list/logout/status UX.

Changes

Datasets, Picker, and Dataset Commands

Layer / File(s) Summary
Dataset client and names-by-type
pkg/datasets/datasets.go, pkg/datasets/datasets_test.go
Adds typed dataset client: FetchHomeDatasets and NamesByType to fetch and filter home datasets by type.
Dataset CLI and picker integration
cmd/dataset.go, cmd/dataset_test.go, pkg/ui/views/picker.go
dataset add/info/remove/list now use dataset-type resolution and validation, support --type and interactive type selection, and picker uses FetchHomeDatasets.

SQL CLI, Saving, Quoting, Limit, and Fetch

Layer / File(s) Summary
SQL command surface and saving
cmd/query.go, cmd/query_test.go, cmd/queryList.go, cmd/queryList_test.go
Introduces pb sql run + pb sql save, moves saved-query list/apply examples to pb sql list, and tightens saved-query apply guards.
SQL normalization and default LIMIT
cmd/query.go, pkg/model/query.go, pkg/model/query_test.go
Implements context-aware identifier quoting for tables/fields, ensureDefaultLimit/ensureDefaultSQLLimit to inject LIMIT 500 at top-level, and test coverage for normalization and limit behavior.
Fetch streaming and error preview
cmd/query.go
Rewrites fetchData to manage spinner, detect non-200 with limited-body preview, stream JSON pretty-printing or text output, and special-case empty JSON arrays.

TUI: SQL and PromQL Controls, Time Editing, and Display Modes

Layer / File(s) Summary
SQL TUI: controls, columns drawer, time overlay
pkg/model/query.go, pkg/model/query_test.go
Adds timeRangeEdit, columnsDrawerOpen, merged SQL controls pane, column insertion UI, and display-mode-aware timestamp rendering.
PromQL TUI: time staging and display mode plumbing
pkg/model/promql.go, pkg/model/promql_test.go
Stages PromQL time edits, threads TimeDisplayMode through fetch/row/chart formatting, refactors controls/results panes, and uses typed metrics datasets.
Time input and datetime segment editing
pkg/model/timeinput.go, pkg/model/timeinput_test.go, pkg/model/datetime/datetime.go
Adds TimeDisplayMode (Local/UTC), display-mode UI, segmented datetime cursor navigation and Up/Down adjustments, validation, and comprehensive tests.

CLI UX, Help, Analytics, and List Output

Layer / File(s) Summary
PromQL CLI, help, and interactive defaults
cmd/promql.go, cmd/promql_test.go
Adds promql top-level command with custom help, updates examples to pb promql ..., and uses 10m interactive --from default when not set.
Main wiring, grouped help, analytics hooks
main.go
Moves SQL commands under sql, wires PromqlCmd top-level, replaces wait-group analytics with async postRunAnalytics, and installs grouped root help renderer.
List commands, logout, and status styling
cmd/role.go, cmd/user.go, cmd/profile.go, cmd/logout.go, cmd/status.go, cmd/style.go, cmd/status_test.go
Adds ls aliases, replaces bullet lists with styled tables, aggregates per-item fetch errors, adds logout confirmation and profile selection, maps auth errors in status, and adds a standard rule style.

Documentation

Layer / File(s) Summary
README updates
README.md
Updates CLI examples: replaces pb query ... with pb sql ... and pb query promql ... with pb promql ... across SQL and PromQL sections.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • parseablehq/pb#97: Introduces dataset picker/spotlight behavior that this PR extends by switching picker to the new FetchHomeDatasets path.

Suggested reviewers

  • nitisht

Poem

🐰 A CLI grows with types and modes—
SQL now flows through ordered rows,
Time displays both light and dark,
PromQL charts hit their mark,
Help text blooms, profiles dance,
Your queries get a second chance!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.31% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: refinements to CLI workflows across datasets, queries (SQL), auth/profiles, and help system. It reflects the primary objectives of the PR and is concise and specific.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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

Copy link
Copy Markdown

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

Caution

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

⚠️ Outside diff range comments (1)
cmd/query.go (1)

271-285: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Don't rewrite every dotted identifier into a quoted field.

The hasDot branch now turns any a.b token into "a.b". That breaks valid qualified references like SELECT a.status FROM logs a and schema-qualified names, because those stop being parsed as table_or_alias.column.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/query.go` around lines 271 - 285, The current loop sets hasDot and then
quotes the whole dotted token (identifier) when hasDot is true, which turns
qualified names like a.b into a single quoted field; change the logic so dotted
identifiers are NOT automatically quoted. Concretely, remove hasDot as a trigger
for quoting and only call the quoting branch when
shouldQuoteIdentifier(identifier, query, k) returns true (or when an individual
segment requires quoting); keep the existing loop that builds identifier but
ensure you do not wrap the entire dotted string in quotes — instead leave a.b
unchanged (or quote individual segments if you detect they need quoting) while
preserving i = k and existing tokenization.
🧹 Nitpick comments (2)
cmd/promql.go (1)

142-161: ⚡ Quick win

Document the hardcoded command order or consider dynamic ordering.

The order slice hardcodes the list of subcommands for help rendering. If a new subcommand is added to PromqlCmd but not included in this slice, it will be silently omitted from help output, which could confuse users and developers.

📝 Options to improve maintainability

Option 1: Add a comment documenting the maintenance requirement:

+	// IMPORTANT: When adding new subcommands to PromqlCmd, update this order slice
+	// to ensure they appear in help output.
 	order := []string{"run", "labels", "label-values", "series", "cardinality", "tsdb", "active-queries"}

Option 2: Generate the order dynamically from the actual commands (falling back to default order for known commands, appending others):

// Known command order for help display
knownOrder := []string{"run", "labels", "label-values", "series", "cardinality", "tsdb", "active-queries"}
order := make([]string, 0, len(cmd.Commands()))
seen := make(map[string]bool)

// Add known commands in preferred order
for _, name := range knownOrder {
	if _, exists := commandsByName[name]; exists {
		order = append(order, name)
		seen[name] = true
	}
}

// Append any additional commands not in knownOrder
for name := range commandsByName {
	if !seen[name] {
		order = append(order, name)
	}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/promql.go` around lines 142 - 161, The help display currently uses a
hardcoded order slice named order in the PromqlCmd help rendering (the loop over
order and the commandsByName map), which will omit new subcommands; replace the
hardcoded order with a dynamically built slice: define knownOrder (the preferred
sequence:
"run","labels","label-values","series","cardinality","tsdb","active-queries"),
build order by appending existing names from knownOrder found in commandsByName
(marking them in a seen map), then append any remaining names from
commandsByName not in seen; use that order in the existing fmt.Fprintf loop so
new subcommands are included automatically, or alternatively add a clear comment
above the current order variable explaining the maintenance requirement if you
prefer to keep the static list.
cmd/queryList_test.go (1)

12-23: ⚡ Quick win

Restore os.Stdout with t.Cleanup.

This test mutates a process-global. If anything fails before Line 22, later tests inherit the pipe and start failing for unrelated reasons. Register the restore/close logic before swapping stdout.

Suggested cleanup pattern
  oldStdout := os.Stdout
  r, w, err := os.Pipe()
  if err != nil {
  	t.Fatalf("pipe failed: %v", err)
  }
+ t.Cleanup(func() {
+ 	os.Stdout = oldStdout
+ 	_ = w.Close()
+ 	_ = r.Close()
+ })
  os.Stdout = w
@@
- w.Close()
- os.Stdout = oldStdout
+ _ = w.Close()
  io.Copy(&output, r)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/queryList_test.go` around lines 12 - 23, The test mutates os.Stdout and
currently restores it after the call, risking leaks if the test fails; register
cleanup handlers with t.Cleanup before swapping so restoration/closing always
runs: create the pipe (r,w), save oldStdout, then call t.Cleanup to close w, r
and restore os.Stdout, then assign os.Stdout = w and call
savedQueryToPbQuery(...). Reference the existing symbols oldStdout, r, w and the
function savedQueryToPbQuery to locate where to add the t.Cleanup registrations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/logout.go`:
- Around line 120-139: confirmLogout currently always reads stdin which breaks
non-interactive/scripted use; change its signature to accept a force (or yes)
bool (e.g., confirmLogout(profileName, profileURL string, force bool)),
short-circuit and return true immediately when force is true, and before reading
stdin detect whether stdin is a terminal (use os.Stdin.Fd() with
golang.org/x/term.IsTerminal); if stdin is not interactive and force is false,
print a clear message to stderr advising to use --yes/--force and return false
(do not block reading), otherwise proceed with the existing interactive prompt
and parsing logic.

In `@cmd/query.go`:
- Around line 522-555: Replace the full-buffering read of resp.Body (io.ReadAll
+ json.Unmarshal/string(respBody)) with a streaming approach: use a bufio.Reader
(wrapping resp.Body) and Peek/ReadByte to detect empty/whitespace-only responses
and whether the body starts with '[' for the "[]"/no-rows check, and for
non-JSON output simply stream the body to stdout with io.Copy to avoid
buffering; for JSON output use json.Decoder to decode and stream/pretty-print
entries as they arrive (or write using json.Encoder/Indent per item) instead of
json.Unmarshal; for non-200 responses capture only a small preview (io.ReadAll
of io.LimitReader(resp.Body, N)) for the error message rather than reading the
entire body; update code around startSpinner/stopSpinner, the resp variable
handling, and the blocks that reference outputFormat and json.Unmarshal to use
the streaming logic.

In `@cmd/role.go`:
- Around line 248-252: The current RunE prints the role table via
printRoleTable(roles, roleResponses) but still returns success even when some
roleResponses[idx].err are non-nil; collect all per-role errors from
roleResponses (referencing roles and roleResponses) into a single aggregated
error string (you can continue appending to cmd.Annotations["errors"] or build a
local buffer), and after rendering the table return a non-nil error (e.g.,
errors.New or fmt.Errorf) that includes the aggregated message so callers and
scripts receive a failing exit code; adjust RunE to check the aggregated error
and return it instead of nil.

In `@cmd/status.go`:
- Around line 51-55: When the status check fails the code currently prints a
friendly message then returns nil; change that to return a non-nil error so the
process exits with a non-zero code. In the error branch that prints "✗ Not
connected" and the output from statusErrorMessage(err), return the original err
(or wrap it with fmt.Errorf("status check failed: %w", err)) instead of nil so
callers get a non-zero exit status; reference the existing err variable and the
statusErrorMessage helper when making the change.

In `@cmd/user.go`:
- Around line 351-359: The code prints user role rows but always returns nil and
sets cmd.Annotations["error"]="none" even if some per-user fetchUserRoles calls
failed; change the control flow to detect failures in the roleResponses slice
after calling printUserRoleTable(users, roleResponses), aggregate any row-level
errors (e.g. count failures and join their messages), set
cmd.Annotations["error"] to a non-success value and return a non-nil error
(fmt.Errorf with summary) instead of nil; apply this logic in both the
outputFormat == "text" branch and the later branch so pb user ls fails when any
fetchUserRoles failed.

In `@main.go`:
- Around line 65-72: The analytics call in postRunAnalytics currently starts
analytics.PostRunAnalytics in a detached goroutine which can be killed when main
returns (after cli.Execute()), causing dropped events; change postRunAnalytics
to ensure the analytics work completes before process exit—either call
analytics.PostRunAnalytics synchronously (remove the leading "go") or coordinate
with main/cli.Execute() using a shared sync mechanism (e.g., waitgroup or
channel) so main waits for the PostRunAnalytics call to finish; update the
postRunAnalytics function and the main/cli.Execute() exit path to use that
synchronization, referencing postRunAnalytics and analytics.PostRunAnalytics
(and main/cli.Execute()) so callers wait for completion.

In `@pkg/model/query.go`:
- Around line 1466-1507: The hasTopLevelSQLLimit function currently skips quotes
and parentheses but treats text inside SQL comments as code; update
hasTopLevelSQLLimit to ignore SQL comments by either pre-stripping comments or
adding comment-skip logic inside the scanner: when you see "--" skip until
end-of-line and when you see "/*" skip until the closing "*/" (respecting EOF)
so that isSQLLimitTokenAt is never invoked for tokens inside comments; keep
existing handling for quotes and parentheses and call isSQLLimitTokenAt only
when not inside a comment.

In `@pkg/model/timeinput.go`:
- Around line 337-363: renderTimeDisplayMode currently builds localLabel from
time.Now(), which can mismatch displayed timestamps across DST boundaries;
change it to derive the offset from the active/selected timestamp instead.
Update renderTimeDisplayMode to accept (or read) the currently selected time
(e.g., selectedTime time.Time or m.SelectedTime) and replace
time.Now().Format("UTC-07:00") with selectedTime.Format("UTC-07:00") when
composing localLabel; keep the rest of the logic (labelStyle, active/inactive
styles, TimeDisplayUTC handling) unchanged so the label reflects the same
instant shown in the results.
- Around line 286-297: The end/evaluation time pane is always passing a fixed
“show now” flag, so the [NOW] badge appears even for historical values. Update
the time input rendering around renderTimePickerInputBox in timeinput.go to
derive the badge from the actual selected end time (for both regular range and
instant evaluation modes) instead of hard-coding it, and make the same change
anywhere else the end box is built in the referenced render block.

In `@README.md`:
- Around line 85-92: The README's SQL examples block omits the new interactive
save command; add a concise example demonstrating the new top-level command
syntax "pb sql save <query>" (and show optional flags like --from, --to,
--save-as) alongside the existing "pb sql run" examples so users can discover
the "pb sql save" flow; update the SQL examples block to include at least one
line such as: pb sql save "SELECT * FROM backend WHERE status = 500" --from=1h
--save-as=server-errors and mention that it creates a saved query in the same
namespace as the shown --save-as usage.

---

Outside diff comments:
In `@cmd/query.go`:
- Around line 271-285: The current loop sets hasDot and then quotes the whole
dotted token (identifier) when hasDot is true, which turns qualified names like
a.b into a single quoted field; change the logic so dotted identifiers are NOT
automatically quoted. Concretely, remove hasDot as a trigger for quoting and
only call the quoting branch when shouldQuoteIdentifier(identifier, query, k)
returns true (or when an individual segment requires quoting); keep the existing
loop that builds identifier but ensure you do not wrap the entire dotted string
in quotes — instead leave a.b unchanged (or quote individual segments if you
detect they need quoting) while preserving i = k and existing tokenization.

---

Nitpick comments:
In `@cmd/promql.go`:
- Around line 142-161: The help display currently uses a hardcoded order slice
named order in the PromqlCmd help rendering (the loop over order and the
commandsByName map), which will omit new subcommands; replace the hardcoded
order with a dynamically built slice: define knownOrder (the preferred sequence:
"run","labels","label-values","series","cardinality","tsdb","active-queries"),
build order by appending existing names from knownOrder found in commandsByName
(marking them in a seen map), then append any remaining names from
commandsByName not in seen; use that order in the existing fmt.Fprintf loop so
new subcommands are included automatically, or alternatively add a clear comment
above the current order variable explaining the maintenance requirement if you
prefer to keep the static list.

In `@cmd/queryList_test.go`:
- Around line 12-23: The test mutates os.Stdout and currently restores it after
the call, risking leaks if the test fails; register cleanup handlers with
t.Cleanup before swapping so restoration/closing always runs: create the pipe
(r,w), save oldStdout, then call t.Cleanup to close w, r and restore os.Stdout,
then assign os.Stdout = w and call savedQueryToPbQuery(...). Reference the
existing symbols oldStdout, r, w and the function savedQueryToPbQuery to locate
where to add the t.Cleanup registrations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d37e24b-e04f-427e-9512-c364f4ce4bc9

📥 Commits

Reviewing files that changed from the base of the PR and between 11074ca and b8f8d38.

📒 Files selected for processing (27)
  • README.md
  • cmd/dataset.go
  • cmd/dataset_test.go
  • cmd/logout.go
  • cmd/profile.go
  • cmd/promql.go
  • cmd/promql_test.go
  • cmd/query.go
  • cmd/queryList.go
  • cmd/queryList_test.go
  • cmd/query_test.go
  • cmd/role.go
  • cmd/status.go
  • cmd/status_test.go
  • cmd/style.go
  • cmd/user.go
  • main.go
  • pkg/datasets/datasets.go
  • pkg/datasets/datasets_test.go
  • pkg/model/datetime/datetime.go
  • pkg/model/promql.go
  • pkg/model/promql_test.go
  • pkg/model/query.go
  • pkg/model/query_test.go
  • pkg/model/timeinput.go
  • pkg/model/timeinput_test.go
  • pkg/ui/views/picker.go

Comment thread cmd/logout.go
Comment thread cmd/query.go Outdated
Comment thread cmd/role.go
Comment thread cmd/status.go Outdated
Comment thread cmd/user.go
Comment thread main.go
Comment thread pkg/model/query.go
Comment thread pkg/model/timeinput.go
Comment thread pkg/model/timeinput.go Outdated
Comment thread README.md
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
pkg/model/query.go (1)

1699-1744: 🏗️ Heavy lift

SQL normalization helpers are duplicated between cmd/query.go and pkg/model/query.go.

quoteUnsafeSQLTableNames here mirrors quoteStreamNames in cmd/query.go. Similarly, quoteUnsafeSQLFieldNames mirrors quoteFieldsWithDots, and the ensureDefaultSQLLimit/hasTopLevelSQLLimit/endsInSQLLineComment functions are near-identical copies.

Consider extracting these into a shared pkg/sql package to avoid maintenance divergence.


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3468afeb-f196-4c2a-b2db-45e6f18d4c1b

📥 Commits

Reviewing files that changed from the base of the PR and between b8f8d38 and 96061e0.

📒 Files selected for processing (12)
  • README.md
  • cmd/query.go
  • cmd/queryList_test.go
  • cmd/query_test.go
  • cmd/role.go
  • cmd/status.go
  • cmd/user.go
  • pkg/analytics/analytics.go
  • pkg/model/query.go
  • pkg/model/query_test.go
  • pkg/model/timeinput.go
  • pkg/model/timeinput_test.go
✅ Files skipped from review due to trivial changes (2)
  • pkg/analytics/analytics.go
  • README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/model/timeinput_test.go
  • cmd/role.go

@pratik50
Copy link
Copy Markdown
Contributor Author

pratik50 commented Jun 4, 2026

🧹 Nitpick comments (1)

pkg/model/query.go (1)> 1699-1744: 🏗️ Heavy lift

SQL normalization helpers are duplicated between cmd/query.go and pkg/model/query.go.
quoteUnsafeSQLTableNames here mirrors quoteStreamNames in cmd/query.go. Similarly, quoteUnsafeSQLFieldNames mirrors quoteFieldsWithDots, and the ensureDefaultSQLLimit/hasTopLevelSQLLimit/endsInSQLLineComment functions are near-identical copies.
Consider extracting these into a shared pkg/sql package to avoid maintenance divergence.

ℹ️ Review info

--This is manjor refactor so will need to do in next version drop or cleanUp!

@nitisht nitisht merged commit a281ab5 into parseablehq:main Jun 4, 2026
3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants