Documentation

Docs / Reference

ADR 0009 — Graph read queries and CLI traversal

Status: Accepted (developer review, 2026-10-06) Date: 2026-10-06

Context

T007b needs filtered node lookup and evidence-preserving edge reads for query, callers and impact. The persistence boundary must continue to support both SQL backends without recursive SQL or contract v1 changes.

Options considered

Decision

Extend store.Query with Term and Limit; Nodes runs in a read transaction, filters exact identity/kind/file/level in SQL and matches name/qualified-name exactly or qualified-name suffix in Go, with byte-sensitive spelling. Zero limit means unlimited; negative limits are invalid. Add Store.Edges accepting identity and edge-kind sets plus direction. Read bounded identity chunks inside one transaction and return deduplicated edges in kind/source/target order. Postgres uses repeatable read. Existing indexes suffice; no migration is added.

CLI graph reads open existing stores without migrations or directory creation. SQLite uses its read-only URI; Postgres sets every transaction read-only. Freshness uses the status scan. Go traversal deduplicates nodes, ignores cycles, and chooses the first shortest path according to sorted edge order. File impact targets seed contained symbols. JSON is documented in docs/cli/queries.md and verified against language fixtures on each backend.

Consequences

Queries remain offline except explicitly configured Postgres infrastructure through egress. Opening a missing or incompatible store is an error. Node term filtering reads the SQL-filtered payloads before applying the limit; adding name columns/indexes remains a measured future optimization. Each store read is consistent; the complete multi-step traversal does not pin one transaction across calls, so concurrent indexing may change the graph between traversal levels. Freshness and graph reads also are separate snapshots.

Known gaps

No type checking, dynamic dispatch, inherited member resolution or evaluation of cfg/build conditions. Unknown unresolved counts estimate possibly missing callers rather than proving a complete impact boundary. Large-graph snapshot sessions and name indexing require measurements before widening this interface.

Review notes (developer, 2026-10-06)

Review notes (developer, 2026-10-07, after T008b)

Review notes (developer, 2026-10-08, after T009)

Report a problem with this pageSource: docs/adr/0009-graph-read-queries-and-cli.md