Skip to content

fix(kuzu): build-system and datasource graphs never wrote on embedded backends - #1644

Merged
Shashankss1205 merged 1 commit into
mainfrom
fix/datasource-embedded-tables
Aug 18, 2026
Merged

Shashankss1205 merged 1 commit into
mainfrom
fix/datasource-embedded-tables

Conversation

@Shashankss1205

Copy link
Copy Markdown
Collaborator

What this fixes

Found by direct feature exercise against a real KùzuDB after the day's merge queue — none of it is reachable from the mocked unit paths, which is why it survived so long.

  1. The entire Gradle/Maven build graph was dead on embedded backends (the default). GradleModule, MavenModule and ExternalLibrary node tables — and MODULE_DEPENDS_ON / USES_LIBRARY / CHILD_MODULE rel tables — were never declared in the Kùzu schema, so write_gradle_build_graph binder-errored on the first write. This is the missing write-side half of bug(gradle): MODULE_DEPENDS_ON is empty on multi-module Android projects; settings.gradle never parsed #1603.
  2. The entire datasource ingest (mysql/redis/cassandra) was dead on embedded backends. DbColumn and RedisKeyPattern declared composite PRIMARY KEY (a, b), which Kùzu cannot parse — the CREATE NODE TABLE failed at every startup, taking the STORED_IN/HAS_COLUMN rel tables down with it. Both are now keyed on a synthesized uid (uid_map, bundle _PK_MAP/_UID_PARTS updated to match). DbTable is now keyed on fqn — the key the writer actually merges on (name collides across datasources) — with a drop-empty-legacy-table migration.
  3. The UNWIND per-row fallback silently dropped every row of node+edge combo queries. It strips the UNWIND but left the bare row variable in WITH tbl, t clauses; the dangling reference binder-errors and the row is skipped with continue. Every datasource and gradle/maven external-lib write goes through this shape.
  4. The uid-only MERGE rewrite dropped displaced pattern properties. MERGE (m:MavenModule {group_id: …, artifact_id: …}) became MERGE (m {uid: …}), and since the follow-up SET doesn't repeat the key fields, group_id/artifact_id stayed NULL — so the CHILD_MODULE/MODULE_DEPENDS_ON MATCHes by artifact_id found nothing. Displaced properties are now re-applied with an injected SET.
  5. Kotlin DSL inter-module deps never matched (gradle.py): the pattern required whitespace before project(, so implementation(project(":core:network")) produced nothing — the remaining open half of bug(gradle): MODULE_DEPENDS_ON is empty on multi-module Android projects; settings.gradle never parsed #1603's headline symptom.

Verification

  • New real-Kùzu regression tests: gradle graph, maven graph (incl. CHILD_MODULE via artifact_id MATCH), datasource graph (incl. same-named columns on two tables staying distinct), idempotent re-ingest; Kotlin-DSL + Groovy gradle parser tests.
  • Full unit suite: 1371 passed / 19 skipped. Full integration suite: 51 passed (all 21 goldens).
  • End-to-end CLI smoke (cgc index + analyze commands) on a mixed py/js project.

Fixes #1603

…fallback and uid-only MERGE rewrites

- GradleModule/MavenModule/ExternalLibrary node tables and MODULE_DEPENDS_ON/
  USES_LIBRARY/CHILD_MODULE rel tables were never declared on the embedded
  backends, so the whole Gradle/Maven build graph binder-errored (#1603).
- DbColumn and RedisKeyPattern used composite PRIMARY KEYs, which Kuzu cannot
  parse: the tables never existed and every datasource ingest failed. They are
  now keyed on a synthesized uid; DbTable is keyed on fqn (the writer's merge
  key) with an empty-legacy-table migration.
- The UNWIND per-row fallback left the bare row variable dangling in
  'WITH node, row' clauses, binder-erroring and silently dropping every row of
  any node+edge combo query (datasources, gradle/maven external libs).
- The uid-only MERGE rewrite dropped displaced pattern properties, leaving key
  columns NULL for labels whose follow-up SET does not repeat them; they are
  now re-applied with an injected SET.
- gradle.py: accept the Kotlin DSL form implementation(project(":x")) in
  inter-module deps — the whitespace-only pattern left MODULE_DEPENDS_ON empty
  on Kotlin-DSL Android projects (#1603).

Includes real-Kuzu regression tests for all of the above.
@vercel

vercel Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-graph-context-pack Ready Ready Preview Aug 18, 2026 6:58pm

@github-actions

Copy link
Copy Markdown
Contributor

Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

@Shashankss1205
Shashankss1205 merged commit 25d80be into main Aug 18, 2026
17 of 19 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board Aug 18, 2026
# reference binder-errors and the row is silently
# dropped. Scrub it from WITH clauses.
loop_query = re.sub(
rf'(WITH\s+[^\n]*?),\s*{row_var}\b(?!\.)', r'\1', loop_query
rf'(WITH\s+[^\n]*?),\s*{row_var}\b(?!\.)', r'\1', loop_query
)
loop_query = re.sub(
rf'WITH\s+{row_var}\s*,\s*', 'WITH ', loop_query
rf'WITH\s+{row_var}\s*,\s*', 'WITH ', loop_query
)
loop_query = re.sub(
rf'WITH\s+{row_var}\b(?!\.)\s*\n', 'WITH 1 AS _row_scrubbed\n', loop_query
@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Code Graph Analysis

fix(kuzu): build-system and datasource graphs never wrote on embedded backends (#1644)

📊 Interactive Visualization

View the blast radius graph: PR Reviewer Dashboard

📦 Artifacts

The graph JSON has been uploaded as a build artifact: pr-code-graph-1644


Generated by CodeGraphContext using FalkorDB Lite

@Shashankss1205
Shashankss1205 deleted the fix/datasource-embedded-tables branch August 18, 2026 19:00

This branch was successfully deployed

1 active deployment
Preview — 32232c00 Deployed Aug 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(gradle): MODULE_DEPENDS_ON is empty on multi-module Android projects; settings.gradle never parsed

2 participants