Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(repro): resolve markdown/awk/issue471 per maintainer decisions
Martin Vogel011c129ef930
diff --git a/internal/cbm/lang_specs.c b/internal/cbm/lang_specs.cindex f7ca80315..74ac85666 100644--- a/internal/cbm/lang_specs.c+++ b/internal/cbm/lang_specs.c@@ -1082,7 +1082,11 @@ static const char *fish_branch_types[] = {"if_statement", "switch_statement", "w"for_statement", NULL};static const char *fish_var_types[] = {"variable", NULL};static const char *fish_module_types[] = {"program", NULL};-static const char *awk_func_types[] = {"func_def", "rule", NULL};+/* Only `func_def` (a named `function f(){}`) is a callable. A `rule` (`{...}` /+ * `/re/{...}` / BEGIN/END) is ANONYMOUS top-level executable code — it cannot be+ * called by name, so a call inside a rule is legitimately Module-sourced, and a+ * rule must NOT be treated as a function boundary. */+static const char *awk_func_types[] = {"func_def", NULL};static const char *awk_call_types[] = {"func_call", "command", NULL};static const char *awk_branch_types[] = {"if_statement","for_statement",diff --git a/tests/repro/repro_grammar_markup.c b/tests/repro/repro_grammar_markup.cindex 409d5ac07..6513eb38d 100644--- a/tests/repro/repro_grammar_markup.c+++ b/tests/repro/repro_grammar_markup.c@@ -465,8 +465,11 @@ TEST(repro_grammar_markup_markdown) {"- item one\n""- item two\n";static const char bad[] = "# Heading\n```unterminated code fence\n";+ /* A heading is a "Section" (a valid label), NOT a "Class" — production+ * correctly mints "Section"; assert the accurate label rather than degrade+ * the graph to "Class". */if (markup_struct_battery("Markdown", src, CBM_LANG_MARKDOWN, "README.md",- "Class", NULL) != 0)+ "Section", NULL) != 0)return 1;return markup_robustness("Markdown", bad, CBM_LANG_MARKDOWN, "README.md");}diff --git a/tests/repro/repro_grammar_shells.c b/tests/repro/repro_grammar_shells.cindex bf5881fb2..d3468751e 100644--- a/tests/repro/repro_grammar_shells.c+++ b/tests/repro/repro_grammar_shells.c@@ -537,13 +537,15 @@ TEST(repro_grammar_shells_tcl) {}/* ── AWK ──────────────────────────────────────────────────────────────────────- * Idiomatic: a user function and a rule that calls it. spec: func=func_def,rule,+ * Idiomatic: two user functions where one calls the other. spec: func=func_def,* call=func_call,command.** Dims asserted: 1-8 + R. Dim 5 = "Function" (func_def -> Function). Dim 6* callee = "inner".- * Dim 7 expected RED: neither "func_def" nor "rule" is in func_kinds_generic- * -> Module-sourced.+ * Dim 7 (callable-sourcing): GREEN. The call `inner(v)` lives INSIDE the named+ * function `process`, so it sources to that Function. A bare AWK `rule` is+ * anonymous top-level code (not a callable), so we deliberately keep the call+ * out of any rule — a call in a rule is correctly Module-sourced.*/TEST(repro_grammar_shells_awk) {static const char src[] =@@ -551,8 +553,12 @@ TEST(repro_grammar_shells_awk) {" return x + 1\n""}\n""\n"- "{\n"- " print inner($1)\n"+ "function process(v) {\n"+ " return inner(v)\n"+ "}\n"+ "\n"+ "BEGIN {\n"+ " answer = 1\n""}\n";static const char bad[] = "function inner(x) {\n return x +";if (sh_callable_battery("AWK", src, CBM_LANG_AWK, "prog.awk",diff --git a/tests/repro/repro_issue471.c b/tests/repro/repro_issue471.cindex 43adb4a49..5aa30e098 100644--- a/tests/repro/repro_issue471.c+++ b/tests/repro/repro_issue471.c@@ -83,18 +83,20 @@/** NESTING_DEPTH: number of f(...) levels to generate.*- * Chosen at 5000:- * - Post-#461-cap, N=2000 finishes in <1 s; the superlinear growth- * is steep enough that N=5000 (6.25x the work for O(n^2)) reliably- * blows the 15-second budget on all tested machines (Linux/macOS x86-64- * and arm64) under the current buggy code.- * - A correct O(n) implementation at N=5000 finishes in <50 ms.- *- * ALARM_SECONDS: wall-clock bound.- * 15 seconds is generous: a fixed impl passes easily; a buggy impl hits- * O(n^2) work and exceeds this budget by a large margin at N=5000.+ * DETERMINISM NOTE: this is now a STABLE TERMINATION guard, not a flaky+ * wall-clock perf gate. At N=5000 the O(n^2) parse takes ~15 s — right at the+ * alarm — so it flipped red/green on CI load alone. N=2000 finishes in <1 s even+ * under heavy CI load, so the assertion "the deeply-nested ambiguous parse+ * TERMINATES within ALARM_SECONDS (no hang/crash from the #461-capped GLR+ * recursion)" is now deterministic on every platform. The O(n^2) PERFORMANCE bug+ * #471 itself remains OPEN and is tracked separately: wall-clock perf cannot be+ * reliably gated in CI, so it is intentionally not asserted here. If #471 is+ * later fixed, raising N back to a large value would still pass.+ *+ * ALARM_SECONDS: wall-clock bound. 15 s is hugely generous for the <1 s N=2000+ * parse — it only fires on a true hang (infinite recursion / crash).*/-#define NESTING_DEPTH 5000+#define NESTING_DEPTH 2000#define ALARM_SECONDS 15/*