Skip to content

Form redesign backend technology - #816

Merged
gemmeren merged 11 commits into
Framework-R-D:mainfrom
wwuoneway:form-redesign-backend-technology
Aug 14, 2026
Merged

Form redesign backend technology#816
gemmeren merged 11 commits into
Framework-R-D:mainfrom
wwuoneway:form-redesign-backend-technology

Conversation

@wwuoneway

@wwuoneway wwuoneway commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary:
Redesign of how a backend's storage technology is represented:

  • Previously the technology was a single int that encoded two levels through arithmetic (major*256 + minor), packed and unpacked via Combine / GetMajor / GetMinor, and re-parsed from strings independently in every module, source, and test.
  • This PR replaces it with a typed value in the foundational (core/) layer.

What changed:

  • Typed technology::Id replaces the packed int. Major is an enum; minor selects the variant within a major (e.g., TTree vs RNTuple within ROOT).
  • Defaulted operator<=> gives exact (major, minor) ordering, so Id is usable directly as a std::map key and for backend dispatch.
  • Single from_string / to_string consolidates the three duplicated parse tables that had drifted across the codebase.
  • Lives in core/ (not form/), so the core carriers Placement and Token don't depend upward on form/.

Compatibility/Consistence:

  • naming style (e.g., form::technology::Id) will need a further discussion. A scan across the form/ and test/form/ folders for consistence check will be needed once we decide. This could be split into a separate PR.
  • Core API

    • Added typed technology::Id with Major, minor, ordering, and predefined ROOT/HDF5 identifiers.
    • Added centralized from_string and to_string conversion.
    • Moved technology definitions from form/ to core/.
  • FORM integration

    • Updated Placement, Token, configuration, storage, and factory APIs to use technology::Id.
    • Replaced packed integer comparisons and local parsing tables with typed IDs and centralized conversion.
    • Preserved backend lookup and ROOT TTree/RNTuple dispatch behavior.
  • Tests

    • Updated FORM tests and utilities to use typed technology IDs.
    • Updated technology string handling and generated test filenames.

@coderabbitai

coderabbitai Bot commented Aug 7, 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: 2228068b-fb1a-4da1-b9c0-22a82995bc65

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

FORM introduces technology::Id as the typed representation for storage technologies. The type is used across core objects, configuration, storage, factories, parsing, logging, and tests. Technology names now use centralized conversion functions.

Changes

Typed technology migration

