Skip to content

Implement sql support#91

Merged
lzehrung merged 21 commits into
mainfrom
implement-sql-support
May 14, 2026
Merged

Implement sql support#91
lzehrung merged 21 commits into
mainfrom
implement-sql-support

Conversation

@lzehrung
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class SQL (.sql) language support across indexing, navigation, graphing, and PR review reporting—while explicitly avoiding application-code string → SQL dependency edges except through review-context heuristics.

Changes:

  • Introduces SQL statement fact extraction + role classification, plus an SQL artifact graph (candidates + provenance).
  • Adds SQL-to-SQL file dependency edges and SQL symbol/navigation support (go-to-definition + find-references within SQL files).
  • Extends review reports and CLI output to optionally include SQL review context and SQL artifact facts.

Reviewed changes

Copilot reviewed 53 out of 54 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/sql-review-context.test.ts Adds tests for SQL review-context inclusion/guardrails.
tests/sql-fact-extraction.test.ts Adds comprehensive SQL statement fact extraction tests.
tests/sql-artifact-graph.test.ts Tests SQL artifact graph + SQL-to-SQL edge behavior (incl. incremental).
tests/samples/sql/graph/report.sql SQL graph fixture: simple query referencing users.
tests/samples/sql/graph/qualified_schema.sql SQL graph fixture: schema-qualified table definition.
tests/samples/sql/graph/qualified_report.sql SQL graph fixture: schema-qualified query.
tests/samples/sql/graph/app.ts Fixture to assert SQL doesn’t link arbitrary app code.
tests/samples/sql/graph/002_alter_users.sql SQL graph fixture: alters users.
tests/samples/sql/graph/001_create_users.sql SQL graph fixture: defines users.
tests/samples/sql/facts/seed.sql Fact extraction fixture: seed insert.
tests/samples/sql/facts/schema.sql Fact extraction fixture: schema snapshot with constraints/view/index.
tests/samples/sql/facts/query.sql Fact extraction fixture: query + join.
tests/samples/sql/facts/migration.sql Fact extraction fixture: migration alter + drop.
tests/samples/sql/facts/dump.sql Fact extraction fixture: dump-like write.
tests/references.test.ts Adds SQL find-references coverage.
tests/project-file-discovery.test.ts Ensures .sql files are discovered by default.
tests/native-parser-ownership.test.ts Adds native ownership coverage for SQL fixtures.
tests/languages/sql.test.ts Adds SQL language registration, chunking, indexing, and native-only assertions.
tests/goto.test.ts Adds SQL go-to-definition coverage.
tests/cli-regressions.test.ts Adds CLI regression for --sql-artifacts JSON output.
src/util/projectFiles.ts Includes .sql in default project discovery patterns.
src/sql/types.ts Defines SQL roles, fact kinds, truth tiers, and review bridge reasons.
src/sql/sourceGraph.ts Builds SQL module index + SQL-to-SQL dependency edges with caching.
src/sql/review.ts Implements SQL PR review context collection (changed files/literals).
src/sql/navigation.ts Implements SQL go-to-definition + find-references within SQL files.
src/sql/index.ts Exposes SQL submodule public exports.
src/sql/graph.ts Projects SQL statement facts into an SQL artifact graph (candidates + provenance).
src/sql/extractFacts.ts Implements statement splitting + fact extraction for common DDL/DML/query patterns.
src/sql/classifySqlFile.ts Classifies SQL file roles (schema snapshot/migration/seed/etc.).
src/review.ts Adds sqlContext to buildReviewReport output.
src/languages/definitions/sql.ts Registers SQL language definition + queries for chunking.
src/languages/all.ts Registers SQL in the global language registry.
src/languages.ts Exposes SQL support via SQL_SUPPORT.
src/indexer/types.ts Adds SQL-relevant symbol kinds (table/view/index/constraint/routine).
src/indexer/navigation.ts Hooks SQL navigation into generic go-to/refs flows.
src/indexer/build-index.ts Uses SQL-specific module indexing and primes SQL fact cache for graph edges.
src/index.ts Exports SQL APIs/types from the package entrypoint.
src/graphs/symbol-graph.ts Normalizes new symbol kinds for symbol graph output.
src/graph-edge-collector.ts Routes .sql files through SQL edge collection; avoids edge caching for SQL.
src/graph-builder.ts Recomputes relevant SQL edges when SQL definitions change (incremental correctness).
src/cli/help.ts Documents --sql-artifacts flag.
src/cli.ts Adds --sql-artifacts to include SQL artifact graph in JSON output.
README.md Documents SQL support and its intentional scope limits.
packages/codegraph-native/src/tests.rs Adds SQL native parser smoke coverage.
packages/codegraph-native/src/languages.rs Adds SQL to native language list and maps to tree-sitter-sequel.
packages/codegraph-native/Cargo.toml Adds tree-sitter-sequel dependency.
packages/codegraph-js-fallback/package.json Adds JS fallback grammar dependency @derekstride/tree-sitter-sql.
package-lock.json Updates lockfile for new JS fallback dependency.
docs/superpowers/plans/2026-05-12-sql-schema-graph-support.md Updates plan doc to reflect revised SQL approach.
docs/scenario-catalog.md Documents SQL scenarios and adds SQL coverage entries.
docs/library-api.md Documents SQL artifact APIs and sqlContext in review output.
docs/language-parity.md Adds SQL to parity matrix + notes about semantics/scope.
docs/cli.md Documents --sql-artifacts output and sqlContext in review JSON.
codegraph-skill/codegraph/SKILL.md Updates skill doc to describe SQL support and flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/sql/sourceGraph.ts Outdated
Comment thread src/sql/navigation.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 53 out of 54 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

