Skip to content

Commit b79f397

Browse files
committed
fix(fqn): keep the extension in __file__ QNs so sibling files stay distinct
cbm_pipeline_fqn_compute() stripped the extension unconditionally. For sibling component files that is the only distinguishing part, so badge.component.ts/.html/.scss all produced the same __file__ QN and cbm_gbuf_upsert_node() merged them into one File node. cbm_store_list_files() then returned 8 paths for 12 files, and write_scoped_filelist() handed that short list to grep, so search_code never opened the merged-away siblings and silently returned incomplete results. Not Angular-specific: it is stem equality after one strip. spec.ts/stories.ts survive because their stems differ. Same class as DeusData#495. Skip the strip for the __file__ sentinel. Symbol and module QNs are unchanged, and the 27 __file__ construction sites all recompute through this same function. Verified against the repro repo @ 5e39bf9 (mode=full): File nodes 8/12 -> 12/12, every extension matches its file_path, search_code reaches all markers (grep -rln parity). Also fixes the extension-corruption follow-up, which came from pass_githistory upserts landing on the merged node. Refs DeusData#769 Signed-off-by: LA-10 <[email protected]>
1 parent 20b1153 commit b79f397

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

‎src/pipeline/fqn.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,11 @@ char *cbm_pipeline_fqn_compute(const char *project, const char *rel_path, const
116116

117117
char *path = strdup(rel_path ? rel_path : "");
118118
cbm_normalize_path_sep(path);
119-
strip_file_extension(path);
120119

120+
if (!(name && strcmp(name, "__file__") == 0)) {
121+
strip_file_extension(path);
122+
}
123+
121124
const char *segments[CBM_SZ_256];
122125
int seg_count = 0;
123126
segments[seg_count++] = project;

‎tests/test_fqn.c‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,36 @@ TEST(fqn_compute_basic_rs) {
5757
PASS();
5858
}
5959

60+
TEST(fqn_compute_file_sibling_distinct) {
61+
char *ts = cbm_pipeline_fqn_compute("proj", "app/badge/badge.component.ts", "__file__");
62+
char *html = cbm_pipeline_fqn_compute("proj", "app/badge/badge.component.html", "__file__");
63+
char *scss = cbm_pipeline_fqn_compute("proj", "app/badge/badge.component.scss", "__file__");
64+
ASSERT_NOT_NULL(ts);
65+
ASSERT_NOT_NULL(html);
66+
ASSERT_NOT_NULL(scss);
67+
ASSERT_STR_NEQ(ts, html);
68+
ASSERT_STR_NEQ(ts, scss);
69+
ASSERT_STR_NEQ(html, scss);
70+
free(ts);
71+
free(html);
72+
free(scss);
73+
PASS();
74+
}
75+
76+
TEST(fqn_compute_symbol_still_strips) {
77+
ASSERT_FQN(cbm_pipeline_fqn_compute("proj", "app/badge/badge.component.ts", "BadgeComponent"),
78+
"proj.app.badge.badge.component.BadgeComponent");
79+
PASS();
80+
}
81+
82+
TEST(fqn_module_siblings_still_share) {
83+
ASSERT_FQN(cbm_pipeline_fqn_module("proj", "app/badge/badge.component.ts"),
84+
"proj.app.badge.badge.component");
85+
ASSERT_FQN(cbm_pipeline_fqn_module("proj", "app/badge/badge.component.html"),
86+
"proj.app.badge.badge.component");
87+
PASS();
88+
}
89+
6090
/* ── Nested paths ─────────────────────────────────────────────── */
6191

6292
TEST(fqn_compute_nested_two_levels) {
@@ -560,6 +590,9 @@ SUITE(fqn) {
560590
RUN_TEST(fqn_compute_basic_js);
561591
RUN_TEST(fqn_compute_basic_c);
562592
RUN_TEST(fqn_compute_basic_rs);
593+
RUN_TEST(fqn_compute_file_sibling_distinct);
594+
RUN_TEST(fqn_compute_symbol_still_strips);
595+
RUN_TEST(fqn_module_siblings_still_share);
563596

564597
/* fqn_compute: nested paths */
565598
RUN_TEST(fqn_compute_nested_two_levels);

0 commit comments

Comments
 (0)