Skip to content

feat(deltagraph): server binary backed by Databricks (Phase 4.1)#336

Merged
genezhang merged 2 commits into
mainfrom
feat/deltagraph-binary
May 17, 2026
Merged

feat(deltagraph): server binary backed by Databricks (Phase 4.1)#336
genezhang merged 2 commits into
mainfrom
feat/deltagraph-binary

Conversation

@genezhang
Copy link
Copy Markdown
Owner

Summary

Ships Phase 4.1 of the DeltaGraph plan — a deltagraph binary alongside clickgraph, both built from the same library. The new binary defaults --databricks on, defaults Neo4j compat mode on (since the headline demo is open Neo4j Browser, run Cypher, hit Databricks under the covers), and forces a token-from-env policy (DATABRICKS_TOKEN is never accepted on the command line).

Architecture: one library, two binaries:

  • ServerConfig.databricks: bool sits alongside ServerConfig.embedded with CLICKGRAPH_DATABRICKS env support. A new feature-gated branch in server::run_with_config builds a DatabricksSqlExecutor (from Phase 2.1) and routes it through the existing QueryExecutor trait. AppState.clickhouse_client stays None — only DDL writes consume it, and the Databricks read path blocks writes upstream via write_guard already.
  • New [[bin]] required-features = [\"databricks\"] keeps the default cargo build producing only clickgraph — no reqwest/Databricks dep pulled into the standard build.
  • clickgraph also picks up a --databricks flag for parity (users on a --features databricks build can flip dialects without two binaries).

Build/run:

cargo build --release --features databricks --bin deltagraph
export DATABRICKS_HOST=dbc-abc123-def4.cloud.databricks.com
export DATABRICKS_WAREHOUSE_ID=abc123def456
export DATABRICKS_TOKEN=dapi-...
./target/release/deltagraph

Tests

  • tests/rust/bin/deltagraph_smoke.rs (gated on feature = \"databricks\", two assert_cmd tests):
    • deltagraph_help_lists_databricks_specific_env_vars--help mentions DATABRICKS_HOST/WAREHOUSE_ID/TOKEN and the env-only policy. Pins the user's discovery surface against accidental help-text rewrites.
    • deltagraph_startup_without_credentials_errors_clearly — missing-creds startup exits non-zero with a precise error naming the missing field (DATABRICKS_HOST not set), not a confusing reqwest connection error.
$ cargo build --bin clickgraph                                  # default build, no databricks dep
$ cargo build --bin clickgraph --features databricks            # adds --databricks flag to clickgraph
$ cargo build --bin deltagraph --features databricks            # produces the new bin
$ cargo test --features databricks --test deltagraph_bin        # 2/2 smoke tests pass
$ cargo test -p clickgraph --features databricks --lib          # 1385 lib tests pass
$ cargo clippy --all-targets --features databricks              # 0 warnings
$ cargo fmt --all --check                                       # clean

What's deferred to Phase 4.3

A full "Bolt → DeltaGraph → Databricks wiremock" startup integration test belongs in Phase 4.3 (the headline Neo4j Browser e2e demo), where it can drive an actual Cypher query through the live server stack. Spinning up the HTTP + Bolt server for a single request in this PR would be expensive scaffolding for a different feature.

Test plan

  • cargo build --bin clickgraph (default features) — unchanged
  • cargo build --bin deltagraph --features databricks — produces working binary
  • cargo test --features databricks --test deltagraph_bin — 2 smoke tests pass
  • cargo test -p clickgraph --features databricks --lib — 1385 tests pass
  • cargo clippy --all-targets --features databricks — 0 warnings
  • cargo fmt --all --check — clean
  • STATUS.md mentions the new deltagraph binary

🤖 Generated with Claude Code

Adds a `deltagraph` binary alongside the existing `clickgraph` server. Same
HTTP + Bolt code path, same Cypher language, but emits Spark SQL via the
dialect routing landed in Phase 1.x and executes against a Databricks SQL
Warehouse via the executor from Phase 2.x. Defaults `--databricks` on,
defaults Neo4j compat mode on (the headline demo is Neo4j Browser →
deltagraph → Databricks), and forces an env-only PAT (DATABRICKS_TOKEN
is never accepted on the command line).

To support both binaries from one library crate:
- `ServerConfig.databricks: bool` sits alongside `ServerConfig.embedded`
  with `CLICKGRAPH_DATABRICKS` env support and a feature-gated dispatch
  branch in `server::run_with_config`. `AppState.clickhouse_client` stays
  `None` — only DDL writes consume it, and the Databricks read path
  blocks writes upstream via the existing write_guard.
- New `[[bin]] required-features = ["databricks"]` keeps the default
  `cargo build` producing only `clickgraph` — no reqwest/Databricks
  dep is pulled into the standard build.
- `clickgraph` also picks up a `--databricks` flag for parity; users on a
  `--features databricks` build can flip dialects without two binaries.

Two assert_cmd smoke tests guard the user's discovery surface:
`--help` mentions DATABRICKS_HOST/WAREHOUSE_ID/TOKEN and the env-only
policy; missing-credentials startup exits non-zero with a precise error
naming the missing field (not a confusing reqwest connection error).

Phase 4.3 (full Neo4j Browser → DeltaGraph → Databricks end-to-end
demo) builds on this binary.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 17, 2026 02:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Databricks-backed server distribution (“DeltaGraph”) by introducing a feature-gated deltagraph binary that reuses the existing server library and routes execution through the Databricks SQL Warehouse executor while keeping the default clickgraph build unchanged.

Changes:

  • Introduces a new deltagraph binary (behind --features databricks) with Databricks-first defaults and env-only token policy.
  • Extends shared server configuration and startup routing to support a Databricks execution backend (--databricks flag + CLICKGRAPH_DATABRICKS env).
  • Adds feature-gated smoke tests validating deltagraph --help discovery strings and clear missing-credentials startup errors.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/rust/bin/deltagraph_smoke.rs Adds Databricks-feature-gated smoke tests for the new deltagraph binary help text and missing-credentials failure path.
STATUS.md Documents the new deltagraph server binary as part of DeltaGraph / Databricks mode.
src/server/mod.rs Adds a databricks startup branch to build a Databricks executor and run the server without a ClickHouse client; adds env-based Databricks config builder.
src/main.rs Adds --databricks CLI flag to clickgraph for parity (feature-gated at runtime).
src/config.rs Extends ServerConfig / CliConfig with a databricks: bool flag and env parsing (CLICKGRAPH_DATABRICKS).
src/bin/deltagraph.rs Implements the new deltagraph binary wrapper that forces Databricks mode and defaults Neo4j compat on.
Cargo.toml Declares deltagraph as a gated [[bin]], adds dev-deps for smoke tests, and registers the standalone test target behind databricks.
Cargo.lock Locks new dev-dependencies (assert_cmd, predicates) into the workspace.

Comment thread src/server/mod.rs Outdated
Comment on lines +174 to +175
// (gated server-side via write_guard for the Remote executor kind)
// consume it, and Databricks ports are read-only in this iteration.
Comment thread Cargo.toml Outdated
Comment on lines +111 to +115
# Standalone smoke test for the `deltagraph` binary (Phase 4.1). Sits
# outside tests/rust/ because it spawns a compiled bin via `cargo run`
# rather than driving library code; cargo's default test discovery
# would otherwise miss it because tests/rust/ is the explicit root for
# unit/integration/e2e above.
Two doc-only fixes from Copilot review:

1. src/server/mod.rs: The DeltaGraph dispatch comment claimed DDL writes
   are "gated server-side via write_guard for the Remote executor kind."
   That's wrong on two counts — the server doesn't pass ExecutorKind
   into the planner (write_guard is only consumed by clickgraph-embedded's
   constructors), and the actual server-side write rejection is the 501
   NOT_IMPLEMENTED in query_handler_inner that triggers whenever
   AppState.clickhouse_client is None. Rewrite the comment to point at
   the real mechanism (matches the embedded branch's existing reliance).

2. Cargo.toml: The [[test]] declaration claimed the smoke test "spawns a
   compiled bin via `cargo run`." It actually uses
   assert_cmd::Command::cargo_bin, which resolves CARGO_BIN_EXE_deltagraph
   (a cargo-set env var pointing at the already-built test binary) — no
   cargo subprocess involved. Correct the wording so future maintainers
   reading the manifest understand the actual mechanism.

No behavior changes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@genezhang genezhang merged commit 75e66dc into main May 17, 2026
4 checks passed
@genezhang genezhang deleted the feat/deltagraph-binary branch May 17, 2026 02:15
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.

2 participants