Skip to content

Epic: schema-v2 rebuild — canrs L1→L4 analyzer #27

Description

@rahlk

Ground-up rebuild of codeanalyzer-rust as the CLDK schema-v2 backend: one additive CPG (L1 symbol table → L2 call graph → L3 intraprocedural dataflow → L4 interprocedural SDG) emitted as analysis.json + a Neo4j projection.

Design summary

  • Stack: rustc internals (HIR/THIR/MIR + TyCtxt) on a pinned nightly (Clippy/Flowistry pattern), bumped per Rust release.
  • Architecture: extractor + stable core — canrs-extractor (only nightly crate, runs as RUSTC_WORKSPACE_WRAPPER under cargo check) serializes versioned per-crate IR; canrs (stable) builds all levels from IR. Core tests run from recorded-IR fixtures on stable.
  • Schema (Rust expansion): seven typed entities (RsStruct, RsEnum, RsUnion, RsTrait, RsTypeAlias, RsImpl, RsMacro) over the kind-tagged v2 wire; unified impl-facet rule (methods live where the impl is written; facets keyed by target type, base_classes = [type, …traits]); macros first-class with from_macro attribution; closures materialized with rustc naming; fully-qualified signature paths; structured attributes; is_unsafe statement flag; unwind CFG edges for diverging sites only.
  • Dispatch: exact static (prov rustc) + CHA baseline ∪ RTA confirmation (prov merge). L4 oracle: ownership + MIR loans (Flowistry-style), weak updates.
  • Distribution: native-runner matrix → thin codeanalyzer-rust PyPI wheels (binary + bin_path()), GitHub Release assets, homebrew-tap formula, tag-triggered release.yml. Runtime requires rustup (pinned toolchain auto-installed).

Full spec: docs/superpowers/specs/2026-07-09-codeanalyzer-rust-v2-design.md (local drafting doc).

Milestones

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions