intel_repo: typed/op-annotated dataflow + error-handling/arith detectors
Goal
Annotate the CPG dataflow with type + operation semantics so error-handling and arithmetic rules become graph-native — the highest-value enrichment, since the def-use shape (DEF_USE, CONTROL_DEP) already exists and only the semantic labels are missing.
Implementation Sketch
Extractor/resolver tags DEF nodes with Result/Option/RAII-ness and arithmetic op nodes with op-kind + checked/unchecked; detectors query the typed dataflow. Schema bump + pin; degradation preserved.
Spec References
intel_repo/neo4j/{cpg_extractor,cpg_resolver,cpg_type_resolver,cpg_dataflow}.py; LEAK:swallowed-error/lossy-fallback/error-source-discard; ARITH:silent-wraparound.
Work Items
- CPG resolver: tag DEF DataFlowNodes with is_result/is_option/is_raii (from type resolution) + tag arithmetic operation nodes with op kind + checked/unchecked.
- Swallowed-error detector (graph-native): Result-typed DEF whose def-use chain has no error-branch USE within its CfgBlock -> LEAK:swallowed-error.
- Lossy-fallback detector: unwrap_or_default / Err->Ok-default over typed dataflow -> LEAK:lossy-fallback.
- Unchecked-arithmetic detector: arithmetic op on size/offset/index value without a proven bound -> ARITH:silent-wraparound (narrowing where the bound-proof is semantic).
- Schema/envelope bump + consumer pin; graceful degradation when cpg_stale.
- Tests + ori_arc smoke.
Fresh intel (regenerated)
{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “graph-driven-hygiene/s-5d7a6bbe” }, “generated_at”: “2026-06-22T04:22:52.567337+00:00”, “graph_state”: { “head_sha”: “9e4174b6”, “last_code_import_at”: “2026-06-22T04:03:42.016Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:graph-driven-hygiene/s-5d7a6bbe] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/graph-driven-hygiene” } } }
(full dossier: typed-dataflow—s-5d7a6bbe.intel.json)