Skip to content

Allow drivers to access configured sources#658

Open
knoepfel wants to merge 7 commits into
Framework-R-D:mainfrom
knoepfel:update-hierarchy
Open

Allow drivers to access configured sources#658
knoepfel wants to merge 7 commits into
Framework-R-D:mainfrom
knoepfel:update-hierarchy

Conversation

@knoepfel

@knoepfel knoepfel commented Jun 23, 2026

Copy link
Copy Markdown
Member

Motivation

Previously, drivers were constructed before the framework_graph was initialized, which meant they had no way to access the sources (input data providers) that had been configured for the graph. This PR wires drivers into the graph after sources are registered, so that a driver can query which sources it is supposed to drive.

What Changed

Driver Configuration Model

framework_graph now uses two static factory methods instead of direct constructors:

Factory Behavior
with_default_driver(int max_parallelism) Loads the built-in default driver immediately
with_deferred_driver(int max_parallelism) Graph is created without a driver; one must be supplied via add_driver() before execute()

The internal driver storage is now std::optional<framework_driver> (previously a bare framework_driver member), and a driver_mode_ enum tracks which mode the graph is in.

Drivers Can Declare Source Parameters

Drivers can now accept parameters derived from source alongside their primary cursor/yielder argument. The framework resolves these parameters automatically from the configured source list:

// Driver function requesting access to two configured sources
void my_driver(data_cell_yielder y, MySource const& s1, AnotherSource const& s2) { ... }

The new detail::invoke_driver_with_sources helper unpacks a source_vector into the typed parameters via dynamic_cast and compile-time index sequencing. The is_driver_like_with_cursor and is_driver_like_with_yielder concepts are now defined in terms of the new is_driver_like_with_sources concept, which validates that additional parameters are source-derived.

load_driver Refactoring

load_driver now accepts a framework_graph& and registers the driver directly instead of returning a driver_bundle. It reads an optional uses_sources list from the configuration and passes the resolved sources to the driver via g.driver_proxy(required_sources).

New framework_graph Helpers

  • add_driver(driver_bundle) — deferred driver registration (validates mode, rejects duplicates)
  • add_driver(std::shared_ptr<Generator>) — templated overload constrained by is_driver_generator_like
  • driver_proxy(std::vector<std::string> strings = {}) — convenience helper that resolves source names through node_catalog::sources_for()
  • execute() now throws if no driver has been configured

Source Infrastructure

  • New source_vector type alias: std::vector<source const*>
  • New node_catalog::sources_for(std::vector<std::string> const& keys) builds a source_vector from named keys

Layer Generator Refactoring

layer_generator can no longer be stack-constructed. Use the new factory:

// Before
experimental::layer_generator gen;
gen.add_layer("run");
experimental::framework_graph g{driver_for_test(gen)};

// After
auto gen = experimental::layer_generator::make();
gen->add_layer("run");
auto g = experimental::framework_graph::with_deferred_driver();
g.add_driver(gen);

The new driver_function() method returns a std::function<void(data_cell_yielder)> suitable for use as a driver callback. The driver_for_test helper has been removed.

Fixed Hierarchy Updates

  • Constructor now deduplicates layer paths and stores them in lexicographic order
  • New fixed_hierarchy::update(std::vector<layer_path>) merges additional layer paths while ignoring duplicates and recomputes the hash table

Tests

All ~30 affected test files have been updated to the new driver initialization pattern. New test coverage includes:

  • fixed_hierarchy constructor deduplication and update() behavior
  • Throwing when execute() is called without a configured driver
  • Late driver configuration (deferred graph with providers registered before set_driver)
  • Throwing on duplicate set_driver calls

@knoepfel knoepfel added this to the Prototype 0.3 milestone Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 77461bfa-522d-4329-825f-7ad10c5f014b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

framework_graph replaces direct constructor-based driver injection with with_default_driver()/with_deferred_driver() factory methods and an explicit set_driver() call, storing the driver as std::optional. driver_proxy gains source-typed parameter dispatch via metaprogramming. layer_generator becomes a shared_ptr factory. fixed_hierarchy gains deduplication and update(). All tests and app wiring are migrated to the new API.

