Skip to content

Commit 62965bc

Browse files
committed
test(doc-links): exercise the ambiguous member row on a Ruby group (DeusData#2587)
The "group shrinks" step of doc_links_md_member_missing_incremental removed one of two Python `area` methods and expected the closure-repair route. Since the Python namespace admission on main (merged into this branch with origin/main), a Python file whose surface changes always takes the full route (closure_decline reason=python_namespace_changed), so the step ran FORCED_FULL on every platform; the Windows leg was simply the first to report it. Nothing here depends on timing: the planner compares content hashes. The group now lives in a Ruby file. Ruby has no doc-link scope, so the lost method reports no removed name and the document re-resolves only through the ambiguous `path::member` rule, which this step exists to bind. (A Rust group was tried too: its scope reports the method as a removed name, so the step passed with the rule removed.) Test: the step takes closure repair with closure=2 (shapes.rb and docs/areas.md). With "ambiguous" dropped from doc_row_member_reason it stays on closure repair with closure=1 and keeps the stale ambiguous row where the full index has the Areas -> Square.area edge. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 406f6c7 commit 62965bc

1 file changed

Lines changed: 24 additions & 16 deletions

File tree

‎tests/test_doc_links_md.c‎

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -608,25 +608,32 @@ TEST(doc_links_md_incremental) {
608608
* on the member file's text, and the row leads to that file by no edge. A
609609
* body edit that writes the name (no definition added) turns the row into a
610610
* file edge, one that drops it turns the edge back into the row; a same-named
611-
* group that shrinks to one turns an ambiguous row into an edge. */
611+
* group that shrinks to one turns an ambiguous row into an edge. The group is
612+
* Ruby: a Python file whose surface changes takes the full route (the Python
613+
* namespace admission), and a language with a doc-link scope (Rust, Go, ...)
614+
* reports the lost method as a removed name, so neither reaches the rule for
615+
* ambiguous member rows. */
612616
TEST(doc_links_md_member_missing_incremental) {
613617
char tmp[256];
614618
snprintf(tmp, sizeof(tmp), "/tmp/cbm_dlmd_inc_XXXXXX");
615619
ASSERT_NOT_NULL(cbm_mkdtemp(tmp));
616620
char repo[512];
617621
snprintf(repo, sizeof(repo), "%s/repo", tmp);
618622
th_write_file(TH_PATH(repo, "docs/helpers.md"), "# Helpers\n\nSee `src/tools.py::helper2`.\n");
619-
th_write_file(TH_PATH(repo, "docs/areas.md"), "# Areas\n\nSee `src/shapes.py::area`.\n");
623+
th_write_file(TH_PATH(repo, "docs/areas.md"), "# Areas\n\nSee `src/shapes.rb::area`.\n");
620624
th_write_file(TH_PATH(repo, "src/tools.py"), "def helper():\n"
621625
" return 1\n");
622-
th_write_file(TH_PATH(repo, "src/shapes.py"), "class Circle:\n"
623-
" def area(self):\n"
624-
" return 3\n"
626+
th_write_file(TH_PATH(repo, "src/shapes.rb"), "class Circle\n"
627+
" def area\n"
628+
" 3\n"
629+
" end\n"
630+
"end\n"
625631
"\n"
626-
"\n"
627-
"class Square:\n"
628-
" def area(self):\n"
629-
" return 4\n");
632+
"class Square\n"
633+
" def area\n"
634+
" 4\n"
635+
" end\n"
636+
"end\n");
630637
char db[512];
631638
char full_db[512];
632639
snprintf(db, sizeof(db), "%s/inc.db", tmp);
@@ -635,7 +642,7 @@ TEST(doc_links_md_member_missing_incremental) {
635642
char reason[64];
636643
dm_row(db, "docs/helpers.md", "src/tools.py::helper2", reason, sizeof(reason), NULL, 0);
637644
ASSERT_STR_EQ(reason, "missing");
638-
dm_row(db, "docs/areas.md", "src/shapes.py::area", reason, sizeof(reason), NULL, 0);
645+
dm_row(db, "docs/areas.md", "src/shapes.rb::area", reason, sizeof(reason), NULL, 0);
639646
ASSERT_STR_EQ(reason, "ambiguous");
640647

641648
/* the body writes the name, no definition added: the row becomes an edge */
@@ -652,13 +659,14 @@ TEST(doc_links_md_member_missing_incremental) {
652659
dm_row(db, "docs/helpers.md", "src/tools.py::helper2", reason, sizeof(reason), NULL, 0);
653660
ASSERT_STR_EQ(reason, "missing");
654661
/* one of two `area` methods goes, the name stays: the one left binds */
655-
th_write_file(TH_PATH(repo, "src/shapes.py"), "class Circle:\n"
656-
" pass\n"
657-
"\n"
662+
th_write_file(TH_PATH(repo, "src/shapes.rb"), "class Circle\n"
663+
"end\n"
658664
"\n"
659-
"class Square:\n"
660-
" def area(self):\n"
661-
" return 4\n");
665+
"class Square\n"
666+
" def area\n"
667+
" 4\n"
668+
" end\n"
669+
"end\n");
662670
ASSERT_EQ(dm_step(repo, db, full_db, "group shrinks", CBM_INCREMENTAL_ROUTE_CLOSURE_REPAIR), 0);
663671
char props[512];
664672
ASSERT_EQ(md_edge(db, "Areas", "Square.area", props, sizeof(props)), 1);

0 commit comments

Comments
 (0)