Skip to content

Latest commit

 

History

History
184 lines (158 loc) · 10.7 KB

progress.md

File metadata and controls

184 lines (158 loc) · 10.7 KB

graphContext — Progress Board

Completed Milestones

M0.1 — Storage Foundation (Schema v3)

  • PR: #2
  • Package: pkg/store
  • Deliverables:
    • SQLite schema v3: nodes, edges, file content hashes, metadata tables.
    • Batched transactional write engine.
    • Typed reads ([]Node, []Edge).
    • FTS5 subword tokenization and symbol search.

M0.2 — Language Layer (Pass 1)

  • PR: #2
  • Package: pkg/lang
  • Deliverables:
    • Language-neutral intermediate representation (FileIR, ImportRef, Ref, TypeFacts).
    • Extension registry and shared tree-sitter AST helpers.
    • Go plugin (pkg/lang/golang): functions, methods, receiver types, struct field types, interface method sets, imports, calls.
    • Python plugin (pkg/lang/python): functions, classes, decorators, inheritance, type annotations, __init__ constructor facts.
    • TypeScript/JavaScript plugin (pkg/lang/typescript): functions, classes, interfaces, type aliases, class fields, imports/re-exports, new expressions.

M0.3 (Part 1) — Cross-File Reference Resolver (Pass 2)

  • PR: #3
  • Package: pkg/resolver
  • Deliverables:
    • Global symbol & module indexing across multiple files.
    • Receiver type propagation (this, self, super, local variables, selector chains like r.db).
    • Base class and interface hierarchy traversal.
    • Tiered resolution engine with confidence levels (exact, ambiguous, name_match, unknown).
    • Structural interface satisfaction discovery (method set subset matching for Go and TypeScript).
    • Deterministic sorting and resolution rate tracking.

M0.3 (Part 2) — Incremental Indexing Pipeline (Pass 3)

  • PR: #4
  • Package: pkg/indexer
  • Deliverables:
    • 3-pass incremental pipeline coordinator (EnsureFresh).
    • SHA256 content hashing to skip unchanged files on subsequent runs.
    • Atomic transactional batch commits to SQLite store.
    • Automatic purging and edge cascading for deleted files.

M1 (Part 1) — In-Memory Graph & Analysis Engine

  • PR: #5
  • Package: pkg/analysis
  • Deliverables:
    • Bi-directional in-memory graph (Out and In adjacency lists).
    • ReverseReach: layered BFS over incoming edges for impact and caller analysis.
    • ForwardReach: layered BFS over outgoing edges for dependency analysis.
    • Trace: forward execution call-tree generator with cycle detection and budget caps.
    • Neighborhood: subgraph extraction around seed symbols with radius limits.
    • PathsBetween: path enumeration between symbols.
    • DegreeMetrics: in/out degree calculation.
    • SCCs: Tarjan's Strongly Connected Components algorithm for circular dependency detection.
    • DeadCandidates: multi-source BFS from root entrypoints (main, routes, tests) for unreachable code detection.
    • Condense: module-level quotient graph with coupling weights and Mermaid diagram generation.

M1 (Part 2) — MCP Server & Core Reasoning Tools

  • PR: #6
  • Branch: feat/mcp-tools
  • Package: pkg/mcp_server
  • Deliverables:
    • Uniform JSON-RPC response envelope (Envelope: answer, caveats, stats, graph_meta).
    • Stdio MCP server with per-project session cache (store.Store + indexer.EnsureFresh + in-memory analysis.Graph).
    • 6 Core Reasoning Tools:
      1. search_symbols(query, kind?, limit): FTS5 matching with in-memory fallback.
      2. get_context(symbol, radius?, include_source?): Symbol-centered context pack with 1-hop callers, callees, inheritance, and optional source snippet.
      3. get_task_context(task, limit?): Context engine scoring task prompt tokens, expanding bounded neighborhoods, and returning ranked context packs.
      4. impact_of_change(symbol, change_type?, max_depth?, limit?): Reverse reachability impact set, affected test files, entrypoints, and dangling references on delete.
      5. trace(from, to?, direction?, max_depth?, limit?): Call-tree execution trace (with recursion detection) or call paths between two symbols.
      6. repo_overview(analysis?, level?, top?): Architecture map with Mermaid diagram, SCC circular dependencies, dead code candidates, and module coupling metrics.
    • Comprehensive end-to-end test suite in pkg/mcp_server/server_test.go.


M2 — Change Intelligence

M2.1 — Unified Git Diff Parser & AST Symbol Mapping

  • PR: #7
  • Branch: feat/m2-diff-parser
  • Package: pkg/diff
  • Deliverables:
    • Unified diff parser (ParseUnifiedDiff) extracting file paths, hunks, line deltas, and condensed line ranges.
    • Safe Git diff runner (RunGitDiff) supporting uncommitted, staged, and branch comparisons.
    • AST symbol mapper (MapDiffToSymbols) intersecting diff line numbers with store.Node spans to classify modified, added, or deleted symbols.
    • Unit test suite in pkg/diff/diff_test.go covering multi-hunk diffs, created/deleted files, git execution, and symbol mapping.

M2.2 — Predictive Test Selection Engine

  • PR: #8
  • Branch: feat/m2-test-selection
  • Package: pkg/testselect
  • Deliverables:
    • Predictive test selector (SelectTests) running ReverseReach across calls, inherits, and overrides to locate reaching tests.
    • Test ranking by call graph distance (depth), resolution confidence, and deterministic node IDs.
    • Repo-wide test reduction metric calculation (ReductionPercent).
    • Git diff integration (SelectTestsFromDiff) combining diff parsing, AST mapping, and test selection into one pipeline.
    • Comprehensive unit test suite in pkg/testselect/testselect_test.go.

M2.3 — Architectural Boundary Linter

  • PR: #9
  • Branch: feat/m2-arch-linter
  • Package: pkg/archlint
  • Deliverables:
    • Declarative architectural rule definitions (RuleSet, ForbiddenRule, LayerRule) with JSON configuration loading.
    • Whole-graph architectural linter (LintGraph) enforcing forbidden path patterns and strict layered architecture hierarchies.
    • Diff-scoped architectural linter (LintDiff) verifying only edges modified or introduced in the diff.
    • Deterministic violation sorting by file, line number, and node IDs.
    • Comprehensive unit test suite in pkg/archlint/archlint_test.go.

M2.4 — MCP Change Intelligence Integration

  • PR: #10
  • Branch: feat/m2-mcp-integration
  • Package: pkg/mcp_server
  • Deliverables:
    • diff_impact tool accepting raw diffs, git revisions, or uncommitted/staged working tree changes.
    • End-to-end Change Intelligence combining diff-to-AST mapping, predictive test selection, and architectural boundary linting.
    • Comprehensive integration test in pkg/mcp_server/server_test.go.

Active Milestone

M3 — Daemon & Live Watcher

M3.1 — File Watcher & Debounce Event Queue

  • PR: #11
  • Branch: feat/m3-file-watcher
  • Package: pkg/watcher
  • Deliverables:
    • Recursive directory watcher leveraging fsnotify with dynamic directory discovery.
    • Sliding-window debouncer with operation coalescing (OpCreate, OpModify, OpDelete) and deterministic path sorting.
    • Extensible path filtering skipping VCS directories, virtual environments, build artifacts, and non-code files.
    • Comprehensive unit test suite covering event coalescing, live file CRUD, dynamic subdirectories, and exclusion rules.

M3.2 — Live In-Memory Graph Incremental Updater

  • PR: #12
  • Branch: feat/m3-daemon
  • Package: pkg/daemon
  • Deliverables:
    • Long-running repository daemon coordinating between pkg/watcher, pkg/indexer, pkg/store, and pkg/analysis.
    • Atomic pointer swaps under sync.RWMutex providing thread-safe concurrent reader access without race conditions or partial states.
    • Event-driven background sync responding to debounced file change batches with real-time SQLite sync.
    • Non-blocking sync event subscription pipeline for downstream clients.
    • Comprehensive unit and integration test suite in pkg/daemon/daemon_test.go.

M3.3 — Idle Session Eviction & Resource Lifecycle

  • PR: #21
  • Package: pkg/mcp_server
  • Deliverables:
    • Idle reaper closing a project's watcher, graph and SQLite handle after GRAPHCONTEXT_IDLE_TTL (default 30m); sessions with a tool call in flight are never evicted.
    • All sessions are closed when the stdio server stops on SIGINT/SIGTERM or stdin close.

M3.4 — CLI Watch Mode & MCP Live Server Integration

  • PR: #20
  • Package: pkg/mcp_server, pkg/daemon, pkg/watcher, pkg/cli
  • Deliverables:
    • MCP sessions served from the live daemon graph via Daemon.FreshGraph, with a watcher sequence number as the read-your-writes barrier.
    • graphcontext watch [dir] runs the daemon standalone and logs each sync.
    • graphcontext run <tool> key=value ..., tools and index expose the MCP tools to shells and CI.

Indexing performance

  • PRs: #14, #16, #17, #18, #19
  • Deliverables:
    • FTS rows keyed to node rowids, delta writes, stat-based skip of unchanged files, cached per-file parse results.
    • Re-index after one edit on a 2000-file synthetic repo: 4.8s to 0.06s. Benchmarks in pkg/indexer/bench_test.go.
    • Crawler takes its extensions from the language registry and shares one ignore list with the watcher.

Language breadth

  • PRs: #23, #24, #25, #26, #27
  • Package: pkg/lang/generic
  • Deliverables:
    • Table-driven language engine: a language is a Spec of grammar node types.
    • Java, Rust, C#, C, C++, Ruby, PHP, Kotlin, Swift and Scala, for 13 languages in total.
    • Resolver resolves each language family on its own index and treats a type-named receiver as a static call.

Roadmap

  • M4 — Validation & Benchmarks: Token-cost and resolver accuracy benchmarks.
  • M5 — Research Artifact: Mutation-derived agent evaluation.