Layer / File(s) Summary
Technology identifier contract
form/core/technology.hpp, form/core/placement.*, form/core/token.*
Defines technology identifiers, predefined ROOT/HDF5 values, and string conversions. Placement and Token now use technology::Id.
Configuration and factory integration
form/form/config.*, form/storage/*, form/util/factories.hpp
Configuration maps, storage lookups, and factory APIs now use typed technology identifiers.
FORM parsing and logging
form/form_module.cpp, form/form_source.cpp, form/form/technology.hpp
FORM uses centralized parsing and formatting through technology::from_string and technology::to_string.
Test updates
test/form/*
Tests use typed identifiers, predefined constants, string conversion, and inferred technology types.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: aolivier23

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.57% 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 clearly identifies the main change: redesigning backend technology handling in FORM.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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: 2

🤖 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 `@form/core/technology.hpp`:
- Around line 11-32: Rename the public technology symbols Major, Id, ROOT_TTREE,
ROOT_RNTUPLE, and HDF5 to lower_case identifiers, and move them from
form::technology into the required phlex namespace. Update every migrated call
site and related backend-dispatch usage to reference the renamed phlex symbols
while preserving their existing values and ordering behavior.
- Around line 43-44: HDF5 is currently accepted by technology parsing but
unsupported by every factory path, so prevent silent fallback. In
form/core/technology.hpp lines 43-44, reject HDF5 until complete support exists;
in form/util/factories.hpp lines 40-43, 60-64, 84-89, and 108-113, either
implement the corresponding HDF5 file, write association, read container, and
write container branches or fail explicitly instead of returning generic
storage.
🪄 Autofix

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: 0b8fe1ae-e08d-45f7-a62e-fbbc62af75b5

📥 Commits

Reviewing files that changed from the base of the PR and between 448de24 and e8e4d1a.

📒 Files selected for processing (20)
  • form/core/placement.cpp
  • form/core/placement.hpp
  • form/core/technology.hpp
  • form/core/token.cpp
  • form/core/token.hpp
  • form/form/config.cpp
  • form/form/config.hpp
  • form/form/technology.hpp
  • form/form_module.cpp
  • form/form_source.cpp
  • form/storage/storage_reader.cpp
  • form/storage/storage_writer.cpp
  • form/util/factories.hpp
  • test/form/form_basics_test.cpp
  • test/form/form_root_schema_read_test.cpp
  • test/form/form_root_schema_write_test.cpp
  • test/form/form_storage_test.cpp
  • test/form/reader.cpp
  • test/form/test_utils.hpp
  • test/form/writer.cpp
💤 Files with no reviewable changes (1)
  • form/form/technology.hpp
📜 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: setup
🧰 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/form/form_root_schema_write_test.cpp
  • test/form/form_root_schema_read_test.cpp
  • form/storage/storage_writer.cpp
  • test/form/reader.cpp
  • test/form/writer.cpp
  • form/core/placement.cpp
  • form/form_source.cpp
  • form/core/technology.hpp
  • form/core/token.hpp
  • form/core/placement.hpp
  • form/core/token.cpp
  • form/form/config.hpp
  • form/form/config.cpp
  • test/form/form_basics_test.cpp
  • form/util/factories.hpp
  • test/form/form_storage_test.cpp
  • test/form/test_utils.hpp
  • form/storage/storage_reader.cpp
  • form/form_module.cpp
**/*.{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/form/form_root_schema_write_test.cpp
  • test/form/form_root_schema_read_test.cpp
  • form/storage/storage_writer.cpp
  • test/form/reader.cpp
  • test/form/writer.cpp
  • form/core/placement.cpp
  • form/form_source.cpp
  • form/core/technology.hpp
  • form/core/token.hpp
  • form/core/placement.hpp
  • form/core/token.cpp
  • form/form/config.hpp
  • form/form/config.cpp
  • test/form/form_basics_test.cpp
  • form/util/factories.hpp
  • test/form/form_storage_test.cpp
  • test/form/test_utils.hpp
  • form/storage/storage_reader.cpp
  • form/form_module.cpp
**/*.hpp

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • form/core/technology.hpp
  • form/core/token.hpp
  • form/core/placement.hpp
  • form/form/config.hpp
  • form/util/factories.hpp
  • test/form/test_utils.hpp
🪛 Cppcheck (2.21.0)
form/core/placement.cpp

[style] 22-22: The function 'technology' is never used.

(unusedFunction)

form/core/token.cpp

[style] 23-23: The function 'technology' is never used.

(unusedFunction)

form/form/config.cpp

[style] 35-35: The function 'from_string' is never used.

(unusedFunction)


[style] 34-34: The function 'getFileTable' is never used.

(unusedFunction)


[style] 41-41: The function 'getContainerTable' is never used.

(unusedFunction)

🔇 Additional comments (16)
test/form/form_basics_test.cpp (1)

1-1: LGTM!

Also applies to: 29-29, 126-135, 146-146, 162-167, 180-181, 202-203, 224-224, 237-245, 301-301, 314-314, 326-326

test/form/form_root_schema_read_test.cpp (1)

17-17: LGTM!

test/form/form_root_schema_write_test.cpp (1)

16-16: LGTM!

test/form/form_storage_test.cpp (1)

24-24: LGTM!

Also applies to: 286-287, 336-337, 372-372, 425-425, 455-456

test/form/reader.cpp (1)

3-3: LGTM!

Also applies to: 39-39

test/form/test_utils.hpp (1)

42-42: LGTM!

Also applies to: 51-51, 72-72, 86-86, 100-109

test/form/writer.cpp (1)

3-3: LGTM!

Also applies to: 51-51

form/core/placement.hpp (1)

6-7: LGTM!

Also applies to: 21-32

form/core/placement.cpp (1)

10-10: LGTM!

Also applies to: 22-22

form/core/token.hpp (1)

6-7: LGTM!

Also applies to: 17-34

form/core/token.cpp (1)

10-10: LGTM!

Also applies to: 23-23

form/form/config.hpp (1)

4-5: LGTM!

Also applies to: 17-23, 35-37, 51-56

form/form/config.cpp (1)

17-22: LGTM!

Also applies to: 34-46

form/form_module.cpp (1)

7-27: LGTM!

Also applies to: 105-105, 124-124

form/form_source.cpp (1)

3-3: LGTM!

Also applies to: 178-178

form/core/technology.hpp (1)

26-26: 📐 Maintainability & Code Quality

Add an explicit C++20/23 flag before relying on the spaceship operator.

operator<=> requires C++20, but this workspace only shows cxxstd=23 in Spack configuration and no direct CMake standard setting. Add a declared -std=c++20/-std=c++23 flag if the build target is not already C++20+.

Comment thread form/core/technology.hpp
Comment thread form/core/technology.hpp Outdated
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main     #816      +/-   ##
==========================================
+ Coverage   83.89%   84.17%   +0.27%     
==========================================
  Files         171      172       +1     
  Lines        7234     7425     +191     
  Branches      850      884      +34     
==========================================
+ Hits         6069     6250     +181     
- Misses        881      892      +11     
+ Partials      284      283       -1     
Flag Coverage Δ
scripts 80.09% <ø> (ø)
unittests 86.13% <100.00%> (+0.34%) ⬆️

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

Files with missing lines Coverage Δ
form/core/placement.cpp 100.00% <100.00%> (ø)
form/core/technology.hpp 100.00% <100.00%> (ø)
form/core/token.cpp 100.00% <100.00%> (ø)
form/core/token.hpp 100.00% <100.00%> (ø)
form/form/config.cpp 84.61% <ø> (ø)
form/form/config.hpp 100.00% <ø> (ø)
form/form_module.cpp 94.87% <100.00%> (+3.56%) ⬆️
form/form_source.cpp 55.43% <100.00%> (-1.14%) ⬇️
form/storage/factories.cpp 100.00% <100.00%> (ø)
form/storage/storage_reader.cpp 80.18% <ø> (-1.39%) ⬇️
... and 1 more

... and 6 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 448de24...f1299a8. Read the comment docs.

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

gemmeren
gemmeren previously approved these changes Aug 7, 2026
Comment thread form/core/technology.hpp
Comment thread form/util/factories.hpp Outdated
Comment thread form/util/factories.hpp Outdated

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

Mostly looks good. Thank you for this improvement! There are two comments I left about things I want to discuss:

  • if we want HDF5 container creation to throw for now, do we need to also protect against unknown technologies?
  • Looks like we're changing the meaning of USE_RNTUPLE_STORAGE in one place but not the others. Let's discuss that please.

…lently returning the no-op generic backend; enforce RNTuple-requires-ROOT; fix form_basics_test macro visibility and add throw-path tests
Comment thread form/storage/factories.cpp Outdated
gemmeren
gemmeren previously approved these changes Aug 11, 2026
aolivier23
aolivier23 previously approved these changes Aug 11, 2026

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

LGTM. Thanks for the discussion.

Comment thread form/core/technology.hpp Outdated
Comment thread form/storage/factories.cpp
pcanal
pcanal previously approved these changes Aug 11, 2026

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

LFTM

@wwuoneway
wwuoneway dismissed stale reviews from pcanal and aolivier23 via 7e977f5 August 13, 2026 02:21
gemmeren
gemmeren previously approved these changes Aug 13, 2026
Comment thread form/storage/factories.cpp
Comment thread form/storage/factories.cpp
aolivier23
aolivier23 previously approved these changes Aug 14, 2026

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

LGTM. I agree with Phillipe about the tests, but they're not a show-stopper for me.

@wwuoneway
wwuoneway dismissed stale reviews from aolivier23 and gemmeren via f1299a8 August 14, 2026 16:13

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

Thank you for the new test! LGTM.

@gemmeren
gemmeren self-requested a review August 14, 2026 16:27
@gemmeren
gemmeren enabled auto-merge August 14, 2026 17:35
@gemmeren
gemmeren merged commit 4404ced into Framework-R-D:main Aug 14, 2026
44 checks passed
@wwuoneway
wwuoneway deleted the form-redesign-backend-technology branch August 14, 2026 19:10
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.

4 participants