Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ea9fe36
doc-links: doc-comment references become MENTIONS edges, C# first
DeusData Oct 1, 2026
8271c21
doc-links(cs): bounds and checks from security review 2 (S11 to S16, …
DeusData Oct 4, 2026
4b3f5a8
doc-links(cs): a shared doc comment counts once; lost doc-link data f…
DeusData Oct 4, 2026
429a40f
doc-links(cs): a scope this run wrote that does not parse costs only …
DeusData Oct 4, 2026
e3c1ea3
doc-links(msbuild): a group's condition is evaluated once, not per ch…
DeusData Oct 4, 2026
91aa8e2
doc-links(cs): test the project-file scan's allocation failure too (S17)
DeusData Oct 4, 2026
6e2a462
doc-links: lint-ci clean again (seam calls only in seam builds; escap…
DeusData Oct 4, 2026
cc2c966
doc-links(cs): a name is looked up once per region; a second candidat…
DeusData Oct 4, 2026
decc832
doc-links(cs): the lookup memo holds no memory until a step is rememb…
DeusData Oct 4, 2026
aba240b
doc-links(cs): a scope its run refused is stored as a rejected marker…
DeusData Oct 4, 2026
b372112
doc-links(cs): a doc-line map that cannot grow fails the layer (R5)
DeusData Oct 5, 2026
d77ce46
doc-links(cs): a stored region record with an empty name is refused (R8)
DeusData Oct 5, 2026
ba529c9
doc-links(cs): a props or targets file that does not parse up to its …
DeusData Oct 5, 2026
abb71db
doc-links(cs): a directives-only file that loses its scope fails the …
DeusData Oct 5, 2026
5fd1a07
doc-links(cs): the type names of a refused scope are quarantined, in …
DeusData Oct 5, 2026
19783ed
doc-links(cs): a unit's using directives are asked once per query, no…
DeusData Oct 5, 2026
346b856
doc-links(cs): a unit step no directive can give anything asks no mem…
DeusData Oct 5, 2026
fb8d14f
doc-links(cs): what the Linux leg showed: path-ordered binding, a tes…
DeusData Oct 5, 2026
e6638a7
doc-links(core): index_status failure paths leave through its one exit
DeusData Oct 5, 2026
e3b951e
test(doc-links): no runner-shaped "<n> failed" text in passing output
DeusData Oct 9, 2026
8207f8a
Merge main into feat/doc-links-core
DeusData Oct 9, 2026
341783a
test(doc-links): read index_status's doc_links block up to the next key
DeusData Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile.cbm
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ EXTRACTION_SRCS = \
$(CBM_DIR)/extract_channels.c \
$(CBM_DIR)/extract_k8s.c \
$(CBM_DIR)/extract_dbt.c \
$(CBM_DIR)/doclink.c \
$(CBM_DIR)/doclink_cs.c \
$(CBM_DIR)/sql_values.c \
$(CBM_DIR)/helpers.c \
$(CBM_DIR)/cpp_branch_views.c \
Expand Down Expand Up @@ -493,6 +495,9 @@ PIPELINE_SRCS = \
src/pipeline/pass_configures.c \
src/pipeline/pass_configlink.c \
src/pipeline/pass_doclinks.c \
src/pipeline/doc_links.c \
src/pipeline/doc_links_cs.c \
src/pipeline/doc_links_msbuild.c \
src/pipeline/pass_route_nodes.c \
src/pipeline/pass_enrichment.c \
src/pipeline/pass_envscan.c \
Expand Down Expand Up @@ -754,7 +759,7 @@ TEST_DISCOVER_SRCS = \

TEST_GRAPH_BUFFER_SRCS = tests/test_graph_buffer.c

TEST_PIPELINE_SRCS = tests/test_registry.c tests/test_pipeline.c tests/test_pipeline_conventions.c tests/test_pipeline_frozen.c tests/test_importance.c tests/test_cross_repo.c tests/test_fqn.c tests/test_route_canon.c tests/test_path_alias.c tests/test_configlink.c tests/test_doclinks.c tests/test_infrascan.c tests/test_worker_pool.c tests/test_parallel.c tests/test_index_resilience.c tests/test_index_format.c tests/test_call_reference_contract.c tests/repro/repro_call_scope_usages.c tests/repro/repro_call_argument_usages.c tests/repro/repro_reference_precision.c tests/repro/repro_lexical_binding_precision.c tests/repro/repro_call_argument_matrix_a.c tests/repro/repro_call_argument_matrix_b.c tests/repro/repro_call_node_behaviors.c tests/repro/repro_language_registry.c tests/repro/repro_call_node_manifest.c tests/repro/repro_lsp_ordered_signatures.c tests/repro/repro_lsp_ordered_local.c tests/repro/repro_ts_overload_return_chains.c tests/repro/repro_harness_cleanup.c tests/repro/repro_runner_filter.c
TEST_PIPELINE_SRCS = tests/test_registry.c tests/test_pipeline.c tests/test_pipeline_conventions.c tests/test_pipeline_frozen.c tests/test_importance.c tests/test_cross_repo.c tests/test_fqn.c tests/test_route_canon.c tests/test_path_alias.c tests/test_configlink.c tests/test_doclinks.c tests/test_doc_mentions.c tests/test_infrascan.c tests/test_worker_pool.c tests/test_parallel.c tests/test_index_resilience.c tests/test_index_format.c tests/test_call_reference_contract.c tests/repro/repro_call_scope_usages.c tests/repro/repro_call_argument_usages.c tests/repro/repro_reference_precision.c tests/repro/repro_lexical_binding_precision.c tests/repro/repro_call_argument_matrix_a.c tests/repro/repro_call_argument_matrix_b.c tests/repro/repro_call_node_behaviors.c tests/repro/repro_language_registry.c tests/repro/repro_call_node_manifest.c tests/repro/repro_lsp_ordered_signatures.c tests/repro/repro_lsp_ordered_local.c tests/repro/repro_ts_overload_return_chains.c tests/repro/repro_harness_cleanup.c tests/repro/repro_runner_filter.c

TEST_WATCHER_SRCS = tests/test_watcher.c

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,9 @@ mode. `index_status` keeps describing the published graph and its freshness.

### Edge Types

`CONTAINS_PACKAGE`, `CONTAINS_FOLDER`, `CONTAINS_FILE`, `DEFINES`, `DEFINES_METHOD`, `IMPORTS`, `CALLS`, `CALL_REFERENCE`, `HTTP_CALLS`, `ASYNC_CALLS`, `SPAWNS`, `IMPLEMENTS`, `HANDLES`, `USAGE`, `CONFIGURES`, `REFERENCES_FILE`, `WRITES`, `MEMBER_OF`, `TESTS`, `USES_TYPE`, `FILE_CHANGES_WITH`
`CONTAINS_PACKAGE`, `CONTAINS_FOLDER`, `CONTAINS_FILE`, `DEFINES`, `DEFINES_METHOD`, `IMPORTS`, `CALLS`, `CALL_REFERENCE`, `HTTP_CALLS`, `ASYNC_CALLS`, `SPAWNS`, `IMPLEMENTS`, `HANDLES`, `USAGE`, `CONFIGURES`, `REFERENCES_FILE`, `MENTIONS`, `WRITES`, `MEMBER_OF`, `TESTS`, `USES_TYPE`, `FILE_CHANGES_WITH`

`MENTIONS` links a documented definition to the code its doc comment references (C# `<see cref>`, `<seealso cref>`, `<exception cref>`, `<inheritdoc cref>`), one edge per pair with `via`, `syntax`, `tier` (`exact` or `unique`), first `line` and `count`. A reference is bound only when it names exactly one definition under the language's own lookup rules; the rest are counted by reason in `index_status` under `doc_links` (samples with `diagnostics='full'`).

### Qualified Names

Expand Down
9 changes: 5 additions & 4 deletions docs/EVALUATION_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,16 @@ SHA, and — **not just totals** — a **per-type breakdown**:
- `node-types.json` — a histogram of **node count by label** (`Function`, `Method`, `Class`,
`Interface`, `Type`/`Enum`/`Struct`, `Field`, `Variable`, `Route`, `Module`, `Section`, `Macro`,
`File`, `Folder`) + total.
- `edge-types.json` — a histogram of **edge count by type, with one entry for every one of the 32
- `edge-types.json` — a histogram of **edge count by type, with one entry for every one of the 33
edge types, including those that came back `0`**. The canonical set is the indexer's own
`ALL_EDGE_TYPES[]` (26 intra-repo types — `tests/test_lang_contract.c`): `CALLS`, `ASYNC_CALLS`,
`ALL_EDGE_TYPES[]` (27 intra-repo types — `tests/test_lang_contract.c`): `CALLS`, `ASYNC_CALLS`,
`HTTP_CALLS`, `GRPC_CALLS`, `GRAPHQL_CALLS`, `TRPC_CALLS`, `DEFINES`, `DEFINES_METHOD`, `IMPLEMENTS`,
`INHERITS`, `OVERRIDE`, `DECORATES`, `IMPORTS`, `HANDLES`, `CONFIGURES`, `DEPENDS_ON`, `USAGE`,
`DATA_FLOWS`, `SEMANTICALLY_RELATED`, `SIMILAR_TO`, `TESTS`, `TESTS_FILE`, `INFRA_MAPS`,
`FILE_CHANGES_WITH`, `CONTAINS_FILE`, `CONTAINS_FOLDER` — **plus the 6 cross-repo types** from the
`FILE_CHANGES_WITH`, `CONTAINS_FILE`, `CONTAINS_FOLDER`, `MENTIONS` (doc comment -> referenced
code) — **plus the 6 cross-repo types** from the
cross-repo pass (`CROSS_HTTP_CALLS`, `CROSS_ASYNC_CALLS`, `CROSS_GRPC_CALLS`, `CROSS_GRAPHQL_CALLS`,
`CROSS_TRPC_CALLS`, `CROSS_CHANNEL`) and a total. The writer **emits the full 32-type list and
`CROSS_TRPC_CALLS`, `CROSS_CHANNEL`) and a total. The writer **emits the full 33-type list and
back-fills missing types with `0`** rather than recording only the types that appeared.

These come straight from `query_graph` (`MATCH (n) RETURN labels(n), count(*)` and
Expand Down
7 changes: 6 additions & 1 deletion internal/cbm/cbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include "foundation/mem_events.h" // waste sanitizer: the bound allocators bypass every observer
#include "foundation/log.h" // cbm_log_warn -- extract.lsp.skipped
#include "cbm.h"
#include "arena.h" // CBMArena, cbm_arena_init/alloc/strdup/destroy
#include "arena.h" // CBMArena, cbm_arena_init/alloc/strdup/destroy
#include "doclink.h" // cbm_doclinks_extract: doc-comment references + doc-link scope
#include "helpers.h"
#include "lang_specs.h"
#include "extract_unified.h"
Expand Down Expand Up @@ -3601,6 +3602,10 @@ static CBMFileResult *extract_file_ex_body(const char *source, int source_len, C

result->imports_count = result->imports.count;

/* Doc-comment references of the documented definitions, and the file's
* doc-link scope: both read the complete docstrings and the tree. */
cbm_doclinks_extract(&ctx);

// Accumulate profiling counters
atomic_fetch_add(&total_parse_ns, t1 - t0);
atomic_fetch_add(&total_extract_ns, t2 - t1);
Expand Down
45 changes: 45 additions & 0 deletions internal/cbm/cbm.h
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,31 @@ typedef struct {
int cap;
} CBMFieldTypeArray;

/* One reference found in a definition's complete doc comment, or in the file's
* own doc (doclink.h has the syntax table and the per-language parsers).
* Resolution happens later, per file, in the pipeline
* (src/pipeline/doc_links.c). */
typedef struct {
const char *source_qn; // QN of the documented definition (the edge source);
// for a file-level reference the file's module QN
const char *raw; // the reference as written, markup entities decoded
uint32_t line; // 1-based source line of the reference
uint32_t def_line; // 1-based start line of the documented definition
uint16_t syntax; // CBMDocLinkSyntax (doclink.h)
uint16_t flags; // CBM_DOCLINK_FLAG_* (doclink.h); set by the driver
} CBMDocLink;

typedef struct {
CBMDocLink *items;
int count;
int cap;
/* Memory ran out while this file's doc-link data was extracted (a token,
* a reference value, a doc text or the scope blob was lost): the
* resolving half fails the layer instead of publishing a silently
* incomplete graph. */
bool failed;
} CBMDocLinkArray;

// Full extraction result for one file.
typedef struct CBMFileResult {
CBMArena arena; // owns local memory; composites may also retain child arenas below
Expand Down Expand Up @@ -722,6 +747,14 @@ typedef struct CBMFileResult {
int test_owner_source_len;
CBMLanguage test_owner_language;
char test_owner_source_sha256[65]; /* exact raw source; identity, not authentication */

/* Doc-comment references of this file's definitions (doclink.h), and the
* file's doc-link scope: a language-tagged text blob with what OTHER
* files' doc-link resolution needs from this file (C#: namespaces,
* usings, type and member declarations). A pure function of the file's
* bytes; NULL for languages without a scope scanner. */
CBMDocLinkArray doc_links;
const char *doc_scope;
} CBMFileResult;

// --- Enclosing function cache ---
Expand Down Expand Up @@ -818,6 +851,18 @@ typedef struct {
struct CBMTestDefinitionMatch *test_definition_matches; /* traversal scratch */
int test_definition_match_count;
int test_definition_match_cap;
/* Start line of every doc text doc_run_text built, keyed by the returned
* pointer (doclink.c), so a definition's doc references get exact source
* lines. NULL until the first doc; allocated in `scratch`. */
void *doc_lines;
/* A per-file slot for the language's doc-link hooks (parse_doc and
* scan_scope, internal/cbm/doclink_<lang>.c): state that has to survive
* between the hook calls of ONE file, e.g. an index of the file's doc
* sections. NULL at the start of every file. What a hook stores here must
* be allocated in `scratch` (or `arena`), so that it ends with the file.
* The core never reads, interprets or frees it. It is the only place for
* such state: a static or thread-local cache is not. */
void *doclink_state;
} CBMExtractCtx;

/* Internal configured-definition seams. No declarations pointer enters a result. */
Expand Down
Loading
Loading