@@ -2229,14 +2229,21 @@ prepare_build(bool print_fingerprint,
22292229 };
22302230
22312231 auto xpkgLuaMatchesCandidate =
2232- [](const mcpp::pm::DependencyCoordinate& coord,
2233- std::string_view luaContent,
2234- bool allowLegacyBareDefault) {
2232+ [& ](const mcpp::pm::DependencyCoordinate& coord,
2233+ std::string_view luaContent,
2234+ bool allowLegacyBareDefault) {
22352235 // Single source of truth: the descriptor identity gate lives in
2236- // mcpp.manifest and is shared with the read_xpkg_lua family.
2236+ // mcpp.manifest and is shared with the read_xpkg_lua family. A
2237+ // descriptor served by a declared project index inherits that
2238+ // index's namespace when package.namespace is omitted; preserve
2239+ // the same owner context during this second, stricter check.
2240+ const auto route = index_route ();
2241+ const auto * owner = route.find_for_ns (coord.namespace_ );
2242+ const std::string_view ownerNs = owner
2243+ ? std::string_view{owner->name } : std::string_view{};
22372244 return mcpp::manifest::xpkg_lua_identity_matches (
22382245 luaContent, coord.namespace_ , coord.shortName ,
2239- allowLegacyBareDefault);
2246+ allowLegacyBareDefault, ownerNs );
22402247 };
22412248
22422249 auto dependencyCoordinates =
0 commit comments