Skip to content

fix: Standardize RunOnLinuxOnly attribute usage in build modules#1734

Merged
thomhurst merged 1 commit into
mainfrom
fix/1528-attribute-naming
Jan 1, 2026
Merged

fix: Standardize RunOnLinuxOnly attribute usage in build modules#1734
thomhurst merged 1 commit into
mainfrom
fix/1528-attribute-naming

Conversation

@thomhurst

Copy link
Copy Markdown
Owner

Summary

Fixes #1528 - Inconsistent naming RunOnLinux vs RunOnLinuxOnly attributes

Investigation findings:

  • RunOnLinux and RunOnLinuxOnly are different attributes with different semantics:
    • RunOnLinux inherits from RunConditionAttribute (OR logic - module runs if ANY condition is met)
    • RunOnLinuxOnly inherits from MandatoryRunConditionAttribute (AND logic - ALL conditions must be met)

Issue:

  • ChangedFilesInPullRequestModule used [RunOnLinux] while all other build modules used [RunOnLinuxOnly]
  • Since the module should only run on Linux (mandatory requirement), this was inconsistent with other modules

Changes:

  • Updated ChangedFilesInPullRequestModule to use [RunOnLinuxOnly] for consistency
  • Added documentation for the *Only variants in the run-conditions documentation

Test plan

  • Verified the attribute change is syntactically correct (same namespace already imported)
  • Core ModularPipelines project builds successfully
  • CI will validate full build passes

🤖 Generated with Claude Code

Fixed inconsistent attribute naming where ChangedFilesInPullRequestModule used
[RunOnLinux] while all other build modules used [RunOnLinuxOnly]. Since the
module should only run on Linux (mandatory condition), updated to use
RunOnLinuxOnly for consistency and correct semantics.

Also updated documentation to clarify the difference between:
- RunOn{OS} (OR logic - any matching condition allows run)
- RunOn{OS}Only (AND/mandatory logic - condition must be met)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 1, 2026 22:05
@thomhurst

Copy link
Copy Markdown
Owner Author

Summary

This PR fixes inconsistent run condition attribute usage by changing ChangedFilesInPullRequestModule from [RunOnLinux] to [RunOnLinuxOnly] and adds documentation for the *Only attribute variants.

Critical Issues

None found ✅

Suggestions

Documentation Enhancement: The new documentation section correctly explains the *Only variants, but could be clearer about the semantic difference:

In docs/docs/how-to/run-conditions.md:47-57, consider adding a brief note explaining that *Only variants inherit from MandatoryRunConditionAttribute, which enforces AND logic (all conditions must pass). This would help users understand why these variants exist beyond just platform restriction.

Example addition after line 46:

**Note**: The `*Only` variants use mandatory condition logic (AND) - if you combine `[RunOnLinuxOnly]` with other mandatory conditions, ALL must return true. This differs from the non-`Only` variants which use OR logic.

This is optional but would strengthen the conceptual link between the two sections of the documentation.

Verification

Consistency verified: All other build modules use [RunOnLinuxOnly]:

  • DependabotCommitsModule.cs:12
  • PackagePathsParserModule.cs:10
  • FormatMarkdownModule.cs:21
  • CreateReleaseModule.cs:18
  • CodeFormattedNicelyModule.cs:21
  • UploadPackagesToNugetModule.cs:17
  • PushVersionTagModule.cs:13
  • PackProjectsModule.cs:20

ChangedFilesInPullRequestModule was the only outlier using [RunOnLinux].

Semantic correctness: The module calls git diff which is Linux-specific in this pipeline context, so the mandatory condition is appropriate.

Implementation verified: Confirmed that:

  • RunConditionAttribute uses OR logic (src/ModularPipelines/Engine/ModuleConditionHandler.cs:98-108)
  • MandatoryRunConditionAttribute uses AND logic (src/ModularPipelines/Engine/ModuleConditionHandler.cs:82-91)

Verdict

APPROVE - No critical issues. The change improves consistency and the documentation addition is helpful.

@thomhurst thomhurst merged commit a2bcc35 into main Jan 1, 2026
14 of 16 checks passed
@thomhurst thomhurst deleted the fix/1528-attribute-naming branch January 1, 2026 22:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes the usage of the RunOnLinuxOnly attribute across build modules to ensure consistency. The PR addresses an inconsistency where ChangedFilesInPullRequestModule was using [RunOnLinux] (OR logic) instead of [RunOnLinuxOnly] (AND logic/mandatory) like all other build modules.

Key changes:

  • Updated ChangedFilesInPullRequestModule to use [RunOnLinuxOnly] instead of [RunOnLinux]
  • Added documentation for the *Only variants of OS condition attributes (RunOnLinuxOnly, RunOnWindowsOnly, RunOnMacOSOnly)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/ModularPipelines.Build/Modules/ChangedFilesInPullRequestModule.cs Changed attribute from [RunOnLinux] to [RunOnLinuxOnly] for consistency with other build modules
docs/docs/how-to/run-conditions.md Added documentation explaining the *Only variants for mandatory OS-specific run conditions with examples

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.

Code smell: Inconsistent naming - RunOnLinux vs RunOnLinuxOnly attributes

2 participants