Skip to content

COMP: CI check that the remote-module list stays in sync (#4786) - #6410

Merged
jhlegarreta merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:remote-module-list-ci-check
Jun 10, 2026
Merged

jhlegarreta merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:remote-module-list-ci-check

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Jun 6, 2026 •

Copy link
Copy Markdown
Member

Add a CI check that keeps the generated remote-module documentation page in sync with its sources, on top of the generator added in #6409 (now merged).

The generator is offline and deterministic, so the page can only drift when someone edits a Modules/Remote/*.remote.cmake file or the classification file without regenerating. This workflow runs GenerateRemoteModuleList.py --check on PRs touching those paths and fails with the exact regeneration command if the committed page is stale.

Why a PR check and not a scheduled regenerate job

The page depends only on in-repo files, so there is no external input for a periodic job to react to — a cron regenerate would always be a no-op. The PR-time check is the correct enforcement for the current offline design. A scheduled regenerate (and the bot PR it would open) becomes meaningful only once external data is introduced — the GitHub itk-module topic scrape and per-repo CI status badges planned for the next PR — so it is deferred to that change.

Validation
  • In-sync tree: --check exits 0.
  • Simulated source edit without regenerating: --check exits 1 with the regeneration instruction.
  • No untrusted github.event.* input is interpolated into any run: step.

@github-actions github-actions Bot added type:Compiler Compiler support or related warnings type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:Python wrapping Python bindings for a class area:Documentation Issues affecting the Documentation module labels Jun 6, 2026
@hjmjohnson
hjmjohnson requested a review from jhlegarreta June 6, 2026 15:21
@hjmjohnson
hjmjohnson marked this pull request as ready for review June 6, 2026 15:21
@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a CI workflow that runs GenerateRemoteModuleList.py --check on pull requests touching Modules/Remote/*.remote.cmake, the classification YAML, or the generated page, ensuring the committed remote_modules.md never drifts from its sources. It also lands the generated page itself and the curated classification YAML.

  • Workflow (.github/workflows/remote-module-list.yml): triggers only on pull_request (the correct choice — no secrets needed), installs pyyaml, and surfaces a ::error:: annotation with the exact regeneration command on failure.
  • Generator (GenerateRemoteModuleList.py): offline and deterministic; parses 18 *.remote.cmake files plus the YAML, renders sorted Markdown tables, and exits non-zero with a clear message in --check mode.
  • Documentation: remote_modules.md is generated from current sources and carries a "do not edit by hand" banner; index.md is updated to include it in the TOC.

Confidence Score: 4/5

Safe to merge; the workflow logic and generator are correct for all current cmake files, and the two findings are edge-case quality concerns rather than blocking defects.

The write_text call omits newline='
', which can produce CRLF line endings when the generator is run on Windows. Because *.md files are not covered by the repo's .gitattributes LF rules, a Windows developer committing with core.autocrlf=false would cause the Linux CI check to report a spurious mismatch. The fix is a one-character addition. The greedy regex in parse_remote_cmake is a documentation gap rather than a current bug, and all other logic is correct.

The write_text call at line 242 and the greedy regex at line 97 of Utilities/Maintenance/GenerateRemoteModuleList.py.

Important Files Changed

Filename Overview
.github/workflows/remote-module-list.yml New CI workflow triggering on pull_request with correct path filters; the
Utilities/Maintenance/GenerateRemoteModuleList.py New offline deterministic generator; two minor concerns: write_text without newline='\n' risks CRLF-vs-LF mismatches on Windows, and the greedy outer regex for itk_fetch_module(...) could produce an oversized inner string if a cmake file gains content with ) after the closing paren.
Documentation/remote_modules_classification.yaml New YAML classification file; all kind values are documented and consistent with KIND_SECTIONS in the generator. No issues.
Documentation/docs/scientific_ecosystem/remote_modules.md Generated documentation page with a 'do not edit by hand' banner, kept in sync by the new CI check.
Documentation/docs/index.md Adds remote_modules.md to the TOC; one-line change, no issues.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PR touches watched paths] --> B[remote-module-list.yml triggers]
    B --> C[checkout and setup-python]
    C --> D[pip install pyyaml]
    D --> E[GenerateRemoteModuleList.py --check]
    E --> F{Exit code?}
    F -->|0| G[Step passes - file is up to date]
    F -->|non-zero| H[echo error annotation and exit 1]
    H --> I[CI step fails]
    subgraph Generator internals
        J[Modules/Remote/*.remote.cmake] --> K[parse_remote_cmake]
        L[remote_modules_classification.yaml] --> M[load_classification]
        K --> N[render]
        M --> N
        N --> O[generated content]
        O --> P{compare with committed file}
        P -->|match| Q[print OK and exit 0]
        P -->|mismatch| R[raise SystemExit and exit 1]
    end
    E -.-> J
    E -.-> L
Loading

Reviews (1): Last reviewed commit: "COMP: Add CI check that the remote-modul..." | Re-trigger Greptile

@jhlegarreta jhlegarreta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for doing this, Hans.

@hjmjohnson
hjmjohnson force-pushed the remote-module-list-ci-check branch from 8e3a0b1 to 36ab16a Compare June 7, 2026 13:16
@hjmjohnson
hjmjohnson requested a review from jhlegarreta June 7, 2026 14:07
@hjmjohnson
hjmjohnson force-pushed the remote-module-list-ci-check branch from 36ab16a to 6f408e7 Compare June 9, 2026 01:32
@github-actions github-actions Bot removed area:Python wrapping Python bindings for a class area:Documentation Issues affecting the Documentation module labels Jun 9, 2026
@hjmjohnson
hjmjohnson force-pushed the remote-module-list-ci-check branch from 6f408e7 to 07518c9 Compare June 9, 2026 20:11
Run GenerateRemoteModuleList.py --check on pull requests that touch the
remote-module sources or the generated page. The generator is offline and
deterministic, so a stale page means a source (a *.remote.cmake file or the
classification file) was edited without regenerating; the check fails with
the regeneration command.
@hjmjohnson
hjmjohnson force-pushed the remote-module-list-ci-check branch from 07518c9 to 6f9d678 Compare June 9, 2026 20:15
@hjmjohnson

Copy link
Copy Markdown
Member Author

@jhlegarreta This now incorporates all your requests. Let me know if you approve.

@jhlegarreta
jhlegarreta merged commit c2cd68a into InsightSoftwareConsortium:main Jun 10, 2026
16 checks passed
@hjmjohnson
hjmjohnson deleted the remote-module-list-ci-check branch August 22, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:Compiler Compiler support or related warnings type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants