@@ -1272,6 +1272,108 @@ TEST(lrp_ts_s8_field_type_hint) {
12721272 PASS ();
12731273}
12741274
1275+ /* Barrels: a type imported through an index.ts that re-exports it must resolve
1276+ * to the defining module. Covers a dotted folder imported by alias (B1), a lib
1277+ * barrel with a named re-export (B2), a relative import of a barrel folder
1278+ * (B3) and a nested `export *` barrel (B4). The import used to stop at the
1279+ * Folder/barrel module, so every DI call below had no CALLS edge. */
1280+ TEST (lrp_ts_barrel_reexport_member_calls ) {
1281+ static const LRP_File f [] = {
1282+ {"apps/api/tsconfig.json" , "{\"compilerOptions\":{\"baseUrl\":\"./\",\"paths\":{"
1283+ "\"@acme/shipping\":[\"libs/shipping/src\"],"
1284+ "\"@acme/shipping/*\":[\"libs/shipping/src/*\"]}}}\n" },
1285+ {"apps/api/libs/shipping/src/application/service/label-print.service/"
1286+ "label-print.service.ts" ,
1287+ "import { LabelPrintParams } from \"./label-print.interface\";\n"
1288+ "export class LabelPrintService {\n"
1289+ " printStream(params: LabelPrintParams): string {\n"
1290+ " return this.printWithStats(params).body;\n"
1291+ " }\n"
1292+ " printWithStats(params: LabelPrintParams): { body: string; pages: number } {\n"
1293+ " return { body: params.shipmentId, pages: 1 };\n"
1294+ " }\n"
1295+ "}\n" },
1296+ {"apps/api/libs/shipping/src/application/service/label-print.service/"
1297+ "label-print.interface.ts" ,
1298+ "export interface LabelPrintParams {\n"
1299+ " shipmentId: string;\n"
1300+ "}\n" },
1301+ {"apps/api/libs/shipping/src/application/service/label-print.service/index.ts" ,
1302+ "export * from \"./label-print.service\";\n"
1303+ "export * from \"./label-print.interface\";\n" },
1304+ {"apps/api/libs/shipping/src/domain/tracking/tracking-code.service.ts" ,
1305+ "export class TrackingCodeService {\n"
1306+ " generate(shipmentId: string): string {\n"
1307+ " return shipmentId;\n"
1308+ " }\n"
1309+ "}\n" },
1310+ {"apps/api/libs/shipping/src/domain/tracking/index.ts" ,
1311+ "export * from \"./tracking-code.service\";\n" },
1312+ {"apps/api/libs/shipping/src/domain/carrier.service.ts" ,
1313+ "export class CarrierService {\n"
1314+ " quote(weightKg: number): number {\n"
1315+ " return weightKg * 2;\n"
1316+ " }\n"
1317+ "}\n" },
1318+ {"apps/api/libs/shipping/src/index.ts" ,
1319+ "export * from \"./domain/tracking\";\n"
1320+ "export {\n"
1321+ " CarrierService,\n"
1322+ "} from \"./domain/carrier.service\";\n"
1323+ "export type { LabelPrintParams } from \"./application/service/label-print.service\";\n" },
1324+ {"apps/api/libs/invoice/src/application/command/handler/ship-invoice.handler.ts" ,
1325+ "import { LabelPrintService } from "
1326+ "\"@acme/shipping/application/service/label-print.service\";\n"
1327+ "import { CarrierService, TrackingCodeService } from \"@acme/shipping\";\n"
1328+ "export class ShipInvoiceHandler {\n"
1329+ " constructor(\n"
1330+ " private readonly labelPrintService: LabelPrintService,\n"
1331+ " private readonly carrierService: CarrierService,\n"
1332+ " private readonly trackingCodeService: TrackingCodeService,\n"
1333+ " ) {}\n"
1334+ " execute(shipmentId: string): string {\n"
1335+ " const cost = this.carrierService.quote(3);\n"
1336+ " const code = this.trackingCodeService.generate(shipmentId);\n"
1337+ " const label = this.labelPrintService.printStream({ shipmentId });\n"
1338+ " return `${label}:${code}:${cost}`;\n"
1339+ " }\n"
1340+ "}\n" },
1341+ {"apps/api/libs/invoice/src/application/service/label-preview.service.ts" ,
1342+ "import { LabelPrintService } from "
1343+ "\"../../../../shipping/src/application/service/label-print.service\";\n"
1344+ "export class LabelPreviewService {\n"
1345+ " constructor(private readonly labelPrintService: LabelPrintService) {}\n"
1346+ " preview(shipmentId: string): number {\n"
1347+ " return this.labelPrintService.printWithStats({ shipmentId }).pages;\n"
1348+ " }\n"
1349+ "}\n" },
1350+ };
1351+ LRP_Proj lp ;
1352+ cbm_store_t * store = lrp_index (& lp , f , (int )(sizeof (f ) / sizeof (f [0 ])));
1353+ ASSERT_NOT_NULL (store );
1354+
1355+ int b1 = lrp_exact_edge_by_qn_suffix (store , lp .project , "CALLS" , "ShipInvoiceHandler.execute" ,
1356+ "LabelPrintService.printStream" );
1357+ int b2 = lrp_exact_edge_by_qn_suffix (store , lp .project , "CALLS" , "ShipInvoiceHandler.execute" ,
1358+ "CarrierService.quote" );
1359+ int b3 = lrp_exact_edge_by_qn_suffix (store , lp .project , "CALLS" , "LabelPreviewService.preview" ,
1360+ "LabelPrintService.printWithStats" );
1361+ int b4 = lrp_exact_edge_by_qn_suffix (store , lp .project , "CALLS" , "ShipInvoiceHandler.execute" ,
1362+ "TrackingCodeService.generate" );
1363+ int self =
1364+ lrp_exact_edge_by_qn_suffix (store , lp .project , "CALLS" , "LabelPrintService.printStream" ,
1365+ "LabelPrintService.printWithStats" );
1366+ printf (" [ts/barrel] B1=%d B2=%d B3=%d B4=%d self=%d\n" , b1 , b2 , b3 , b4 , self );
1367+ lrp_cleanup (& lp , store );
1368+
1369+ ASSERT_EQ (b1 , 1 );
1370+ ASSERT_EQ (b2 , 1 );
1371+ ASSERT_EQ (b3 , 1 );
1372+ ASSERT_EQ (b4 , 1 );
1373+ ASSERT_EQ (self , 1 );
1374+ PASS ();
1375+ }
1376+
12751377/* ══════════════════════════════════════════════════════════════════════
12761378 * ─── GROUP 7: JAVA (lsp_cross NOT WIRED) ─────────────────────────────
12771379 * ══════════════════════════════════════════════════════════════════════
@@ -1919,6 +2021,7 @@ SUITE(lsp_resolution_probe) {
19192021 RUN_TEST (lrp_ts_s6_inherited_method );
19202022 RUN_TEST (lrp_ts_s7_generic );
19212023 RUN_TEST (lrp_ts_s8_field_type_hint );
2024+ RUN_TEST (lrp_ts_barrel_reexport_member_calls );
19222025
19232026 /* ── Java (lsp_cross NOT WIRED) — S1 GREEN, S2–S8 RED reproductions ── */
19242027 RUN_TEST (lrp_java_s1_crossfile_call );
0 commit comments