src/sql/review.ts:86

  • collectChangedSqlLiteralObjects does an O(changedFiles × sqlObjectNames) regex scan, constructing a new RegExp for every object name and testing it against each changed file's full source. If a repo has many SQL facts, this can become a bottleneck. Consider precomputing patterns once, short-circuiting based on a cheap substring check, or building a single combined matcher (e.g., tokenizing identifiers in the changed source and intersecting with the known object-name set).

Comment thread src/sql/navigation.ts
Comment thread src/sql/review.ts Outdated
Comment thread src/sql/sourceGraph.ts Outdated
Comment thread src/sql/sourceGraph.ts
Comment thread src/sql/graph.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 53 out of 54 changed files in this pull request and generated 3 comments.

Comment thread src/sql/review.ts Outdated
Comment thread src/sql/extractFacts.ts Outdated
Comment thread tests/sql-review-context.test.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 53 out of 54 changed files in this pull request and generated 2 comments.

Comment thread src/sql/review.ts Outdated
Comment thread src/sql/sourceGraph.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 53 out of 54 changed files in this pull request and generated 3 comments.

Comment thread src/sql/navigation.ts
Comment thread src/sql/sourceGraph.ts Outdated
Comment thread src/sql/sourceGraph.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 53 out of 54 changed files in this pull request and generated 1 comment.

Comment thread src/sql/navigation.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 54 out of 55 changed files in this pull request and generated 1 comment.

Comment thread src/sql/sourceGraph.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 54 out of 55 changed files in this pull request and generated 1 comment.

Comment thread src/sql/navigation.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 54 out of 55 changed files in this pull request and generated 2 comments.

Comment thread src/indexer/build-index.ts
Comment thread src/sql/navigation.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 55 out of 56 changed files in this pull request and generated 2 comments.

Comment thread src/sql/sourceGraph.ts Outdated
Comment thread src/sql/sourceGraph.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 55 out of 56 changed files in this pull request and generated 4 comments.

Comment thread src/indexer/build-index.ts Outdated
Comment thread src/sql/review.ts
Comment thread src/sql/sourceGraph.ts
Comment thread src/review.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 55 out of 56 changed files in this pull request and generated 3 comments.

Comment thread src/sql/sourceGraph.ts
Comment thread src/sql/review.ts
Comment thread src/sql/classifySqlFile.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 55 out of 56 changed files in this pull request and generated no new comments.

@lzehrung lzehrung merged commit 05a528d into main May 14, 2026
7 checks passed
@lzehrung lzehrung deleted the implement-sql-support branch May 14, 2026 12:47
lzehrung added a commit that referenced this pull request May 14, 2026
* feat: add SQL artifact graph support

* feat: promote SQL to language support

* fix: harden SQL native support

* fix: refresh SQL graph dependencies incrementally

* fix: improve SQL reference matching

* fix: broaden SQL statement fact coverage

* feat: add practical SQL qualified navigation

* fix: address SQL PR review findings

* fix: address follow-up SQL review comments

* fix: tighten SQL review heuristics

* fix: record precise SQL statement ranges

* fix: tighten SQL edge precision

* fix: repair SQL basename navigation fallback

* fix: cache SQL graph edges by corpus

* fix: tighten SQL update literal hints

* fix: avoid SQL rename target dependency edges

* fix: avoid ambiguous SQL prefix navigation

* fix: persist SQL graph cache signatures

* fix: align SQL graph edge resolution

* Address SQL review performance feedback

* Bound SQL corpus reads
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