Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 19, 2025

This PR implements two new CLI help commands for eicrecon to provide better plugin and factory introspection capabilities, addressing the need for users to understand the available factories and their relationships within the EICrecon framework.

New Commands

--list-available-factories <plugin>

Query plugins for available factories within them, similar to the existing --list-available-plugins command.

eicrecon --list-available-factories EEMC

Features:

  • Lists all factories provided by a specific plugin in a clean table format
  • Shows factory object names, tags, and descriptions
  • Smart error handling: displays available plugins when target plugin not found
  • Includes summary count of factories per plugin

--print-factory-info

Query factories for comprehensive system information and provide detailed factory overview.

eicrecon --print-factory-info

Features:

  • Shows detailed information about all factories in the system
  • Displays factory summary statistics and breakdowns by plugin
  • Includes heuristic analysis of collection naming patterns (e.g., Ecal*, Hcal*)
  • Provides user guidance on accessing detailed input/output information

Implementation Details

The implementation follows existing CLI patterns and integrates seamlessly with the current command structure:

  • Extended Flag enum: Added ListPluginFactories and PrintFactoryInfo flags
  • Enhanced UserOptions: Added plugin_name field for plugin-specific queries
  • Command parsing: Added proper tokenizer entries and case handlers
  • Error handling: Comprehensive validation with user-friendly error messages
  • Consistent formatting: Uses existing JTablePrinter for uniform output

Testing

Added comprehensive CI testing in the GitHub Actions workflow with a dedicated test-factory-cli job that validates both commands work correctly in the eic-shell environment.

Documentation

Added comprehensive user documentation at docs/tutorial/05-factory-help-commands.md with:

  • Detailed usage examples and command syntax
  • Technical notes on accessing input/output collection information
  • Guidance on inspecting factory source code for precise I/O specifications
  • Integration guidance with existing CLI commands

Benefits

This enhancement provides valuable introspection capabilities for EICrecon users:

  • Plugin developers can easily see what factories their plugins provide
  • Users can understand the available data processing components
  • Debugging becomes easier with clear factory organization by plugin
  • Learning is facilitated through pattern analysis and comprehensive overviews

The commands complement the existing --list-available-plugins and --list-factories options, providing a complete hierarchy of introspection from plugins → factories → detailed information.

Future Extensions

The implementation provides a foundation for future enhancements when extended JANA API access becomes available, such as runtime access to input/output collection specifications and factory dependency graphs.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Implement a new help command for the eicrecon command line interface (similar to --list-available-plugins) that can be used to query plugins for the available factories within them (--list-available-factories <plugin>) and that can be used to query... Add factory introspection CLI commands: --list-available-factories and --print-factory-info Aug 19, 2025
@Copilot Copilot AI requested a review from wdconinc August 19, 2025 21:30
Copilot finished work on behalf of wdconinc August 19, 2025 21:30
@github-actions github-actions bot added the topic: documentation Improvements or additions to documentation label Aug 19, 2025
@wdconinc wdconinc added the pre-commit.ci autofix Enable pre-commit.ci autofixes even for bot accounts label Aug 19, 2025
@pre-commit-ci pre-commit-ci bot removed the pre-commit.ci autofix Enable pre-commit.ci autofixes even for bot accounts label Aug 19, 2025
Copy link
Contributor

@wdconinc wdconinc left a comment

Choose a reason for hiding this comment

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

@copilot Ensure that GitHub Actions checks succeed.

Copy link
Contributor Author

Copilot AI commented Aug 19, 2025

@copilot Ensure that GitHub Actions checks succeed.

I've fixed the clang-tidy static analysis issues that were causing the GitHub Actions checks to fail. The main problems were C-style casts that needed to be replaced with static_cast. I also cleaned up some accidentally committed build files.

Changes made in commit 6623f95:

  • Replaced size_t(3) with static_cast<size_t>(3)
  • Replaced std::size_t(4) and std::size_t(5) with static_cast<std::size_t>(4) and static_cast<std::size_t>(5)
  • Applied clang-format to ensure proper line length formatting
  • Removed build artifacts that were accidentally committed

The GitHub Actions checks should now pass with these clang-tidy compliance fixes.

@Copilot Copilot AI requested a review from wdconinc August 19, 2025 22:20
Copilot finished work on behalf of wdconinc August 19, 2025 22:20
Copy link
Contributor

@wdconinc wdconinc left a comment

Choose a reason for hiding this comment

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

@copilot There are still compilation failures in the CI checks. Notably the following two:

In file included from /home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon.cc:11:
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:87:6: error: redefinition of 'PrintFactoryInfo' as different kind of symbol
   87 | void PrintFactoryInfo(JApplication* app);
      |      ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:32:3: note: previous definition is here
   32 |   PrintFactoryInfo
      |   ^
