From c955721f9297db917f6b057270efccbb2a2f44e6 Mon Sep 17 00:00:00 2001 From: Marius Ciepluch <11855163+norandom@users.noreply.github.com> Date: Fri, 11 Sep 2026 10:49:10 +0200 Subject: [PATCH] fix(cpg): the census overlay list is layer names, not characters One flatten too many turned "base,controlflow,typerel,callgraph,dataflowOss" into "b,a,s,e,...", and every real build then warned that its graph lacked the dataflow layer while carrying it. The compile test now asserts the shape on a real graph. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG --- src/openultrasast/cpg/queries/census.sc | 2 +- tests/test_cpg_queries_compile.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/openultrasast/cpg/queries/census.sc b/src/openultrasast/cpg/queries/census.sc index e8b22ee..dc190ed 100644 --- a/src/openultrasast/cpg/queries/census.sc +++ b/src/openultrasast/cpg/queries/census.sc @@ -23,7 +23,7 @@ ujson.Obj( "files" -> cpg.file.size.toString, "methods" -> cpg.method.size.toString, - "overlays" -> cpg.metaData.overlays.l.flatten.mkString(","), + "overlays" -> cpg.metaData.overlays.l.mkString(","), "maxHeapMB" -> (Runtime.getRuntime.maxMemory / 1048576).toString ) ) diff --git a/tests/test_cpg_queries_compile.py b/tests/test_cpg_queries_compile.py index 9b5646d..5da68eb 100644 --- a/tests/test_cpg_queries_compile.py +++ b/tests/test_cpg_queries_compile.py @@ -56,4 +56,12 @@ def test_each_query_compiles_and_answers(name: str, tmp_path: Path) -> None: done = subprocess.run(command, capture_output=True, text=True, timeout=900, check=False, cwd=str(tmp_path)) assert done.returncode == 0, f"{name}.sc did not run: {(done.stderr or done.stdout or '')[-500:]}" - assert extract_payload(done.stdout or "") is not None, f"{name}.sc produced no parseable payload" + payload = extract_payload(done.stdout or "") + assert payload is not None, f"{name}.sc produced no parseable payload" + if name == "census": + # The overlay list is what the backend checks for the dataflow layer. It shipped once as a list of + # CHARACTERS (`b,a,s,e,...`) -- one `flatten` too many -- and every real build warned that its graph + # lacked `dataflowOss` while carrying it. `importCpg` applies the layer here, so it must be named. + overlays = str(payload.get("overlays", "")).split(",") + assert "dataflowOss" in overlays, f"census reports overlays {overlays!r}, which is not a list of layer names" + assert str(payload.get("maxHeapMB", "")).isdigit()