Changes

Deferred Driver Configuration

Layer / File(s) Summary
source_vector type and node_catalog::sources_for
phlex/core/source.hpp, phlex/core/node_catalog.hpp, phlex/core/node_catalog.cpp
Introduces source_vector (std::vector<source const*>) type alias and adds sources_for(vector<string>) to node_catalog for name-based source lookup consumed by driver_proxy.
fixed_hierarchy deduplication and update()
phlex/model/fixed_hierarchy.hpp, phlex/model/fixed_hierarchy.cpp, test/fixed_hierarchy_test.cpp
Adds unique_paths helper to deduplicate on construction, updates convert_vector_vector_string to use it, and introduces fixed_hierarchy::update() to union-merge additional paths post-construction; backed by three new test cases.
driver_proxy source-typed dispatch and generator concept
phlex/driver.hpp
Adds detail::invoke_driver_with_sources (index-sequence + dynamic_cast unpacking), source parameter type traits, is_driver_like_with_sources concept, redefines cursor/yielder concepts, adds is_driver_generator_like, and refactors driver_proxy::driver() overloads to use a private make_driver_bundle helper with source unpacking; adds generator overload rejecting null input.
layer_generator factory pattern and driver_function()
plugins/layer_generator.hpp, plugins/layer_generator.cpp, plugins/generate_layers.cpp
Moves layer_generator() constructor to private, adds [[nodiscard]] static make() returning shared_ptr<layer_generator>, implements driver_function() returning a yielder callable over indices(), removes driver_for_test(), and simplifies generate_layers.cpp to call d.driver(std::move(gen)).
framework_graph driver_mode, factory methods, optional driver, and set_driver()
phlex/core/framework_graph.hpp, phlex/core/framework_graph.cpp
Adds driver_mode enum, replaces old constructors with with_default_driver()/with_deferred_driver() factories, changes driver_ to std::optional<framework_driver>, adds driver_mode_ member, implements set_driver(driver_bundle) with three-way validation (wrong mode, already set, empty), adds templated set_driver(shared_ptr<Generator>) and driver_proxy(vector<string>) helper; execute() throws when no driver is configured and calls driver_->stop() in exception paths.
load_driver and run.cpp app wiring
phlex/app/load_module.hpp, phlex/app/load_module.cpp, phlex/app/run.cpp
load_driver signature changes to void(framework_graph&, config), reads optional uses_sources, constructs the driver via g.driver_proxy(required_sources) and registers it with g.set_driver(). run() now calls with_deferred_driver() then load_driver(g, driver_config) as a two-step initialization.
Test migration to new API
test/framework_graph.cpp, test/layer_generator.cpp, test/filter.cpp, test/fold.cpp, test/provider_test.cpp, test/...
All test files migrated from layer_generator stack allocation + driver_for_test() + direct framework_graph constructor to layer_generator::make(), with_deferred_driver()/with_default_driver(), and g.set_driver(gen). New framework_graph tests cover: executing without a driver throws, late set_driver after wiring is valid, and double set_driver throws.

Sequence Diagram

