Skip to content

feat(integration): lance-graph-contract 0.2.0 + Glue #2/#4 scaffolds (Sprint 0)#404

Merged
AdaWorldAPI merged 13 commits into
mainfrom
claude/lance-surrealdb-analysis-LXmug
May 18, 2026
Merged

feat(integration): lance-graph-contract 0.2.0 + Glue #2/#4 scaffolds (Sprint 0)#404
AdaWorldAPI merged 13 commits into
mainfrom
claude/lance-surrealdb-analysis-LXmug

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Summary

Sprint 0 of the four-repo integration plan (lance-graph ↔ surrealdb ↔ sea-orm ↔ ndarray). All work is additive contract shape — zero existing trait signature changes, zero existing module moves, zero existing file deletes.

  • lance-graph-contract 0.2.0 — three new submodules (ir, provider, actor) carrying the federated planner IR + Arrow provider markers + supervisable-shader vocabulary. Existing 0.1.x surface unchanged so today's surrealdb-core consumers compile without code change.
  • crates/lance-graph-tikv-provider/ (new, in workspace.exclude) — Glue Module 6: #[track_caller] error macros for zero-cost location capture #2: TiKV ranges → Arrow TableProvider. Implements DataFusion 53 TableProvider + MvccProvider markers from the new contract submodule. Bodies stay Sprint 1 unimplemented!().
  • crates/cognitive-shader-actor/ (new, in workspace.exclude) — Glue Claude/setup adaworld repos 4k pex #4: wraps any SupervisableShader as a ractor::Actor with ShaderMessage<P> mailbox + RestartBackoff supervisor. Bodies stay Sprint 2 unimplemented!().
  • Four .claude/plans/integration-plan.md files with the additive-contract-shape principle codified and cross-referenced across all four repos.

Commits in this PR (oldest first)

Commit Description
415a9ef plans: integration plan for lance-graph ↔ surrealdb ↔ sea-orm ↔ ndarray convergence
c47d10a plans: tighten to strictly additive + contract-shape principle
5b9b532 feat(lance-graph-contract): add 0.2.0 additive submodules (ir, provider, actor)
617f6a5 feat(workspace): scaffold lance-graph-tikv-provider + cognitive-shader-actor (Sprint 0)
344ee93 chore(lockfiles): commit Cargo.lock for the two wave-1 scaffold crates
1e1840e fix(lance-graph-tikv-provider): DataFusion 53 API (EmissionType/Boundedness + Arc + Debug)
2dcb1b1 plans: reconcile AP6 drift HOLDs from PP-13 savant audit

Coordinated PRs in sibling repos

Repo PR
AdaWorldAPI/surrealdb claude/lance-surrealdb-analysis-LXmug
AdaWorldAPI/sea-orm claude/lance-surrealdb-analysis-LXmug
AdaWorldAPI/ndarray claude/lance-surrealdb-analysis-LXmug

A [patch."https://github.com/AdaWorldAPI/lance-graph.git"] block in the surrealdb PR redirects lance-graph-contract to the local path so surrealdb-core sees the 0.2.0 additions immediately during dev.

Test plan

  • cargo check -p lance-graph-contract — passes clean
  • cargo check --manifest-path crates/lance-graph-tikv-provider/Cargo.toml — passes (4 warnings on unused imports + dead_code on stubs, expected)
  • cargo check --manifest-path crates/cognitive-shader-actor/Cargo.toml — passes clean
  • cargo test -p lance-graph-contract — all tests pass (new tests in ir, provider, actor submodules: cardinality arithmetic, operator builder, snapshot-min, backoff exponential, supervisable shader defaults)
  • Verified from surrealdb side: cargo check -p surrealdb-core --features lance-graph picks up the patched 0.2.0 contract crate
  • Sprint 1 / Sprint 2: real bodies in lance-graph-tikv-provider + cognitive-shader-actor (out of scope of this PR)
  • Promote both crates from workspace.exclude to members once Sprint 1/2 land (out of scope of this PR)

PP-13 savant audit

Ran a PP-13 brutally-honest-tester pass over the wave-1 output. Three REJECTs (DataFusion 53 compile errors in tikv-provider, missing [workspace] in surrealdb-ractor / sea-orm-ractor) all addressed in wave-3. Three AP6 drift HOLDs reconciled in plan §post-script (commit 2dcb1b1). Final compile-verification matrix in the wave-3 commit messages.

https://claude.ai/code/session_01LiUiGeUDLje8KMnxB4FfA3


Generated by Claude Code

AdaWorldAPI and others added 13 commits May 18, 2026 13:05
…er, actor)

Sprint 0 of the four-repo integration plan. Pure additions; the 0.1.x
surface is unchanged so existing surrealdb-core consumers compile without
code change at 0.1.x -> 0.2.0.

New submodules:

- ir: federated planner IR (Operator, OperatorKind, OperatorTree,
  Cardinality, EngineHint). Cross-engine planner vocabulary distinct
  from plan::PlannerContract (lance-graph's own planner) and from
  orchestration::OrchestrationBridge (cross-system step routing).

- provider: backend provider markers (BackendId, MvccProvider,
  TikvBackedProvider, LanceBackedProvider). Zero-dep markers used by
  the federated planner to compose snapshot-consistent reads across
  TiKV / Lance / local KV TableProvider impls without pulling in
  DataFusion / Arrow as deps here.

- actor: supervisable-shader vocabulary (SupervisableShader,
  SupervisionPolicy, RestartBackoff). Distinct from
  cognitive_shader::CognitiveShaderDriver (in-process driver);
  consumed by the upcoming cognitive-shader-actor crate to wrap
  shaders as ractor::Actor with let-it-crash supervision.

Each module has doc-tests and unit tests. Zero new dependencies.

Per .claude/plans/integration-plan.md (this branch) Sprint 0.
…r-actor (Sprint 0)

Adds two new stub crates from the four-repo integration plan as
workspace-EXCLUDED scaffolds (additive contract shape; promoted to
members in Sprint 1/2 once heavy deps land).

* crates/lance-graph-tikv-provider/  (Glue #2, plan §5)
  TikvNodeTableProvider + TikvEdgeTableProvider stubs implementing
  datafusion::catalog::TableProvider + lance_graph_contract::provider
  markers. Bodies are Sprint 1 unimplemented!() with the trait shape
  pinned.

* crates/cognitive-shader-actor/  (Glue #4, plan §6)
  CognitiveShaderActor<S> wrapping any SupervisableShader (from the
  new lance_graph_contract::actor module) as a ractor::Actor with
  ShaderMessage enum + ShaderSupervisor stub. Bodies are Sprint 2
  unimplemented!() pending ractor::Actor signature confirmation.

Both crates depend only on lance-graph-contract = "0.2" (path) plus
their domain crates (tikv-client / ractor); no existing crate gains
or loses a dep. Workspace check stays unaffected (excluded).

Workers: LG-1, LG-2. Sprint 0 of the four-repo wave.
Both crates/lance-graph-tikv-provider and crates/cognitive-shader-actor
are in workspace.exclude, so they generate their own Cargo.lock when
checked standalone. Other excluded crates in the workspace (bgz-tensor,
bgz17, causal-edge, bge-m3, etc.) already follow this convention —
committing the lockfiles pins their deps for standalone builds.

Generated by the wave-1 worker verification (cargo check standalone in
each crate dir before reporting back to the orchestrator).
…dedness + Arc<PlanProperties> + Debug

Resolves PP-13 savant REJECT verdict: wave-1 LG-1 scaffolded against
DataFusion 51-style APIs but Cargo.lock pins datafusion 53.1.0. The
6 compile errors broke down as:

1. ExecutionMode no longer in datafusion::physical_plan (removed in 53)
   → replaced with EmissionType + Boundedness from
   datafusion::physical_plan::execution_plan
2. PlanProperties::new now takes 4 args (eq_props, partitioning,
   emission_type, boundedness); the old 3-arg call used ExecutionMode
3. TableProvider now requires Debug on impls
   → manual `impl std::fmt::Debug` for TikvNodeTableProvider /
   TikvEdgeTableProvider / TikvScanExec (tikv-client::TransactionClient
   doesn't derive Debug, so manual impl just prints the struct name)
4. ExecutionPlan::properties now returns &Arc<PlanProperties> instead
   of &PlanProperties → wrap PlanProperties in Arc + return Arc reference

Function bodies remain Sprint 1 unimplemented!("Sprint 1 stub") with
the correct return-type shapes. Bodies are out of scope for this fix;
only the surface compiles now.

Verified: `cargo check --manifest-path crates/lance-graph-tikv-provider/Cargo.toml`
exits 0 (4 warnings on unused imports + dead_code, acceptable for stubs).

Worker: W-LG-3. PP-13 REJECT resolved.
Pins three plan-vs-source mismatches that the savant flagged as AP6
drift, by appending a reconciliation note before §10 Cross-references.
In each case the SHIPPED source is better than the original sketch in
the §1 Contracts table / §6 example, so the docs are updated to match
shipped reality rather than rewriting the source:

1. TikvBackedProvider extends MvccProvider (zero-dep) instead of
   datafusion::catalog::TableProvider directly. Preserves the
   contract crate's zero-dep guarantee.

2. The actor-wrapper trait is named SupervisableShader, not
   CognitiveShader. Avoids colliding with the pre-existing
   cognitive_shader::CognitiveShaderDriver trait in the same crate
   (different lifecycle semantics: driver = in-process ShaderDispatch;
   supervisable = actor lifecycle apply/apply_delta/drain).

3. ShaderMessage<P> is generic over the payload type P. The actor
   wrapper picks RecordBatch at instantiation; other consumers can
   pick alternative payloads. Better composition than monomorphic
   sketch.

All three were applied during wave-1 scaffolding; this note pins
the docs accordingly. The §1 Contracts table itself will be rewritten
in a future plan-revision pass.

Per PP-13 savant audit. Wave-3 of the four-repo integration.
…ith #[default] variant

CI `clippy` job (PR #404) flagged two `clippy::derivable_impls` warnings
in the 0.2.0 additive submodules. Both manual `impl Default` blocks
replaced with `#[derive(Default)]` on the enum + `#[default]` attribute
on the chosen variant:

* SupervisionPolicy: derive Default; mark OneForOne with #[default].
  Kept a const fn one_for_one() constructor for call-site readability.
* EngineHint: derive Default; mark Auto with #[default].

441/441 lance-graph-contract lib tests still pass. clippy clean.

CI signal: PR #404 clippy.
…aderActor

Sprint 1 Glue #4 implementation. Replaces the wave-1 commented-out
scaffold with a real `ractor::Actor` impl against ractor 0.15.13:

* Associated types: Msg = ShaderMessage<S::Payload>, State = Arc<S>,
  Arguments = Arc<S>. `S::Error: Into<anyhow::Error>` + `S::Payload: Debug`
  bounds added.
* `pre_start`: identity (shader passed via Arguments lives in State).
* `handle` dispatches all three `ShaderMessage` variants:
  - Apply: shader.apply(input) → reply with anyhow::Result<P>
  - ApplyDelta: shader.apply_delta(delta), no reply
  - Drain: spin-yield while inflight > 0, shader.drain(), reply (),
    `myself.stop(Some("drained"))`
* End-to-end test `e2e_apply_doubles_input`: Counter shader (Payload=u32),
  spawn via `Actor::spawn`, ractor::call!(actor, ShaderMessage::Apply,
  input=5) → asserts Ok(10).

`cargo test --manifest-path crates/cognitive-shader-actor/Cargo.toml`:
1/1 test passes; `cargo check` clean.

Worker: W-LG-4. Sprint 1 of the four-repo integration.
Adds dated board-hygiene entry per the Mandatory Board-Hygiene Rule
in CLAUDE.md. Records the wave-1..4 additions that landed during this
session:

* lance-graph-contract 0.2.0 with three new additive submodules
  (ir, provider, actor)
* Two new excluded crates: crates/lance-graph-tikv-provider/ and
  crates/cognitive-shader-actor/
* Sprint-1 implementation progress checklist (LG-4 Actor impl + the
  cross-repo SO-6/SO-7 work in sea-orm)
* PP-13 savant audit REJECTs resolved (DataFusion 53 API drift,
  [workspace]-table requirement for excluded ractor crates)

Pure append: lines 210-263 prepended after the Last-updated paragraph
and before the prior 2026-05-05 entry. No existing entries touched.

Worker: W-BOARD-1.
Wave-5 worker W-INT-1. New excluded crate at `crates/four-repo-demo/`
that demonstrates three of the four glue surfaces working together:

* `cognitive-shader-actor::CognitiveShaderActor` wrapping a real
  `SupervisableShader` (`SumShader`) — running-sum state via
  `Arc<Mutex<i64>>`, payload is `arrow_array::RecordBatch`.
* `lance-graph-contract::actor::SupervisableShader` trait consumed
  end-to-end (impl is real, not stub).
* `lance-graph-contract::ir::{Operator, OperatorTree, EngineHint,
  Cardinality}` — builds a 3-node tree (RangeScan → Filter →
  CognitiveApply) and computes total estimated cardinality.

The example at `examples/run_demo.rs`:
1. Spawns CognitiveShaderActor<SumShader> via ractor 0.15.13
2. Sends two ShaderMessage::Apply with single-row Int64 batches (5, 7)
3. Sends ShaderMessage::Drain
4. Prints the running sum (12) + the operator tree + cardinality estimate

Test results (cargo test --manifest-path crates/four-repo-demo/Cargo.toml):
* sum_shader_actor_running_sum ... ok
* operator_tree_has_three_nodes ... ok
* operator_tree_shape_correct ... ok
* operator_tree_total_cardinality ... ok
* 2 doc-tests pass
* All 6/6 tests pass

NOT demonstrated (and why, in the crate's lib.rs and README):
* Glue #1 surrealdb-ractor — needs a live SurrealDB
* Glue #2 lance-graph-tikv-provider — needs a TiKV cluster
* Glue #3 sea-orm-ractor — needs running Postgres + the derive

Workspace: added to `exclude` (heavy tokio + ractor + arrow deps).
.gitignore: `/crates/four-repo-demo/target/` to keep build artefacts
out of git.

Worker: W-INT-1. Wave-5 of the four-repo integration.
@AdaWorldAPI AdaWorldAPI merged commit 360a44b into main May 18, 2026
4 checks passed
AdaWorldAPI added a commit that referenced this pull request May 19, 2026
Revert #404 — lance-surrealdb-analysis four-repo integration arc
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