Skip to content

Support phlex::sources and implicit providers#637

Open
knoepfel wants to merge 3 commits into
Framework-R-D:mainfrom
knoepfel:support-source-macro
Open

Support phlex::sources and implicit providers#637
knoepfel wants to merge 3 commits into
Framework-R-D:mainfrom
knoepfel:support-source-macro

Conversation

@knoepfel

@knoepfel knoepfel commented Jun 5, 2026

Copy link
Copy Markdown
Member

This PR implements the majority of features discussed here, such as:

  • phlex::provider_bundle class
  • phlex::source base class
  • PHLEX_REGISTER_SOURCE macro and g.source<T>(...) registration
  • automatic registration of implicit providers from user-defined sources

@knoepfel knoepfel marked this pull request as draft June 5, 2026 13:01
@greenc-FNAL

greenc-FNAL commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

✅ 7 CodeQL alerts resolved compared to main

  • Warning # 182 actions/unpinned-tag at .github/actions/prepare-check-outputs/action.yaml:47:13 — Unpinned 3rd party Action 'action.yaml' step Uses Step: get_pr uses 'Framework-R-D/phlex/.github/actions/get-pr-info' with ref 'main', not a pinned commit hash
  • Warning # 183 actions/unpinned-tag at .github/actions/prepare-check-outputs/action.yaml:51:13 — Unpinned 3rd party Action 'action.yaml' step Uses Step: detect_act uses 'Framework-R-D/phlex/.github/actions/detect-act-env' with ref 'main', not a pinned commit hash
  • Warning # 184 actions/unpinned-tag at .github/actions/prepare-fix-outputs/action.yaml:29:13 — Unpinned 3rd party Action 'action.yaml' step Uses Step: get_pr uses 'Framework-R-D/phlex/.github/actions/get-pr-info' with ref 'main', not a pinned commit hash
  • Warning # 185 actions/unpinned-tag at .github/actions/run-change-detection/action.yaml:62:13 — Unpinned 3rd party Action 'action.yaml' step Uses Step: filter uses 'Framework-R-D/phlex/.github/actions/detect-relevant-changes' with ref 'main', not a pinned commit hash
  • Warning # 186 actions/unpinned-tag at .github/actions/workflow-setup/action.yaml:68:13 — Unpinned 3rd party Action 'action.yaml' step Uses Step: prepare_check uses 'Framework-R-D/phlex/.github/actions/prepare-check-outputs' with ref 'main', not a pinned commit hash
  • Warning # 187 actions/unpinned-tag at .github/actions/workflow-setup/action.yaml:79:13 — Unpinned 3rd party Action 'action.yaml' step Uses Step: prepare_fix uses 'Framework-R-D/phlex/.github/actions/prepare-fix-outputs' with ref 'main', not a pinned commit hash
  • Warning # 188 actions/unpinned-tag at .github/actions/workflow-setup/action.yaml:128:13 — Unpinned 3rd party Action 'action.yaml' step Uses Step: detect uses 'Framework-R-D/phlex/.github/actions/run-change-detection' with ref 'main', not a pinned commit hash

Review the full CodeQL report for details.

@knoepfel knoepfel force-pushed the support-source-macro branch 3 times, most recently from 7ce86e6 to 415a7c9 Compare June 5, 2026 21:53
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 5, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 5, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 5, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 5, 2026
@knoepfel knoepfel marked this pull request as ready for review June 5, 2026 21:54
@knoepfel knoepfel force-pushed the support-source-macro branch from 415a7c9 to c4d0b3d Compare June 5, 2026 22:03
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main     #637      +/-   ##
==========================================
- Coverage   83.27%   83.05%   -0.22%     
==========================================
  Files         162      164       +2     
  Lines        5912     6002      +90     
  Branches      670      682      +12     
==========================================
+ Hits         4923     4985      +62     
- Misses        796      824      +28     
  Partials      193      193              
Flag Coverage Δ
scripts 76.36% <ø> (ø)
unittests 86.44% <100.00%> (-0.41%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
phlex/app/load_module.cpp 86.66% <100.00%> (-0.29%) ⬇️
phlex/core/framework_graph.cpp 99.07% <100.00%> (ø)
phlex/core/framework_graph.hpp 100.00% <100.00%> (ø)
phlex/core/glue.hpp 100.00% <100.00%> (ø)
phlex/core/graph_proxy.hpp 90.00% <ø> (ø)
phlex/core/make_computational_edges.cpp 100.00% <100.00%> (ø)
phlex/core/node_catalog.hpp 100.00% <ø> (ø)
phlex/core/source.cpp 100.00% <100.00%> (ø)
phlex/core/source.hpp 100.00% <100.00%> (ø)
phlex/detail/plugin_macros.hpp 100.00% <100.00%> (ø)
... and 3 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ed92fc...4f4b2af. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 8, 2026
@knoepfel knoepfel force-pushed the support-source-macro branch from c4d0b3d to 4875ba8 Compare June 8, 2026 14:08
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 8, 2026
@knoepfel knoepfel linked an issue Jun 8, 2026 that may be closed by this pull request
@knoepfel knoepfel force-pushed the support-source-macro branch from 4875ba8 to 4f4b2af Compare June 8, 2026 14:37
@knoepfel knoepfel closed this Jun 8, 2026
@knoepfel knoepfel reopened this Jun 8, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Clang-Tidy Check Results

Found 5948 issue(s); none are newly introduced by this patch.

All issues by check:

  • readability-identifier-naming: 1792
  • readability-redundant-typename: 1228
  • readability-redundant-member-init: 1209
  • performance-unnecessary-value-param: 477
  • readability-avoid-const-params-in-decls: 257
  • modernize-pass-by-value: 200
  • readability-use-concise-preprocessor-directives: 192
  • modernize-use-designated-initializers: 100
  • readability-braces-around-statements: 89
  • readability-convert-member-functions-to-static: 80
  • readability-const-return-type: 47
  • modernize-use-auto: 27
  • modernize-avoid-c-style-cast: 22
  • readability-inconsistent-ifelse-braces: 21
  • readability-qualified-auto: 19
  • readability-redundant-control-flow: 19
  • readability-math-missing-parentheses: 17
  • modernize-avoid-c-arrays: 15
  • modernize-use-equals-default: 14
  • modernize-use-using: 13
  • readability-static-definition-in-anonymous-namespace: 12
  • modernize-concat-nested-namespaces: 10
  • modernize-return-braced-init-list: 10
  • readability-function-size: 10
  • readability-isolate-declaration: 8
  • cppcoreguidelines-special-member-functions: 7
  • readability-container-contains: 7
  • modernize-use-starts-ends-with: 6
  • readability-redundant-access-specifiers: 5
  • readability-inconsistent-declaration-parameter-name: 5
  • modernize-use-ranges: 5
  • readability-container-size-empty: 5
  • readability-redundant-casting: 3
  • bugprone-branch-clone: 3
  • modernize-use-std-numbers: 3
  • performance-move-const-arg: 2
  • clang-analyzer-security.ArrayBound: 2
  • modernize-redundant-void-arg: 1
  • readability-redundant-string-init: 1
  • readability-else-after-return: 1
  • modernize-make-shared: 1
  • readability-simplify-boolean-expr: 1
  • modernize-use-integer-sign-comparison: 1
  • readability-use-anyofallof: 1

See inline comments for details. Comment @phlexbot tidy-fix to auto-fix.

@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 8, 2026
Comment thread test/provider_test.cpp

TEST_CASE("Implicit providers")
{
constexpr auto max_events{3u};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider change max_events to num_spills or the like.

Comment thread test/provider_test.cpp
g.execute();

CHECK(g.execution_count("passer") == max_events);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider checking the execution count on the provider itself, in addition to checking that the transform was triggered (by the provider) the right number of times.

Comment thread test/provider_test.cpp

CHECK_THROWS_WITH(
g.execute(),
Catch::Matchers::ContainsSubstring("Node with name 'vertices_source' already exists"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider changing the message in the exception to say "Source with name ...".

Comment thread phlex/core/glue.hpp
}

template <std::derived_from<source> Source, typename... Args>
void source(std::string name, Args&&... args)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this creates a new thing in the graph on which it is called, consider renaming to add_source.
This probably should be done for the other node types as well, so an issue that addresses this should be created.


/// @brief Registers a source (used by the framework to create provider nodes)
template <std::derived_from<source> Source, typename... Args>
void source(std::string name, Args&&... args)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same comment as put in graph::source applies here: consider renaming to add_source.

source_map const& sources,
tbb::flow::graph& g)
{
index_router::provider_input_ports_t result;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming result to resulting_input_ports or the like.


auto& bundle = bundles[0];
auto const& spec = bundle.specification();
auto node = std::make_unique<provider_node>(spec.creator(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider filing an issue that makes the argument list of the constructor of provider_node shorter by passing in the provider_bundle rather than passing in the innards of the provider_bundle.

Comment thread phlex/core/source.hpp
std::string layer,
std::string stage);

std::function<provider_function_t> release_provider_function();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have accessors for all data members; consider making this class a struct, adjust member names, and removing accessors.

#define PHLEX_DETAIL_REGISTER_PLUGIN(token_type, func_name, dll_alias, ...) \
extern "C" PHLEX_DETAIL_SELECT_SIGNATURE(token_type, dll_alias, __VA_ARGS__)

// ================================================================================================

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there tests for these macros? If not, some should be added.

@marcpaterno marcpaterno left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the already-filed comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to implicitly register providers from input sources

3 participants