sequenceDiagram
    participant run as phlex::run()
    participant load_driver as load_driver()
    participant framework_graph as framework_graph
    participant driver_proxy as driver_proxy
    participant layer_generator as layer_generator

    run->>framework_graph: with_deferred_driver(max_parallelism)
    framework_graph-->>run: g (driver_ empty, mode=deferred)
    run->>load_driver: load_driver(g, driver_config)
    load_driver->>framework_graph: g.driver_proxy(required_sources)
    framework_graph->>driver_proxy: driver_proxy(sources_for(required_sources))
    driver_proxy-->>load_driver: d
    load_driver->>driver_proxy: d.driver(generator) or d.driver(hierarchy, fn)
    driver_proxy->>driver_proxy: make_driver_bundle / invoke_driver_with_sources
    driver_proxy-->>load_driver: driver_bundle result
    load_driver->>framework_graph: g.set_driver(result)
    framework_graph->>framework_graph: validate mode + not-yet-set + non-empty, store driver_

    Note over run,framework_graph: Providers and observers are wired after this point

    run->>framework_graph: g.execute()
    framework_graph->>framework_graph: assert driver_ configured
    framework_graph->>layer_generator: driver_() — pull data cells via yielder
    layer_generator-->>framework_graph: data_cell_index stream
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested reviewers

  • greenc-FNAL
  • marcpaterno
  • sabasehrish
  • wwuoneway
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.63% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Allow drivers to access configured sources' directly describes the core change: extending the driver API to enable drivers to work with configured source data, which is reflected throughout the refactored load_driver, framework_graph, driver_proxy, and test updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@greenc-FNAL

greenc-FNAL commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

31 fixed, 0 new since branch point (cb81c8b)
31 fixed, 0 new since previous report on PR (17b534e)

✅ 31 CodeQL alerts resolved since the previous PR commit

  • Warning # 196 actions/untrusted-checkout-toctou/critical at .github/workflows/clang-tidy-fix.yaml:109:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 197 actions/untrusted-checkout-toctou/critical at .github/workflows/clang-tidy-fix.yaml:137:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 198 actions/untrusted-checkout-toctou/critical at .github/workflows/clang-tidy-fix.yaml:157:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 199 actions/untrusted-checkout-toctou/critical at .github/workflows/clang-tidy-fix.yaml:201:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 200 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:166:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 201 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:188:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 202 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:207:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 203 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:226:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 204 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:251:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 205 actions/untrusted-checkout-toctou/critical at .github/workflows/header-guards-fix.yaml:107:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 206 actions/untrusted-checkout-toctou/critical at .github/workflows/markdown-fix.yaml:107:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 207 actions/untrusted-checkout-toctou/critical at .github/workflows/yaml-fix.yaml:108:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 208 actions/untrusted-checkout-toctou/critical at .github/workflows/yaml-fix.yaml:111:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 209 actions/untrusted-checkout-toctou/high at .github/workflows/clang-format-fix.yaml:94:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 210 actions/untrusted-checkout-toctou/high at .github/workflows/cmake-format-fix.yaml:94:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 211 actions/untrusted-checkout-toctou/high at .github/workflows/jsonnet-format-fix.yaml:95:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 212 actions/untrusted-checkout-toctou/high at .github/workflows/python-fix.yaml:94:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 213 actions/untrusted-checkout/high at .github/workflows/clang-format-fix.yaml:94:9 — Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
    Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
  • Warning # 214 actions/untrusted-checkout/high at .github/workflows/cmake-format-fix.yaml:94:9 — Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
    Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
  • Warning # 215 actions/untrusted-checkout/high at .github/workflows/jsonnet-format-fix.yaml:95:9 — Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
    Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
  • ✅ …and 11 more alerts (see Code Scanning for the full list).

