Skip to content

feat(cli): serve --http via libxsql http_query_server - #15

Merged
0xeb merged 3 commits into
mainfrom
feat/cli-http-on-thinclient
Jun 23, 2026
Merged

0xeb merged 3 commits into
mainfrom
feat/cli-http-on-thinclient

Conversation

@0xeb

@0xeb 0xeb commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Replaces bnsql's hand-rolled CLI run_http_mode (low-level thinclient::server + setup_http_routes + timed_mutex admission) with xsql::thinclient::http_query_server + a statement_executor, removing the duplicated CLI HTTP server.

How behavior is preserved

  • Serialization: use_queue=true (BN QueryEngine isn't concurrency-safe) — the main thread runs run_until_stopped(); the thinclient queue also provides admission timeout + max_queue via runtime_settings hooks.
  • /status: cached function count (queried once at startup; status_fn runs off the main thread) + nested settings + tool.
  • /settings: auth-gated via extra_routes.
  • PRAGMA bnsql.* runtime controls intact; options + format= now handled by the thinclient.
  • Pins libxsql v1.0.9 (executor + a shutdown concurrency fix this migration surfaced, fix(thinclient): make http_query_server::stop() concurrency-safe libxsql#7).

Tested live (--http, ls binary)

/status (functions=138 + settings), /settings 200 w/ token & 401 without, ?continue_on_error=1, ?format=csv, PRAGMA bnsql.max_queue set+read, and graceful /shutdown exits 0 (previously aborted — fixed by #7).

Scope

CLI --http only. REPL .http + the BN plugin still use setup_http_routes (non-queue; migrated separately — they need mutex-serialized non-queue execution, and the plugin path isn't testable headless).

0xeb added 3 commits June 23, 2026 11:34
…utor)

Replace the hand-rolled run_http_mode (thinclient::server + setup_http_routes +
timed_mutex admission) with xsql::thinclient::http_query_server using a
statement_executor and use_queue=true. The thinclient now owns routing, auth,
queue admission (max_queue/queue_admission_timeout via runtime_settings hooks),
options (continue_on_error/include_sql), and formatting (json/text/csv/tsv).

Serialization is preserved via use_queue=true (BN QueryEngine isn't
concurrency-safe); the main thread runs run_until_stopped(). /status reports a
cached function count (queried once at startup) + settings via status_fn;
auth-gated /settings via extra_routes. PRAGMA bnsql.* runtime controls intact.

Removes bnsql's duplicate CLI HTTP implementation. (REPL .http + plugin still
use setup_http_routes; migrated separately.)
@0xeb
0xeb merged commit afd035f into main Jun 23, 2026
3 checks passed
@0xeb
0xeb deleted the feat/cli-http-on-thinclient branch June 23, 2026 21:08
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