code_index: graphe d'appels (tree-sitter) + code_impact (Phase 4)#4
Merged
Conversation
graph.py extrait un graphe d'appels statique (défs ↔ sites d'appel) pour PHP/ Python/TS/JS et expose code_impact : rayon d'impact (callers) et dépendances (callees) d'un symbole. Pendant « code » du lineage data curé ; pur AST, aucun appel API → artefact (JSON/JSON.gz, ~1,5 Mo gz, ~37k nœuds) reconstructible partout. Résolution par nom (multi-langage) avec deux garde-fous data-driven contre les collisions avec des primitives (fanout de définition + fréquence d'appel) et exclusion des fichiers minifiés/bundlés. Un nœud classe tire ses méthodes comme graines. URLs source via le sidecar méta. Accesseurs tree-sitter agnostiques au binding factorisés dans tsutil.py (partagés par chunk_ast et graph). 12 tests graph + suite code_index verte (66).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 4 — Graphe de code +
code_impactPendant code du
lineagedata curé : « qu'est-ce qui casse si je change X ? ».Ajouts
graph.py: extraction d'un graphe d'appels statique via tree-sitter (PHP/Python/TS/JS) — définitions (fonctions/classes/méthodes) reliées par leurs sites d'appel.code_impact(symbol, direction, depth): BFS bornécallers(rayon d'impact) /callees(dépendances). CLIbuild+impact. Pur AST, aucun appel API → artefact (JSON/JSON.gz, ~1,5 Mo gz, ~37k nœuds) reconstructible partout.tsutil.py: accesseurs tree-sitter agnostiques au binding, factorisés depuischunk_ast.py(partagés).Qualité de résolution
Résolution par nom (multi-langage, pragmatique) avec garde-fous data-driven contre les collisions avec des primitives :
--max-fanout: un nom trop défini (ambigu) n'est pas relié ;.push()~2900×) ≈ primitive → non relié ;Résultat sur le périmètre complet : 50587→37030 nœuds, top in-degree redevenu sain. Ambiguïté résiduelle signalée (
ambiguous).Tests
12 tests graph (extraction py/php, construction, garde-fous, BFS callers/callees, round-trip gz) ; suite
code_indexverte (66).