✅ 31 CodeQL alerts resolved since the branch point

  • Warning # 196 actions/untrusted-checkout-toctou/critical at .github/workflows/clang-tidy-fix.yaml:109:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 197 actions/untrusted-checkout-toctou/critical at .github/workflows/clang-tidy-fix.yaml:137:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 198 actions/untrusted-checkout-toctou/critical at .github/workflows/clang-tidy-fix.yaml:157:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 199 actions/untrusted-checkout-toctou/critical at .github/workflows/clang-tidy-fix.yaml:201:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 200 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:166:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 201 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:188:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 202 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:207:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 203 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:226:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 204 actions/untrusted-checkout-toctou/critical at .github/workflows/coverage.yaml:251:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 205 actions/untrusted-checkout-toctou/critical at .github/workflows/header-guards-fix.yaml:107:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 206 actions/untrusted-checkout-toctou/critical at .github/workflows/markdown-fix.yaml:107:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 207 actions/untrusted-checkout-toctou/critical at .github/workflows/yaml-fix.yaml:108:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 208 actions/untrusted-checkout-toctou/critical at .github/workflows/yaml-fix.yaml:111:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 209 actions/untrusted-checkout-toctou/high at .github/workflows/clang-format-fix.yaml:94:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 210 actions/untrusted-checkout-toctou/high at .github/workflows/cmake-format-fix.yaml:94:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 211 actions/untrusted-checkout-toctou/high at .github/workflows/jsonnet-format-fix.yaml:95:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 212 actions/untrusted-checkout-toctou/high at .github/workflows/python-fix.yaml:94:9 — Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
    Insufficient protection against execution of untrusted code on a privileged workflow (issue_comment).
  • Warning # 213 actions/untrusted-checkout/high at .github/workflows/clang-format-fix.yaml:94:9 — Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
    Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
  • Warning # 214 actions/untrusted-checkout/high at .github/workflows/cmake-format-fix.yaml:94:9 — Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
    Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
  • Warning # 215 actions/untrusted-checkout/high at .github/workflows/jsonnet-format-fix.yaml:95:9 — Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
    Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: issue_comment).
  • ✅ …and 11 more alerts (see Code Scanning for the full list).

