Skip to content

F2: cldk/models/cpg — canonical schema-v2 models, modeled once (layer 1) #240

Description

@rahlk

PROBLEM

The SDK has no models for canonical schema v2. This issue adds layer 1 of the two-layer device: the schema modeled ONCE in cldk/models/cpg/, validating v2 analysis.json for every language.

SCOPE BOUNDARY

Parsing/validation layer only — no compat views (F3), no backend invocation changes (F4), no Neo4j (F5). Build against REAL sample analysis.json files from cants and codeanalyzer-python 0.4.x at each max_level, not against keystone prose.

GOALS

  1. Envelope model: schema_version, language, max_level (authoritative — read, never sniff), k_limit, analyzer{name,version}, application.
  2. Application (id, symbol_table, call_graph, param_in, param_out), Module (with whole-file source, imports, types{}, functions{}, content_hash), one open-kind Node (string kind, not a rigid Literal union), Edge ({src,dst,...}; the list name IS the type), Span with byte offsets.
  3. _NullSafeBase throughout (Go/Rust/C serialize empty collections as null).
  4. Accepts sanctioned open-vocabulary prov extensions (e.g. reaching-defs, chore: formalize reaching-defs ddg prov token (+ python-sdk lockstep) codeanalyzer-typescript#32; absorbs feat: accept reaching-defs ddg prov token from codeanalyzer-typescript #232).
  5. The L1 ⊆ L2 ⊆ L3 ⊆ L4 superset gate as a test over the level-series samples.

CAVEATS AND KNOWN RISKS

  • Analyzer tails are still moving (TS hardening, py stage 5): validate against pinned sample artifacts checked into fixtures, refreshed deliberately.
  • Absent = no fact (no null), except the sanctioned callee: null -> id refinement slot.

DEFINITION OF DONE

  • Samples from both analyzers at every available level parse and validate.
  • Superset gate green across the level series.
  • A payload with wrong/missing schema_version fails with an actionable error.

Part of #238

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