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
doc-links(rst): object directives ship as MENTIONS edges
Martin Vogel8d0827537035
diff --git a/internal/cbm/doclink.h b/internal/cbm/doclink.hindex 91d3adaf5..b33812dec 100644--- a/internal/cbm/doclink.h+++ b/internal/cbm/doclink.h@@ -104,7 +104,7 @@X(CBM_DOCLINK_PDF_NAME, CBM_LANG_PDF, "pdf_name", false, false, "MENTIONS") \/* restructuredtext (doclink_rst.c): Sphinx domain markup, directives, inline literals */ \X(CBM_DOCLINK_RST_ROLE, CBM_LANG_RST, "role", false, true, "MENTIONS") \- X(CBM_DOCLINK_RST_OBJECT, CBM_LANG_RST, "object", false, false, "MENTIONS") \+ X(CBM_DOCLINK_RST_OBJECT, CBM_LANG_RST, "object", false, true, "MENTIONS") \X(CBM_DOCLINK_RST_AUTODOC, CBM_LANG_RST, "autodoc", false, true, "MENTIONS") \X(CBM_DOCLINK_RST_INCLUDE, CBM_LANG_RST, "include", false, false, "MENTIONS") \X(CBM_DOCLINK_RST_LITERALINCLUDE, CBM_LANG_RST, "literalinclude", false, true, "MENTIONS") \diff --git a/tests/test_doc_links_md.c b/tests/test_doc_links_md.cindex 09212a6f1..e63cf8381 100644--- a/tests/test_doc_links_md.c+++ b/tests/test_doc_links_md.c@@ -608,6 +608,7 @@ TEST(doc_links_md_ship_gate) {ASSERT_TRUE(cbm_doclink_syntax_ships(CBM_DOCLINK_RST_CODE_PATH));ASSERT_TRUE(cbm_doclink_syntax_ships(CBM_DOCLINK_MD_CODE_PATH));ASSERT_TRUE(cbm_doclink_syntax_ships(CBM_DOCLINK_MD_SUPERSEDES));+ ASSERT_TRUE(cbm_doclink_syntax_ships(CBM_DOCLINK_RST_OBJECT));char tmp[256];snprintf(tmp, sizeof(tmp), "/tmp/cbm_dlmdgate_XXXXXX");ASSERT_NOT_NULL(cbm_mkdtemp(tmp));diff --git a/tests/test_doc_links_rst.c b/tests/test_doc_links_rst.cindex 91b6bd874..714f9a5dc 100644--- a/tests/test_doc_links_rst.c+++ b/tests/test_doc_links_rst.c@@ -489,6 +489,37 @@ TEST(rst_object_and_open_lines) {PASS();}+/* The production gate (doclink.h): object directives ship since their+ * held-out audit; include and kernel-doc are still held, so in the same+ * documents they write rows, not edges. Runs after the suite's forced+ * families are reset. */+TEST(rst_ship_gate) {+ ASSERT_TRUE(cbm_doclink_syntax_ships(CBM_DOCLINK_RST_OBJECT));+ ASSERT_FALSE(cbm_doclink_syntax_ships(CBM_DOCLINK_RST_INCLUDE));+ ASSERT_FALSE(cbm_doclink_syntax_ships(CBM_DOCLINK_RST_KERNEL_DOC));+ char tmp[256];+ snprintf(tmp, sizeof(tmp), "/tmp/cbm_dlrst_gate_XXXXXX");+ ASSERT_NOT_NULL(cbm_mkdtemp(tmp));+ char repo[512];+ char db[512];+ snprintf(repo, sizeof(repo), "%s/repo", tmp);+ snprintf(db, sizeof(db), "%s/g.db", tmp);+ rst_write_repo(repo, INIT_PY);+ ASSERT_EQ(dm_index(repo, db, NULL), 0);+ /* `.. class:: View` in pkg.views: an edge */+ ASSERT_TRUE(rst_edge(db, "docs.api.Models", "pkg.views.View", "\"syntax\":\"object\""));+ /* the include resolves, and its family holds it as a row */+ ASSERT_FALSE(rst_edge(db, "docs.api.Code", "pkg.sub.thing.py.__file__", NULL));+ ASSERT_EQ(dm_count(db, "SELECT COUNT(*) FROM doc_link_unresolved WHERE "+ "reason = 'below_bar_tier' AND syntax = 'include'"),+ 1);+ ASSERT_EQ(dm_count(db, "SELECT COUNT(*) FROM edges WHERE type = 'MENTIONS' AND "+ "properties LIKE '%\"syntax\":\"kernel_doc\"%'"),+ 0);+ th_cleanup(tmp);+ PASS();+}+SUITE(doc_links_rst) {dm_ship_held_families();RUN_TEST(rst_scan_structure);@@ -498,4 +529,5 @@ SUITE(doc_links_rst) {RUN_TEST(rst_adr_record);RUN_TEST(rst_links_incremental);cbm_doclink_test_reset_ships();+ RUN_TEST(rst_ship_gate);}diff --git a/tests/test_doc_mentions_helpers.h b/tests/test_doc_mentions_helpers.hindex 5646b9795..9c2eca104 100644--- a/tests/test_doc_mentions_helpers.h+++ b/tests/test_doc_mentions_helpers.h@@ -416,9 +416,9 @@ static inline int dm_reason_lines(const char *db, const char *block) {* so it is the resolution an audit would ship; doc_links_md_ship_gate tests* the production gate itself. */static const int DM_HELD_FAMILIES[] = {- CBM_DOCLINK_MD_BARE_PATH, CBM_DOCLINK_MD_SUPERSEDES_PROSE, CBM_DOCLINK_RST_OBJECT,- CBM_DOCLINK_RST_INCLUDE, CBM_DOCLINK_RST_KERNEL_DOC, CBM_DOCLINK_ADOC_ATTRIBUTE,- CBM_DOCLINK_ADOC_CODE_PATH, CBM_DOCLINK_ADOC_CODE_NAME,+ CBM_DOCLINK_MD_BARE_PATH, CBM_DOCLINK_MD_SUPERSEDES_PROSE, CBM_DOCLINK_RST_INCLUDE,+ CBM_DOCLINK_RST_KERNEL_DOC, CBM_DOCLINK_ADOC_ATTRIBUTE, CBM_DOCLINK_ADOC_CODE_PATH,+ CBM_DOCLINK_ADOC_CODE_NAME,};static inline void dm_ship_held_families(void) {