Review the full CodeQL report for details.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@phlex/core/framework_graph.hpp`:
- Around line 79-83: The driver_proxy method currently forwards the result of
nodes_.sources_for(strings) directly without validating that all requested
source names were actually resolved, which can cause unresolved keys to be
silently dropped and lead to incorrect positional source binding or runtime
failures. Add validation logic within the driver_proxy method to check that the
collection returned by nodes_.sources_for(strings) contains exactly the number
of sources corresponding to the requested strings, and raise an error or
exception if any source names failed to resolve before constructing and
returning the experimental::driver_proxy object.

In `@phlex/core/node_catalog.cpp`:
- Around line 62-65: The sources_for() function silently skips missing source
keys in the loop instead of failing when a configured source name cannot be
found. Modify the conditional logic in the loop over keys so that when
sources.get(key) returns null or empty for any key, throw an exception with a
descriptive error message indicating which source name is missing, rather than
just skipping it with the if statement. This ensures configuration errors are
caught immediately instead of silently dropping unknown source names.

In `@phlex/driver.hpp`:
- Around line 114-128: The driver method that accepts a Generator parameter
needs to validate that no sources have been configured, similar to how the
function-driver overload validates this. Add a validation check at the beginning
of the driver method (before the null generator check) to ensure that sources_
is empty, and throw an std::invalid_argument exception with an appropriate
message if sources have been configured, since generator-style drivers do not
consume sources and would silently drop any configured source list.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 36736741-8fb2-4555-a748-33dea01f4754

📥 Commits

Reviewing files that changed from the base of the PR and between a98ac3d and a08a772.

📒 Files selected for processing (34)
  • phlex/app/load_module.cpp
  • phlex/app/load_module.hpp
  • phlex/app/run.cpp
  • phlex/core/framework_graph.cpp
  • phlex/core/framework_graph.hpp
  • phlex/core/node_catalog.cpp
  • phlex/core/node_catalog.hpp
  • phlex/core/source.hpp
  • phlex/driver.hpp
  • phlex/model/fixed_hierarchy.cpp
  • phlex/model/fixed_hierarchy.hpp
  • plugins/generate_layers.cpp
  • plugins/layer_generator.cpp
  • plugins/layer_generator.hpp
  • test/allowed_families.cpp
  • test/cached_execution.cpp
  • test/class_registration.cpp
  • test/demo-giantdata/unfold_transform_fold.cpp
  • test/filter.cpp
  • test/fixed_hierarchy_test.cpp
  • test/fold.cpp
  • test/fold_duplicate_layer_name_test.cpp
  • test/framework_graph.cpp
  • test/function_registration.cpp
  • test/hierarchical_nodes.cpp
  • test/layer_generator.cpp
  • test/memory-checks/many_events.cpp
  • test/multiple_function_registration.cpp
  • test/output_products.cpp
  • test/product_selecting.cpp
  • test/provider_test.cpp
  • test/type_distinction.cpp
  • test/unfold.cpp
  • test/vector_of_abstract_types.cpp
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Framework-R-D/action-configure-cmake (auto-detected)
  • Framework-R-D/action-workflow-setup (auto-detected)
  • Framework-R-D/action-complete-pr-comment (auto-detected)
  • Framework-R-D/action-handle-fix-commit (auto-detected)
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: build (gcc, none)
  • GitHub Check: Analyze cpp with CodeQL
  • GitHub Check: coverage
  • GitHub Check: clang-tidy-check
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{cpp,cc,cxx,h,hpp}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{cpp,cc,cxx,h,hpp}: Use clang-format tool for all C++ code formatting (VS Code auto-formats on save); configuration defined in .clang-format with 100-character line limit and 2-space indentation
Follow clang-tidy recommendations defined in .clang-tidy

Files:

  • test/multiple_function_registration.cpp
  • plugins/generate_layers.cpp
  • test/function_registration.cpp
  • test/memory-checks/many_events.cpp
  • test/hierarchical_nodes.cpp
  • phlex/model/fixed_hierarchy.hpp
  • test/fold_duplicate_layer_name_test.cpp
  • phlex/core/node_catalog.hpp
  • test/type_distinction.cpp
  • test/product_selecting.cpp
  • test/vector_of_abstract_types.cpp
  • phlex/core/source.hpp
  • test/demo-giantdata/unfold_transform_fold.cpp
  • test/output_products.cpp
  • phlex/core/node_catalog.cpp
  • phlex/app/load_module.cpp
  • test/layer_generator.cpp
  • test/unfold.cpp
  • phlex/app/load_module.hpp
  • test/class_registration.cpp
  • test/allowed_families.cpp
  • test/fixed_hierarchy_test.cpp
  • plugins/layer_generator.cpp
  • test/cached_execution.cpp
  • test/fold.cpp
  • phlex/app/run.cpp
  • test/framework_graph.cpp
  • test/provider_test.cpp
  • phlex/core/framework_graph.hpp
  • test/filter.cpp
  • phlex/model/fixed_hierarchy.cpp
  • phlex/core/framework_graph.cpp
  • phlex/driver.hpp
  • plugins/layer_generator.hpp
**/*.{hpp,cpp}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{hpp,cpp}: Use .hpp for header files, .cpp for implementation, and *_test.cpp for test files in C++
Enforce 100-character line limit and 2-space indentation in C++ code via .clang-format
Use QualifierAlignment: Right (east-const) style: int const x not const int x in C++
Use PointerAlignment: Left in C++ (pointer * attached to type, not variable name)
All C++ identifiers must use lower_case naming: namespaces, classes, structs, enums, functions, variables, parameters, members, and constants
Exception to C++ naming: template parameters use CamelCase
Exception to C++ naming: macros use UPPER_CASE
Private, protected, and constant members in C++ must have a trailing underscore (_), no trailing underscore on anything else
Use enum class preferred over plain enum in C++
Use std::shared_ptr for shared ownership, std::unique_ptr for exclusive ownership, raw pointers for non-owning references only in C++
Use functors with agent-noun pattern: ModelEvaluator evaluate_model(...) in C++
Apply .clang-tidy checks for bugprone, cert, clang-analyzer, concurrency, cppcoreguidelines, misc, modernize, performance, portability, and readability as defined in the .clang-tidy configuration file
Use phlex:: namespace for core code, phlex::experimental:: for experimental features in C++

Files:

  • test/multiple_function_registration.cpp
  • plugins/generate_layers.cpp
  • test/function_registration.cpp
  • test/memory-checks/many_events.cpp
  • test/hierarchical_nodes.cpp
  • phlex/model/fixed_hierarchy.hpp
  • test/fold_duplicate_layer_name_test.cpp
  • phlex/core/node_catalog.hpp
  • test/type_distinction.cpp
  • test/product_selecting.cpp
  • test/vector_of_abstract_types.cpp
  • phlex/core/source.hpp
  • test/demo-giantdata/unfold_transform_fold.cpp
  • test/output_products.cpp
  • phlex/core/node_catalog.cpp
  • phlex/app/load_module.cpp
  • test/layer_generator.cpp
  • test/unfold.cpp
  • phlex/app/load_module.hpp
  • test/class_registration.cpp
  • test/allowed_families.cpp
  • test/fixed_hierarchy_test.cpp
  • plugins/layer_generator.cpp
  • test/cached_execution.cpp
  • test/fold.cpp
  • phlex/app/run.cpp
  • test/framework_graph.cpp
  • test/provider_test.cpp
  • phlex/core/framework_graph.hpp
  • test/filter.cpp
  • phlex/model/fixed_hierarchy.cpp
  • phlex/core/framework_graph.cpp
  • phlex/driver.hpp
  • plugins/layer_generator.hpp
**/*.hpp

📄 CodeRabbit inference engine (AGENTS.md)

Avoid boolean parameters in C++ interfaces; prefer enumerations instead

Files:

  • phlex/model/fixed_hierarchy.hpp
  • phlex/core/node_catalog.hpp
  • phlex/core/source.hpp
  • phlex/app/load_module.hpp
  • phlex/core/framework_graph.hpp
  • phlex/driver.hpp
  • plugins/layer_generator.hpp
🪛 Cppcheck (2.21.0)
plugins/generate_layers.cpp

[style] 26-26: The function 'PHLEX_REGISTER_DRIVER' is never used.

(unusedFunction)

phlex/app/load_module.cpp

[style] 116-116: The function 'load_driver' is never used.

(unusedFunction)

🔇 Additional comments (34)
phlex/model/fixed_hierarchy.hpp (1)

90-92: LGTM!

phlex/model/fixed_hierarchy.cpp (1)

16-25: LGTM!

Also applies to: 39-39, 51-64, 115-123

test/fixed_hierarchy_test.cpp (1)

74-80: LGTM!

Also applies to: 82-93, 95-105

phlex/core/framework_graph.hpp (1)

29-29: LGTM!

Also applies to: 42-63, 190-192, 201-201, 210-210

phlex/core/framework_graph.cpp (1)

18-34: LGTM!

Also applies to: 53-79, 102-121

phlex/app/run.cpp (1)

20-20: LGTM!

Also applies to: 41-43

test/layer_generator.cpp (1)

12-19: LGTM!

Also applies to: 24-34, 38-50, 54-66, 70-77, 84-103

test/allowed_families.cpp (1)

37-43: LGTM!

test/cached_execution.cpp (1)

55-61: LGTM!

test/demo-giantdata/unfold_transform_fold.cpp (1)

48-54: LGTM!

test/fold.cpp (1)

63-68: LGTM!

Also applies to: 107-112

phlex/app/load_module.hpp (1)

25-25: LGTM!

phlex/app/load_module.cpp (1)

116-127: LGTM!

test/framework_graph.cpp (1)

11-11: LGTM!

Also applies to: 16-17, 23-24, 30-31, 33-34, 45-45, 52-53, 55-56, 79-79, 90-91, 93-94, 114-114, 128-133, 135-156, 158-167

test/class_registration.cpp (1)

68-68: LGTM!

test/function_registration.cpp (1)

64-64: LGTM!

test/multiple_function_registration.cpp (1)

44-44: LGTM!

test/type_distinction.cpp (1)

46-50: LGTM!

test/vector_of_abstract_types.cpp (1)

42-46: LGTM!

test/filter.cpp (1)

105-108: LGTM!

Also applies to: 132-135, 155-158, 186-189, 213-216

test/fold_duplicate_layer_name_test.cpp (1)

60-66: LGTM!

test/hierarchical_nodes.cpp (1)

81-86: LGTM!

test/memory-checks/many_events.cpp (1)

17-21: LGTM!

test/output_products.cpp (1)

39-43: LGTM!

test/product_selecting.cpp (1)

31-34: LGTM!

test/provider_test.cpp (1)

68-72: LGTM!

Also applies to: 91-95, 111-111, 121-121, 140-140

test/unfold.cpp (1)

94-98: LGTM!

Also applies to: 162-166

phlex/core/source.hpp (1)

46-46: LGTM!

phlex/core/node_catalog.hpp (1)

32-33: LGTM!

phlex/core/node_catalog.cpp (1)

4-4: LGTM!

phlex/driver.hpp (1)

5-20: LGTM!

Also applies to: 32-110, 132-163

plugins/layer_generator.hpp (1)

19-24: LGTM!

Also applies to: 37-37, 50-50, 61-68

plugins/layer_generator.cpp (1)

14-17: LGTM!

Also applies to: 139-146

plugins/generate_layers.cpp (1)

22-30: LGTM!

Also applies to: 41-41

Comment thread phlex/core/framework_graph.hpp
Comment thread phlex/core/node_catalog.cpp
Comment thread phlex/driver.hpp
Comment on lines +114 to +128
driver_bundle driver(std::shared_ptr<Generator> generator) const
{
if (!generator) {
throw std::invalid_argument("Cannot configure driver with an empty generator.");
}

auto hierarchy = generator->hierarchy();
auto generator_driver = generator->driver_function();

return {[generator = std::move(generator),
h = hierarchy,
generator_driver = std::move(generator_driver)](framework_driver& d) mutable {
std::invoke(generator_driver, h.yielder(d));
},
std::move(hierarchy)};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject configured sources for generator drivers until they’re supported.

This overload never consumes sources_; if uses_sources is supplied for a generator-style driver, the configured source list is silently dropped. Mirror the function-driver validation by rejecting non-empty sources_ here.

🐛 Proposed fix
       if (!generator) {
         throw std::invalid_argument("Cannot configure driver with an empty generator.");
       }
+      if (!sources_.empty()) {
+        throw std::invalid_argument(
+          "Generator drivers do not accept configured source parameters.");
+      }
 
       auto hierarchy = generator->hierarchy();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@phlex/driver.hpp` around lines 114 - 128, The driver method that accepts a