1 error generated.

and

In file included from /home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:5:
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:87:6: error: redefinition of 'PrintFactoryInfo' as different kind of symbol
   87 | void PrintFactoryInfo(JApplication* app);
      |      ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:32:3: note: previous definition is here
   32 |   PrintFactoryInfo
      |   ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:335:8: error: call to deleted constructor of 'JComponentSummary'
  335 |   auto cs = app->GetComponentSummary();
      |        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/JANA/Components/JComponentSummary.h:102:5: note: 'JComponentSummary' has been explicitly marked deleted here
  102 |     JComponentSummary(const JComponentSummary&) = delete; // Otherwise we have a lot of internal pointers that have to be deep-copied
      |     ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:403:6: error: redefinition of 'PrintFactoryInfo' as different kind of symbol
  403 | void PrintFactoryInfo(JApplication* app) {
      |      ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:32:3: note: previous definition is here
   32 |   PrintFactoryInfo
      |   ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:406:8: error: call to deleted constructor of 'JComponentSummary'
  406 |   auto cs = app->GetComponentSummary();
      |        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/JANA/Components/JComponentSummary.h:102:5: note: 'JComponentSummary' has been explicitly marked deleted here
  102 |     JComponentSummary(const JComponentSummary&) = delete; // Otherwise we have a lot of internal pointers that have to be deep-copied
      |     ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:565:21: error: called object type 'jana::Flag' is not a function or function pointer
  565 |     PrintFactoryInfo(app);
      |     ~~~~~~~~~~~~~~~~^
5 errors generated.

@wdconinc
Copy link
Contributor

@copilot There are still compilation failures in the CI checks. Notably the following two:

In file included from /home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon.cc:11:
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:87:6: error: redefinition of 'PrintFactoryInfo' as different kind of symbol
   87 | void PrintFactoryInfo(JApplication* app);
      |      ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:32:3: note: previous definition is here
   32 |   PrintFactoryInfo
      |   ^
1 error generated.

and

In file included from /home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:5:
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:87:6: error: redefinition of 'PrintFactoryInfo' as different kind of symbol
   87 | void PrintFactoryInfo(JApplication* app);
      |      ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:32:3: note: previous definition is here
   32 |   PrintFactoryInfo
      |   ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:335:8: error: call to deleted constructor of 'JComponentSummary'
  335 |   auto cs = app->GetComponentSummary();
      |        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/JANA/Components/JComponentSummary.h:102:5: note: 'JComponentSummary' has been explicitly marked deleted here
  102 |     JComponentSummary(const JComponentSummary&) = delete; // Otherwise we have a lot of internal pointers that have to be deep-copied
      |     ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:403:6: error: redefinition of 'PrintFactoryInfo' as different kind of symbol
  403 | void PrintFactoryInfo(JApplication* app) {
      |      ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.h:32:3: note: previous definition is here
   32 |   PrintFactoryInfo
      |   ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:406:8: error: call to deleted constructor of 'JComponentSummary'
  406 |   auto cs = app->GetComponentSummary();
      |        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/JANA/Components/JComponentSummary.h:102:5: note: 'JComponentSummary' has been explicitly marked deleted here
  102 |     JComponentSummary(const JComponentSummary&) = delete; // Otherwise we have a lot of internal pointers that have to be deep-copied
      |     ^
/home/runner/work/EICrecon/EICrecon/src/utilities/eicrecon/eicrecon_cli.cpp:565:21: error: called object type 'jana::Flag' is not a function or function pointer
  565 |     PrintFactoryInfo(app);
      |     ~~~~~~~~~~~~~~~~^
5 errors generated.

Copy link
Contributor Author

Copilot AI commented Aug 20, 2025

@copilot There are still compilation failures in the CI checks. Notably the following two:

...

I've fixed the compilation failures identified in the CI checks. The issues were:

  1. Name collision: The PrintFactoryInfo enum value conflicted with the PrintFactoryInfo() function name. I resolved this by renaming the function to ShowFactoryInfo().

  2. Deleted copy constructor: The code was trying to copy JComponentSummary which has a deleted copy constructor. I fixed this by using const auto& cs = app->GetComponentSummary(); instead.

  3. Function call resolution: The name collision caused function calls to be interpreted as enum references. This is now resolved with the function rename.

Changes made in commit d94f23d:

  • Renamed PrintFactoryInfo() function to ShowFactoryInfo() in both header and implementation
  • Changed auto cs = app->GetComponentSummary(); to const auto& cs = app->GetComponentSummary(); in both functions
  • Updated function call from PrintFactoryInfo(app) to ShowFactoryInfo(app)

The CLI command --print-factory-info and all enum handling remain unchanged and functional. Syntax validation tests pass successfully.

@Copilot Copilot AI requested a review from wdconinc August 20, 2025 03:10
Copilot finished work on behalf of wdconinc August 20, 2025 03:10
Copy link
Contributor

@wdconinc wdconinc left a comment

Choose a reason for hiding this comment

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

@copilot Add a test to linux-eic-shell.yml that runs eicrecon with the new flags to demonstrate correct behavior.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

if (pattern.second.size() > 1) { // Only show patterns with multiple factories
std::cout << " " << pattern.first << "*: " << pattern.second.size() << " collections (";
for (size_t i = 0; i < std::min(pattern.second.size(), static_cast<size_t>(3)); ++i) {
if (i > 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ readability-braces-around-statements ⚠️
statement should be inside braces

Suggested change
if (i > 0)
if (i > 0) {

for (size_t i = 0; i < std::min(pattern.second.size(), static_cast<size_t>(3)); ++i) {
if (i > 0)
std::cout << ", ";
std::cout << pattern.second[i];
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ readability-braces-around-statements ⚠️
statement should be inside braces

Suggested change
std::cout << pattern.second[i];
}
std::cout << pattern.second[i];

std::cout << ", ";
std::cout << pattern.second[i];
}
if (pattern.second.size() > 3)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ readability-braces-around-statements ⚠️
statement should be inside braces

Suggested change
if (pattern.second.size() > 3)
if (pattern.second.size() > 3) {

}
if (pattern.second.size() > 3)
std::cout << ", ...";
std::cout << ")" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ readability-braces-around-statements ⚠️
statement should be inside braces

Suggested change
std::cout << ")" << std::endl;
}
std::cout << ")" << std::endl;

Copy link
Contributor Author

Copilot AI commented Aug 20, 2025

@copilot Add a test to linux-eic-shell.yml that runs eicrecon with the new flags to demonstrate correct behavior.

I've added a test job test-factory-cli to the linux-eic-shell.yml workflow that demonstrates both new CLI commands work correctly. The test runs:

  • eicrecon --list-available-factories EEMC to test the plugin-specific factory listing
  • eicrecon --print-factory-info to test the comprehensive factory information display

The job follows the same patterns as other workflow jobs, downloading the install directory and setting up the environment properly. This ensures the new introspection commands are tested as part of CI.

Commit: dbd1d7c

@Copilot Copilot AI requested a review from wdconinc August 20, 2025 03:24
Copilot finished work on behalf of wdconinc August 20, 2025 03:24
wdconinc and others added 2 commits August 19, 2025 22:24
…d --print-factory-info (fix: iwyu) (#2024)

This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/17087436614.
Please merge this PR into the branch
`copilot/fix-d97e6d4d-15a1-4be9-94f9-55e34622d576`
to resolve failures in PR #2023.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@wdconinc
Copy link
Contributor

@copilot Address the error AddressSanitizer: failed to read suppressions file '/home/runner/work/EICrecon/EICrecon/.github/asan.supp' by ensuring that the checkout of the .github directory is done as in the other CI checks.

@wdconinc
Copy link
Contributor

@copilot Address the readability-braces-around-statements clang-tidy check by making sure single line statement are also surrounded by braces.

Copy link
Contributor Author

Copilot AI commented Aug 20, 2025

@copilot Address the error AddressSanitizer: failed to read suppressions file '/home/runner/work/EICrecon/EICrecon/.github/asan.supp' by ensuring that the checkout of the .github directory is done...

Fixed the AddressSanitizer suppressions file error by adding the "Checkout .github" step to the test-factory-cli job, following the same pattern as other CI jobs that use ASAN artifacts. This ensures the .github/asan.supp file is available when running eicrecon with AddressSanitizer enabled.

Commit: a698d05

Copilot finished work on behalf of wdconinc August 20, 2025 04:26
Copy link
Contributor Author

Copilot AI commented Aug 20, 2025

@copilot Address the readability-braces-around-statements clang-tidy check by making sure single line statement are also surrounded by braces.

I've fixed the readability-braces-around-statements clang-tidy check by adding braces around single-line statements after if conditions. The specific changes were in lines 460-461 and 464-465 where single-line statements std::cout << ", "; and std::cout << ", ..."; were missing braces.

Commit: 5f3e01b

Copilot finished work on behalf of wdconinc August 20, 2025 04:30
@github-actions github-actions bot dismissed their stale review August 22, 2025 00:39

No Clang-Tidy warnings found so I assume my comments were addressed

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

Labels

topic: documentation Improvements or additions to documentation topic: infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants