Skip to content

Enhance semantic resolution across ingestion and reference handling#23

Merged
rabii-chaarani merged 4 commits into
mainfrom
codex/enhance_semantic_resolution
Jun 15, 2026
Merged

Enhance semantic resolution across ingestion and reference handling#23
rabii-chaarani merged 4 commits into
mainfrom
codex/enhance_semantic_resolution

Conversation

@rabii-chaarani

Copy link
Copy Markdown
Owner

Summary

  • Improve semantic context building and symbol/reference resolution during ingestion
  • Add call-type resolution and enrichment writer/provider updates to support richer semantic metadata
  • Extend materializer and semantic package exports to wire the new resolution flow together
  • Add tests covering context building, symbol table behavior, reference resolution, call type resolution, and enrichment writing

Testing

  • Added and updated unit tests for the semantic pipeline and materializer behavior
  • Not run (not requested)

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.
@rabii-chaarani rabii-chaarani merged commit 5bad710 into main Jun 15, 2026
54 of 72 checks passed
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