resolve: walk supertypes in the kernel once its db holds every inheritance edge (Phase 6 leg 6a)

Merged
BO
1mo ago
+275-37

When a method was missing on a receiver's own type, the kernel handed the ref back to TypeScript (btm-supers, rmot-supers). TypeScript then walks implements/extends edges from the live database, and the resolution loop writes those edges as it goes, so a kernel snapshot might lack them.

But only the prerequisite phase writes those edges: imports, extends and implements, drained before any call ref. A connection that sees the database after that phase sees all of them.

What changed:

  • Kernel: both walks are ported, gated by a new supertypesComplete config flag. matchBoundTypeMember's node-anchored BFS follows getSupertypeNodes (any target kind, each node visited once). resolveMethodOnType's getSupertypes name-union recursion goes to depth 4. Both read edges with the same WHERE source = ? AND kind IN (…) scan TypeScript runs, so the order matches.
  • Main-thread kernels read the live database and always set the flag.
  • Pool workers set it once their snapshot postdates the prerequisite phase. At the first idle boundary after that phase, the loop takes a fresh snapshot copy with a new generation and hands it over through the existing recycle message. If no prerequisite batch ran, there's no new copy; the workers just switch the walks on. A new pool-timing log line records the refresh.
CorpusNative beforeNative afterDump, kernel vs CODEGRAPH_KERNEL_RESOLVE=0
ktor (worker pool)96.5% (btm 2,313, rmot 616)98.2%identical
celery99.0%99.6%identical
Ocelot95.0% (rmot 373)96.2%identical
vitest (worker pool)92.7%93.0%identical
svelte98.9%99.0%identical

On ktor and vitest the pool's first snapshot was taken during the prerequisite phase, so the walks could only run after the boundary refresh.

Checks:

  • New parity pin: with the flag, svc.call resolves to BaseSvc::call through an extends edge. The existing pin, without the flag, still punts.
  • Parity, golden, resolution and pool suites pass. The kernel lib clippy gate (build:kernel) and check:kernel-rules are clean.
  • Full suite: 316 files, 5241 passed, 11 skipped.

Ledger: docs/design/metrics-ledger.md §5.67. Plan: Phase 6 leg 6a marked done; via-src and the tree-based receiver arms remain.