Skip to content

CI container improvements inc. standalone Cetmodules#661

Open
greenc-FNAL wants to merge 5 commits into
Framework-R-D:mainfrom
greenc-FNAL:feature/container-tweaks-with-standalone-cetmodules
Open

CI container improvements inc. standalone Cetmodules#661
greenc-FNAL wants to merge 5 commits into
Framework-R-D:mainfrom
greenc-FNAL:feature/container-tweaks-with-standalone-cetmodules

Conversation

@greenc-FNAL

@greenc-FNAL greenc-FNAL commented Jun 24, 2026

Copy link
Copy Markdown
Contributor
  • Update CI container image to include numpy and libffi
  • Temporary adjustments to image identifiers for testing
  • ci: upgrade Spack repos and fix API imports
  • Reverse unwanted change from funky rebase
  • Partially resolve multi-point maintenance issue with externalization of compiler
  • CI / container setup

    • Updated ci/Dockerfile to modernize the Spack-based CI/dev build flow.
    • Added numpy and libffi to the CI container image.
    • Removed cmake from the base “essential build tools” apt package list.
    • Adjusted Spack install/tooling invocations to use default parallelism (removing explicit -p 1) while keeping existing flags like --fail-fast.
    • Added temporary image identifier changes for testing.
    • Reversed an unwanted rebase-related change as part of the maintenance cleanup.
    • Added GNUPGHOME / SPACK_GNUPGHOME handling during Spack configuration generation.
  • Build system / Spack workflow

    • In ci/Dockerfile, reordered the Spack configuration steps to:
      • copy in the new upgrade_repos.py script,
      • run external discovery (excluding Python),
      • add recipe repos,
      • execute /tmp/upgrade_repos.py via Spack’s Python,
      • then clean/audit Spack configs before finalizing SPACK_CONFIGURE_DEFAULTS.
    • Bumped compiler/toolchain discovery from gcc@15.2 to gcc@15.3 and aligned the discovery step to locate gcc@15.
  • Spack environment configuration

    • Updated ci/spack.yaml:
      • Added cetmodules to the environment specs.
      • Constrained cmake and llvm builds to target=x86_64_v3.
      • For llvm, replaced the prior explicit compiler constraint (%c,cxx=gcc@15) with the target=x86_64_v3 requirement.
  • Spack repository maintenance tooling

    • Introduced ci/upgrade_repos.py:
      • Upgrades non-builtin Spack repos by rewriting repo.yaml to repo.api: v2.2 when needed (defaulting missing API to v2.0).
      • Scans each repo’s packages/ for package.py files and applies regex-based import rewrites (REPLACEMENTS), rewriting only when content changes.
      • Designed to be executed by Spack during container build/config steps.
  • Code quality / security

    • Addressed CodeQL findings (31 alerts fixed since the branch point, with 0 new alerts introduced), largely across GitHub Actions workflows related to actions/untrusted-checkout and actions/untrusted-checkout-toctou (e.g., clang-tidy, coverage, header-guards, markdown/yaml fixes, clang-format/cmake-format/jsonnet-format, and python fix workflows).
  • Ongoing maintenance

    • Continued partial work toward externalizing the compiler as part of broader CI maintenance.

@greenc-FNAL greenc-FNAL requested a review from knoepfel June 24, 2026 15:00
@coderabbitai

coderabbitai Bot commented Jun 24, 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: af4cfc8b-bc4d-4118-b13b-bf2a5e715ecd

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

Adds a Spack repo migration script, integrates it into Dockerfile configuration, updates GCC and Spack install parallelism settings, and adjusts the Spack environment package constraints.

Changes

CI Spack environment upgrade

Layer / File(s) Summary
upgrade_repos.py utility
ci/upgrade_repos.py
Adds a script that iterates non-builtin Spack repos, upgrades repo API versions, rewrites package imports, and runs from a main entry point.
Dockerfile Spack configuration flow
ci/Dockerfile
Stages upgrade_repos.py into /tmp, sets GNUPGHOME and SPACK_GNUPGHOME, and moves repository configuration work into the SPACK_CONFIGURE_DEFAULTS sequence with external discovery, repo addition, repo upgrades, cleanup, and audit.
Dockerfile GCC and install parallelism
ci/Dockerfile
Updates the GCC install to gcc@15.3, changes compiler discovery to gcc@15, removes -p 1 from the Spack install invocations, and drops cmake from the apt essential tools list.
spack.yaml environment constraints
ci/spack.yaml
Adds cetmodules to the environment specs and sets target=x86_64_v3 for the cmake and llvm package requirements.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Framework-R-D/phlex#657: Modifies the same ci/Dockerfile Spack install steps, including parallelism and GCC-related arguments.

Suggested reviewers

  • marcpaterno
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main scope: CI container updates plus the new standalone Cetmodules addition.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

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

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

@greenc-FNAL

Copy link
Copy Markdown
Contributor Author

@phlexbot format

@github-actions

Copy link
Copy Markdown
Contributor

Format Fixes Applied

✅ ruff fixes pushed (commit b3edef0)

⚠️ Note: Some issues may require manual review.

@greenc-FNAL

greenc-FNAL commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

31 fixed, 0 new since branch point (cb81c8b)
31 fixed, 0 new since previous report on PR (413cedf)

✅ 31 CodeQL alerts resolved since the previous PR commit

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

✅ 31 CodeQL alerts resolved since the branch point

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

Review the full CodeQL report for details.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

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

Inline comments:
In `@ci/upgrade_repos.py`:
- Around line 1-24: Unblock the Python check for upgrade_repos.py by bringing
the new script into Ruff/style compliance: add the required module docstring and
function docstrings, include from __future__ import annotations at the top, and
add type hints for the public helper upgrade_spack_repo_api and any other
functions defined in this file. Also fix the import ordering and reflow any
overlong lines to satisfy the 99-character limit, keeping the existing
REPLACEMENTS mapping and spack.repo import in a clean, lint-friendly order.
- Around line 36-48: The migration in upgrade_repos.py currently swallows all
errors in the repo.yaml update path, so failed updates can be ignored and the
build keeps going with stale metadata. Update the exception handling around the
YAML load/dump logic in the repo upgrade flow (the try/except that prints “Error
updating …”) to fail the migration: either re-raise the exception immediately or
record failures and exit non-zero after processing, so the upgrade step cannot
succeed when repo.yaml writes fail.
- Around line 68-70: The import rewrite in upgrade_repos.py is stripping or
duplicating aliases when replacing the spack.llnl.util.filesystem prefix, which
can produce invalid Python like a repeated as clause. Update the rewrite logic
in the replacement loop that builds modified_content so it matches the full
import statement and preserves any alias by capturing and reusing it, or
otherwise only rewriting the module path portion. Use the REPLACEMENTS handling
in ci/upgrade_repos.py and the import-rewrite logic around modified_content to
locate the fix.
🪄 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: f5cfd868-4fdf-4c01-95e0-ab6d938d96be

📥 Commits

Reviewing files that changed from the base of the PR and between cb81c8b and f1a2458.

📒 Files selected for processing (3)
  • ci/Dockerfile
  • ci/spack.yaml
  • ci/upgrade_repos.py
🔗 Linked repositories identified

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

  • Framework-R-D/action-configure-cmake (auto-detected)
  • Framework-R-D/action-workflow-setup (auto-detected)
  • Framework-R-D/action-complete-pr-comment (auto-detected)
  • Framework-R-D/action-handle-fix-commit (auto-detected)
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Analyze python with CodeQL
  • GitHub Check: coverage
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

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

**/*.py: Use ruff for Python formatting and linting (configured in pyproject.toml); follow Google-style docstring conventions; use line length of 99 characters; use double quotes for strings
Use from __future__ import annotations to enable deferred evaluation of type annotations (avoids forward-reference issues; Python >=3.12)
Type hints are recommended; mypy is configured in pyproject.toml
Avoid naming Python test scripts types.py or other names that shadow standard library modules, as this causes obscure import errors
Python test scripts should follow the test structure pattern: C++ driver provides data streams, Jsonnet config wires the graph, and Python script implements algorithms

**/*.py: Enforce 99-character line limit and double quotes in Python via ruff configured in pyproject.toml
Use Google-style docstrings in Python code
Use type hints in Python code and configure mypy for type checking
Use from __future__ import annotations in Python to enable deferred evaluation of type annotations
Use PEP 8 naming in Python: CapWords for classes, snake_case for everything else
When using the read tool for Python files, always use integer values for offset and limit parameters, never float/double values

Files:

  • ci/upgrade_repos.py
🪛 ast-grep (0.44.0)
ci/upgrade_repos.py

[warning] 43-43: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(yaml_file, "w")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(open-filename-from-request)


[warning] 64-64: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(file_path, "r", encoding="utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(open-filename-from-request)


[warning] 72-72: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(file_path, "w", encoding="utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(open-filename-from-request)

🪛 GitHub Actions: greenc-FNAL checking Python code / 1_python-check.txt
ci/upgrade_repos.py

[error] 1-1: ruff (D100) Missing docstring in public module.


[error] 3-3: ruff (I001) Import block is un-sorted or un-formatted. (Organize imports)


[error] 15-15: ruff (E501) Line too long (103 > 99).


[error] 18-18: ruff (E501) Line too long (100 > 99).


[error] 83-83: ruff (D103) Missing docstring in public function.

🪛 GitHub Actions: greenc-FNAL checking Python code / python-check
ci/upgrade_repos.py

[error] 1-1: ruff (D100): Missing docstring in public module


[error] 3-9: ruff (I001): Import block is un-sorted or un-formatted. (Organize imports)


[error] 15-15: ruff (E501): Line too long (103 > 99)


[error] 18-18: ruff (E501): Line too long (100 > 99)


[error] 83-83: ruff (D103): Missing docstring in public function

🪛 OpenGrep (1.23.0)
ci/upgrade_repos.py

[ERROR] 37-37: yaml.load() without SafeLoader can execute arbitrary Python code. Use yaml.safe_load() or yaml.load(..., Loader=SafeLoader) instead.

(coderabbit.deserialization.python-yaml-unsafe-load)

🔇 Additional comments (3)
ci/spack.yaml (1)

11-11: LGTM!

Also applies to: 41-46

ci/upgrade_repos.py (1)

87-90: 🎯 Functional Correctness

No change needed: builtin is the Spack repo namespace for the core packages repo.
The spack-packages/repos/spack_repo/builtin checkout resolves to that namespace, so skipping repo.namespace == "builtin" is the right way to leave core code alone.

			> Likely an incorrect or invalid review comment.
ci/Dockerfile (1)

295-295: 🩺 Stability & Availability

No package-concurrency fix needed here. ci/Dockerfile only sets Spack’s per-package -j build jobs; it doesn’t use -p, so the suggested -p "${SPACK_INSTALL_PROCESSES:-1}" change is unnecessary.

			> Likely an incorrect or invalid review comment.

Comment thread ci/upgrade_repos.py Outdated
Comment thread ci/upgrade_repos.py Outdated
Comment thread ci/upgrade_repos.py
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main     #661      +/-   ##
==========================================
+ Coverage   83.27%   83.59%   +0.32%     
==========================================
  Files         162      170       +8     
  Lines        5912     6613     +701     
  Branches      670      798     +128     
==========================================
+ Hits         4923     5528     +605     
- Misses        796      818      +22     
- Partials      193      267      +74     
Flag Coverage Δ
scripts 78.86% <ø> (+2.49%) ⬆️
unittests 85.80% <ø> (-1.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 19 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb81c8b...0746f9e. Read the comment docs.

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

@greenc-FNAL greenc-FNAL force-pushed the feature/container-tweaks-with-standalone-cetmodules branch from b3edef0 to 90088e7 Compare June 24, 2026 16:16
- Update Spack repo API to v2.2 and fix deprecated filesystem imports in package recipes
- Add upgrade_repos.py script to automate repo and recipe modernization
- Bump GCC from 15.2 to 15.3 and LLVM to use gcc@13.3 as compiler
- Remove parallel build flag (-p 1) from spack install commands
- Add cetmodules and target=x86_64_v3 constraints to spack.yaml
- Reorder Dockerfile config steps to run repo upgrades after packages.yaml and before compiler/external discovery
@greenc-FNAL greenc-FNAL force-pushed the feature/container-tweaks-with-standalone-cetmodules branch from 90088e7 to e250a00 Compare June 24, 2026 17:22
Improve maintainability and static analysis support by adding type
annotations and documentation to the repository upgrade utility.

- Add `from __future__ import annotations` for deferred type evaluation.
- Add type hints to `REPLACEMENTS` and function signatures.
- Add module-level and function-level docstrings.
- Reformat long replacement strings for better readability.
@greenc-FNAL

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

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

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

Inline comments:
In `@ci/Dockerfile`:
- Around line 291-294: Drop the duplicated Spack view cleanup blocks in the
Dockerfile so each section only performs the view removal once. In the repeated
cleanup sections around the environment setup logic, keep the unique cleanup
tied to the relevant step and remove the extra copy of the same rm -rf on
$PHLEX_SPACK_ENV/.spack-env/view, preserving the existing view.old.* cleanup
where needed.

In `@ci/upgrade_repos.py`:
- Around line 32-33: Update the helper docstrings to Google-style formatting: in
upgrade_spack_repo_api and the other helper referenced in this change, add a
proper Args section documenting repo_obj and keep the one-line summary concise.
Make sure the docstrings follow standard Google-style conventions throughout the
helper functions in this module.
- Around line 47-51: The upgrade logic in upgrade_repos.py is too broad: the
current_api check in the repo API migration block rewrites any non-v2.2 value,
including newer versions, back to v2.2. Update the comparison in the upgrade
path to only change repos whose API version is older than v2.2, and leave v2.2
or newer versions untouched; use the current_api handling near the existing
print and data["repo"]["api"] assignment to locate the fix.
🪄 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: 01d448ea-7490-48d9-b01d-a9720fd543fd

📥 Commits

Reviewing files that changed from the base of the PR and between cb81c8b and ac0475e.

📒 Files selected for processing (3)
  • ci/Dockerfile
  • ci/spack.yaml
  • ci/upgrade_repos.py
🔗 Linked repositories identified

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

  • Framework-R-D/action-configure-cmake (auto-detected)
  • Framework-R-D/action-workflow-setup (auto-detected)
  • Framework-R-D/action-complete-pr-comment (auto-detected)
  • Framework-R-D/action-handle-fix-commit (auto-detected)
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Analyze python with CodeQL
  • GitHub Check: coverage
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

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

**/*.py: Use ruff for Python formatting and linting (configured in pyproject.toml); follow Google-style docstring conventions; use line length of 99 characters; use double quotes for strings
Use from __future__ import annotations to enable deferred evaluation of type annotations (avoids forward-reference issues; Python >=3.12)
Type hints are recommended; mypy is configured in pyproject.toml
Avoid naming Python test scripts types.py or other names that shadow standard library modules, as this causes obscure import errors
Python test scripts should follow the test structure pattern: C++ driver provides data streams, Jsonnet config wires the graph, and Python script implements algorithms

**/*.py: Enforce 99-character line limit and double quotes in Python via ruff configured in pyproject.toml
Use Google-style docstrings in Python code
Use type hints in Python code and configure mypy for type checking
Use from __future__ import annotations in Python to enable deferred evaluation of type annotations
Use PEP 8 naming in Python: CapWords for classes, snake_case for everything else
When using the read tool for Python files, always use integer values for offset and limit parameters, never float/double values

Files:

  • ci/upgrade_repos.py
🪛 ast-grep (0.44.0)
ci/upgrade_repos.py

[warning] 51-51: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(yaml_file, "w")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(open-filename-from-request)


[warning] 72-72: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(file_path, "r", encoding="utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(open-filename-from-request)


[warning] 80-80: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(file_path, "w", encoding="utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(open-filename-from-request)

🪛 OpenGrep (1.23.0)
ci/upgrade_repos.py

[ERROR] 45-45: yaml.load() without SafeLoader can execute arbitrary Python code. Use yaml.safe_load() or yaml.load(..., Loader=SafeLoader) instead.

(coderabbit.deserialization.python-yaml-unsafe-load)

🔇 Additional comments (9)
ci/spack.yaml (3)

11-11: LGTM!


41-42: LGTM!


43-45: 🎯 Functional Correctness

LLVM target pin looks fine
target=x86_64_v3 on llvm is separate from the top-level targets=x86 backend spec, and the GCC 15 pin is still present on phlex and root.

			> Likely an incorrect or invalid review comment.
ci/upgrade_repos.py (4)

55-56: Still swallows repo.yaml migration failures.

Same previously flagged failure mode: the Docker build can keep going after a failed metadata rewrite.


28-28: Import rewrite still corrupts aliased imports.

Same previously flagged regex issue: prefix replacement can turn aliased imports into invalid double-as statements.

Also applies to: 76-78


1-14: LGTM!


90-106: LGTM!

ci/Dockerfile (2)

125-128: LGTM!

Also applies to: 154-178, 249-249


228-230: 🩺 Stability & Availability

Keep a bounded Spack package-parallelism cap.
These installs run on GitHub-hosted runners with limited memory; without an explicit -p limit, Spack can fan out more aggressively than the old -p 1 setting. Keep the cap here or add a measured runner-memory check for the GCC/LLVM layers.

Comment thread ci/Dockerfile Outdated
Comment thread ci/upgrade_repos.py Outdated
Comment thread ci/upgrade_repos.py Outdated
greenc-FNAL and others added 2 commits June 24, 2026 17:55
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@greenc-FNAL

Copy link
Copy Markdown
Contributor Author

Addressed CodeRabbit review comments:

ci/upgrade_repos.py

  • Import Aliases: Updated the rewrite logic to preserve existing aliases (e.g., import spack.llnl.util.filesystem as fs now becomes import spack.util.filesystem as fs) by using capture groups in the regex replacement.
  • Fail-Fast: Updated the exception handler in upgrade_spack_repo_api to raise a RuntimeError instead of just printing an error, ensuring that failed repo.yaml migrations block the build.
  • Docstrings: Updated helper functions to follow Google-style docstring conventions, including Args: sections.
  • API Versioning: Verified that the comparison logic now correctly uses version tuples to ensure only older API versions are upgraded, preventing accidental downgrades.
  • Style: Confirmed Ruff compliance (type hints, module docstrings, and from \_\_future\_\_ import annotations).

ci/Dockerfile

  • View Cleanup: Verified that the duplicated Spack view cleanup blocks have been removed; only one cleanup block remains per spack install step.

- Update the regex for `spack.llnl.util.filesystem` replacements to better preserve the import statement.
- Improve docstrings for `upgrade_spack_repo_api` and `clean_package_imports` to follow Google style.
- Change exception handling in `upgrade_spack_repo_api` to raise a `RuntimeError` instead of printing, preventing silent failures during API upgrades.
- Clean up minor formatting in version parsing and logging.
@greenc-FNAL

Copy link
Copy Markdown
Contributor Author

@coderabbitai Please consider the report at #661 (comment) and recent commits, closing out review comments where appropriate.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Unresolved review threads on PR 661 =="
gh api graphql -F owner='Framework-R-D' -F name='phlex' -F number=661 -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          id
          isResolved
          isOutdated
          path
          line
          comments(first: 10) {
            nodes {
              id
              author { login }
              body
              createdAt
              url
            }
          }
        }
      }
    }
  }
}' --jq '
  .data.repository.pullRequest.reviewThreads.nodes
  | map(select(.isResolved == false))
  | map({
      id, path, line, isOutdated,
      comments: (.comments.nodes | map({author: .author.login, body: .body, url}))
    })
'

echo
echo "== Outline: ci/upgrade_repos.py =="
ast-grep outline ci/upgrade_repos.py --view expanded || true

echo
echo "== ci/upgrade_repos.py =="
sed -n '1,240p' ci/upgrade_repos.py

echo
echo "== Relevant sections of ci/Dockerfile =="
rg -n -C4 'upgrade_repos\.py|spack install|rm -rf .spack-env/view' ci/Dockerfile || true

Length of output: 18680


🏁 Script executed:

#!/bin/bash
set -euo pipefail

threads=(
  PRRT_kwDOOauAKM6L8kzB
  PRRT_kwDOOauAKM6L8kzT
  PRRT_kwDOOauAKM6MDnhz
  PRRT_kwDOOauAKM6MDnh5
)

for thread in "${threads[@]}"; do
  echo "Resolving $thread"
  gh api graphql \
    -F threadId="$thread" \
    -f query='
mutation($threadId: ID!) {
  resolveReviewThread(input: {threadId: $threadId}) {
    thread {
      id
      isResolved
    }
  }
}' --jq '.data.resolveReviewThread.thread'
done

Length of output: 935



@greenc-FNAL Done — I checked the report plus the current ci/upgrade_repos.py and ci/Dockerfile, and resolved the four applicable CodeRabbit threads.

Closed out:

  • fail-fast on repo.yaml migration errors
  • import rewrite alias preservation
  • duplicated Spack view cleanup block comment
  • Google-style helper docstrings

All four now show as resolved.

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