# v0.34.0.0 migration — recursive code intelligence

`gbrain upgrade` runs `gbrain apply-migrations` automatically. Most users
won't need to do anything else. If you hit issues or want to verify the
upgrade succeeded, run the steps below.

## What changed

v0.34.0.0 ships the recursive code-intelligence layer on top of v0.33.3's
MCP-exposed code-callers/callees/def/refs foundation:

**Recursive walks (NEW for agents):**

- `code_blast(symbol, depth=5, max_nodes=200)` — recursive callers walk
  with depth grouping. Use BEFORE editing any function.
- `code_flow(entry_point, depth=8, max_nodes=200)` — recursive callees
  walk with terminal-sink tagging. Use when tracing how a request flows.
- `code_traversal_cache_clear` — admin op for invalidating cached walks.

**Foundation extensions:**

- W1: receiver-type resolution at extraction time. `obj.method()` now
  resolves to `Class::method` for the 3 MUST patterns in JS/TS/TSX +
  Python (import, this/self, new C()). Bare-token emit on miss
  (pre-W1 behavior).
- W2: new `imports` and `references` edge types. JS/TS/TSX + Python get
  imports; TS gets type-position references. Ruby/Go/Rust/Java stay at
  calls-only.
- W3b: `code_traversal_cache` table for memoizing blast/flow results.
  Cache invalidation honors the D3 cluster-generation counter.
- W7: `src/core/eval-capture-graph.ts` — pure-function metrics module
  for replay-driven regression checks.

## Mechanical migration

`gbrain upgrade` runs:
1. `bun install` (refreshes deps; no new external deps in v0.34)
2. `gbrain post-upgrade` → `gbrain apply-migrations` → migration v56
   (`code_traversal_cache_v0_34`) creates the cache table on Postgres
   and PGLite.

If your agent uses code symbol-resolution heavily, also run:

```bash
gbrain edges-backfill --all-sources
```

This walks every `content_chunks` row whose `edges_backfilled_at` is
NULL or older than `EDGE_EXTRACTOR_VERSION_TS` (bumped by v0.34 to
re-walk every chunk with the new receiver-resolution + imports +
references emission shape). Resumable; Ctrl-C is safe.

## Verify

```bash
gbrain doctor --json | jq '.checks.code_intel_coverage'
gbrain call code_blast --symbol performSync
gbrain call code_flow --entry_point runCycle
```

## Slip handling — what's NOT in v0.34.0.0

Per the plan's explicit slip-handling clause, the following ship in
v0.34.1 after operator brain validation:

- **W4–5 Leiden clusters.** Cluster ship gate (≤0.03 clusters/node)
  requires real brain data; v0.34.0.0 ships without clusters.
- **`gbrain wiki`** — depends on clusters.
- **`gbrain blast` / `gbrain flow` CLI thin-shims.** Use `gbrain call
  code_blast --symbol <name>` for v0.34.0.0; CLI wrappers come with
  v0.34.1.
- **eval-capture wiring** — the metric module ships in v0.34.0.0;
  capture/replay dispatch on tool comes with v0.34.1.

## If something fails

File an issue at https://github.com/garrytan/gbrain/issues with:
- output of `gbrain doctor`
- contents of `~/.gbrain/upgrade-errors.jsonl` if it exists
- which step broke
