Skip to content

refactor(memory-lancedb): keep query contracts in schema owner - #196227

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/lancedb-query-schema-owner
Nov 9, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/lancedb-query-schema-owner

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

The LanceDB CLI currently imports shared query contracts through the storage implementation.

User Impact

No user-visible behavior change. Query validation, predicates, ordering, null handling and storage lifecycle remain unchanged.

Why This Change Was Made

Move the existing query-column constant and two types verbatim into the existing import-free schema owner. Both CLI and store consume that owner; the CLI retains only a type import of MemoryDB from the store. This replaces one direct CLI-to-store runtime dependency with CLI-to-schema. The plugin entrypoint still reaches the store and Arrow; no startup, bundle, CPU, memory or latency improvement is claimed.

No public export, SDK subpath, package metadata, configuration or test change. The three-file diff adds 112 bytes and three LF characters.

Evidence

  • Exact signed head: c4a9104d42654793f88b45c3c42897c619c58060; source base: b299821f3adc50d2810b6707474c41d4ca526d2e.
  • The complete 329-byte/seven-LF declaration family is byte-identical after relocation. Caller census found only the store and CLI using these names; existing Doctor/stats consumers and the default plugin export are preserved.
  • Pinned formatter check and normal signed-commit hooks passed.
  • Fresh precommit autoreview: complete single pass, no findings, confidence 0.99. Fresh full committed-range local ClawSweeper review: complete, no findings, confidence 0.96, no review cache hits. These are source reviews, not runtime proof.
  • The normal task-owned physical native graph is now qualified after one successful frozen install with lifecycle scripts enabled. The installed Matrix 0.6.6 binary and marker passed their exact digest validation. No foreign application graph is used.
  • All six requested unchanged suites passed: memory-cli, memory-stats, doctor-contract-api, lancedb-store.staleness, arrow-null-predicates and startup-imports: 6 files / 35 cases in every preparation and measured invocation.
  • Owning package run-tsgo --noEmit, type-aware run-oxlint for all three changed modules, both extension import-boundary checks, formatter and normal signed hooks passed.
  • Full pnpm build passed (195.48s wall; 278.66s user / 60.81s system; maximum RSS 6,311,428,096 bytes), including runtime output and public SDK declarations. The emitted CLI imports the query value from schema; the store exposes MemoryDB only, and the plugin entrypoint still imports the store.
  • The build retained normal warnings, including Control UI budget warnings: CSS gzip +1,651 bytes / raw +8,948 bytes, chat boot JS gzip +353 bytes, new boot JS gzip +625 bytes over their configured limits. The build exited zero; these are not claimed as passing UI budgets or attributed to this private move. No baseline was changed.
  • Normal two-revision plugin-sdk:api:diff against the exact source base/head reported no entrypoint or export changes (digest ff7b090f43d2d90e4cd883d95840d6b752475a7a1769e295fb4cbb558a6ffb64). Both owner-managed declaration-only installs, renders and temporary-checkout cleanup completed; no API allowance or baseline changed. Comparison cost: 477.02s wall, 828.76s user / 145.64s system, maximum RSS 7,467,794,432 bytes.

Test-cost protocol and results

This is the predeclared compiler-warm whole-command set: five serial base/head pairs, each arm receiving one separately timed successful preparation immediately followed by one identical measured invocation. No arm was retried or discarded. The six suites and 35 cases, physical application graph, 626 relevant dependency inputs, runtime and flags matched independently at both revisions. Node 26.13.0 on Darwin arm64, 18 logical CPUs / 128 GiB; observed load 2.79–6.97; inherited heap 4096 MiB and one Vitest worker. Every measured arm showed the normal local compiler cache hit, reused outputs, generation verification/retention and settled cleanup. The first base preparation missed; every later preparation hit. Preparation is not silently excluded from study spend.

Command: /usr/bin/time -l node scripts/run-vitest.mjs followed by the six named suite paths and --maxWorkers=1, with one unchanged task-local filesystem-module-cache path. No compiler/startup/cleanup time was subtracted. Raw rows below are seconds, except RSS in bytes; every row exited zero and passed 6 files / 35 cases.

Preparation (separate population)

pair revision wall user CPU system CPU max RSS bytes Vitest
1 base 50.58 55.65 23.22 7976828928 44.01
1 head 9.52 9.53 9.92 1098874880 7.42
2 base 11.22 9.96 10.37 1139294208 8.90
2 head 11.40 10.05 11.69 1088061440 8.91
3 base 9.19 9.38 9.84 1123893248 7.11
3 head 9.50 9.37 10.17 1103970304 7.27
4 base 10.07 9.78 12.28 1110818816 7.94
4 head 9.22 9.47 10.36 1147109376 7.07
5 base 9.50 9.49 10.12 1123581952 7.30
5 head 9.10 9.40 9.94 1105002496 7.00

Measured warm population

