From 587347ba177123a0dd820b5b2eacacc92f109db5 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Fri, 25 Sep 2026 18:49:59 +0000 Subject: [PATCH] docs(cfg): correct the Kotlin and Python grammar-field notes (#3354) The Kotlin CFG visitor claimed no control-flow node has fields; a parse of the vendored grammar shows if_expression fields condition/consequence/ alternative (when/for/while/do/try/elvis are fieldless). The Python harvest note listed conditional_expression's children like field names; the node is fieldless and they are positional. Both notes were misleading reviewers of the #3354 value-alternatives hooks. Comment-only. Co-Authored-By: Claude Opus 5.5 (1M context) --- gitnexus/src/core/ingestion/cfg/visitors/kotlin.ts | 7 ++++--- gitnexus/src/core/ingestion/cfg/visitors/python-harvest.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gitnexus/src/core/ingestion/cfg/visitors/kotlin.ts b/gitnexus/src/core/ingestion/cfg/visitors/kotlin.ts index 68ef9f118..6f6d77efd 100644 --- a/gitnexus/src/core/ingestion/cfg/visitors/kotlin.ts +++ b/gitnexus/src/core/ingestion/cfg/visitors/kotlin.ts @@ -3,9 +3,10 @@ * * Kotlin's tree-sitter grammar (vendored, NOT an npm package — loaded via * `requireVendoredGrammar('tree-sitter-kotlin')`, exactly like tree-sitter-swift) - * is field-less for control flow: NONE of the control-flow nodes expose - * `childForFieldName` fields (verified by a real parse — every `fieldNameForChild` - * came back null), so this visitor navigates purely by child TYPE and position. + * is mostly field-less for control flow (`when` / loops / `try` / `elvis_expression` + * expose no fields), so this visitor navigates purely by child TYPE and position. + * `if_expression` is the exception: it DOES field `condition` / `consequence` / + * `alternative` (#3354 — callable-flow capture reads them); position still works. * Every node-type literal below was grammar-validated against the vendored * tree-sitter-kotlin via the introspection probe before use (mandatory pre-step — * the grammar-literal CI gate maps `kotlin.ts → Kotlin` and fails on a wrong diff --git a/gitnexus/src/core/ingestion/cfg/visitors/python-harvest.ts b/gitnexus/src/core/ingestion/cfg/visitors/python-harvest.ts index acecf42c1..27d21aa4f 100644 --- a/gitnexus/src/core/ingestion/cfg/visitors/python-harvest.ts +++ b/gitnexus/src/core/ingestion/cfg/visitors/python-harvest.ts @@ -46,8 +46,8 @@ * - reads: `attribute` (fields `object`/`attribute`), `subscript` (fields * `value`/`subscript`), `call` (fields `function`/`arguments`), * `boolean_operator` (fields `left`/`operator`/`right`), - * `conditional_expression` (ternary: consequent / condition / alternative in - * source order), `parenthesized_expression`. + * `conditional_expression` (ternary, FIELDLESS: consequent, condition, + * alternative as positional children), `parenthesized_expression`. * * TWO-PHASE, ORDER-INDEPENDENT (load-bearing — mirrors the TS / Go harvesters): * the CFG walk is NOT source-order, so resolving names against a scope stack