Skip to content

Conversation

@PhilipDeegan
Copy link
Member

@PhilipDeegan PhilipDeegan commented Nov 20, 2025

attempt to fix LSP/clangd
cleanup dict includes
todo: fix tests

@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

📝 Walkthrough

Walkthrough

This pull request reorganizes cppdict include paths across the codebase and updates CMake build configuration. It replaces external include directives with local ones, adds cppdict linking to build targets, removes public include directory exposures, and configures properties for the Python module.

Changes

Cohort / File(s) Change Summary
CMake Build Configuration
res/cmake/dep/highfive.cmake, src/amr/CMakeLists.txt, src/core/CMakeLists.txt, src/initializer/CMakeLists.txt
Added include directories for HighFive; added cppdict to PUBLIC/PRIVATE link libraries in amr and core targets; added cppdict to PUBLIC link libraries in initializer; removed PUBLIC include directories exposing ../../subprojects; added build properties (IPO, output directory, link flags) to the dictator Python module target.
Header Include Path Updates
src/core/errors.hpp, src/core/utilities/types.hpp, src/diagnostic/diagnostic_model_view.hpp, src/diagnostic/diagnostic_props.hpp, src/diagnostic/diagnostic_writer.hpp, src/diagnostic/diagnostics.hpp, src/initializer/data_provider.hpp, src/phare_core.hpp, src/python3/data_wrangler.hpp, src/restarts/restarts_props.hpp
Changed include directive from "cppdict/include/dict.hpp" to local "dict.hpp" in all listed headers.
Source File Updates
src/initializer/dictator.cpp
Updated include directive from "cppdict/include/dict.hpp" to local "dict.hpp".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The majority of changes are repetitive and homogeneous (include path replacements across 10+ files following the same pattern)
  • CMake linkage additions are straightforward but warrant verification of dependency ordering in src/initializer/CMakeLists.txt where multiple properties are added to the dictator target
  • Confirm removal of PUBLIC include directories in core and initializer targets does not break downstream dependents

Possibly related PRs

Suggested reviewers

  • nicolasaunai

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author, making it impossible to evaluate relatedness to the changeset. Add a pull request description explaining the motivation and impact of the include path changes and HighFive configuration update.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: updating includes to use direct imports and fixing HighFive's include path configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/restarts/restarts_props.hpp (1)

4-7: Restore <string> include to keep this header self-contained

Switching to #include "dict.hpp" is consistent with the cppdict changes, but RestartsProperties still uses std::string in FileAttributes and this header no longer includes <string> itself. That makes it dependent on transitive includes from dict.hpp.

Consider adding <string> back explicitly:

-#include <vector>
-
-#include "dict.hpp"
+#include <vector>
+#include <string>
+
+#include "dict.hpp"

This keeps restarts_props.hpp self-contained regardless of how dict.hpp evolves.

Also applies to: 12-13

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c69074c and f862c1a.

📒 Files selected for processing (14)
  • res/cmake/dep/highfive.cmake (1 hunks)
  • src/amr/CMakeLists.txt (1 hunks)
  • src/core/CMakeLists.txt (1 hunks)
  • src/core/errors.hpp (1 hunks)
  • src/diagnostic/diagnostic_model_view.hpp (1 hunks)
  • src/diagnostic/diagnostic_props.hpp (1 hunks)
  • src/diagnostic/diagnostics.hpp (1 hunks)
  • src/initializer/CMakeLists.txt (1 hunks)
  • src/initializer/data_provider.hpp (1 hunks)
  • src/initializer/dictator.cpp (1 hunks)
  • src/phare_core.hpp (1 hunks)
  • src/python3/data_wrangler.hpp (1 hunks)
  • src/restarts/restarts.hpp (1 hunks)
  • src/restarts/restarts_props.hpp (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.hpp

⚙️ CodeRabbit configuration file

Review the C++ code, point out issues relative to principles of clean code, expressiveness, and performance.

Files:

  • src/diagnostic/diagnostics.hpp
  • src/restarts/restarts_props.hpp
  • src/initializer/data_provider.hpp
  • src/python3/data_wrangler.hpp
  • src/core/errors.hpp
  • src/restarts/restarts.hpp
  • src/diagnostic/diagnostic_model_view.hpp
  • src/diagnostic/diagnostic_props.hpp
  • src/phare_core.hpp
🧠 Learnings (5)
📓 Common learnings
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 784
File: tests/simulator/test_restarts.py:333-339
Timestamp: 2024-07-26T22:04:34.160Z
Learning: PhilipDeegan has indicated a preference for minimal and efficient code, even after making changes to get a function working. There may be opportunities to remove or optimize parts of the code such as sleep/wait/advances.
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 784
File: tests/simulator/test_restarts.py:333-339
Timestamp: 2024-10-09T08:32:15.667Z
Learning: PhilipDeegan has indicated a preference for minimal and efficient code, even after making changes to get a function working. There may be opportunities to remove or optimize parts of the code such as sleep/wait/advances.
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 1068
File: src/amr/data/field/coarsening/electric_field_coarsener.hpp:1-2
Timestamp: 2025-09-17T13:35:11.533Z
Learning: PhilipDeegan prefers header guard names that include the full directory path structure, following the pattern PHARE_[PATH_WITH_UNDERSCORES]_HPP. For example, a file at src/amr/data/field/coarsening/electric_field_coarsener.hpp should use PHARE_AMR_DATA_FIELD_COARSENING_ELECTRIC_FIELD_COARSENER_HPP as the header guard.
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 888
File: src/hdf5/detail/h5/h5_file.hpp:78-79
Timestamp: 2024-10-09T08:32:15.667Z
Learning: Avoid commenting on draft PRs for the user PhilipDeegan.
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 888
File: src/hdf5/detail/h5/h5_file.hpp:78-79
Timestamp: 2024-09-05T17:02:58.784Z
Learning: Avoid commenting on draft PRs for the user PhilipDeegan.
📚 Learning: 2025-07-09T17:18:05.771Z
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 888
File: src/amr/CMakeLists.txt:103-105
Timestamp: 2025-07-09T17:18:05.771Z
Learning: In the PHARE project, `HighFive` is a CMake option defined in `res/cmake/options.cmake` as `option(HighFive "Build with highfive usage" ON)`, not a target that would be created by find_package(). The condition `if (HighFive)` correctly checks this option.

Applied to files:

  • src/diagnostic/diagnostics.hpp
  • res/cmake/dep/highfive.cmake
  • src/core/CMakeLists.txt
📚 Learning: 2025-01-16T10:45:48.912Z
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 943
File: res/cmake/dep/highfive.cmake:7-7
Timestamp: 2025-01-16T10:45:48.912Z
Learning: The HighFive library development has moved from BlueBrain/HighFive to highfive-devs/highfive as of December 2024 due to the conclusion of the Blue Brain Project.

Applied to files:

  • res/cmake/dep/highfive.cmake
📚 Learning: 2025-02-07T14:35:14.630Z
Learnt from: nicolasaunai
Repo: PHAREHUB/PHARE PR: 591
File: res/cmake/options.cmake:73-75
Timestamp: 2025-02-07T14:35:14.630Z
Learning: In CMake configuration for PHARE, `lowResourceTests` and `highResourceTests` options must be mutually exclusive and cannot be enabled simultaneously.

Applied to files:

  • src/core/CMakeLists.txt
📚 Learning: 2025-11-10T09:37:57.021Z
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 1084
File: src/diagnostic/diagnostic_model_view.hpp:219-221
Timestamp: 2025-11-10T09:37:57.021Z
Learning: In PHARE, temporary fields like tmpField_, tmpVec_, and tmpTensor_ in src/diagnostic/diagnostic_model_view.hpp use a name-based resource allocation pattern. Fields with names "PHARE_sumField", "PHARE_sumVec", and "PHARE_sumTensor" are allocated globally elsewhere in the resources manager (e.g., in src/amr/messengers/hybrid_hybrid_messenger_strategy.hpp), and components reference the same storage through identically-named field objects. These do not require local allocation via rm.enumerate().

Applied to files:

  • src/diagnostic/diagnostic_model_view.hpp
🔇 Additional comments (12)
res/cmake/dep/highfive.cmake (1)

18-19: HighFive include path wiring looks fine

Adding include_directories(${HIGHFIVE_SRC}/include) before add_subdirectory(${HIGHFIVE_SRC}) is consistent with using HighFive as an embedded subproject and should make its public headers reliably visible to dependents in this directory scope.

src/python3/data_wrangler.hpp (1)

17-17: dict.hpp include aligns with cppdict usage

Switching to #include "dict.hpp" here matches the rest of the codebase’s use of PHAREDictHandler/cppdict and keeps the dependency localized without touching the class logic.

src/diagnostic/diagnostic_props.hpp (1)

9-9: Header now correctly pulls in cppdict definitions

Including dict.hpp here makes the cppdict::Dict typedefs self-contained and consistent with the include-path changes elsewhere in the PR.

src/core/errors.hpp (1)

12-24: cppdict dependency is now explicitly included

Bringing in dict.hpp makes the DictionaryException::Dict_t = cppdict::Dict<std::string> alias properly self-contained in this header, with no changes to existing behavior.

src/initializer/dictator.cpp (1)

2-3: Local dict include matches cppdict usage in bindings

Including dict.hpp here correctly covers cppdict::add and the PHARE dict handler used by the pybind11 bindings, without altering module behavior.

src/amr/CMakeLists.txt (1)

88-103: Linking cppdict into phare_amr looks appropriate

Adding cppdict as a PUBLIC dependency of the ${PROJECT_NAME} amr library matches the move to dict.hpp-based types in headers that downstream targets may include, and it fits naturally with the existing link set.

src/restarts/restarts.hpp (1)

10-10: LGTM!

The include path simplification from "cppdict/include/dict.hpp" to "dict.hpp" is clean and aligns with the explicit cppdict linkage added in the CMakeLists.txt files.

src/phare_core.hpp (1)

18-18: LGTM!

The include path update is consistent with the PR's refactoring objectives.

src/diagnostic/diagnostic_model_view.hpp (1)

12-12: LGTM!

The include path update is consistent with the PR's refactoring objectives.

src/diagnostic/diagnostics.hpp (1)

21-21: LGTM!

The include path update is consistent with the PR's refactoring objectives.

src/initializer/CMakeLists.txt (2)

17-17: LGTM!

Adding cppdict as a PUBLIC dependency is appropriate for phare_initializer, ensuring downstream targets have access to cppdict's include directories.


25-31: LGTM!

The dictator Python module configuration is comprehensive and follows CMake best practices:

  • PUBLIC linking to phare_initializer and pybind11::embed ensures proper dependency resolution
  • Interprocedural optimization is enabled consistently with the parent library
  • Library output directory is explicitly configured for Python module organization
  • Link flags are properly preserved

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (3)
src/diagnostic/diagnostic_writer.hpp (1)

6-6: Same include path change as other files.

This file makes the same include path change from "cppdict/include/dict.hpp" to "dict.hpp". The verification script provided for src/core/utilities/types.hpp will confirm whether dict.hpp is properly resolvable across all affected files.

src/restarts/restarts_props.hpp (1)

6-6: Same include path change pattern.

This is the same include path update from "cppdict/include/dict.hpp" to "dict.hpp" seen in other files. Refer to the verification script in the review of src/core/utilities/types.hpp.

src/core/CMakeLists.txt (1)

66-68: Change cppdict linkage from PRIVATE to PUBLIC.

The cppdict library is linked as PRIVATE, but phare_core's public headers (e.g., src/phare_core.hpp and src/core/errors.hpp) expose cppdict::Dict types and include "dict.hpp". When a library's public API exposes types from a dependency, that dependency must be linked as PUBLIC so downstream targets can access the necessary include directories.

Apply this diff:

-target_link_libraries(${PROJECT_NAME}  PRIVATE phare_initializer MPI::MPI_C cppdict
+target_link_libraries(${PROJECT_NAME}  PRIVATE phare_initializer MPI::MPI_C
+    PUBLIC cppdict
     PUBLIC ${PHARE_BASE_LIBS}
   )
🧹 Nitpick comments (1)
res/cmake/dep/highfive.cmake (1)

18-18: Let me check which targets actually depend on HighFive by examining the target hierarchy:

Now let me verify whether all targets using HighFive are actually linked to the HighFive target:Perfect! The verification is complete. The web search confirms that HighFive creates interface targets with target_include_directories(...INTERFACE...), and the recommended CMake pattern for using HighFive via add_subdirectory is target_link_libraries(foo HighFive).

The review comment is valid. PHARE uses v3.0.0-beta2 (from the codebase), and the global include_directories() call is indeed unnecessary since HighFive's CMakeLists exports its own target with interface includes. While PHARE's diagnostic module correctly links the HighFive target, the global include statement before add_subdirectory() violates modern CMake practice by making includes available to all targets regardless of whether they actually depend on HighFive.

Remove the global include_directories() call for HighFive and rely on target linkage instead.

The global include_directories(${HIGHFIVE_SRC}/include) on line 18 is unnecessary. HighFive exports interface targets with target_include_directories(...INTERFACE...), and the documented CMake pattern uses target_link_libraries(foo HighFive) to propagate includes automatically. PHARE already follows this correctly in src/diagnostic/CMakeLists.txt:27 where it links the HighFive target. Remove this line and ensure all targets using HighFive are explicitly linked to the HighFive target via target_link_libraries() rather than relying on the global include scope.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f862c1a and 34fed8d.

📒 Files selected for processing (15)
  • res/cmake/dep/highfive.cmake (1 hunks)
  • src/amr/CMakeLists.txt (1 hunks)
  • src/core/CMakeLists.txt (1 hunks)
  • src/core/errors.hpp (1 hunks)
  • src/core/utilities/types.hpp (1 hunks)
  • src/diagnostic/diagnostic_model_view.hpp (1 hunks)
  • src/diagnostic/diagnostic_props.hpp (1 hunks)
  • src/diagnostic/diagnostic_writer.hpp (1 hunks)
  • src/diagnostic/diagnostics.hpp (1 hunks)
  • src/initializer/CMakeLists.txt (1 hunks)
  • src/initializer/data_provider.hpp (1 hunks)
  • src/initializer/dictator.cpp (1 hunks)
  • src/phare_core.hpp (1 hunks)
  • src/python3/data_wrangler.hpp (1 hunks)
  • src/restarts/restarts_props.hpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/diagnostic/diagnostics.hpp
  • src/diagnostic/diagnostic_props.hpp
  • src/initializer/dictator.cpp
  • src/initializer/data_provider.hpp
  • src/amr/CMakeLists.txt
  • src/core/errors.hpp
  • src/phare_core.hpp
  • src/diagnostic/diagnostic_model_view.hpp
  • src/python3/data_wrangler.hpp
🧰 Additional context used
📓 Path-based instructions (1)
**/*.hpp

⚙️ CodeRabbit configuration file

Review the C++ code, point out issues relative to principles of clean code, expressiveness, and performance.

Files:

  • src/core/utilities/types.hpp
  • src/diagnostic/diagnostic_writer.hpp
  • src/restarts/restarts_props.hpp
🧠 Learnings (4)
📓 Common learnings
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 784
File: tests/simulator/test_restarts.py:333-339
Timestamp: 2024-07-26T22:04:34.160Z
Learning: PhilipDeegan has indicated a preference for minimal and efficient code, even after making changes to get a function working. There may be opportunities to remove or optimize parts of the code such as sleep/wait/advances.
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 784
File: tests/simulator/test_restarts.py:333-339
Timestamp: 2024-10-09T08:32:15.667Z
Learning: PhilipDeegan has indicated a preference for minimal and efficient code, even after making changes to get a function working. There may be opportunities to remove or optimize parts of the code such as sleep/wait/advances.
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 1068
File: src/amr/data/field/coarsening/electric_field_coarsener.hpp:1-2
Timestamp: 2025-09-17T13:35:11.533Z
Learning: PhilipDeegan prefers header guard names that include the full directory path structure, following the pattern PHARE_[PATH_WITH_UNDERSCORES]_HPP. For example, a file at src/amr/data/field/coarsening/electric_field_coarsener.hpp should use PHARE_AMR_DATA_FIELD_COARSENING_ELECTRIC_FIELD_COARSENER_HPP as the header guard.
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 888
File: src/hdf5/detail/h5/h5_file.hpp:78-79
Timestamp: 2024-10-09T08:32:15.667Z
Learning: Avoid commenting on draft PRs for the user PhilipDeegan.
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 888
File: src/hdf5/detail/h5/h5_file.hpp:78-79
Timestamp: 2024-09-05T17:02:58.784Z
Learning: Avoid commenting on draft PRs for the user PhilipDeegan.
📚 Learning: 2025-07-09T17:18:05.771Z
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 888
File: src/amr/CMakeLists.txt:103-105
Timestamp: 2025-07-09T17:18:05.771Z
Learning: In the PHARE project, `HighFive` is a CMake option defined in `res/cmake/options.cmake` as `option(HighFive "Build with highfive usage" ON)`, not a target that would be created by find_package(). The condition `if (HighFive)` correctly checks this option.

Applied to files:

  • src/core/CMakeLists.txt
  • res/cmake/dep/highfive.cmake
📚 Learning: 2025-02-07T14:35:14.630Z
Learnt from: nicolasaunai
Repo: PHAREHUB/PHARE PR: 591
File: res/cmake/options.cmake:73-75
Timestamp: 2025-02-07T14:35:14.630Z
Learning: In CMake configuration for PHARE, `lowResourceTests` and `highResourceTests` options must be mutually exclusive and cannot be enabled simultaneously.

Applied to files:

  • src/core/CMakeLists.txt
📚 Learning: 2025-01-16T10:45:48.912Z
Learnt from: PhilipDeegan
Repo: PHAREHUB/PHARE PR: 943
File: res/cmake/dep/highfive.cmake:7-7
Timestamp: 2025-01-16T10:45:48.912Z
Learning: The HighFive library development has moved from BlueBrain/HighFive to highfive-devs/highfive as of December 2024 due to the conclusion of the Blue Brain Project.

Applied to files:

  • res/cmake/dep/highfive.cmake
⏰ 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). (6)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (macos-14)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (cpp)
  • GitHub Check: build (ubuntu-latest, clang)
  • GitHub Check: build (ubuntu-latest, gcc)
🔇 Additional comments (3)
src/initializer/CMakeLists.txt (2)

17-17: LGTM: PUBLIC linkage is appropriate for cppdict.

The PUBLIC linkage of cppdict ensures that downstream targets have access to cppdict's include directories and usage requirements. This is the correct approach when a library's public API exposes types from a dependency.


25-31: LGTM: Python module configuration is appropriate.

The configuration for the dictator Python module follows standard CMake practices:

  • PUBLIC linkage ensures dependencies propagate correctly
  • INTERPROCEDURAL_OPTIMIZATION respects project-wide settings
  • Dedicated output directory organizes build artifacts
  • Link flags follow project conventions
src/core/utilities/types.hpp (1)

20-20: Verify that cppdict v1.0.0's CMakeLists properly exports include directories.

The include path was changed from the explicit "cppdict/include/dict.hpp" to the relative "dict.hpp". This change depends entirely on cppdict's CMakeLists.txt correctly configuring target_include_directories() with PUBLIC scope so that linked targets inherit the include path.

Since cppdict is an external dependency downloaded at build time, its CMakeLists cannot be verified in this sandbox. Before merging, confirm that:

  1. cppdict v1.0.0's CMakeLists exposes include directories via target_include_directories(cppdict PUBLIC ...) or include_directories().
  2. The build succeeds with the new relative include path in a full build environment.

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.

1 participant