Skip to content

Remove deprecated CSV/JSON storage options - #214

Merged
panarch merged 2 commits into
mainfrom
remove_csv_json_storage
Sep 19, 2025
Merged

panarch merged 2 commits into
mainfrom
remove_csv_json_storage

Conversation

@panarch

@panarch panarch commented Sep 19, 2025 •

Copy link
Copy Markdown
Member

Summary

  • drop CSV/JSON entry points from the TUI, core entry state, and proxy server CLI, promoting Proxy to key [5]
  • delete the local backend implementations for CSV/JSON so we no longer pull in gluesql-json-storage
  • update README/help text and insta snapshots to reflect the reduced storage matrix

Testing

  • cargo fmt
  • cargo clippy --all-targets -- -D warnings
  • cargo test
  • cargo test -p glues --test entry
  • cargo coverage --no-report

Summary by CodeRabbit

  • Refactor
    • Removed CSV/JSON storage backends across app, CLI, and server. Supported options are Memory, File, Git, Mongo, plus Proxy (remote backend).
  • Documentation
    • Updated README and in-app help to remove CSV/JSON references, add Proxy usage instructions, and reflect new menu numbering.
  • Style
    • Entry menu now displays uniform colors; CSV/JSON options removed; Proxy repositioned to [5].
  • Tests
    • Updated TUI entry test to validate Proxy prompt.
  • Chores
    • Disabled JSON storage feature in build configuration; updated package descriptions.

@coderabbitai

coderabbitai Bot commented Sep 19, 2025 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

CSV/JSON storage backends were removed across core, server CLI, TUI, tests, and documentation. Features disabling JSON storage were updated. Entry events, constructors, enum variants, UI menu items, help text, and tests were adjusted accordingly. Proxy remains available and is repositioned in the TUI. Git, File, Memory, and Mongo backends persist.

Changes

Cohort / File(s) Summary
Workspace feature flags
Cargo.toml
Removed gluesql-json-storage from workspace dependency features; default-features = false unchanged.
Docs
README.md
Removed CSV/JSON mentions and usage; updated supported backends list; adjusted TUI menu numbering; revised roadmap phrasing.
Core backend removal
core/src/backend/local.rs, core/src/event.rs, core/src/state/entry.rs
Dropped CSV/JSON: removed enum variants, constructors (Db::csv, Db::json), and EntryEvent::OpenCsv/OpenJson; corresponding state handling deleted.
Server CLI
server/src/main.rs
Removed StorageCommand::Csv/Json and related build_backend match arms.
TUI actions and context
tui/src/action.rs, tui/src/context/entry.rs
Deleted TuiAction::OpenCsv/OpenJson, inputs, and constants; updated menu to exclude CSV/JSON; PROXY relabeled to “[5] Proxy”.
TUI visuals and help
tui/src/views/body/entry.rs, tui/src/views/dialog/help.rs, tui/Cargo.toml
Unified menu item coloring; replaced CSV/JSON help with Proxy instructions; updated package description to mention proxy instead of CSV/JSON.
Tests
tui/tests/entry.rs
Renamed and repurposed CSV prompt test to proxy prompt open; removed empty-path CSV alert scenario.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant TUI as TUI Entry Menu
  participant Core as Core State
  participant DB as Db Builder
  participant BE as Backend

  User->>TUI: Select backend (Memory/File/Git/Mongo/Proxy)
  TUI->>Core: EntryEvent(OpenMemory|OpenFile|OpenGit|OpenMongo|OpenProxy)
  Core->>DB: Build corresponding Db
  alt Local backends (Memory/File/Git/Mongo)
    DB->>BE: Initialize backend
    BE-->>DB: Ready
  else Proxy
    DB->>BE: Connect to remote proxy
    BE-->>DB: Ready
  end
  DB-->>Core: Db handle
  Core-->>TUI: OpenNotebook
  note over TUI,Core: CSV/JSON flows removed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I thump my paws, the logs are lean,
No more crumbs of CSV or JSON sheen.
I hop to Proxy, tunnels bright—
Memory, File, Git, Mongo in sight.
Burrows trimmed, the path is clear,
Carrot-fast connect, autumn’s near. 🥕✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove_csv_json_storage

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef005be and 894bb16.

⛔ Files ignored due to path filters (6)
  • Cargo.lock is excluded by !**/*.lock
  • tui/tests/snapshots/entry__csv_alert.snap is excluded by !**/*.snap
  • tui/tests/snapshots/entry__help_closed.snap is excluded by !**/*.snap
  • tui/tests/snapshots/entry__help_open.snap is excluded by !**/*.snap
  • tui/tests/snapshots/entry__local_prompt.snap is excluded by !**/*.snap
  • tui/tests/snapshots/entry__proxy_prompt_open.snap is excluded by !**/*.snap
