Enhance semantic resolution across ingestion and reference handling#23
Merged
Conversation
Adds an additive semantic package for build context detection, symbol tables, provider discovery, reference resolution, call/type enrichment, and graph metadata persistence. Materialization now runs local-only semantic enrichment after syntax graph building and before persistence while preserving syntax-only fallback behavior. Constraint: Provider-backed resolution must remain disabled by default. Rejected: Add new ontology relation types | Existing GraphEdge confidence and metadata support semantic evidence without migration. Confidence: medium Scope-risk: moderate Directive: Keep semantic enrichment additive and catch enrichment failures so materialization remains a valid syntax-only fallback. Tested: ./.venv/bin/ruff check . Tested: ./.venv/bin/pytest Tested: ./.venv/bin/codebase-graph setup --repo-root . --mcp-client none Tested: Scryer validate_model Not-tested: Real rust-analyzer/gopls/clangd/fortls process integration; local_only mode intentionally does not execute providers.
Graph search and context now carry additive semantic relation annotations from stored relation metadata through context payloads, block output, and CLI/MCP facade controls. Type resolution persistence now emits legal HasTypeAnnotation owner-to-annotation edges while preserving annotation-to-target References fallbacks, and semantic evidence can use existing EvidencedBy edges when valid evidence nodes exist. Constraint: No ontology schema migration or new relation types were allowed. Rejected: Adding semantic-specific relation tables | existing GraphEdge metadata, confidence, and ontology relations already cover the output gap. Confidence: high Scope-risk: moderate Directive: Keep semantic output additive; syntax-only graph behavior must remain a valid fallback path. Tested: ./.venv/bin/ruff check . Tested: ./.venv/bin/pytest Tested: ./.venv/bin/codebase-graph setup --repo-root . --mcp-client none Tested: graph-query semantic relation count smoke check Tested: graph-search and graph-context semantic block output smoke checks Tested: Scryer validate_model
Evidence-chain rendering now treats ontology-shaped labels such as ReturnType:<id> as already typed, instead of prefixing the node type again. This removes redundant output like ReturnType ReturnType:<id> while keeping human labels such as Method line type-qualified. Constraint: Keep existing block output shape and semantic annotations unchanged. Rejected: Strip ontology ids entirely | explicit graph-context lookups still need a stable identifier when no human label is available. Confidence: high Scope-risk: narrow Directive: Do not type-prefix labels that are already ontology ids. Tested: ./.venv/bin/ruff check . Tested: ./.venv/bin/pytest Tested: ./.venv/bin/codebase-graph setup --repo-root . --mcp-client none Tested: graph-context block output for ReturnType:601da8cabed4de5c3be0 Not-tested: Live in-chat MCP server reload; current tool process still shows old output until restarted.
Evidence-chain text now follows stored relation direction instead of always starting from the query root. Incoming call context around GraphNeighbor now renders as CallExpression GraphNeighbor Calls Class GraphNeighbor, and deeper context shows Function _neighbor_from_row Calls CallExpression GraphNeighbor Calls Class GraphNeighbor. The explicit graph_context path also honors a non-default context_limit while preserving --limit as the fallback for existing callers. Constraint: Keep existing ontology relations and block row fields unchanged. Rejected: Rewriting call graph materialization | the stored Calls edges were already correct; only the human-readable evidence chain was reversed. Confidence: high Scope-risk: narrow Directive: Evidence-chain prose must respect source_node_id -> target_node_id for relation semantics. Tested: ./.venv/bin/ruff check . Tested: ./.venv/bin/pytest Tested: ./.venv/bin/codebase-graph setup --repo-root . --mcp-client none Tested: graph-search GraphNeighbor callgraph block output Tested: graph-context Class:fc89487d1f971fa3e24a callgraph block output Not-tested: Live in-chat MCP server reload after this commit; current process still served old chain text before reload.
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
Testing