Skip to content

READS_FROM/WRITES_TO/FLOWS_TO: extend I/O and data-flow edges beyond Python #714

Description

@vitali87

Summary

READS_FROM / WRITES_TO / FLOWS_TO are emitted for Python only. Every other indexed language parses into the graph with full structure/calls but produces zero I/O or data-flow edges, because the source/sink/handle registry and the processors' language gate are Python-specific.

Root cause (grounded)

  • Both processors early-return for non-Python:
    • IOAccessProcessor.process_io_for_callerif language != cs.SupportedLanguage.PYTHON: return (codebase_rag/parsers/io_access/processor.py:64).
    • FlowProcessor.process_flow_for_caller — same gate (codebase_rag/parsers/flow_access/processor.py:116).
  • The registries have only Python entries: IO_SINKS, IO_HANDLE_CONSTRUCTORS, IO_HANDLE_METHODS are keyed {SupportedLanguage.PYTHON: (...)} (codebase_rag/parsers/io_access/registry.py).
  • The AST-node handling (assignment / call / return / handle-method detection, e.g. _binding_from_node, _arg_names, _return_value_nodes) is written against Python tree-sitter node types (TS_PY_*).

Scope

Add per-language source/sink/handle tables plus per-language node-type handling. Rough per-language surface:

  • Goos.Getenv/os.Open/os.Create, net/http (http.Get, http.Post), database/sql (db.Query, db.Exec), fmt.Println.
  • JavaScript / TypeScriptfs.readFile/writeFile, fetch/axios, process.env, console.log.
  • Javajava.io/java.nio streams, java.sql (Statement.execute*), System.getenv, System.out.print*.
  • Ruststd::fs, std::net, std::env::var, println!.
  • C++fstream, sockets, getenv, std::cout.

Each language also needs its own node-type constants for assignment/call/return and handle-method receiver parsing, mirroring the Python paths.

Suggested direction

  • Generalize the registry maps to {SupportedLanguage: (...)} (the dict shape already exists) and populate per language.
  • Abstract the Python-specific node-type lookups behind a small per-language descriptor (assignment/left/right, call/function/arguments, return value nodes, attribute/handle receiver), so the processors' walk is language-agnostic.
  • Land one language at a time behind the existing opt-in io capture group, each with its own edge tests. Direction heuristics (e.g. the SQL first-keyword refinement) should be revisited per language.

Until then, non-Python I/O/flow is silently absent; this issue tracks closing that gap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions