feat: graph utilization improvements for description generation and text2sql - #78
Merged
Conversation
2 tasks
Switch example model to gemma4:31b (qwen3-coder:30b no longer pulled locally) and refresh all stored outputs, including the new include_sources example showing source columns described from forward usage.
…dation BigQuery backticked identifiers (and other dialect-specific syntax) failed dialect-less parsing, so generated SQL took the fail-open passthrough and skipped destructive-statement validation entirely.
Demonstrates lineage-derived prompt context (table roles, column lineage, observed and candidate join hints), direct vs two-stage strategies, and LineageAgent routing, executed against gemma4:31b. Removes the enterprise demo's dead SKIP_TEXT_TO_SQL flag in favor of the dedicated example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements all 9 features from the graph-utilization design specs (PR #77) as 12 commits — one per feature plus two final-review fixes. Each feature landed with tests written first and passed an independent spec+quality review before the next began.
Description generation (D2→D3→D4→D1):
refactor:incoming-edge lookups use the adjacency index (publicPipeline.get_incoming_edges), replacing O(V·E) scansfeat:newDescriptionSource.FALLBACK— rule-based placeholders are distinguishable, retried on rerun, and their text is excluded from downstream prompts (all sources now listed by name)fix:terminal SELECTs get descriptions via sharedtarget_table()resolution (parity with metadata propagation, spy-tested)feat:include_sources=Truedescribes source-table columns from forward usage context (build_source_description_prompt, dispatch ontable_graphis_source— notis_computed(), which is True for parsed input nodes)Text2SQL (T1→T4→T2→T3a→T3b→T5):
feat:one capped table set (resolve_context_tables) feeds schema, relationships, lineage, notes, andtables_used; column lineage now in the default direct strategy; lineage caps configurablefeat:source/intermediate/final role labels, prefer-final-tables instruction, role-priority truncationfeat:expand_with_lineage(depth)— transitive BFS (default 2), shallow-first, self-reference safefeat:## Join Hints— observed equi-joins extracted from query ASTs with scope-correct alias resolution (no fabrication from nested-subquery alias collisions; chainedUSINGskipped; cross-query provenance kept)feat:candidate joins from shared lineage sources, restricted to identity-preserving paths (AST-verified rename-only edges; aggregates/transforms fail closed; out-of-context sources not leaked into prompts)feat:keyword-selection fallback gets 1-hop score diffusion and deterministic role-aware paddingfix:parenthesizedONconditions now resolve (final-review finding)docs:changelog entries for all user-facing changesNotable deviations from the specs (all review-driven)
direct_column/star_passthrough/cross_query— the spec's"direct"never occurs;"expression"edges qualify only when the target's expression unaliases to a bare column (UPPER(email) AS xis rejected, pinned by test)query_idsprovenance list in addition to first-seenquery_idTest plan
get_incoming_edges,include_sources,build_source_description_prompt,ContextConfigfields) — follow-up PR in the docs submodule🤖 Generated with Claude Code
https://claude.ai/code/session_01MCAw3ceZaN7roTDpAuUtYF