Skip to content

Commit ef63dc3

Browse files
committed
Merge upstream 8df0639 into the CLI fork (step 9)
Merge upstream's Ansible/configlink and graph-memory changes onto the step-8 fork head, retaining the CLI-only boundary and the fork's operation semantics. The upstream range is 932dd1d..8df0639 (33 commits through DeusData#2643/DeusData#2644/DeusData#2642). MCP transport files remain deleted. Conflicts and resolutions: - Makefile.cbm: keep the fork's operation/daemon/UI source graph and MCP removals; wire pass_ansible, pass_envjoin, graph_mem and relevant tests. - README.md: preserve CLI-fork positioning and MCP-removal documentation, incorporate upstream capability additions. - src/cypher/cypher.c: retain streamed execution and graph-store improvements; restore the fork's max_rows projection cap for oversized explicit LIMITs. - src/foundation/mem_core.{c,h}: retain fork budget APIs and operation_arg, add upstream graph_cache class. - src/pipeline/pipeline.c: combine fork timing metrics with upstream backup and no-op state. - tests/test_main.c and tests/test_cypher.c: merge suite/test registrations and preserve the fork row-budget contract. - scripts/memory-core-baseline.txt: regenerate after the memory-core merge. - src/mcp/** and tests/test_mcp*.c: keep removed; convert the graph-cache request-eviction test to a CLI operation dispatch. Ported: - Add read batches to short-lived read operations and end them on store close. - Use cbm_git_branch_resolve for project branch records; add CONNECTS_TO to trace topology. - Use chunked source reads, per-request root-containment caching, indexed search-result lookup, and the scoped in-process source scanner with fallback. - Add the graph-memory adjacency cache, trace/degree integration and idle eviction after operation execution. - Add operation-level source-search tests and upstream Ansible/envjoin passes. Validation: scripts/build-dev.sh (-Werror), test-runner build, source_search suite (3 passed), required and touched suites (1,225 passed), scripts/lint.sh --ci, Jenkins daemon-recovery test, vendored checksums (1,083 OK), and memory-core lint passed. No push.
2 parents f701caf + 8df0639 commit ef63dc3

73 files changed

Lines changed: 14493 additions & 774 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile.cbm‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ PREPROCESSOR_SRC = $(CBM_DIR)/preprocessor.cpp
451451
SQLITE_WRITER_SRC = $(CBM_DIR)/sqlite_writer.c
452452

453453
# Store module (new)
454-
STORE_SRCS = src/store/store.c src/store/architecture_projection.c src/store/store_impact.c src/store/store_graph_digest.c src/store/store_content_digest.c
454+
STORE_SRCS = src/store/store.c src/store/graph_mem.c src/store/architecture_projection.c src/store/store_impact.c src/store/store_graph_digest.c src/store/store_content_digest.c
455455

456456
# Cypher module (new)
457457
CYPHER_SRCS = src/cypher/cypher.c
@@ -541,7 +541,9 @@ PIPELINE_SRCS = \
541541
src/pipeline/pass_operator.c \
542542
src/pipeline/pass_shell.c \
543543
src/pipeline/pass_terraform.c \
544+
src/pipeline/pass_ansible.c \
544545
src/pipeline/pass_docker.c \
546+
src/pipeline/pass_envjoin.c \
545547
src/pipeline/pass_ci.c \
546548
src/pipeline/pass_similarity.c \
547549
src/pipeline/pass_semantic_edges.c \
@@ -745,6 +747,7 @@ TEST_STORE_SRCS = \
745747
tests/test_store_impact.c \
746748
tests/test_store_scope.c \
747749
tests/test_store_graph_digest.c \
750+
tests/test_graph_mem.c \
748751
tests/test_store_search.c \
749752
tests/test_store_arch.c \
750753
tests/test_architecture_projection.c \
@@ -760,6 +763,7 @@ TEST_OPERATION_SRCS = \
760763
tests/test_index_supervisor.c \
761764
tests/test_changes_operation.c \
762765
tests/test_trace_architecture_operations.c \
766+
tests/test_source_search.c \
763767
$(wildcard tests/test_test_impact*.c)
764768

765769
TEST_DAEMON_SRCS = \

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ It includes:
6060
- definitions, calls, imports, usages, routes, channels, and cross-service links;
6161
- architecture summaries, change-impact analysis, dead-code queries, ADRs, and Cypher queries;
6262
- BM25, semantic, structural, and graph-augmented source search;
63+
- infrastructure and configuration linking for Ansible, Kubernetes, Helm, Compose, Terraform, TOML and INI, including `CONNECTS_TO` topology;
64+
- in-memory adjacency acceleration for trace traversal and degree-filtered search;
6365
- cross-repository graph intelligence and the CBM Atlas web UI: an explorer and read-only reader, a semantic twin that follows the caret, flow, bug-hunt and change-scope reading modes, the 3D galaxy and project management, served by the binary on loopback (`localhost:9749`) through native `/api/*` endpoints and `POST /api/tool`;
6466
- a persistent local index with incremental updates and optional shared graph artifacts;
6567
- a coordination daemon, supervised workers, and filesystem watcher for reliable background indexing.

‎internal/cbm/cbm.h‎

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -701,31 +701,44 @@ typedef struct {
701701
/* A fact a Kubernetes manifest states about other objects (extract_k8s.c),
702702
* resolved by the K8s pass against the objects of the source's bundle.
703703
* CBM_K8S_FACT_REF: object def_index names a kind/ns/name object at a
704-
* reference path (via), drawn as edge (USAGE, INFRA_MAPS or DEPENDS_ON);
705-
* ns NULL = the source's own namespace.
704+
* reference path (via), drawn as edge (USAGE, INFRA_MAPS, DEPENDS_ON or
705+
* CONNECTS_TO); ns NULL = the source's own namespace. A CONNECTS_TO
706+
* reference (via "env") is the Service the value of environment variable
707+
* `key` of container `container` addresses -- the value is not kept.
706708
* CBM_K8S_FACT_CRD: the CRD def_index declares kind `kind` in group `name`.
707709
* CBM_K8S_FACT_DEPLOY: object def_index (a Flux Kustomization, an Argo
708710
* Application) deploys the repository directory `name` into namespace
709-
* `ns` (NULL: the objects' own); via "flux" / "argo".
711+
* `ns` (NULL: the objects' own); via "flux" / "argo". via "kustomize"
712+
* (def_index -1: the kustomization itself): a `helmCharts` entry
713+
* inflates chart `name` of repository `url` at `version` as release
714+
* `release` into namespace `ns`, with values file `path`.
710715
* CBM_K8S_FACT_ROUTE: object def_index (an Ingress, an HTTPRoute) exposes
711716
* `route` ("<host or *><path>") and sends it to the kind/ns/name backend
712717
* (name NULL: none); via "ingress" / "httproute".
713718
* CBM_K8S_FACT_SOURCE: object def_index (a Flux OCIRepository) fetches
714719
* from the URL `name`; a HelmRelease whose chartRef names it deploys the
715720
* chart there.
716-
* CBM_K8S_FACT_IMAGE: object def_index runs a container of image `name`
717-
* (a literal reference); via "container".
721+
* CBM_K8S_FACT_IMAGE: object def_index runs its container `container`
722+
* (NULL: unnamed) from image `name` (a literal reference); via "container".
718723
* CBM_K8S_FACT_ENV: object def_index sets environment variable `name` in
719724
* its container `container` (NULL: unnamed) at `line`; via = where the
720-
* value comes from ("value", or the valueFrom kind) -- never the value. */
725+
* value comes from ("value", or the valueFrom kind) -- never the value.
726+
* CBM_K8S_FACT_PATCH: a kustomization's `patches` entry at `line` patches
727+
* the objects of its build named by kind / group / version / name / ns
728+
* (any NULL: any) -- its `target`, else an inline patch document's own
729+
* kind / group / name / ns; `path` is
730+
* the patch file (as written, relative to the kustomization), NULL for an
731+
* inline patch. kind and name both NULL: the patch file's documents name
732+
* them. def_index -1: the kustomization itself is the source. */
721733
typedef enum {
722734
CBM_K8S_FACT_REF = 0,
723735
CBM_K8S_FACT_CRD,
724736
CBM_K8S_FACT_DEPLOY,
725737
CBM_K8S_FACT_ROUTE,
726738
CBM_K8S_FACT_SOURCE,
727739
CBM_K8S_FACT_IMAGE,
728-
CBM_K8S_FACT_ENV
740+
CBM_K8S_FACT_ENV,
741+
CBM_K8S_FACT_PATCH
729742
} CBMK8sFactKind;
730743
typedef struct {
731744
CBMK8sFactKind fact;
@@ -737,6 +750,13 @@ typedef struct {
737750
const char *edge;
738751
const char *route;
739752
const char *container;
753+
const char *key; /* CONNECTS_TO: the environment variable addressing it */
754+
const char *group; /* PATCH: the API group named ("core"), NULL: any */
755+
const char *version; /* PATCH: the API version named, NULL: any */
756+
const char *path; /* PATCH: the patch file, NULL: inline */
757+
const char *selector; /* PATCH: the target's labelSelector, NULL: none */
758+
const char *url; /* DEPLOY (kustomize): the chart repository */
759+
const char *release; /* DEPLOY (kustomize): the release name */
740760
int line;
741761
} CBMK8sFact;
742762

‎internal/cbm/extract_defs.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7197,18 +7197,19 @@ static char *find_hcl_block_name(CBMArena *a, TSNode node, const char *source) {
71977197
// Append the block's quoted labels so each block gets a distinct,
71987198
// query-friendly name: resource "aws_instance" "web" -> resource.aws_instance.web
71997199
// rather than every resource collapsing to the bare keyword "resource" (#337).
7200-
// HCL stores labels as string_lit -> template_literal children.
7200+
// HCL stores quoted labels as string_lit -> template_literal children and
7201+
// bare ones (`variable region {}`, valid HCL) as identifiers after the
7202+
// keyword's own -- both name the block.
72017203
uint32_t cc = ts_node_named_child_count(node);
72027204
for (uint32_t i = 0; i < cc; i++) {
72037205
TSNode ch = ts_node_named_child(node, i);
7204-
if (strcmp(ts_node_type(ch), "string_lit") != 0) {
7205-
continue;
7206-
}
7207-
TSNode lit = cbm_find_child_by_kind(ch, "template_literal");
7208-
if (ts_node_is_null(lit)) {
7209-
continue;
7206+
char *label = NULL;
7207+
if (strcmp(ts_node_type(ch), "string_lit") == 0) {
7208+
TSNode lit = cbm_find_child_by_kind(ch, "template_literal");
7209+
label = ts_node_is_null(lit) ? NULL : cbm_node_text(a, lit, source);
7210+
} else if (strcmp(ts_node_type(ch), "identifier") == 0 && !ts_node_eq(ch, id)) {
7211+
label = cbm_node_text(a, ch, source);
72107212
}
7211-
char *label = cbm_node_text(a, lit, source);
72127213
if (!label || !label[0]) {
72137214
continue;
72147215
}

0 commit comments

Comments
 (0)