Skip to content

Expose query root and declared tables to the frontend - #1498

Merged
thekevinbot merged 5 commits into
mainfrom
bot/1488-frontend-metadata-1011
Oct 13, 2026
Merged

thekevinbot merged 5 commits into
mainfrom
bot/1488-frontend-metadata-1011

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1488

GET /frontend/state (with --frontend) now returns, when ready, {"error": null, "root": "<abs query root>", "tables": [{"name", "columns": [{"name", "type"}]}]}. 503 {"error": ...} on config failure is unchanged. POST /query is unchanged. Implemented once in the Rust core (DirSQL::root(), DirSQL::tables()), so all three CLI distributions share it.

Choices

  • Transport: extend the existing /frontend/state rather than add a route.
  • Source: SQLite catalog only (pragma_table_list + pragma_table_xinfo); no parsers, no walk, no counts.
  • Listed: plain tables in the persistent schema, ordered by name; columns in declaration order with declared type ("" if untyped); hidden vtab columns omitted.
  • Excluded: _dirsql_*, sqlite_*, virtual tables and their shadows, temp path-tables.
  • Unavailable state: no root/tables, only the existing error.

Red/green

  • Red: eb1dd9e, run 38187450886 (Windows tests: frontend_state_* and updated frontend_* e2e fail on missing tables/root).

Manual

Built dirsql, ran dirsql server --frontend --port N in a temp dir:

  • -c .dirsql.toml (tables posts, and an empty "order" with a "two words" column): 200 with both tables, root /tmp/m1488; POST /query still [] for an empty select.
  • no config: 200 {"error":null,"root":"/tmp/m1488","tables":[]}.
  • -c missing.toml: 503 {"error":"failed to resolve missing.toml: ..."}.

E2E Verification

  • Ran e2e suites locally for every affected SDK
  • Rust: cargo test -p dirsql --features cli --lib --test cli_integration --test cli_e2e green.
  • Python: pytest tests/e2e/cli_version_test.py query_contract_test.py declared_table_name_test.py on_file_query_test.py green (16 passed), receipt committed.
  • TypeScript: pnpm test:e2e green (18 passed), receipt committed.

Changelog / Migrations

  • Changelog fragment added under packages/rust/changelog.d/
  • Migration fragment with the same slug added under packages/rust/migrations.d/

@thekevinbot
thekevinbot merged commit 5dfa565 into main Oct 13, 2026
90 checks passed
@thekevinbot
thekevinbot deleted the bot/1488-frontend-metadata-1011 branch October 13, 2026 21:17
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.

Expose query-root and declared-table metadata for the frontend

1 participant