Skip to content

Migrate graph storage from KuzuDB to LadybugDB#302

Merged
HumanBean17 merged 2 commits into
masterfrom
propose/ladybug-migrate
Jun 8, 2026
Merged

Migrate graph storage from KuzuDB to LadybugDB#302
HumanBean17 merged 2 commits into
masterfrom
propose/ladybug-migrate

Conversation

@HumanBean17

Copy link
Copy Markdown
Owner

Summary

  • Replace the archived kuzu dependency with its maintained fork ladybug (same core team, MIT licensed, actively developed).
  • This PR currently contains the proposal (propose/active/LADYBUG-DB-MIGRATE-PROPOSE.md) and the implementation plan (plans/active/PLAN-LADYBUG-DB-MIGRATE.md).
  • The implementation will be a single PR with purely mechanical renames across 43 Python files and 11 markdown docs: import kuzuimport ladybug, KuzuGraphLadybugGraph, kuzu_queriesladybug_queries, --kuzu-path--ladybug-path, code_graph.kuzucode_graph.lbug.

Key decisions

Decision Choice Rationale
Compatibility shim Clean break Repo allows breaking changes
kuzu_type rename graph_type Engine-agnostic, avoids future rename
Dependency pin ladybug>=0.17.1,<0.18 Mirrors existing strict minor pin
DB file extension .lbug Short, unique, no collisions
Ontology bump None required No enrichment semantics change

Test plan

  • Full test suite passes after mechanical rename (.venv/bin/python -m pytest tests -v)
  • Graph builder smoke produces valid .lbug database from bank-chat fixture
  • grep -ri "kuzu" --include="*.py" returns zero hits
  • grep -ri "kuzu" --include="*.md" AGENTS.md README.md docs/ tests/README.md returns zero hits
  • .venv/bin/ruff check . passes

🤖 Generated with Claude Code

HumanBean17 and others added 2 commits June 8, 2026 23:10
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@HumanBean17 HumanBean17 merged commit d36ed2f into master Jun 8, 2026
1 check passed
HumanBean17 added a commit that referenced this pull request Jun 17, 2026
… migration doc close-out (#333)

* Bump version to 0.6.3

* perf(path-filter): drop O(n²) winning-row from is_ignored hot path

is_ignored returned (bool, IgnoreLayer) and computed _winning_row (one
GitIgnoreSpec rebuild per ignore-rule prefix) on every call. All 7
production callers (iter_java_source_files + java_index_flow_lancedb)
discarded the layer; only diagnose-ignore needs source attribution, and
diagnose_dict already computes it. is_ignored now returns a plain bool;
the two test assertions that checked the layer's source migrate to
diagnose_dict. On a repo with ~100 ignore rules this cuts ~5000 spec
compilations per indexed file down to one.

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: collapse mechanical duplication across four modules

- ast_java: four byte-identical _codebase_*_inner_annotation_nodes walkers
  -> one _inner_annotation_nodes(node, src, target_simple).
- graph_enrich: three identical _route/_client/_async _hint_lookup helpers
  -> one generic _hint_lookup (TypeVar) used at all three call sites.
- ladybug_queries: find_callers/find_callees (~50-line near-twins) -> one
  _walk_calls helper; the two public methods keep their signatures and
  delegate, differing only in call-graph orientation.
- pr_analysis: drop the dead 'notes' local in compute_risk (never appended;
  the real notes are assembled by analyze_pr_pipeline and merged there).

meta()'s 5-level query cascade in ladybug_queries is intentionally left in
place: it is reachable via direct LadybugGraph(...) construction that bypasses
get()'s ontology gate, and test_feign_not_exoser relies on its fallback, so it
is not cleanly dead right after the Ladybug migration.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: latent footguns in mcp_v2 error branches and brownfield layer literals

mcp_v2: 15 error branches passed hints=[] to NeighborsOutput/DescribeOutput,
neither of which has a hints field (their fields are advisories /
hints_structured, both defaulting to []). pydantic silently dropped the kwarg;
today harmless, but the moment anyone adds extra='forbid' to those models every
error branch would raise ValidationError swallowed by the catch-all. The models
already default to empty, so the dead kwargs are simply removed.

build_ast_graph: the four brownfield layer names were spelled out four times
(_client_source_layer, _producer_source_layer, brownfield_strategies, and
_BROWNFIELD_LAYERS). Promote _BROWNFIELD_LAYERS to the single source of truth
and define brownfield_strategies as _BROWNFIELD_LAYERS plus the two caller-side
declaration strategies (codebase_client/codebase_producer). The two sets still
differ deliberately: _BROWNFIELD_LAYERS gates brownfield_only authoritativeness
(per edge), while brownfield_strategies counts annotation-declared callers in
the *_from_brownfield_pct stats — now that relationship is explicit instead of
two independent literals that looked unrelated.

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: close out the LadybugDB migration across docs, strings, and plans

The KuzuDB->LadybugDB migration (commit #302) landed as code but its doc/string
sweep and plan close-out were never finished, leaving operator and agent docs
asserting the old store. This completes it:

Docs (current-state Kuzu -> LadybugDB, code_graph.kuzu -> .lbug, --kuzu-path
-> --ladybug-path, kuzu_queries.py -> ladybug_queries.py, KuzuGraph ->
LadybugGraph, kuzu_path -> ladybug_path; ontology 15/16 -> 17):
  README, AGENTS, docs/CONFIGURATION, docs/JAVA-CODEBASE-RAG-CLI,
  docs/MANUAL-VERIFICATION-CHECKLIST, docs/CODEBASE_REQUIREMENTS,
  docs/AGENT-GUIDE, docs/PRODUCT-VISION, tests/README.

Factual fixes surfaced by the markdown freshness audit:
  - README: DECLARES_ROUTE (nonexistent edge) -> EXPOSES; role list no longer
    lists PRODUCER (a node kind) and now includes COMPONENT/CONFIG/ENTITY;
    EMBEDDING_MODEL -> SBERT_MODEL (the real env var).
  - AGENT-GUIDE + SKILL: route frameworks corrected to spring_mvc/webflux
    (kafka/rabbitmq/jms/stream are route kinds; feign is a client kind).
  - PRODUCT-VISION: CALLS is shipped, not 'planned'. External citation titles
    (footnotes 12/17) intentionally left as 'Kuzu'.

Shipped-artifact resync + plan close-out:
  - install_data/{skills,agents} explorer copies re-synced from source (they
    were behind, missing source_layer and the schema-rejection note).
  - Moved the landed PLAN/propose for LADYBUG-DB-MIGRATE and INDEX-OUTPUT-REWORK
    from active/ to completed/.

Source docstring/help-string sweep only (cli/pr_analysis/mcp_v2/search_lancedb,
conftest, test_ladybug_queries docstrings) — no behaviour change; the one
clearly-stale kuzu 0.11.x version reference in mcp_v2 is genericized.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
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