Skip to content

Commit 6bbadc6

Browse files
committed
feat(schema): v2 model layer — body nodes, split edge lists, Analysis envelope
1 parent 7ac0741 commit 6bbadc6

6 files changed

Lines changed: 145 additions & 183 deletions

File tree

codeanalyzer/core.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -455,23 +455,7 @@ def analyze(self) -> PyApplication:
455455
.build()
456456
)
457457

458-
if self.analysis_level >= 3:
459-
# Level 3: native dataflow graphs (CFG/PDG/SDG) over the same
460-
# signatures, gated so -a 1/-a 2 timings stay untouched.
461-
from codeanalyzer.dataflow.builder import (
462-
build_program_graphs,
463-
to_program_graphs,
464-
)
465-
466-
t0_l3 = time.perf_counter()
467-
ir = build_program_graphs(app, k=self.options.graph_field_depth)
468-
app.program_graphs = to_program_graphs(
469-
ir, set(self.options.graphs.split(","))
470-
)
471-
logger.info(
472-
"✅ Program graphs: %d functions, %d SDG edges in %.1fs",
473-
len(ir.functions), len(ir.sdg_edges), time.perf_counter() - t0_l3,
474-
)
458+
# L3/L4 dataflow emission rebuilt on the v2 tree in Stage 3+
475459

476460
# Save to cache
477461
self._save_analysis_cache(app, cache_file)

codeanalyzer/neo4j/project.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ def project(app: PyApplication, app_name: str) -> GraphRows:
7474
"PY_CALLS", src, tgt, _call_edge_props(e.weight, list(e.provenance or []))
7575
)
7676

77-
# Level-3 CPG overlay (present only at -a 3): the same program_graphs IR
78-
# projected as :PyCFGNode nodes and PY_-namespaced dependence edge types.
79-
if app.program_graphs is not None:
80-
_project_program_graphs(b, app)
77+
# CPG overlay projection rebuilt on the v2 tree in Stage 3
8178

8279
return b.finish()
8380

codeanalyzer/schema/__init__.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@
22
from packaging.version import parse as parse_version
33

44
from .py_schema import (
5+
Analysis,
6+
BodyNode,
7+
CdgEdge,
8+
CfgEdge,
9+
DdgEdge,
10+
ParamEdge,
511
PyApplication,
612
PyCallable,
713
PyCallableParameter,
8-
PyCFG,
9-
PyCFGEdge,
1014
PyClass,
1115
PyClassAttribute,
1216
PyComment,
1317
PyExternalSymbol,
14-
PyFunctionGraphs,
15-
PyGraphNode,
1618
PyImport,
1719
PyModule,
18-
PyParamNode,
19-
PyPDG,
20-
PyPDGEdge,
21-
PyProgramGraphs,
22-
PySDGEdge,
23-
PySDGEndpoint,
2420
PyVariableDeclaration,
21+
Span,
22+
SummaryEdge,
2523
)
2624

2725
__all__ = [
26+
"Analysis",
2827
"PyApplication",
2928
"PyExternalSymbol",
3029
"PyImport",
@@ -35,16 +34,13 @@
3534
"PyCallable",
3635
"PyClassAttribute",
3736
"PyCallableParameter",
38-
"PyGraphNode",
39-
"PyCFGEdge",
40-
"PyPDGEdge",
41-
"PyParamNode",
42-
"PyCFG",
43-
"PyPDG",
44-
"PyFunctionGraphs",
45-
"PySDGEndpoint",
46-
"PySDGEdge",
47-
"PyProgramGraphs",
37+
"Span",
38+
"BodyNode",
39+
"CfgEdge",
40+
"CdgEdge",
41+
"DdgEdge",
42+
"SummaryEdge",
43+
"ParamEdge",
4844
]
4945

5046
try:
@@ -64,6 +60,7 @@
6460
PyClass=PyClass,
6561
PyModule=PyModule
6662
)
63+
Analysis.update_forward_refs(PyApplication=PyApplication)
6764

6865
# Compatibility helpers for Pydantic v1/v2
6966
def model_dump_json(model, **kwargs):

0 commit comments

Comments
 (0)