diff --git a/app/buck2_build_api/src/actions/calculation.rs b/app/buck2_build_api/src/actions/calculation.rs index 7bf5360600f55..9a08a3a155779 100644 --- a/app/buck2_build_api/src/actions/calculation.rs +++ b/app/buck2_build_api/src/actions/calculation.rs @@ -633,7 +633,7 @@ pub async fn get_target_rule_type_name( .get_configured_target_node(label) .await? .require_compatible()? - .rule_type() + .underlying_rule_type() .name() .to_owned()) } diff --git a/app/buck2_node/src/nodes/configured.rs b/app/buck2_node/src/nodes/configured.rs index 11d2f6133542e..6ed7789e6a7a3 100644 --- a/app/buck2_node/src/nodes/configured.rs +++ b/app/buck2_node/src/nodes/configured.rs @@ -119,6 +119,13 @@ impl TargetNodeOrForward { } } + fn underlying_rule_type(&self) -> &RuleType { + match self { + TargetNodeOrForward::TargetNode(target_node) => target_node.rule_type(), + TargetNodeOrForward::Forward(_, node) => node.underlying_rule_type(), + } + } + fn rule_kind(&self) -> RuleKind { match self { TargetNodeOrForward::TargetNode(x) => x.rule_kind(), @@ -433,6 +440,10 @@ impl ConfiguredTargetNode { self.0.target_node.rule_type() } + pub fn underlying_rule_type(&self) -> &RuleType { + self.0.target_node.underlying_rule_type() + } + pub fn rule_kind(&self) -> RuleKind { self.0.target_node.rule_kind() } diff --git a/tests/core/build/test_build_rule_type_name_logging.py b/tests/core/build/test_build_rule_type_name_logging.py index bd1ecb52ddd20..657345deea1f6 100644 --- a/tests/core/build/test_build_rule_type_name_logging.py +++ b/tests/core/build/test_build_rule_type_name_logging.py @@ -63,8 +63,7 @@ async def test_build_rule_with_transition(buck: Buck) -> None: "//:a_writer_with_transition", ) - # TODO(T208425986) This should not be "forward" - await check_rule_type_names(buck, ["forward"]) + await check_rule_type_names(buck, ["three_with_transition"]) @buck_test() @@ -76,7 +75,7 @@ async def test_build_all_in_target(buck: Buck) -> None: buck, [ "two", - "forward", + "three_with_transition", "nested_subtargets", "one", "one", @@ -94,7 +93,7 @@ async def test_build_all_recursive(buck: Buck) -> None: buck, [ "two", - "forward", + "three_with_transition", "nested_subtargets", "one", "one",