From 21497416a90d9ec5e21af062d8a4a9766c65f129 Mon Sep 17 00:00:00 2001 From: Beojan Stanislaus Date: Mon, 6 Jul 2026 10:09:02 -0700 Subject: [PATCH 1/4] New product_selector print formt --- phlex/core/product_selector.cpp | 19 ++++++++++++++++--- test/provider_test.cpp | 10 +++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/phlex/core/product_selector.cpp b/phlex/core/product_selector.cpp index ccefde092..598e0550c 100644 --- a/phlex/core/product_selector.cpp +++ b/phlex/core/product_selector.cpp @@ -71,10 +71,23 @@ namespace phlex { std::string product_selector::to_string() const { - if (suffix) { - return fmt::format("{}/{} ϵ {}", creator, *suffix, layer); + // Will generate [][::][ by [ (of )]][ in ] + // where square brackets indicate optional sections. If stage is specified but not creator, + // creator will be [ANY] + using experimental::identifier; + std::string_view suffix_str = + suffix.transform(&identifier::operator std::string_view).value_or(""); + std::string type_str = + this->type.valid() ? fmt::format("::{}", this->type) : ""; // will later be concept + std::string layer_str = fmt::format(" in {}", identifier(layer)); + std::string creator_str; // depends on whether /stage/ is specified + if (stage.has_value()) { + creator_str = fmt::format(" by {} of {}", creator, stage.value()); + } else { + creator_str = creator ? fmt::format(" by {}", creator) : ""; } - return fmt::format("{} ϵ {}", creator, layer); + + return fmt::format("{}{}{}{}", suffix_str, type_str, creator_str, layer_str); } bool product_selector::operator==(product_selector const& rhs) const diff --git a/test/provider_test.cpp b/test/provider_test.cpp index 4c9e15091..c2af62bd7 100644 --- a/test/provider_test.cpp +++ b/test/provider_test.cpp @@ -170,9 +170,9 @@ TEST_CASE("Throw when two implicit providers are found for the same product") CHECK_THROWS_WITH( g.execute(), - ContainsSubstring( - "Multiple implicit providers found for product 'vertices_maker/happy_vertices") && - ContainsSubstring("spill") && ContainsSubstring("passer")); + ContainsSubstring("Multiple implicit providers found for product 'happy_vertices") && + ContainsSubstring("by vertices_maker") && ContainsSubstring("in spill") && + ContainsSubstring("node 'passer'")); } TEST_CASE("Throw when implicit provider insertion fails") @@ -194,8 +194,8 @@ TEST_CASE("Throw when implicit provider insertion fails") CHECK_THROWS_WITH( g.execute(), - ContainsSubstring("Failed to create implicit provider for product selector 'vertices_maker/") && - ContainsSubstring("happy_vertices") && + ContainsSubstring("Failed to create implicit provider for product selector 'happy_vertices") && + ContainsSubstring("by vertices_maker") && ContainsSubstring( "Implicit providers not yet supported for creators that created multiple data products")); } From 7fb760a11a8b4ec313023e551f0eac85603c1d1e Mon Sep 17 00:00:00 2001 From: Beojan Stanislaus Date: Wed, 8 Jul 2026 14:32:21 -0700 Subject: [PATCH 2/4] Adjust representation of unspecified selector fields in printout --- phlex/core/product_selector.cpp | 22 +++++++++------------- phlex/core/product_selector.hpp | 1 + test/provider_test.cpp | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/phlex/core/product_selector.cpp b/phlex/core/product_selector.cpp index 598e0550c..c56ad9c7d 100644 --- a/phlex/core/product_selector.cpp +++ b/phlex/core/product_selector.cpp @@ -71,23 +71,19 @@ namespace phlex { std::string product_selector::to_string() const { - // Will generate [][::][ by [ (of )]][ in ] - // where square brackets indicate optional sections. If stage is specified but not creator, - // creator will be [ANY] + // Will generate <:: by (of ) in > using experimental::identifier; std::string_view suffix_str = - suffix.transform(&identifier::operator std::string_view).value_or(""); + suffix.transform(&identifier::operator std::string_view).value_or("[ANY]"); std::string type_str = - this->type.valid() ? fmt::format("::{}", this->type) : ""; // will later be concept - std::string layer_str = fmt::format(" in {}", identifier(layer)); - std::string creator_str; // depends on whether /stage/ is specified - if (stage.has_value()) { - creator_str = fmt::format(" by {} of {}", creator, stage.value()); - } else { - creator_str = creator ? fmt::format(" by {}", creator) : ""; - } + this->type.valid() ? fmt::format("[{}]", this->type) : "[UNSET]"; // will later be concept + auto layer_str = std::string_view(layer); + std::string_view creator_str = creator ? std::string_view(*creator) : "[ANY]"; + std::string_view stage_str = + stage.transform(&identifier::operator std::string_view).value_or("[ANY STAGE]"); - return fmt::format("{}{}{}{}", suffix_str, type_str, creator_str, layer_str); + return fmt::format( + "<{}::{} by {} (of {}) in {}>", suffix_str, type_str, creator_str, stage_str, layer_str); } bool product_selector::operator==(product_selector const& rhs) const diff --git a/phlex/core/product_selector.hpp b/phlex/core/product_selector.hpp index 199c84996..83d52eed0 100644 --- a/phlex/core/product_selector.hpp +++ b/phlex/core/product_selector.hpp @@ -69,6 +69,7 @@ namespace phlex { // NOLINTNEXTLINE(google-explicit-constructor) - Implicit conversion is intentional operator T const&() const noexcept { return content_; } + explicit operator std::string_view() const noexcept { return std::string_view(content_); } bool operator==(required_layer_name const&) const noexcept = default; private: diff --git a/test/provider_test.cpp b/test/provider_test.cpp index c2af62bd7..98afaa906 100644 --- a/test/provider_test.cpp +++ b/test/provider_test.cpp @@ -170,7 +170,7 @@ TEST_CASE("Throw when two implicit providers are found for the same product") CHECK_THROWS_WITH( g.execute(), - ContainsSubstring("Multiple implicit providers found for product 'happy_vertices") && + ContainsSubstring("Multiple implicit providers found for product ' Date: Thu, 9 Jul 2026 10:14:46 -0700 Subject: [PATCH 3/4] Improve clarity --- phlex/core/product_selector.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/phlex/core/product_selector.cpp b/phlex/core/product_selector.cpp index c56ad9c7d..18e399dcd 100644 --- a/phlex/core/product_selector.cpp +++ b/phlex/core/product_selector.cpp @@ -74,16 +74,20 @@ namespace phlex { // Will generate <:: by (of ) in > using experimental::identifier; std::string_view suffix_str = - suffix.transform(&identifier::operator std::string_view).value_or("[ANY]"); - std::string type_str = - this->type.valid() ? fmt::format("[{}]", this->type) : "[UNSET]"; // will later be concept + suffix.transform(&identifier::operator std::string_view).value_or("[ANY SUFFIX]"); + std::string type_str = this->type.valid() ? fmt::format("<{}>", this->type) + : "[UNSET TYPE]"; // will later be concept auto layer_str = std::string_view(layer); - std::string_view creator_str = creator ? std::string_view(*creator) : "[ANY]"; + std::string_view creator_str = creator ? std::string_view(*creator) : "[ANY CREATOR]"; std::string_view stage_str = stage.transform(&identifier::operator std::string_view).value_or("[ANY STAGE]"); - return fmt::format( - "<{}::{} by {} (of {}) in {}>", suffix_str, type_str, creator_str, stage_str, layer_str); + return fmt::format("<{} (of type {}) by {} (of {}) in {}>", + suffix_str, + type_str, + creator_str, + stage_str, + layer_str); } bool product_selector::operator==(product_selector const& rhs) const From e31cf005e2a916244f72e349746d92fdc7156b3e Mon Sep 17 00:00:00 2001 From: Beojan Stanislaus Date: Thu, 9 Jul 2026 11:10:04 -0700 Subject: [PATCH 4/4] Further improve clarity --- phlex/core/product_selector.cpp | 8 ++++---- test/provider_test.cpp | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/phlex/core/product_selector.cpp b/phlex/core/product_selector.cpp index 18e399dcd..d754ffb66 100644 --- a/phlex/core/product_selector.cpp +++ b/phlex/core/product_selector.cpp @@ -74,15 +74,15 @@ namespace phlex { // Will generate <:: by (of ) in > using experimental::identifier; std::string_view suffix_str = - suffix.transform(&identifier::operator std::string_view).value_or("[ANY SUFFIX]"); + suffix.transform(&identifier::operator std::string_view).value_or("[ANY]"); std::string type_str = this->type.valid() ? fmt::format("<{}>", this->type) : "[UNSET TYPE]"; // will later be concept auto layer_str = std::string_view(layer); - std::string_view creator_str = creator ? std::string_view(*creator) : "[ANY CREATOR]"; + std::string_view creator_str = creator ? std::string_view(*creator) : "[ANY]"; std::string_view stage_str = - stage.transform(&identifier::operator std::string_view).value_or("[ANY STAGE]"); + stage.transform(&identifier::operator std::string_view).value_or("[ANY]"); - return fmt::format("<{} (of type {}) by {} (of {}) in {}>", + return fmt::format("", suffix_str, type_str, creator_str, diff --git a/test/provider_test.cpp b/test/provider_test.cpp index 98afaa906..f0618ad4c 100644 --- a/test/provider_test.cpp +++ b/test/provider_test.cpp @@ -170,8 +170,8 @@ TEST_CASE("Throw when two implicit providers are found for the same product") CHECK_THROWS_WITH( g.execute(), - ContainsSubstring("Multiple implicit providers found for product '