Generator parameter needs to validate that no sources have been configured,
similar to how the function-driver overload validates this. Add a validation
check at the beginning of the driver method (before the null generator check) to
ensure that sources_ is empty, and throw an std::invalid_argument exception with
an appropriate message if sources have been configured, since generator-style
drivers do not consume sources and would silently drop any configured source
list.

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.21429% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
phlex/driver.hpp 95.00% 0 Missing and 2 partials ⚠️
@@            Coverage Diff             @@
##             main     #658      +/-   ##
==========================================
+ Coverage   83.27%   83.72%   +0.45%     
==========================================
  Files         162      170       +8     
  Lines        5912     6679     +767     
  Branches      670      807     +137     
==========================================
+ Hits         4923     5592     +669     
- Misses        796      816      +20     
- Partials      193      271      +78     
Flag Coverage Δ
scripts 78.86% <ø> (+2.49%) ⬆️
unittests 85.97% <98.21%> (-0.89%) ⬇️

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 84.78% <100.00%> (-2.18%) ⬇️
phlex/app/run.cpp 88.88% <100.00%> (+0.65%) ⬆️
phlex/core/framework_graph.cpp 96.63% <100.00%> (-2.44%) ⬇️
phlex/core/framework_graph.hpp 100.00% <100.00%> (ø)
phlex/core/glue.hpp 98.43% <ø> (-1.57%) ⬇️
phlex/core/graph_proxy.hpp 91.66% <100.00%> (+1.66%) ⬆️
phlex/core/node_catalog.cpp 88.88% <100.00%> (+3.17%) ⬆️
phlex/core/node_catalog.hpp 100.00% <ø> (ø)
phlex/core/source.hpp 100.00% <ø> (ø)
phlex/model/fixed_hierarchy.cpp 88.63% <100.00%> (+13.63%) ⬆️
... and 6 more

... and 17 files 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 cb81c8b...1dfdf53. 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 24, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 24, 2026
@Framework-R-D Framework-R-D deleted a comment from coderabbitai Bot Jun 24, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Clang-Tidy Check Results

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

All issues by check:

  • readability-identifier-naming: 2127
  • readability-redundant-member-init: 1282
  • portability-template-virtual-member-function: 563
  • performance-unnecessary-value-param: 487
  • readability-avoid-const-params-in-decls: 269
  • modernize-pass-by-value: 206
  • readability-braces-around-statements: 93
  • modernize-use-designated-initializers: 88
  • readability-convert-member-functions-to-static: 82
  • readability-const-return-type: 50
  • modernize-use-auto: 36
  • performance-move-const-arg: 29
  • readability-qualified-auto: 27
  • readability-redundant-control-flow: 24
  • performance-enum-size: 24
  • modernize-concat-nested-namespaces: 17
  • readability-math-missing-parentheses: 16
  • modernize-use-equals-default: 15
  • modernize-avoid-c-arrays: 15
  • modernize-use-using: 13
  • bugprone-branch-clone: 12
  • readability-function-size: 12
  • readability-static-definition-in-anonymous-namespace: 12
  • modernize-return-braced-init-list: 11
  • cppcoreguidelines-special-member-functions: 8
  • readability-isolate-declaration: 8
  • readability-container-size-empty: 7
  • modernize-use-starts-ends-with: 7
  • modernize-use-ranges: 6
  • readability-redundant-access-specifiers: 5
  • readability-inconsistent-declaration-parameter-name: 5
  • readability-container-contains: 5
  • readability-redundant-casting: 3
  • modernize-use-std-numbers: 3
  • modernize-use-emplace: 3
  • performance-avoid-endl: 2
  • modernize-use-integer-sign-comparison: 2
  • modernize-redundant-void-arg: 1
  • readability-else-after-return: 1
  • modernize-make-shared: 1
  • readability-redundant-string-init: 1
  • readability-simplify-boolean-expr: 1
  • readability-use-anyofallof: 1

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

@github-actions

Copy link
Copy Markdown
Contributor

Clang-Tidy Check Results

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

All issues by check:

  • readability-identifier-naming: 2127
  • readability-redundant-member-init: 1282
  • portability-template-virtual-member-function: 563
  • performance-unnecessary-value-param: 487
  • readability-avoid-const-params-in-decls: 269
  • modernize-pass-by-value: 206
  • readability-braces-around-statements: 93
  • modernize-use-designated-initializers: 88
  • readability-convert-member-functions-to-static: 82
  • readability-const-return-type: 50
  • modernize-use-auto: 36
  • performance-move-const-arg: 29
  • readability-qualified-auto: 27
  • performance-enum-size: 24
  • readability-redundant-control-flow: 24
  • modernize-concat-nested-namespaces: 17
  • readability-math-missing-parentheses: 16
  • modernize-use-equals-default: 15
  • modernize-avoid-c-arrays: 15
  • modernize-use-using: 13
  • bugprone-branch-clone: 12
  • readability-function-size: 12
  • readability-static-definition-in-anonymous-namespace: 12
  • modernize-return-braced-init-list: 11
  • cppcoreguidelines-special-member-functions: 8
  • readability-isolate-declaration: 8
  • readability-container-size-empty: 7
  • modernize-use-starts-ends-with: 7
  • modernize-use-ranges: 6
  • readability-inconsistent-declaration-parameter-name: 5
  • readability-container-contains: 5
  • readability-redundant-access-specifiers: 5
  • modernize-use-std-numbers: 3
  • readability-redundant-casting: 3
  • modernize-use-emplace: 3
  • performance-avoid-endl: 2
  • modernize-use-integer-sign-comparison: 2
  • modernize-make-shared: 1
  • modernize-redundant-void-arg: 1
  • readability-else-after-return: 1
  • readability-redundant-string-init: 1
  • readability-simplify-boolean-expr: 1
  • readability-use-anyofallof: 1

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

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.

2 participants