Skip to content

Dev#161

Merged
robertjbass merged 2 commits intomainfrom
dev
Apr 3, 2026
Merged

Dev#161
robertjbass merged 2 commits intomainfrom
dev

Conversation

@robertjbass
Copy link
Copy Markdown
Owner

@robertjbass robertjbass commented Apr 3, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Fixed spindb query --json output to return the complete result object (columns, rows, rowCount, commandTag) instead of only rows.
    • Improved command tag recognition for PostgreSQL-compatible engines to correctly handle DDL and write commands (INSERT, UPDATE, CREATE TABLE, etc.) instead of treating them as CSV headers.
  • Chores

    • Version bump to 0.47.14.

Detect PostgreSQL command tags (INSERT, UPDATE, DELETE, CREATE TABLE, etc.)
in parseCSVToQueryResult instead of misinterpreting them as CSV headers.
JSON mode now outputs { columns, rows, rowCount, commandTag } instead of
just the rows array.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

📝 Walkthrough

Walkthrough

Version 0.47.14 release modifying JSON output semantics for spindb query --json to return the complete result object (columns, rows, rowCount, commandTag) instead of only rows, and enhancing CSV query parsing to recognize PostgreSQL-style command tags across all PG-wire engines.

Changes

Cohort / File(s) Summary
Type & Output Changes
types/index.ts, cli/commands/query.ts
Extended QueryResult type with optional commandTag field. Modified --json output to serialize full result object including columns, rows, rowCount, commandTag (when present), and executionTimeMs (when defined) instead of only rows array.
CSV Query Parsing
core/query-parser.ts
Added PostgreSQL command-tag detection via regex pattern to recognize write/DDL command tags (e.g., INSERT 0 1, CREATE TABLE, UPDATE 3) from psql --csv output; returns empty tabular result with rowCount inferred from tag numeric component and commandTag field.
Version & Documentation
package.json, CHANGELOG.md, CLAUDE.md
Incremented package version to 0.47.14; documented fixes for --json output semantics and command-tag recognition across PostgreSQL, CockroachDB, DuckDB, SQLite, and QuestDB engines; updated credential provisioning guidance for MongoDB and QuestDB.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hops joyfully through 0.47.14's release,
Command tags recognized in parsing peace,
JSON results bloom with columns and rows,
Full QueryResult objects—watch knowledge grow!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The pull request title 'Dev' is vague and does not convey meaningful information about the changeset, which includes query result serialization, PostgreSQL command-tag detection, type extensions, and version bump. Provide a descriptive title summarizing the main change, such as 'Enrich spindb query --json output with full result object and command-tag support' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CLAUDE.md`:
- Around line 231-235: The docs claim that `spindb create` provisions
engine-specific credentials (e.g., MongoDB admin user, QuestDB creds) but the
code paths (the engine startup/load routines for MongoDB and QuestDB) only load
configs at start and do not provision during `create`; either update the
CLAUDE.md section to state this is planned work (remove/annotate the claim about
create-time provisioning and SETUP_FIRST_ENGINES removal) or implement actual
provisioning in the CLI: add create-time handlers invoked by `spindb create`
that write MongoDB admin credentials and QuestDB config files (matching the
formats used by the startup code) so that `spindb start` can read them
immediately; reference the `spindb create`/`spindb start` commands and the
SETUP_FIRST_ENGINES behavior when making the doc or code change.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: af989e2b-f1ce-4532-a11e-901c620dd6b7

📥 Commits

Reviewing files that changed from the base of the PR and between 048b3c6 and 874af36.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • CLAUDE.md
  • cli/commands/query.ts
  • core/query-parser.ts
  • package.json
  • types/index.ts

Comment on lines +231 to +235
**Current state:** `spindb create` + `spindb start` are separate steps. Some engines (SurrealDB, InfluxDB, Weaviate, MongoDB, QuestDB) need config files (credential files, admin tokens, auth env) written BEFORE the first `start`. Layerbase Cloud's `setup-database.sh` fills this gap via `SETUP_FIRST_ENGINES`.

**Target:** `spindb create --username X --password Y` writes all engine-specific config files during create (admin-token.json for InfluxDB, weaviate.env for Weaviate, `--user/--pass` persistence for SurrealDB). Then `spindb start` reads the config and works correctly from the first call.
**Target:** `spindb create --username X --password Y` writes all engine-specific config files during create (admin-token.json for InfluxDB, weaviate.env for Weaviate, `--user/--pass` persistence for SurrealDB, admin user for MongoDB). Then `spindb start` reads the config and works correctly from the first call.

**Impact:** Eliminates `SETUP_FIRST_ENGINES` / `setupHandlesStart` in Layerbase Cloud. Simplifies `setup-database.sh` to just `spindb create --username X --password Y --bind 127.0.0.1` + health check.
**Impact:** Eliminates `SETUP_FIRST_ENGINES` in Layerbase Cloud. Simplifies `setup-database.sh` to just `spindb create --username X --password Y --bind 127.0.0.1` + health check.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Doc behavior does not match current MongoDB/QuestDB implementation

This section states create-time credential/config provisioning (including MongoDB admin user creation) as current/target behavior, but the referenced engine code paths only show credential loading and startup, not provisioning during create. Please either update docs to mark this as planned work or land the implementation before documenting it as expected behavior.

Suggested doc correction
-**Current state:** `spindb create` + `spindb start` are separate steps. Some engines (SurrealDB, InfluxDB, Weaviate, MongoDB, QuestDB) need config files (credential files, admin tokens, auth env) written BEFORE the first `start`. Layerbase Cloud's `setup-database.sh` fills this gap via `SETUP_FIRST_ENGINES`.
+**Current state:** `spindb create` + `spindb start` are separate steps. Some engines (SurrealDB, InfluxDB, Weaviate) need config files (credential files, admin tokens, auth env) written BEFORE the first `start`. MongoDB and QuestDB currently load saved/default credentials during runtime but do not yet provision create-time auth artifacts. Layerbase Cloud's `setup-database.sh` fills this gap via `SETUP_FIRST_ENGINES`.
 
-**Target:** `spindb create --username X --password Y` writes all engine-specific config files during create (admin-token.json for InfluxDB, weaviate.env for Weaviate, `--user/--pass` persistence for SurrealDB, admin user for MongoDB). Then `spindb start` reads the config and works correctly from the first call.
+**Target:** `spindb create --username X --password Y` writes all engine-specific config files during create (admin-token.json for InfluxDB, weaviate.env for Weaviate, `--user/--pass` persistence for SurrealDB, and planned MongoDB/QuestDB create-time auth provisioning). Then `spindb start` reads the config and works correctly from the first call.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 231 - 235, The docs claim that `spindb create`
provisions engine-specific credentials (e.g., MongoDB admin user, QuestDB creds)
but the code paths (the engine startup/load routines for MongoDB and QuestDB)
only load configs at start and do not provision during `create`; either update
the CLAUDE.md section to state this is planned work (remove/annotate the claim
about create-time provisioning and SETUP_FIRST_ENGINES removal) or implement
actual provisioning in the CLI: add create-time handlers invoked by `spindb
create` that write MongoDB admin credentials and QuestDB config files (matching
the formats used by the startup code) so that `spindb start` can read them
immediately; reference the `spindb create`/`spindb start` commands and the
SETUP_FIRST_ENGINES behavior when making the doc or code change.

@robertjbass robertjbass merged commit 2c5a036 into main Apr 3, 2026
137 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.

1 participant