📒 Files selected for processing (12)
  • Cargo.toml (0 hunks)
  • README.md (3 hunks)
  • core/src/backend/local.rs (1 hunks)
  • core/src/event.rs (0 hunks)
  • core/src/state/entry.rs (0 hunks)
  • server/src/main.rs (0 hunks)
  • tui/Cargo.toml (1 hunks)
  • tui/src/action.rs (1 hunks)
  • tui/src/context/entry.rs (3 hunks)
  • tui/src/views/body/entry.rs (1 hunks)
  • tui/src/views/dialog/help.rs (1 hunks)
  • tui/tests/entry.rs (1 hunks)

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.

@panarch panarch self-assigned this Sep 19, 2025
@gluesql-coverage-bot

Copy link
Copy Markdown

Glues Coverage Report

  • Commit: 894bb16faf786541c00adf6132caf83859c76478
  • Timestamp: 2025-09-19T095419Z
  • Report: View report

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (7)
README.md (2)

10-15: Clarify supported backends in intro to match Usage section.

Line 14 says “Currently, it supports Git and MongoDB…”, but the app also supports Instant (memory), Local (files), and Proxy. Suggest rewording for consistency.

-Currently, it supports Git and MongoDB for storage, and we plan to integrate additional storage options through [GlueSQL](https://github.com/gluesql/gluesql), giving you even more flexibility in managing your data.
+Currently, it supports Instant (in‑memory), Local (files), Git, and MongoDB for storage, and we plan to integrate additional storage options through [GlueSQL](https://github.com/gluesql/gluesql), giving you even more flexibility in managing your data. You can also connect via a Proxy to a remote backend.

53-54: Fix markdownlint MD004: unify list marker style.

Your config expects asterisks; these two sub-bullets use dashes.

-  - Run `cargo run -p glues-proxy-server -- memory` (or file/git/mongo) to start a local proxy.
-  - In the TUI entry menu choose `[5] Proxy`, enter the proxy URL (e.g. `http://127.0.0.1:4000`), and Glues will talk to the remote backend just like it does locally.
+  * Run `cargo run -p glues-proxy-server -- memory` (or file/git/mongo) to start a local proxy.
+  * In the TUI entry menu choose `[5] Proxy`, enter the proxy URL (e.g. `http://127.0.0.1:4000`), and Glues will talk to the remote backend just like it does locally.
core/src/backend/local.rs (1)

92-119: Consider signaling misuse of pull/sync on non‑Git backends.

Currently no‑ops; optionally return a typed error or log a notice to aid callers.

-    pub fn pull(&mut self) -> Result<()> {
-        if let Storage::Git(glue) = &mut self.storage {
-            glue.storage.pull()?;
-        }
-        Ok(())
-    }
+    pub fn pull(&mut self) -> Result<()> {
+        match &mut self.storage {
+            Storage::Git(glue) => glue.storage.pull()?,
+            _ => {
+                log::debug!("Db::pull called on non-Git storage (no-op)");
+            }
+        }
+        Ok(())
+    }
tui/src/views/dialog/help.rs (1)

70-74: Mirror README note about default port/--listen for parity.

Small UX boost: add “listens on 127.0.0.1:4000 by default; use --listen to change”.

-Run `cargo run -p glues-proxy-server -- memory` (or file/git/mongo) to start a local proxy.
+Run `cargo run -p glues-proxy-server -- memory` (or file/git/mongo) to start a local proxy (defaults to 127.0.0.1:4000; use `--listen` to change).
tui/src/action.rs (3)

201-215: Guard against empty/invalid Proxy URL before dispatch.

Provide immediate feedback instead of failing downstream.

 Action::Tui(TuiAction::OpenProxy) => {
     let url = self
         .context
         .take_prompt_input()
         .log_expect("proxy url must not be none");
-
-    config::update(LAST_PROXY_URL, &url).await;
+    let url = url.trim().to_string();
+    if url.is_empty() {
+        self.context.alert = Some("Proxy URL cannot be empty".to_string());
+        return false;
+    }
+    if !(url.starts_with("http://") || url.starts_with("https://")) {
+        self.context.alert = Some("Proxy URL must start with http:// or https://".to_string());
+        return false;
+    }
+    config::update(LAST_PROXY_URL, &url).await;

186-201: Validate Mongo database name before dispatch.

Consistent with file path validation; avoids trivial backend errors.

 Action::Tui(TuiAction::OpenMongo(OpenMongoStep::Database { conn_str })) => {
     let db_name = self
         .context
         .take_prompt_input()
         .log_expect("database name must not be none");
+    if db_name.trim().is_empty() {
+        self.context.alert = Some("Database name cannot be empty".to_string());
+        return false;
+    }
 
     config::update(LAST_MONGO_DB_NAME, &db_name).await;

150-168: Optional: validate Git branch before dispatch.

Prevents immediate error if left blank.

 Action::Tui(TuiAction::OpenGit(OpenGitStep::Branch { path, remote })) => {
     let branch = self
         .context
         .take_prompt_input()
         .log_expect("branch must not be none");
+    if branch.trim().is_empty() {
+        self.context.alert = Some("Git branch cannot be empty".to_string());
+        return false;
+    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef005be and 894bb16.

⛔ Files ignored due to path filters (6)
  • Cargo.lock is excluded by !**/*.lock
  • tui/tests/snapshots/entry__csv_alert.snap is excluded by !**/*.snap
  • tui/tests/snapshots/entry__help_closed.snap is excluded by !**/*.snap
  • tui/tests/snapshots/entry__help_open.snap is excluded by !**/*.snap
  • tui/tests/snapshots/entry__local_prompt.snap is excluded by !**/*.snap
  • tui/tests/snapshots/entry__proxy_prompt_open.snap is excluded by !**/*.snap
📒 Files selected for processing (12)
  • Cargo.toml (0 hunks)
  • README.md (3 hunks)
  • core/src/backend/local.rs (1 hunks)
  • core/src/event.rs (0 hunks)
  • core/src/state/entry.rs (0 hunks)
  • server/src/main.rs (0 hunks)
  • tui/Cargo.toml (1 hunks)
  • tui/src/action.rs (1 hunks)
  • tui/src/context/entry.rs (3 hunks)
  • tui/src/views/body/entry.rs (1 hunks)
  • tui/src/views/dialog/help.rs (1 hunks)
  • tui/tests/entry.rs (1 hunks)
💤 Files with no reviewable changes (4)
  • Cargo.toml
  • core/src/state/entry.rs
  • core/src/event.rs
  • server/src/main.rs
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

53-53: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


54-54: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)

⏰ 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). (1)
  • GitHub Check: coverage
🔇 Additional comments (8)
tui/Cargo.toml (2)

8-8: Description update aligns with feature set (LGTM).

Accurately reflects removal of CSV/JSON and promotion of Proxy.


1-32: Sweep for stale CSV/JSON mentions — confirm which to keep/remove

Found occurrences:

  • server/src/main.rs — Json import and JSON handler types (lines 3, 114–118).
  • core/src/backend/proxy/client.rs — reqwest .json() calls (lines 22–23, 40–41).
  • core/tests/proxy.rs — "application/json" test header (line 37).
  • core/Cargo.toml — reqwest features include "json" (line 18).
  • Cargo.toml — "gluesql-csv-storage" in workspace (line 23).
  • Cargo.lock — csv, csv-core, gluesql-csv-storage, gluesql-json-storage entries.
  • AGENTS.md — JSON-related instruction (line 13).
  • deny.toml — commented deny = ["json"] (line 183).

If CSV storage is obsolete: remove gluesql-csv-storage from Cargo.toml, update/remove docs (AGENTS.md/README), and regenerate Cargo.lock. If JSON usage is intentional (server/reqwest/tests), keep as-is and close this sweep.

core/src/backend/local.rs (1)

13-14: Removed CSV/JSON imports and variants (LGTM).

Imports and enum now match the reduced backend matrix. Constructors and dispatch look consistent.

tui/src/views/body/entry.rs (1)

35-41: Uniform menu styling after CSV/JSON removal (LGTM).

Simpler and consistent; no functional risk.

tui/src/views/dialog/help.rs (1)

70-74: Help text update for Proxy (LGTM).

Matches the new menu index and workflow.

tui/src/context/entry.rs (2)

16-21: Menu renumbering and size update (LGTM).

PROXY -> [5], MENU_ITEMS -> 7 entries; consistent with UI and docs.


95-100: Keybinding for Proxy (LGTM).

Direct hotkey mapping added for '5'.

tui/tests/entry.rs (1)

70-79: Test migration from CSV to Proxy prompt — LGTM; confirm insta snapshot update

Hotkey [5] and snapshot rename align with UI changes (tui/tests/entry.rs:70-79). Confirm the insta snapshot "proxy_prompt_open" exists and was updated in this PR. Run:

rg -n "proxy_prompt_open" tui/tests -S
rg -n "proxy_prompt_open" tui/tests/snapshots -S
git status --porcelain | rg 'tui/tests/snapshots' || true

@panarch
panarch merged commit dc525d7 into main Sep 19, 2025
1 check passed
@panarch
panarch deleted the remove_csv_json_storage branch September 19, 2025 10:07
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