pair revision wall user CPU system CPU max RSS bytes Vitest
1 base 9.23 9.38 9.85 1144012800 7.11
1 head 9.23 9.43 9.93 1135165440 7.16
2 base 9.21 9.60 10.27 1134116864 7.15
2 head 10.92 9.50 10.14 1138769920 8.66
3 base 9.24 9.49 9.93 1141293056 7.13
3 head 8.98 9.36 10.03 1123385344 6.94
4 base 9.46 9.57 10.43 1147731968 7.34
4 head 9.26 9.62 9.96 1115258880 7.16
5 base 9.14 9.45 10.01 1157545984 7.08
5 head 9.25 9.34 9.95 1152434176 7.08
measured metric base median / spread / p95 head median / spread / p95 median change p95 change
wallSeconds 9.23 / 0.32 / 9.46 9.25 / 1.94 / 10.92 +0.22% +15.43%
userCpuSeconds 9.49 / 0.22 / 9.60 9.43 / 0.28 / 9.62 -0.63% +0.21%
systemCpuSeconds 10.01 / 0.58 / 10.43 9.96 / 0.21 / 10.14 -0.50% -2.78%
maximumRssBytes 1144012800 / 23429120 / 1157545984 1135165440 / 37175296 / 1152434176 -0.77% -0.44%
vitestSeconds 7.13 / 0.26 / 7.34 7.16 / 1.72 / 8.66 +0.42% +17.98%

All declared median and nearest-rank p95 comparison cells passed the unchanged 20% regression stop. With n=5, p95 is the observed maximum, not a reliable tail estimate. Spread means maximum minus minimum. This is test-cost qualification, not a product latency, startup, memory or CPU improvement claim.

Preparation total: 139.30s wall / 142.08s user / 117.91s system. Measured total: 93.92s wall / 94.74s user / 100.50s system. All timed commands: 233.22s wall / 236.82s user / 218.41s system. Largest individual reported maximum RSS: preparation 7,976,828,928 bytes; measurement 1,157,545,984 bytes; study maximum 7,976,828,928 bytes. Individual maxima are not summed into a simultaneous peak. Phase elapsed time including guards/operator gaps was 989.29s, not test latency. Full raw output and normal cache/lifecycle evidence are retained privately.

Exact-head CI run 42697172546 completed successfully (19 successful jobs / 32 scope skips), including its aggregate gate; the exact-head security review also succeeded. Earlier draft skips remain historical skips.

Normal preparation preserved the reviewed head without another push. The pinned squash request merged that exact head as cc5c2914c58bde53e0ef708620071213bce06ce8 on 2026-11-09 at 21:03:01 UTC. Native ownership-checked cleanup and COMPLETE both succeeded; all owned local commands and streams are joined. Native completion receipt comment. The personal source checkout and proof remain retained; completion did not authorize personal deletion.

@vincentkoc vincentkoc self-assigned this Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-lancedb Extension: memory-lancedb size: XS labels Nov 9, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR moves shared LanceDB query declarations into the existing schema module and updates the CLI and store imports.

Example: Run openclaw ltm query --cols id,text --filter "importance >= 0.8".

  • Before: The CLI obtains query declarations through the storage implementation.
  • After: The CLI obtains the same declarations from the schema module; query results remain unchanged.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source change is focused and appears correct; validation remains explicitly incomplete.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored declaration-only refactor is outside the ordinary contributor proof gate; no runtime result is claimed, and the draft explicitly records pending validation.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction modestly improves internal dependency ownership while preserving the existing product contract and avoiding unsupported performance claims.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored draft open: the focused refactor preserves existing behavior, and no introduced correctness or security defect was found.

Priority: P3
Reviewed head: c4a9104d42654793f88b45c3c42897c619c58060

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The draft has not yet supplied results for its planned owning-suite and build/package validation.
Agent review details

How this fits together

The LanceDB plugin CLI parses query options and passes typed requests to MemoryDB, which applies agent-scoped predicates and returns stored memory rows.

flowchart LR
  User[CLI query options] --> CLI[Memory CLI]
  Schema[Shared query declarations] --> CLI
  Schema --> Store[MemoryDB]
  CLI --> Store
  Store --> Table[Agent scoped LanceDB rows]
  Table --> Output[JSON results]
Loading

Technical review

Best possible solution:

Keep the verbatim declarations in the existing schema owner and complete the draft’s focused consumer and build validation.

Do we have a high-confidence way to reproduce the issue?

There is no reported runtime bug to reproduce; the original CLI-to-store declaration dependency is directly visible in the pinned base.

Is this the best way to solve the issue?

The patch is the smallest complete ownership move: it reuses the import-free schema module, updates every identified consumer, and introduces no wrapper or parallel implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e64c3514e419.

Provenance checked

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 822eaa5 adds extensions/memory-lancedb/memory-cli.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 822eaa53f72c; files: extensions/memory-lancedb/memory-cli.ts)
  • Shubhankar Tripathy: Raw commit 6390ede adds extensions/memory-lancedb/lancedb-store.ts:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6390edec25e2; files: extensions/memory-lancedb/lancedb-store.ts)

PR surface

Source +3. Total +3 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 13 10 +3
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 13 10 +3

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P3: This is a behavior-preserving internal ownership cleanup with no claimed user-facing defect or performance improvement.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a behavior-preserving internal ownership cleanup with no claimed user-facing defect or performance improvement.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the existing CLI/store consumer checks and build/package validation on the pinned head.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 9, 2026, 3:24 PM ET / 20:24 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 9, 2026 20:52
@vincentkoc
vincentkoc enabled auto-merge (squash) November 9, 2026 20:54
@vincentkoc
vincentkoc merged commit cc5c291 into main Nov 9, 2026
192 checks passed
@vincentkoc
vincentkoc deleted the refactor/lancedb-query-schema-owner branch November 9, 2026 21:03
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-lancedb Extension: memory-lancedb P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant