Skip to content

Introduce layer_path class - #640

Merged
knoepfel merged 18 commits into
Framework-R-D:mainfrom
beojan:identifier-layer-paths
Jun 16, 2026
Merged

knoepfel merged 18 commits into
Framework-R-D:mainfrom
beojan:identifier-layer-paths

Conversation

@beojan

@beojan beojan commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

The new layer_path class is used in index_router and the related infrastructure.

I've kept strings and vector<string>s for now in drivers. That might be the next step.

  • CI / CodeQL

    • Resolved seven CodeQL alerts for unpinned third-party GitHub Actions (actions referenced with ref 'main'):
      • .github/actions/prepare-check-outputs/action.yaml: get_pr, detect_act
      • .github/actions/prepare-fix-outputs/action.yaml: get_pr
      • .github/actions/run-change-detection/action.yaml: filter
      • .github/actions/workflow-setup/action.yaml: prepare_check, prepare_fix, detect
  • Code (Core Framework)

    • index_router
      • Migrated driver-provided layer paths to phlex::experimental::layer_path.
      • establish_layers(...) signature changed to accept std::vector<layer_path>.
      • index_set_node_for overload accepts layer_path const&; lookups and matching now use layer_path::ends_with, hash(), is_strict_prefix_of.
      • multilayer_slot matching adapted to layer_path API.
      • Ambiguity error messages reformatted using phlex::experimental::bulleted_list.
    • framework_graph
      • seen_cell_count now calls hierarchy_.count_for(experimental::layer_path(...)).
      • Registration-error messages use bulleted_list for formatting.
    • input_arguments & producer_catalog
      • Replaced manual fmt::join formatting with bulleted_list for product/candidate lists.
  • Code (Model / Data Structures)

    • New: phlex::experimental::layer_path
      • Added phlex/model/layer_path.hpp and phlex/model/layer_path.cpp.
      • Represents std::vector, validates semantics (rejects empty, enforces job-root rules), supports:
        • is_complete(), is_strict_prefix_of(), ends_with(layer_path/identifier), to_string()
        • hash() (implicit job-root behavior) and hashes() (cumulative parent hashes)
      • Integrates formatting, hashing helpers, and stream operator.
      • Constructors from vector and declared string_view constructor (parses '/'-delimited input).
    • data_cell_index
      • layer_path() now returns experimental::layer_path (was std::string); implementation builds identifier sequence from parent chain.
    • data_layer_hierarchy
      • count_for() now takes layer_path const& (was std::string); matching uses entry->layer_path.ends_with(layer).
      • layer_entry stores experimental::layer_path.
      • Ambiguity messages use bulleted_list.
    • fixed_hierarchy
      • Stores layer_paths_ as std::vectorexperimental::layer_path (converted from nested vectors).
      • Builds layer_hashes_ via layer_path.hashes(); removed prior validated_path helper.
      • data_cell_cursor::layer_path() now returns experimental::layer_path.
    • handle
      • handle::layer_path() returns std::string created from id_->layer_path().to_string() (clarifies ownership/format).
    • identifier
      • identifier::hash_string inlined as constexpr using xxhash_64.
      • operator""_idq made consteval to precompute identifier_query hashes at compile time.
      • Added inline hash_value(identifier const&) returning id.hash().
    • fixed_hierarchy / fixed_hierarchy.cpp reviewer note: potential out-of-bounds CodeQL concern for empty-vector conversion addressed by layer_path constructor's validate() which rejects empty entries.
  • Utilities

    • Added phlex::experimental::bulleted_list (phlex/utilities/bulleted_list.hpp) to render ranges as indented bulleted strings with overloads for fmt-formattable and to_string()-able elements.
  • Build System

    • phlex/model/CMakeLists.txt: added layer_path.cpp to library sources and layer_path.hpp to installed headers.
    • phlex/utilities/CMakeLists.txt: added bulleted_list.hpp to installed headers.
    • test/CMakeLists.txt: added Catch2 test target for layer_path.
  • Tests

    • Added test/layer_path.cpp: Catch2 tests for construction, prefix relationships, completeness, ends_with, to_string, and hashes().
    • Extended test/core_misc_test.cpp with a test for bulleted_list formatting.
  • Plugins

    • layer_generator
      • Uses the cell's layer_path string for parent_to_children_ lookup and builds child paths with fmt::format("{}/{}", cell_lp, child).
  • Public API / Signature Changes (notable)

    • index_router::establish_layers(...) now accepts std::vector<layer_path>.
    • index_router::index_set_node_for(...) overload accepts layer_path const&.
    • phlex::data_cell_index::layer_path() now returns experimental::layer_path.
    • data_layer_hierarchy::count_for(...) now accepts layer_path const&.
    • fixed_hierarchy stores layer_paths_ as std::vectorexperimental::layer_path; data_cell_cursor::layer_path() returns experimental::layer_path.
    • handle::layer_path() now returns std::string via to_string().
    • identifier operator""_idq is consteval; identifier::hash_string is constexpr.
  • Notes / Review Impact

    • Broad migration from string-based layer identifiers to layer_path affects core model APIs and routing logic; consumer code and drivers should be reviewed for compatibility (drivers currently still supply strings/vectors in some conversion helpers; full driver migration may be required later).
    • Consistent, improved error-list formatting via bulleted_list across modules.
    • Several public/ABI-impacting changes warrant attention during integration and release.

@greenc-FNAL

greenc-FNAL commented Jun 9, 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3077e35b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread phlex/model/layer_path.cpp Outdated
Comment thread phlex/model/layer_path.cpp Outdated
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.09677% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
phlex/core/input_arguments.hpp 0.00% 5 Missing ⚠️
phlex/core/index_router.cpp 60.00% 4 Missing ⚠️
phlex/model/layer_path.hpp 57.14% 3 Missing ⚠️
phlex/core/producer_catalog.cpp 0.00% 2 Missing ⚠️
phlex/model/fixed_hierarchy.cpp 93.33% 1 Missing ⚠️
phlex/model/layer_path.cpp 97.50% 0 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main     #640      +/-   ##
==========================================
+ Coverage   83.27%   84.05%   +0.78%     
==========================================
  Files         162      166       +4     
  Lines        5912     6128     +216     
  Branches      670      681      +11     
==========================================
+ Hits         4923     5151     +228     
+ Misses        796      785      -11     
+ Partials      193      192       -1     
Flag Coverage Δ
scripts 79.18% <ø> (+2.82%) ⬆️
unittests 86.58% <87.09%> (-0.27%) ⬇️

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

Files with missing lines Coverage Δ
phlex/core/framework_graph.cpp 99.07% <100.00%> (ø)
phlex/core/index_router.hpp 100.00% <ø> (ø)
phlex/model/data_cell_index.cpp 90.32% <100.00%> (ø)
phlex/model/data_cell_index.hpp 0.00% <ø> (ø)
phlex/model/data_layer_hierarchy.cpp 100.00% <100.00%> (ø)
phlex/model/data_layer_hierarchy.hpp 100.00% <ø> (ø)
phlex/model/fixed_hierarchy.hpp 100.00% <ø> (ø)
phlex/model/handle.hpp 100.00% <ø> (ø)
phlex/model/identifier.cpp 92.85% <100.00%> (-1.59%) ⬇️
phlex/model/identifier.hpp 100.00% <100.00%> (ø)
... and 8 more

... and 13 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 4ed92fc...a3b86b4. Read the comment docs.

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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ea55cdadf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread phlex/model/layer_path.cpp
Comment thread phlex/model/layer_path.cpp Outdated
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 10, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 10, 2026

@knoepfel knoepfel 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.

@beojan, this PR looks very good. I have several comments below. I think the highest-priority comment is to make sure we have a dedicated set of unit tests for layer_path.

Comment thread phlex/model/layer_path.hpp Outdated
Comment thread phlex/model/layer_path.hpp Outdated
Comment thread phlex/model/layer_path.hpp Outdated
Comment thread plugins/layer_generator.cpp
Comment thread phlex/model/data_layer_hierarchy.hpp Outdated
Comment thread phlex/model/data_layer_hierarchy.hpp
Comment thread phlex/model/data_cell_index.cpp
Comment thread phlex/core/index_router.cpp Outdated
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 11, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7231923365

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread phlex/model/layer_path.cpp
@Framework-R-D Framework-R-D deleted a comment from beojan Jun 12, 2026
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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: 50421eb3-9f15-46c1-a591-18ed42697129

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

This PR adds phlex::experimental::layer_path and phlex::experimental::bulleted_list, migrates model storage/APIs and core routing/counting to use layer_path (including hashing and suffix/prefix checks), and replaces manual multi-item runtime-error rendering with bulleted_list; plugins and tests are updated accordingly.

Changes

Layer path type migration with bulleted list utilities

Layer / File(s) Summary
Layer path class definition and validation
phlex/model/layer_path.hpp, phlex/model/layer_path.cpp, phlex/model/identifier.hpp
phlex::experimental::layer_path wraps a std::vector<identifier>, parses/validates /-delimited paths, exposes is_complete/is_strict_prefix_of/ends_with, provides to_string(), hash(), and hashes(). Identifier hashing and _idq literal behavior were inlined and identifier_query predicate support added.
Bulleted list error message formatting
phlex/utilities/bulleted_list.hpp, phlex/utilities/CMakeLists.txt
Adds phlex::experimental::bulleted_list overloads (formattable and to_string()-able ranges) and installs the header.
Model: data_cell_index accessor
phlex/model/data_cell_index.hpp, phlex/model/data_cell_index.cpp
data_cell_index::layer_path() now returns experimental::layer_path constructed by walking parent chain rather than a formatted string.
Data layer hierarchy matching
phlex/model/data_layer_hierarchy.hpp, phlex/model/data_layer_hierarchy.cpp
data_layer_hierarchy::count_for() now accepts layer_path and matches entries via ends_with(); layer_entry stores layer_path; multi-candidate messages use bulleted_list().
Fixed hierarchy refactor
phlex/model/fixed_hierarchy.hpp, phlex/model/fixed_hierarchy.cpp
fixed_hierarchy stores std::vector<experimental::layer_path>, converts driver string paths to layer_path, and builds layer_hashes_ by merging each layer_path::hashes(); data_cell_cursor::layer_path() returns layer_path.
Index router API and lookup
phlex/core/index_router.hpp, phlex/core/index_router.cpp
index_router::establish_layers() now accepts std::vector<layer_path> and uses layer_path APIs for prefix/suffix/hash operations; index_set_node_for() overload accepts layer_path and uses ends_with(); ambiguous matches are reported with bulleted_list().
Core framework error-message updates
phlex/core/framework_graph.cpp, phlex/core/input_arguments.hpp, phlex/core/producer_catalog.cpp
framework_graph::seen_cell_count now calls hierarchy_.count_for(experimental::layer_path(layer_name)). Multi-item runtime_error messages use bulleted_list() formatting.
Plugin and handle adapters
plugins/layer_generator.cpp, phlex/model/handle.hpp
Where string keys or concatenation remain required, code now calls to_string() on layer_path (plugin lookup and child path formation); handle<T>::layer_path() materializes via to_string().
Tests and CMake
test/layer_path.cpp, test/core_misc_test.cpp, test/CMakeLists.txt, phlex/model/CMakeLists.txt
Adds Catch2 tests for layer_path semantics and for bulleted_list formatting; registers layer_path test target; adds layer_path.cpp to model build and installs layer_path.hpp.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% 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 'Introduce layer_path class' is concise and clearly identifies the main deliverable of the PR: a new layer_path class that refactors layer representation throughout the codebase.
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 and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 562791c8be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread phlex/model/layer_path.cpp

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 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/model/data_cell_index.cpp`:
- Around line 67-75: Add a direct include for the C assert header in
phlex/model/data_cell_index.cpp so the new use of assert(ptr) does not rely on
transitive includes; insert `#include` <cassert> at the top of the translation
unit (near other includes) to ensure assert is defined for the code that
iterates layers using ptr, layer_name(), and parent_.get().

In `@phlex/model/data_layer_hierarchy.cpp`:
- Around line 4-5: The TU uses std::views::transform in data_layer_hierarchy.cpp
(around the code that constructs transformed views) but relies on an indirect
include; make the translation unit self-contained by adding a direct `#include`
<ranges> at the top of phlex/model/data_layer_hierarchy.cpp so the usage of
std::views::transform and other std::views utilities resolve without depending
on bulleted_list.hpp; update the include section near the existing `#include`
"phlex/utilities/bulleted_list.hpp".

In `@phlex/model/layer_path.cpp`:
- Around line 15-27: The constructor layer_path::layer_path builds layer_path_
from path then calls is_complete() which assumes layer_path_ has at least one
element, causing UB for inputs like "/" where layer_path_ is empty; fix by
guarding that call — either check layer_path_.empty() before calling
is_complete() or explicitly validate/throw for an empty layer_path_ prior to
is_complete(); update the constructor to use if (path.starts_with("/") &&
!layer_path_.empty() && not is_complete()) or add an early empty check that
throws, referencing layer_path::layer_path, layer_path_, is_complete(), and
validate() so the empty-path case is rejected safely.
- Around line 86-97: layer_path::hashes() fails to include the implicit "/job"
parent hash for incomplete paths causing ancestor mismatch with
layer_path::hash(); update hashes() to always insert the root job hash when the
path is not complete so that both complete and incomplete inputs produce the
same ancestor set: detect when is_complete() is false and ensure you insert
"job"_idq.hash (or the equivalent experimental::hash("job"_idq.hash,
layer_path_[0].hash()) as appropriate) as the first ancestor before iterating
the rest of layer_path_ (use the same cumulative_hash logic as in hash() to
maintain consistency with experimental::hash and cumulative_hash updates).

In `@phlex/model/layer_path.hpp`:
- Around line 6-10: This header is not self-contained: add the missing standard
headers so the code compiles without relying on transitive includes—include
<utility> for std::move, include <concepts> for std::constructible_from and
std::same_as used in the template constraints, and include <compare> for
three-way comparison operators; update the top-of-file includes accordingly so
symbols referenced in layer_path.hpp (std::move, std::constructible_from,
std::same_as, and any operator<=>/comparison usage) are provided directly.

In `@phlex/utilities/bulleted_list.hpp`:
- Around line 21-42: The bulleted_list templates unconditionally prepend a
prefix causing bulleted_list(rng) to return "  - " for empty ranges; update both
overloads (template <detail::range_of_formattable R> std::string
bulleted_list(...) and the template <detail::range_of_to_stringable R>
requires(...) overload) to early-return an empty string when the input range is
empty (use std::ranges::empty(rng) or check begin==end) before constructing
prefix/prefix_with_newline and joining entries so empty ranges produce ""
instead of a dangling bullet.
🪄 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: acce8139-cd0d-436b-9f27-59d3c0e7d815

📥 Commits

Reviewing files that changed from the base of the PR and between 4ed92fc and 562791c.

📒 Files selected for processing (22)
  • phlex/core/framework_graph.cpp
  • phlex/core/index_router.cpp
  • phlex/core/index_router.hpp
  • phlex/core/input_arguments.hpp
  • phlex/core/producer_catalog.cpp
  • phlex/model/CMakeLists.txt
  • phlex/model/data_cell_index.cpp
  • phlex/model/data_cell_index.hpp
  • phlex/model/data_layer_hierarchy.cpp
  • phlex/model/data_layer_hierarchy.hpp
  • phlex/model/fixed_hierarchy.cpp
  • phlex/model/fixed_hierarchy.hpp
  • phlex/model/handle.hpp
  • phlex/model/identifier.hpp
  • phlex/model/layer_path.cpp
  • phlex/model/layer_path.hpp
  • phlex/utilities/CMakeLists.txt
  • phlex/utilities/bulleted_list.hpp
  • plugins/layer_generator.cpp
  • test/CMakeLists.txt
  • test/core_misc_test.cpp
  • test/layer_path.cpp
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Analyze cpp with CodeQL
  • GitHub Check: build (gcc, none)
  • GitHub Check: clang-tidy-check
  • GitHub Check: coverage
🧰 Additional context used
🪛 Cppcheck (2.20.0)
phlex/model/layer_path.cpp

[style] 44-44: The function 'is_strict_prefix_of' is never used.

(unusedFunction)


[style] 56-56: The function 'ends_with' is never used.

(unusedFunction)


[style] 86-86: The function 'hashes' is never used.

(unusedFunction)


[style] 49-49: The function 'format_as' is never used.

(unusedFunction)


[style] 50-50: The function 'hash_value' is never used.

(unusedFunction)

🔇 Additional comments (13)
test/CMakeLists.txt (1)

32-32: LGTM!

test/core_misc_test.cpp (1)

6-6: LGTM!

Also applies to: 49-54

test/layer_path.cpp (1)

1-36: LGTM!

phlex/core/index_router.hpp (1)

59-61: LGTM!

Also applies to: 94-95

phlex/core/index_router.cpp (1)

4-5: LGTM!

Also applies to: 33-34, 69-72, 102-121, 226-253

phlex/core/framework_graph.cpp (1)

73-74: LGTM!

Also applies to: 139-140

phlex/core/producer_catalog.cpp (1)

79-82: LGTM!

phlex/utilities/CMakeLists.txt (1)

15-27: LGTM!

phlex/model/data_layer_hierarchy.hpp (1)

8-9: LGTM!

Also applies to: 29-29, 43-50

phlex/model/fixed_hierarchy.hpp (1)

7-7: LGTM!

Also applies to: 29-29, 91-91

phlex/model/fixed_hierarchy.cpp (1)

30-52: LGTM!

Also applies to: 75-75, 98-100

plugins/layer_generator.cpp (1)

136-143: LGTM!

phlex/model/handle.hpp (1)

98-98: LGTM!

Comment thread phlex/model/data_cell_index.cpp
Comment thread phlex/model/data_layer_hierarchy.cpp
Comment thread phlex/model/layer_path.cpp
Comment thread phlex/model/layer_path.cpp
Comment thread phlex/model/layer_path.hpp
Comment thread phlex/utilities/bulleted_list.hpp

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
phlex/model/layer_path.cpp (1)

40-42: 🧹 Nitpick | 🔵 Trivial

No _id/_idq logic inconsistency—hashes line up for "job"

  • In phlex/model/identifier.cpp, "job"_idq builds an identifier_query from identifier::hash_string("job") (hash-only), while "job"_id constructs an identifier with the same hash_string in hash_.
  • Equality is compatible in both directions (identifier == identifier_query compares hash; identifier == identifier compares hash then content), so validate()’s "job"_id contains check and is_complete()’s "job"_idq completion check won’t diverge.
  • Optional: validate() could use "job"_idq to avoid constructing a literal identifier, but it’s not required for correctness.
🤖 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/model/layer_path.cpp` around lines 40 - 42, The check in validate()
uses a literal identifier `"job"_id` while elsewhere completion checks use
`"job"_idq`; to keep construction semantics consistent (and avoid constructing a
full identifier), change the contains() call in
phlex::model::LayerPath::validate (referencing layer_path_) to use the
identifier_query form `"job"_idq` instead of `"job"_id`; ensure the
std::ranges::contains call compares against std::span{layer_path_}.subspan(1)
with `"job"_idq` so equality uses the hash-only path and behavior remains
identical.
♻️ Duplicate comments (1)
phlex/model/layer_path.cpp (1)

89-100: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

hashes() still omits the /job root ancestor for incomplete paths.

The previous review correctly identified this: for an incomplete path like "subrun/event" (which implies /job/subrun/event), hashes() returns {hash("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/job/subrun"), hash("/job/subrun/event")} but misses hash("/job"). Meanwhile hash() correctly treats the same path as rooted at /job.

This will break downstream fixed_hierarchy lookups that expect all ancestor hashes to be present (see context: index_router.cpp uses layer_path::hashes() for membership tests).

The fix from the previous review still applies:

Proposed fix
   std::set<std::size_t> hashes;
-  // Add the appropriate first hash
-  std::size_t cumulative_hash =
-    is_complete() ? "job"_idq.hash : experimental::hash("job"_idq.hash, layer_path_[0].hash());
+  std::size_t cumulative_hash = "job"_idq.hash;
   hashes.insert(cumulative_hash);
-  for (auto const& name : layer_path_ | std::views::drop(1)) {
+  for (auto const& name : layer_path_ | std::views::drop(is_complete() ? 1 : 0)) {
     cumulative_hash = experimental::hash(cumulative_hash, name.hash());
     hashes.insert(cumulative_hash);
   }
🤖 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/model/layer_path.cpp` around lines 89 - 100, layer_path::hashes()
currently fails to include the "/job" ancestor for incomplete paths; update it
so when is_complete() is false you explicitly insert the root hash
("job"_idq.hash) before computing cumulative hashes for the rest of layer_path_:
compute and insert the root hash, then initialize cumulative_hash by hashing the
root with the first element (using experimental::hash("job"_idq.hash,
layer_path_[0].hash()) or equivalent), and proceed with the loop as before so
all ancestor hashes including "/job" are present for downstream fixed_hierarchy
lookups.
🤖 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.

Outside diff comments:
In `@phlex/model/layer_path.cpp`:
- Around line 40-42: The check in validate() uses a literal identifier
`"job"_id` while elsewhere completion checks use `"job"_idq`; to keep
construction semantics consistent (and avoid constructing a full identifier),
change the contains() call in phlex::model::LayerPath::validate (referencing
layer_path_) to use the identifier_query form `"job"_idq` instead of `"job"_id`;
ensure the std::ranges::contains call compares against
std::span{layer_path_}.subspan(1) with `"job"_idq` so equality uses the
hash-only path and behavior remains identical.

---

Duplicate comments:
In `@phlex/model/layer_path.cpp`:
- Around line 89-100: layer_path::hashes() currently fails to include the "/job"
ancestor for incomplete paths; update it so when is_complete() is false you
explicitly insert the root hash ("job"_idq.hash) before computing cumulative
hashes for the rest of layer_path_: compute and insert the root hash, then
initialize cumulative_hash by hashing the root with the first element (using
experimental::hash("job"_idq.hash, layer_path_[0].hash()) or equivalent), and
proceed with the loop as before so all ancestor hashes including "/job" are
present for downstream fixed_hierarchy lookups.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e1ba76a2-c4c1-4f3a-bbdf-6df43af41fdf

📥 Commits

Reviewing files that changed from the base of the PR and between 562791c and b63d503.

📒 Files selected for processing (1)
  • phlex/model/layer_path.cpp
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Analyze cpp with CodeQL
  • GitHub Check: build (gcc, none)
  • GitHub Check: coverage
  • GitHub Check: clang-tidy-check
🔇 Additional comments (5)
phlex/model/layer_path.cpp (5)

22-24: LGTM!


45-45: LGTM!


47-57: LGTM!


59-72: LGTM!


74-87: LGTM!

beojan added 3 commits June 12, 2026 14:05
- _idq is now consteval
- _idq has a function call operator allowing it to be used as a callable
  in ranges::any_of

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
phlex/model/fixed_hierarchy.cpp (1)

43-53: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Reject empty layer-path entries before building hashes.

convert_vector_vector_string() happily turns {} into an empty experimental::layer_path, and build_hashes() immediately calls path.hashes() on it. In phlex/model/layer_path.cpp:80-102, layer_path::hashes() indexes layer_path_[0] for incomplete paths, so fixed_hierarchy{{}} becomes an out-of-bounds read instead of a clean validation error.

Possible fix
   std::vector<phlex::experimental::layer_path> convert_vector_vector_string(
     std::vector<std::vector<std::string>>&& layer_paths)
   {
     using namespace phlex::experimental;
     return std::move(layer_paths) | std::views::transform([](std::vector<std::string>& lp) {
+             if (lp.empty()) {
+               throw std::invalid_argument("Fixed hierarchy layer paths must be non-empty.");
+             }
              auto lp_as_ids =
                lp | std::views::transform([](auto& str) { return identifier(std::move(str)); }) |
                std::ranges::to<std::vector>();
              return layer_path(std::move(lp_as_ids));
            }) |
            std::ranges::to<std::vector<layer_path>>();
   }
🤖 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/model/fixed_hierarchy.cpp` around lines 43 - 53,
convert_vector_vector_string currently converts empty inner vectors into empty
experimental::layer_path objects which later cause out-of-bounds access in
layer_path::hashes; modify convert_vector_vector_string to reject or filter out
empty layer-path entries before constructing layer_path: when mapping over
layer_paths in convert_vector_vector_string, skip any inner
std::vector<std::string> that is empty (or explicitly throw a validation error)
rather than creating a layer_path from it, and keep using identifier(...) and
layer_path(...) for non-empty entries so downstream calls to
layer_path::hashes() never see an empty layer_path.
🤖 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/model/fixed_hierarchy.cpp`:
- Around line 35-39: build_hashes() currently always seeds the set with
"job"_idq.hash, so fixed_hierarchy constructed with an empty layer_paths yields
a non-empty layer_hashes_; change build_hashes() (and the other similar block
around where hashes is initialized/merged) to return an empty
std::set<std::size_t> when layer_paths.empty(), or alternatively defer inserting
"job"_idq.hash until after you iterate and see at least one configured path;
ensure layer_hashes_ remains empty for fixed_hierarchy({}) by only merging
path.hashes() into hashes and then adding "job"_idq.hash conditionally when
there was at least one path.

---

Outside diff comments:
In `@phlex/model/fixed_hierarchy.cpp`:
- Around line 43-53: convert_vector_vector_string currently converts empty inner
vectors into empty experimental::layer_path objects which later cause
out-of-bounds access in layer_path::hashes; modify convert_vector_vector_string
to reject or filter out empty layer-path entries before constructing layer_path:
when mapping over layer_paths in convert_vector_vector_string, skip any inner
std::vector<std::string> that is empty (or explicitly throw a validation error)
rather than creating a layer_path from it, and keep using identifier(...) and
layer_path(...) for non-empty entries so downstream calls to
layer_path::hashes() never see an empty layer_path.
🪄 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: 6ff6f648-ce41-4820-8cc0-bd3139ed20a2

📥 Commits

Reviewing files that changed from the base of the PR and between 474a157 and 3ee7f8a.

📒 Files selected for processing (1)
  • phlex/model/fixed_hierarchy.cpp
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (gcc, none)
  • GitHub Check: Analyze cpp with CodeQL
  • GitHub Check: clang-tidy-check
  • GitHub Check: coverage

Comment thread phlex/model/fixed_hierarchy.cpp
@beojan

beojan commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

phlex/model/fixed_hierarchy.cpp (1)> 43-53: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Reject empty layer-path entries before building hashes.
convert_vector_vector_string() happily turns {} into an empty experimental::layer_path, and build_hashes() immediately calls path.hashes() on it. In phlex/model/layer_path.cpp:80-102, layer_path::hashes() indexes layer_path_[0] for incomplete paths, so fixed_hierarchy{{}} becomes an out-of-bounds read instead of a clean validation error.

The layer_path constructor from vector<string> calls validate() which catches this.

@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 12, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 12, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 12, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 12, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 12, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 12, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 15, 2026
@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 15, 2026

@knoepfel knoepfel 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.

@beojan, there is still some missing code coverage in layer_path and bulleted_list. Could you address that? Then I think we'll be ready to approve.

@github-actions

Copy link
Copy Markdown
Contributor

Clang-Tidy Check Results

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

All issues by check:

  • readability-identifier-naming: 1792
  • readability-redundant-typename: 1223
  • readability-redundant-member-init: 1208
  • performance-unnecessary-value-param: 476
  • readability-avoid-const-params-in-decls: 257
  • modernize-pass-by-value: 200
  • readability-use-concise-preprocessor-directives: 189
  • 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-redundant-control-flow: 19
  • readability-qualified-auto: 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
  • readability-function-size: 10
  • modernize-concat-nested-namespaces: 10
  • modernize-return-braced-init-list: 10
  • readability-isolate-declaration: 8
  • readability-container-size-empty: 7
  • readability-container-contains: 7
  • cppcoreguidelines-special-member-functions: 7
  • modernize-use-starts-ends-with: 6
  • readability-redundant-access-specifiers: 5
  • readability-inconsistent-declaration-parameter-name: 5
  • modernize-use-ranges: 5
  • bugprone-branch-clone: 3
  • readability-redundant-casting: 3
  • modernize-use-std-numbers: 3
  • clang-analyzer-security.ArrayBound: 2
  • modernize-make-shared: 1
  • performance-move-const-arg: 1
  • readability-redundant-string-init: 1
  • modernize-redundant-void-arg: 1
  • readability-else-after-return: 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.

@beojan

beojan commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Should be good now, I think

@Framework-R-D Framework-R-D deleted a comment from github-actions Bot Jun 16, 2026
@knoepfel
knoepfel merged commit 732b4bd into Framework-R-D:main Jun 16, 2026
41 checks passed
@beojan
beojan deleted the identifier-layer-paths branch June 16, 2026 16:30
wlav added a commit to wlav/phlex that referenced this pull request Jun 18, 2026
wlav added a commit to wlav/phlex that referenced this pull request Jun 18, 2026
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.

3 participants