Skip to content

feat(ci): automate and enhance performance validation, add semantic PR checks, and consolidate build steps#562

Merged
rjmurillo merged 41 commits intomainfrom
feature/issue-553
Jul 19, 2025
Merged

feat(ci): automate and enhance performance validation, add semantic PR checks, and consolidate build steps#562
rjmurillo merged 41 commits intomainfrom
feature/issue-553

Conversation

@rjmurillo
Copy link
Copy Markdown
Owner

@rjmurillo rjmurillo commented Jul 19, 2025

This PR introduces major CI/CD improvements focused on performance testing automation, workflow maintainability, and semantic PR validation. For details on CI performance benchmarking and baseline caching, see docs/ci-performance.md.

Key changes:

  • Automated performance validation:
    • The performance job now runs nightly, on PRs, and can be triggered manually via workflow_dispatch input.
    • BenchmarkDotNet parameters are configurable for reliable measurements (--warmupCount 2 --invocationCount 15).
    • Baseline comparison and regression gates are enforced for actionable results.
    • Caching and artifact handling improved for cross-platform matrix jobs.
    • Baseline performance results are now cached per OS and SHA, reducing redundant benchmark runs.
    • Maintainers can force a fresh baseline run using workflow inputs or environment variables.
    • Performance summaries are published to the GitHub Actions summary for easier review.
  • Workflow consolidation:
    • Common setup, restore, and build steps are moved to a reusable composite action (setup-restore-build), reducing duplication and improving maintainability.
  • Semantic PR title validation:
    • Adds a workflow to enforce semantic PR titles, improving release automation and changelog generation.
  • Documentation:
    • Added docs/ci-performance.md and updated related docs to explain CI performance benchmarking, baseline caching, and manual override features for maintainers.
  • Other improvements:
    • Artifact naming fixed to prevent OS conflicts.
    • Expanded OS matrix for build and performance jobs.
    • Removed unnecessary path filters and improved job conditions for clarity.

These changes fix #553 and related CI reliability concerns. They ensure performance validation is robust, maintainable, and actionable, while enforcing best practices for PR titles and workflow structure.

Summary by CodeRabbit

  • New Features

    • Added manual workflow inputs to control performance job execution and baseline benchmarking.
    • Introduced caching for baseline performance results with an option to force rerun benchmarks.
    • Performance summaries are now published directly to the GitHub step summary for easier review.
  • Chores

    • Improved naming consistency for artifact uploads in the workflow.
  • Documentation

    • Added detailed documentation on CI performance benchmarking, baseline caching, and manual override procedures.
    • Updated contributing guidelines to explain performance benchmarking and caching features.

rjmurillo added 24 commits July 19, 2025 11:13
…m and ubuntu-24.04-arm for cross-platform coverage
…m and ubuntu-24.04-arm for cross-platform coverage
Introduce a new GitHub Action for Dependency Review to scan for known-vulnerable package versions in pull requests. Update the PowerShell workflow with enhanced permissions and add PSScriptAnalyzer for script validation. Implement a new "Semantic PR Check" workflow for title validation. Refactor C# methods to enhance detection of Moq's Raises methods using symbol-based analysis, and add unit tests to ensure accurate identification of valid and invalid patterns.
Add checkout step using actions/checkout@v4 with fetch-depth 0
to action.yml and main.yml. Introduce "Setup, Restore, and
Build Solution" step for consistent .NET build process across
jobs. Include performance validation step using PowerShell.
Copilot AI review requested due to automatic review settings July 19, 2025 20:09
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 19, 2025

📝 Walkthrough

Walkthrough

The GitHub Actions workflow for performance validation was updated to support caching of baseline benchmark results keyed by SHA, with options to force reruns. The performance script was modified to check for existing cached results and only rerun benchmarks if necessary or explicitly requested.

Changes

File(s) Change Summary
.github/workflows/main.yml Enhanced workflow with manual trigger inputs, conditional performance job execution, baseline cache handling, and summary publishing.
build/scripts/perf/PerfCore.ps1 Added logic to use cached baseline results if available, with an option to force rerun via environment variable.
build/scripts/perf/DiffPerfToBaseline.ps1 Added parameter to optionally reuse cached baseline results; skips baseline checkout and rerun if cache is used.
build/scripts/perf/RunPerfTests.ps1 Fixed typo in variable name for dotnet command arguments.
CONTRIBUTING.md Added section describing CI performance benchmarking and baseline caching with manual override instructions.
build/scripts/perf/README.md Added CI performance benchmarking overview and reference to detailed documentation.
docs/ci-performance.md Added detailed documentation on CI performance benchmarking workflow, baseline caching, manual triggers, and force refresh usage.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHubActions
    participant PerfScript

    User->>GitHubActions: Manually triggers workflow (with inputs)
    GitHubActions->>GitHubActions: Checks if performance job should run
    GitHubActions->>GitHubActions: Reads baseline SHA, tries to restore baseline cache
    GitHubActions->>PerfScript: Runs performance validation script
    PerfScript->>PerfScript: Checks for cached baseline results
    alt Baseline cache exists and not forced
        PerfScript->>PerfScript: Uses cached results, skips rerun
    else Baseline cache missing or force rerun
        PerfScript->>PerfScript: Runs baseline benchmarks
    end
    PerfScript->>GitHubActions: Outputs performance summaries
    GitHubActions->>GitHubActions: Publishes summaries and uploads artifacts
    GitHubActions->>GitHubActions: Uploads new baseline cache if needed
Loading

Suggested reviewers

  • MattKotsenas

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@rjmurillo rjmurillo added github_actions Pull requests that update GitHub Actions code releasable build feature labels Jul 19, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🔭 Outside diff range comments (1)
docs/ci-performance.md (1)

1-43: Minor style & navigation tweaks for clarity

  1. Add an automatic link to issue #553 so readers can jump straight to the rationale.
  2. Use sentence-case headings and consistent spacing to silence markdown/LanguageTool warnings.
  3. Convert the “Manual Run” steps into an ordered list that renders correctly.
-## Example: Manual Run
-
-1. Go to the Actions tab in GitHub.
-2. Select the main workflow.
-3. Click "Run workflow".
-4. Set `run_performance` to `true`.
-5. Set `force_baseline` to `true` if you want to re-run baseline benchmarks.
+## Example: manual run
+
+1. Go to **Actions** in GitHub.
+2. Select **Main build** workflow.
+3. Click **Run workflow**.
+4. Enable `run_performance`.
+5. (Optional) Enable `force_baseline` to regenerate baseline benchmarks.
♻️ Duplicate comments (3)
build/scripts/perf/RunPerfTests.ps1 (1)

25-36: LGTM! Typo fix implemented correctly.

The variable name has been consistently corrected from $comandArguments to $commandArguments throughout the script, addressing the spelling error identified in previous reviews.

build/scripts/perf/DiffPerfToBaseline.ps1 (1)

41-41: Security scanning false positive - git worktree usage is appropriate.

The security scanning tool flagged the git worktree command as a restricted function. However, this is a legitimate use case in a development/CI performance benchmarking script where creating temporary worktrees for baseline comparisons is the intended functionality.

.github/workflows/main.yml (1)

124-128: Complex schedule / dispatch condition can be simplified for readability

The multiline if: is hard to scan and easy to get wrong when new triggers are added.
Recommend collapsing to a single expression and documenting the intent:

-    if: |
-      (github.event_name == 'schedule'  && github.ref == 'refs/heads/main') ||
-      (github.event_name == 'workflow_dispatch' && github.event.inputs.run_performance == 'true')
+    if: >
+      (github.event_name == 'schedule'        && github.ref == 'refs/heads/main') ||
+      (github.event_name == 'workflow_dispatch' && github.event.inputs.run_performance == 'true')

Using the > scalar keeps it on one logical line while remaining under the max-line-length rule.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc3153d and 3ca4209.

📒 Files selected for processing (7)
  • .github/workflows/main.yml (3 hunks)
  • CONTRIBUTING.md (1 hunks)
  • build/scripts/perf/DiffPerfToBaseline.ps1 (3 hunks)
  • build/scripts/perf/PerfCore.ps1 (1 hunks)
  • build/scripts/perf/README.md (1 hunks)
  • build/scripts/perf/RunPerfTests.ps1 (1 hunks)
  • docs/ci-performance.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .github/copilot-instructions.md
**/*.md

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .github/copilot-instructions.md
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Summarize all changes in the PR description and cite relevant lines from modified files for clarity.
Learnt from: rjmurillo
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-approve-and-auto-merge.yml:8-8
Timestamp: 2025-01-22T00:47:24.622Z
Learning: For the moq.analyzers repository, ARM64 runner migration can proceed without staged rollout as there are minimal dependencies, with policy configurations to be adjusted post-merge.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Every pull request must include evidence of running code formatting, building with warnings as errors, and running all unit tests (console log/text or screenshots) in the PR description.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Every pull request must include evidence of steps 1–3 in the PR description (console log/text or screenshots). Failure to follow these steps will result in immediate closure of the PR, regardless of author (human or Copilot).
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: When making changes, follow the workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues if any → Run/Update Tests → Fix test failures if any → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Keep commit messages short and in the imperative mood (e.g., "Add Moq1200 tests").
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: When making changes, follow this workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues → Run/Update Tests → Update Docs → Commit & PR.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/label-pr.yml:13-13
Timestamp: 2025-01-17T21:45:05.188Z
Learning: As of January 2025, GitHub-hosted ARM64 runners should use the syntax `ubuntu-24.04-arm` in GitHub Actions workflow files, as documented in the GitHub changelog.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/release.yml:24-24
Timestamp: 2025-01-17T21:44:35.686Z
Learning: As of January 2025, GitHub Actions supports ARM64 runners in public repositories (public preview). The runner specification format is `ubuntu-24.04-arm` for ARM64-based Ubuntu runners.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-auto-approve.yml:9-9
Timestamp: 2025-01-17T21:43:46.997Z
Learning: As of January 2025, GitHub Actions supports ARM64 runners in public preview. The runner label format is `ubuntu-24.04-arm` for ARM64 Ubuntu runners. This is available for free in public repositories.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-auto-approve.yml:9-9
Timestamp: 2025-01-17T21:44:17.410Z
Learning: GitHub Actions now supports ARM64 runners (as of January 2025) with labels like `ubuntu-24.04-arm`. These runners are available for free in public repositories during the public preview period.
build/scripts/perf/README.md (6)
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {README.md,docs/rules/README.md} : Update README.md and docs/rules/README.md if workflows or rules change.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Summarize all changes in the PR description and cite relevant lines from modified files for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .cursor/rules/conventional-commit-messages.mdc:0-0
Timestamp: 2025-06-25T12:42:55.421Z
Learning: Types other than feat and fix may be used in commit messages, such as build, chore, ci, docs, style, refactor, perf, and test, but only feat, fix, and breaking changes have implicit effects on Semantic Versioning.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Summaries in pull requests should mention key line numbers using the repository citation format.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Summaries in pull requests should mention key line numbers using the repository citation format.
build/scripts/perf/RunPerfTests.ps1 (14)
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : Use .Protected().Setup(...) only for protected virtual members, and only in Moq 4.18.4+.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : If a Moq feature has known limitations or edge cases (e.g., explicit interface implementation, event setup), document this in the test or analyzer code.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : Moq cannot mock or set up static, const, or readonly members. Do not add analyzer tests for these scenarios; the C# compiler will prevent them.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: If a Moq feature has known limitations or edge cases (e.g., explicit interface implementation, event setup), document this in the test or analyzer code.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to tests/**/*.cs : When writing tests that verify code patterns don't trigger unwanted diagnostics from any Moq analyzer, use the AllAnalyzersVerifier helper class.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : Setups for explicit interface implementations must use the correct cast syntax (e.g., ((IMyInterface)x).Method()). Only test these scenarios if the Moq version supports them.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : Use SetupAdd and SetupRemove only for virtual events, and only in Moq 4.18.4+.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: For Moq analyzers and tests: only set up or verify virtual, abstract, or interface members; do not attempt to set up or verify non-virtual, static, or sealed members.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Moq cannot mock or set up static, const, or readonly members; do not add analyzer tests for these scenarios.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Avoid unnecessary complexity in test types and mock setups; each test should demonstrate a single Moq feature or analyzer rule.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Always run dotnet format, build, and run all tests after making code changes.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Run all unit tests: dotnet test --settings ./build/targets/tests/test.runsettings.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Re-run dotnet format, build, and tests after resolving feedback or merge conflicts.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Re-run dotnet format, build, and tests after resolving feedback or merge conflicts.
CONTRIBUTING.md (20)
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Summarize all changes in the PR description and cite relevant lines from modified files for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Summaries in pull requests should mention key line numbers using the repository citation format.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Summaries in pull requests should mention key line numbers using the repository citation format.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {README.md,docs/rules/README.md} : Update README.md and docs/rules/README.md if workflows or rules change.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .cursor/rules/conventional-commit-messages.mdc:0-0
Timestamp: 2025-06-25T12:42:55.421Z
Learning: Types other than feat and fix may be used in commit messages, such as build, chore, ci, docs, style, refactor, perf, and test, but only feat, fix, and breaking changes have implicit effects on Semantic Versioning.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .cursor/rules/conventional-commit-messages.mdc:0-0
Timestamp: 2025-06-25T12:42:54.674Z
Learning: Types other than 'feat' and 'fix' (such as build, chore, ci, docs, style, refactor, perf, test) may be used in commit messages, but only 'feat', 'fix', and breaking changes have implicit effects on Semantic Versioning.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .cursor/rules/conventional-commit-messages.mdc:0-0
Timestamp: 2025-06-25T12:42:55.421Z
Learning: A description must immediately follow the colon and space after the type/scope prefix, and should be a short summary of the code changes.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Ensure all changes are covered by tests and documentation before committing.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Ensure all changes are covered by tests and documentation before committing.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Repository structure: 'src/' for analyzers, code fixes, and tools; 'tests/' for unit tests and benchmarks; 'docs/' for rule documentation; 'build/' for build scripts and shared targets.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: If adding an analyzer, also add a code fix, a benchmark, and documentation in 'docs/rules'.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,src/CodeFixes/**/*.cs,tests/**/*.cs,docs/rules/**/*.md} : If adding an analyzer: also add a code fix, a benchmark, and documentation in docs/rules.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to src/Analyzers/**/*.cs : Keep analyzers efficient, memory-friendly, and organized using existing patterns and dependency injection.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to tests/**/*.cs : Use AllAnalyzersVerifier.VerifyAllAnalyzersAsync to check for false positives across all analyzers.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Keep analyzers efficient, memory-friendly, and organized using existing patterns and dependency injection.
Learnt from: rjmurillo
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-approve-and-auto-merge.yml:8-8
Timestamp: 2025-01-22T00:47:24.622Z
Learning: For the moq.analyzers repository, ARM64 runner migration can proceed without staged rollout as there are minimal dependencies, with policy configurations to be adjusted post-merge.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to tests/**/*.cs : Use AllAnalyzersVerifier.VerifyAllAnalyzersAsync() for "no diagnostics" tests.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/*Analyzer.cs,src/CodeFixes/*Fixer.cs,tests/*AnalyzerTests.cs,tests/*CodeFixTests.cs} : Use [Description]Analyzer.cs, [Description]Fixer.cs, [Description]AnalyzerTests.cs, [Description]CodeFixTests.cs for new components.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Review docs/rules/ before changing analyzers or code fixes.
build/scripts/perf/DiffPerfToBaseline.ps1 (10)
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : Use .Protected().Setup(...) only for protected virtual members, and only in Moq 4.18.4+.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : If a Moq feature has known limitations or edge cases (e.g., explicit interface implementation, event setup), document this in the test or analyzer code.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : Moq cannot mock or set up static, const, or readonly members. Do not add analyzer tests for these scenarios; the C# compiler will prevent them.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: If a Moq feature has known limitations or edge cases (e.g., explicit interface implementation, event setup), document this in the test or analyzer code.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : Setups for explicit interface implementations must use the correct cast syntax (e.g., ((IMyInterface)x).Method()). Only test these scenarios if the Moq version supports them.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to tests/**/*.cs : When writing tests that verify code patterns don't trigger unwanted diagnostics from any Moq analyzer, use the AllAnalyzersVerifier helper class.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {src/Analyzers/**/*.cs,tests/**/*.cs} : Use SetupAdd and SetupRemove only for virtual events, and only in Moq 4.18.4+.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: For Moq analyzers and tests: only set up or verify virtual, abstract, or interface members; do not attempt to set up or verify non-virtual, static, or sealed members.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Moq cannot mock or set up static, const, or readonly members; do not add analyzer tests for these scenarios.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Avoid unnecessary complexity in test types and mock setups; each test should demonstrate a single Moq feature or analyzer rule.
.github/workflows/main.yml (13)
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {README.md,docs/rules/README.md} : Update README.md and docs/rules/README.md if workflows or rules change.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: When testing code fixes that modify a class member, use a data-driven pattern: a public static IEnumerable<object[]> data source, a [Theory] test method with [MemberData], a static Template function with placeholders, and Verify.VerifyCodeFixAsync.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: After rebasing or merging, review for duplicate or conflicting changes, especially in shared files or properties. Remove redundant changes and note this in the PR description.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: After rebasing or merging, review for duplicate or conflicting changes, especially in shared files or properties, and remove redundant changes.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Address all feedback from automated bots (e.g., Codeclimate, formatting/linting bots) as you would human reviewers; resolve all formatting and linting issues flagged by bots or CI before requesting review or merging.
Learnt from: rjmurillo
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-approve-and-auto-merge.yml:8-8
Timestamp: 2025-01-22T00:47:24.622Z
Learning: For the moq.analyzers repository, ARM64 runner migration can proceed without staged rollout as there are minimal dependencies, with policy configurations to be adjusted post-merge.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Address all feedback from automated bots (e.g., Codeclimate, formatting/linting bots) as you would human reviewers.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Always check for and follow any new rules in .cursor/rules/, .editorconfig, and .github/copilot-instructions.md before making changes.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: When making changes, follow this workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues → Run/Update Tests → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: When making changes, follow the workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues if any → Run/Update Tests → Fix test failures if any → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Every pull request must include evidence of steps 1–3 in the PR description (console log/text or screenshots). Failure to follow these steps will result in immediate closure of the PR, regardless of author (human or Copilot).
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Reference affected analyzer rule IDs in PR descriptions.
docs/ci-performance.md (5)
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {README.md,docs/rules/README.md} : Update README.md and docs/rules/README.md if workflows or rules change.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {tests/**/*.cs,docs/rules/**/*.md} : Update or add xUnit tests and documentation under docs/rules/ when analyzers change.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Summarize all changes in the PR description and cite relevant lines from modified files for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to docs/rules/**/*.md : If changing an analyzer: update documentation in docs/rules to reflect all changes.
🪛 LanguageTool
build/scripts/perf/README.md

[grammar] ~4-~4: Use proper capitalization
Context: ... Baseline results are cached per OS and SHA, and can be force-refreshed via workflo...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~4-~4: Use correct spacing
Context: ...ge, manual runs, and force options, see docs/ci-performance.md. When running benchmarks, use the `PerfCo...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

CONTRIBUTING.md

[grammar] ~19-~19: Use correct spacing
Context: ...I Performance Benchmarking and Baseline Caching This repository supports automated perfo...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~21-~21: Use commas correctly
Context: ... Baseline results are cached per OS and SHA, and can be force-refreshed via workflow ...

(QB_NEW_EN_OTHER_ERROR_IDS_33)


[grammar] ~21-~21: Use correct spacing
Context: ...ge, manual runs, and force options, see docs/ci-performance.md.

(QB_NEW_EN_OTHER_ERROR_IDS_5)

docs/ci-performance.md

[grammar] ~1-~1: Use correct spacing
Context: ...I Performance Benchmarking and Baseline Caching ## Overview The CI workflow for this repos...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~5-~5: Use correct spacing
Context: ...efresh baseline results for performance validation. ## Baseline Caching - Baseline performance...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~7-~7: Use correct spacing
Context: ...or performance validation. ## Baseline Caching - Baseline performance results are cached ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~11-~11: Use correct spacing
Context: ...mparisons, avoiding redundant benchmark runs. ## Forcing Baseline Benchmark Runs - To fo...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~13-~13: Use correct spacing
Context: ...rk runs. ## Forcing Baseline Benchmark Runs - To force a fresh baseline run (even if c...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~16-~16: Use correct spacing
Context: ...e baseline benchmarks for the specified SHA. ## Manual Workflow Dispatch - You can manu...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~18-~18: Use correct spacing
Context: ... the specified SHA. ## Manual Workflow Dispatch - You can manually trigger the performance...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~22-~22: Use correct spacing
Context: ...netotrue` to force a fresh baseline run. ## Script Behavior - When running with the...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~24-~24: Use correct spacing
Context: ... force a fresh baseline run. ## Script Behavior - When running with the -diff flag, the ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~29-~29: Use correct spacing
Context: ...- Always run benchmarks for the current commit. ## Example: Manual Run 1. Go to the Action...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~31-~31: Use correct spacing
Context: ...the current commit. ## Example: Manual Run 1. Go to the Actions tab in GitHub. 2. Sele...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~35-~35: There might be a mistake here.
Context: ...he main workflow. 3. Click "Run workflow". 4. Set run_performance to true. 5. ...

(QB_NEW_EN_OTHER)


[grammar] ~37-~37: Use correct spacing
Context: ...o true if you want to re-run baseline benchmarks. ## Notes - This mechanism ensures efficien...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🪛 actionlint (1.7.7)
.github/workflows/main.yml

131-131: label "windows-11-arm" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

🪛 YAMLlint (1.37.1)
.github/workflows/main.yml

[error] 139-139: wrong indentation: expected 6 but found 4

(indentation)

🔇 Additional comments (9)
build/scripts/perf/README.md (1)

3-5: Fix grammar and formatting issues in the new CI benchmarking section.

The content is valuable, but there are some formatting issues that should be addressed:

Apply this diff to fix grammar and spacing issues:

-> **CI Performance Benchmarking and Baseline Caching:**
-> This repository supports automated performance benchmarking in CI, with baseline result caching and manual override capabilities. Baseline results are cached per OS and SHA, and can be force-refreshed via workflow inputs. For details on usage, manual runs, and force options, see [docs/ci-performance.md](../../../docs/ci-performance.md).
+> **CI Performance Benchmarking and Baseline Caching:**  
+> This repository supports automated performance benchmarking in CI, with baseline result caching and manual override capabilities. Baseline results are cached per OS and commit SHA and can be force-refreshed via workflow inputs. For details on usage, manual runs, and force options, see [docs/ci-performance.md](../../../docs/ci-performance.md).
+>
⛔ Skipped due to learnings
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to **/* : All formatting and linting issues flagged by bots or CI must be resolved before requesting review or merging.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Address all feedback from automated bots (e.g., Codeclimate, formatting/linting bots) as you would human reviewers; resolve all formatting and linting issues flagged by bots or CI before requesting review or merging.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Address all feedback from automated bots (e.g., Codeclimate, formatting/linting bots) as you would human reviewers.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: When making changes, follow the workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues if any → Run/Update Tests → Fix test failures if any → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: When making changes, follow this workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues → Run/Update Tests → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Summarize all changes in the PR description and cite relevant lines from modified files for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: After rebasing or merging, review for duplicate or conflicting changes, especially in shared files or properties. Remove redundant changes and note this in the PR description.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: If adding an analyzer, also add a code fix, a benchmark, and documentation in 'docs/rules'.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .cursor/rules/codacy.mdc:0-0
Timestamp: 2025-07-19T08:09:35.137Z
Learning: If any issues are found in the new edits by `codacy_cli_analyze`, propose and apply fixes for them
build/scripts/perf/PerfCore.ps1 (3)

58-58: LGTM! Environment variable handling implemented correctly.

The $forceBaseline variable properly reads the FORCE_BASELINE environment variable to control baseline caching behavior.


65-74: LGTM! Baseline caching logic implemented correctly.

The logic properly:

  • Checks for existing cached baseline results
  • Respects the force baseline flag
  • Provides informative user feedback about cache usage
  • Sets the appropriate flag for downstream processing

80-80: LGTM! Parameter passing implemented correctly.

The useCachedBaseline parameter is properly passed to the baseline comparison script to control caching behavior.

build/scripts/perf/DiffPerfToBaseline.ps1 (3)

9-9: LGTM! New parameter for baseline caching implemented correctly.

The $useCachedBaseline parameter provides proper control over whether to use cached baseline results or run fresh benchmarks.


26-26: LGTM! Temp directory path updated for artifact consistency.

The path change to use the artifacts folder aligns with the caching strategy and CI workflow expectations.


36-53: LGTM! Baseline caching logic implemented correctly.

The conditional logic properly:

  • Checks for cached baseline availability
  • Provides informative feedback to users
  • Skips unnecessary git operations and benchmark runs when cached results exist
  • Maintains the existing baseline workflow when cache is not used
.github/workflows/main.yml (2)

4-15: Boolean inputs: prefer explicit string casting to avoid silent type coercion

GitHub will pass unchecked values from the UI as strings ('true', 'false'), yet the later if: expressions compare against the boolean literal true.
This mismatch is benign for workflow_dispatch events (it comes through as a string and you explicitly compare to 'true' later), but for scheduled runs github.event.inputs.* is undefined which becomes the empty string – not the literal false.
Consider normalising at the source to guarantee predictable values.

-      force_baseline:
+      force_baseline:
         ...
-        default: false
+        default: 'false'

…and then always compare with string equality in downstream conditionals.
This prevents edge-cases where the expression engine treats an empty value as truthy/falsy in surprising ways.


168-181: Step only works on PowerShell-enabled runners

pwsh is fine under Windows and the cross-platform dotnet image on Linux, but on macOS the pre-installed PowerShell may not exist or be outdated.
Either:

  1. Use the pwsh action: shell: pwsh {0} which installs PowerShell; or
  2. Convert to a portable Bash snippet.

Failure to do so will abort the macOS-matrix leg.

Comment on lines +150 to +156
- name: Download baseline performance cache
id: restore-baseline-cache
uses: actions/cache/restore@v4
with:
path: ./artifacts/performance/perfResults/baseline
key: baseline-performance-${{ matrix.os }}-${{ steps.get-baseline-sha.outputs.sha }}

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Jul 19, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Cache key risks hash-collision when baseline SHA changes across branches

The cache is keyed on ${{ steps.get-baseline-sha.outputs.sha }} only; if two different PRs reference the same baseline commit but diverge in BenchmarkDotNet parameters, stale artefacts might be used.
Add the BDN parameter hash (or workflow revision) to the key to ensure correctness.

🤖 Prompt for AI Agents
In .github/workflows/main.yml around lines 150 to 156, the cache key for the
baseline performance cache only uses the baseline SHA, which risks hash
collisions when different PRs share the same baseline commit but have different
BenchmarkDotNet parameters. To fix this, modify the cache key to include a hash
or identifier of the BenchmarkDotNet parameters or the workflow revision,
ensuring the cache key uniquely reflects both the baseline SHA and the
parameters to prevent stale artifact usage.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@coderabbitai create an issue to track this suggestion

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.

🧩 Analysis chain

I'll create an issue to track this cache key collision suggestion.

@rjmurillo I've created an issue to track the cache key collision suggestion. The issue will help ensure this improvement is properly prioritized and implemented in a future PR.


🏁 Script executed:

#!/bin/bash
# Create GitHub issue to track the cache key collision suggestion
gh issue create \
  --title "Performance cache key collision risk with shared baseline SHA across different BenchmarkDotNet parameters" \
  --body "## Problem

The performance workflow cache key in \`.github/workflows/main.yml\` currently only uses the baseline SHA (\`baseline-performance-\${{ matrix.os }}-\${{ steps.get-baseline-sha.outputs.sha }}\`), which creates a risk of hash collisions when different PRs reference the same baseline commit but have different BenchmarkDotNet parameters.

## Impact

If two different PRs share the same baseline commit but diverge in BenchmarkDotNet parameters, stale artifacts might be used, leading to incorrect performance comparisons.

## Suggested Solution

Modify the cache key to include a hash or identifier of the BenchmarkDotNet parameters or the workflow revision, ensuring the cache key uniquely reflects both the baseline SHA and the parameters.

For example:
\`\`\`
key: baseline-performance-\${{ matrix.os }}-\${{ steps.get-baseline-sha.outputs.sha }}-\${{ hashFiles('build/scripts/perf/**') }}
\`\`\`

## References

- PR: https://github.com/rjmurillo/moq.analyzers/pull/562
- Comment: https://github.com/rjmurillo/moq.analyzers/pull/562#discussion_r2217497278
- Requested by: @rjmurillo" \
  --assignee rjmurillo

Length of output: 1305


@rjmurillo Perfect! I've successfully created issue #564 to track the cache key collision risk. The issue includes:

  • A clear description of the problem with the current cache key implementation
  • The potential impact of hash collisions when different PRs share baseline commits
  • A suggested solution using hashFiles() to include BenchmarkDotNet parameter changes
  • Proper backlinks to this PR and comment thread
  • Assignment to you for future prioritization

The issue is now available at: #564


🧠 Learnings used
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: If you disagree with a bot's suggestion, explain why in the PR description.

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Address all feedback from automated bots (e.g., Codeclimate, formatting/linting bots) as you would human reviewers; resolve all formatting and linting issues flagged by bots or CI before requesting review or merging.

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: When making changes, follow this workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues → Run/Update Tests → Update Docs → Commit & PR.

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Summarize all changes in the PR description and cite relevant lines from modified files for clarity.

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {README.md,docs/rules/README.md} : Update README.md and docs/rules/README.md if workflows or rules change.

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.

Learnt from: rjmurillo
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-approve-and-auto-merge.yml:8-8
Timestamp: 2025-01-22T00:47:24.622Z
Learning: For the moq.analyzers repository, ARM64 runner migration can proceed without staged rollout as there are minimal dependencies, with policy configurations to be adjusted post-merge.

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Every pull request must include evidence of running code formatting, building with warnings as errors, and running all unit tests (console log/text or screenshots) in the PR description.

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Every pull request must include evidence of steps 1–3 in the PR description (console log/text or screenshots). Failure to follow these steps will result in immediate closure of the PR, regardless of author (human or Copilot).

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: When making changes, follow the workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues if any → Run/Update Tests → Fix test failures if any → Update Docs → Commit & PR.

Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Keep commit messages short and in the imperative mood (e.g., "Add Moq1200 tests").

Comment on lines +204 to +209
- name: Upload baseline performance cache
if: steps.restore-baseline-cache.outputs.cache-hit != 'true' || env.FORCE_BASELINE == 'true'
uses: actions/cache/save@v4
with:
path: ./artifacts/performance/perfResults/baseline
key: baseline-performance-${{ matrix.os }}-${{ steps.get-baseline-sha.outputs.sha }}
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.

⚠️ Potential issue

save step may overwrite a valid cache when FORCE_BASELINE is true

When forcing a baseline refresh the current job overrides the previously restored cache key, even if the perf run fails.
Protect against accidental corruption:

-      if: steps.restore-baseline-cache.outputs.cache-hit != 'true' || env.FORCE_BASELINE == 'true'
+      if: (steps.restore-baseline-cache.outputs.cache-hit != 'true') && (env.FORCE_BASELINE != 'true')

…and instead rely on a fresh key (e.g., append a timestamp) when FORCE_BASELINE is requested.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Upload baseline performance cache
if: steps.restore-baseline-cache.outputs.cache-hit != 'true' || env.FORCE_BASELINE == 'true'
uses: actions/cache/save@v4
with:
path: ./artifacts/performance/perfResults/baseline
key: baseline-performance-${{ matrix.os }}-${{ steps.get-baseline-sha.outputs.sha }}
- name: Upload baseline performance cache
- if: steps.restore-baseline-cache.outputs.cache-hit != 'true' || env.FORCE_BASELINE == 'true'
+ if: (steps.restore-baseline-cache.outputs.cache-hit != 'true') && (env.FORCE_BASELINE != 'true')
uses: actions/cache/save@v4
with:
path: ./artifacts/performance/perfResults/baseline
key: baseline-performance-${{ matrix.os }}-${{ steps.get-baseline-sha.outputs.sha }}
🤖 Prompt for AI Agents
In .github/workflows/main.yml around lines 204 to 209, the cache save step uses
a fixed key even when FORCE_BASELINE is true, which can overwrite a valid cache
if the performance run fails. To fix this, modify the cache key to append a
unique value like a timestamp when FORCE_BASELINE is true, ensuring a fresh
cache key is used and preventing accidental cache corruption.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (2)
.github/workflows/main.yml (2)

40-42: Unknown runner label windows-11-arm

Only self-hosted runners can use arbitrary labels. GitHub-hosted images expose windows-latest, windows-2022 etc., but no official windows-11-arm. Action-lint flags this.

Replace with either a supported label (windows-2022) or configure a self-hosted runner and add it to actionlint.yaml.


207-213: Potential cache corruption when FORCE_BASELINE is true

Using the same key while forcing a refresh can overwrite a good cache if the benchmark step later fails.
Safest approach: generate a fresh key when FORCE_BASELINE is requested.

-key: baseline-performance-${{ matrix.os }}-${{ steps.get-baseline-sha.outputs.sha }}
+key: baseline-performance-${{ matrix.os }}-${{ steps.get-baseline-sha.outputs.sha }}${{ env.FORCE_BASELINE == 'true' && format('-{0}', github.run_id) || '' }}
♻️ Duplicate comments (1)
.github/workflows/main.yml (1)

138-142: Invalid indentation – workflow will fail to parse

- uses: items must be 6 spaces deep under steps:. Action-lint already flags the error (expected 6 but found 4).
Without the correct indentation the entire performance job will be ignored.

-    steps:
-    - uses: actions/checkout@v4
+    steps:
+      - uses: actions/checkout@v4
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ca4209 and 3023beb.

📒 Files selected for processing (1)
  • .github/workflows/main.yml (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Summarize all changes in the PR description and cite relevant lines from modified files for clarity.
Learnt from: rjmurillo
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-approve-and-auto-merge.yml:8-8
Timestamp: 2025-01-22T00:47:24.622Z
Learning: For the moq.analyzers repository, ARM64 runner migration can proceed without staged rollout as there are minimal dependencies, with policy configurations to be adjusted post-merge.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Every pull request must include evidence of running code formatting, building with warnings as errors, and running all unit tests (console log/text or screenshots) in the PR description.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Keep commit messages short and in the imperative mood (e.g., "Add Moq1200 tests").
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Every pull request must include evidence of steps 1–3 in the PR description (console log/text or screenshots). Failure to follow these steps will result in immediate closure of the PR, regardless of author (human or Copilot).
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: When making changes, follow the workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues if any → Run/Update Tests → Fix test failures if any → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: When making changes, follow this workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues → Run/Update Tests → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .cursor/rules/conventional-commit-messages.mdc:0-0
Timestamp: 2025-06-25T12:42:55.421Z
Learning: Types other than feat and fix may be used in commit messages, such as build, chore, ci, docs, style, refactor, perf, and test, but only feat, fix, and breaking changes have implicit effects on Semantic Versioning.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Address all feedback from automated bots (e.g., Codeclimate, formatting/linting bots) as you would human reviewers; resolve all formatting and linting issues flagged by bots or CI before requesting review or merging.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/label-pr.yml:13-13
Timestamp: 2025-01-17T21:45:05.188Z
Learning: As of January 2025, GitHub-hosted ARM64 runners should use the syntax `ubuntu-24.04-arm` in GitHub Actions workflow files, as documented in the GitHub changelog.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/release.yml:24-24
Timestamp: 2025-01-17T21:44:35.686Z
Learning: As of January 2025, GitHub Actions supports ARM64 runners in public repositories (public preview). The runner specification format is `ubuntu-24.04-arm` for ARM64-based Ubuntu runners.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-auto-approve.yml:9-9
Timestamp: 2025-01-17T21:43:46.997Z
Learning: As of January 2025, GitHub Actions supports ARM64 runners in public preview. The runner label format is `ubuntu-24.04-arm` for ARM64 Ubuntu runners. This is available for free in public repositories.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-auto-approve.yml:9-9
Timestamp: 2025-01-17T21:44:17.410Z
Learning: GitHub Actions now supports ARM64 runners (as of January 2025) with labels like `ubuntu-24.04-arm`. These runners are available for free in public repositories during the public preview period.
.github/workflows/main.yml (22)
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to {README.md,docs/rules/README.md} : Update README.md and docs/rules/README.md if workflows or rules change.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: When testing code fixes that modify a class member, use a data-driven pattern: a public static IEnumerable<object[]> data source, a [Theory] test method with [MemberData], a static Template function with placeholders, and Verify.VerifyCodeFixAsync.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Cite relevant lines from modified files in PR summaries for clarity.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: After rebasing or merging, review for duplicate or conflicting changes, especially in shared files or properties. Remove redundant changes and note this in the PR description.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: After rebasing or merging, review for duplicate or conflicting changes, especially in shared files or properties, and remove redundant changes.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Address all feedback from automated bots (e.g., Codeclimate, formatting/linting bots) as you would human reviewers; resolve all formatting and linting issues flagged by bots or CI before requesting review or merging.
Learnt from: rjmurillo
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/dependabot-approve-and-auto-merge.yml:8-8
Timestamp: 2025-01-22T00:47:24.622Z
Learning: For the moq.analyzers repository, ARM64 runner migration can proceed without staged rollout as there are minimal dependencies, with policy configurations to be adjusted post-merge.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Address all feedback from automated bots (e.g., Codeclimate, formatting/linting bots) as you would human reviewers.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: Always check for and follow any new rules in .cursor/rules/, .editorconfig, and .github/copilot-instructions.md before making changes.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: When making changes, follow this workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues → Run/Update Tests → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.111Z
Learning: When making changes, follow the workflow: Edit/Add Code or Test → Run codacy_cli_analyze → Fix issues if any → Run/Update Tests → Fix test failures if any → Update Docs → Commit & PR.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Every pull request must include evidence of steps 1–3 in the PR description (console log/text or screenshots). Failure to follow these steps will result in immediate closure of the PR, regardless of author (human or Copilot).
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: Reference affected analyzer rule IDs in PR descriptions.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: If you disagree with a bot's suggestion, explain why in the PR description.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to **/* : All formatting and linting issues flagged by bots or CI must be resolved before requesting review or merging.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/label-issues.yml:14-14
Timestamp: 2025-01-17T21:44:41.600Z
Learning: As of January 2025, GitHub Actions ARM64 runners should use the syntax `ubuntu-24.04-arm` for the `runs-on` field, not the array syntax with separate OS and architecture labels.
Learnt from: MattKotsenas
PR: rjmurillo/moq.analyzers#325
File: .github/workflows/label-pr.yml:13-13
Timestamp: 2025-01-17T21:45:05.188Z
Learning: As of January 2025, GitHub-hosted ARM64 runners should use the syntax `ubuntu-24.04-arm` in GitHub Actions workflow files, as documented in the GitHub changelog.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .cursor/rules/conventional-commit-messages.mdc:0-0
Timestamp: 2025-06-25T12:42:55.421Z
Learning: Types other than feat and fix may be used in commit messages, such as build, chore, ci, docs, style, refactor, perf, and test, but only feat, fix, and breaking changes have implicit effects on Semantic Versioning.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .cursor/rules/conventional-commit-messages.mdc:0-0
Timestamp: 2025-06-25T12:42:54.674Z
Learning: Types other than 'feat' and 'fix' (such as build, chore, ci, docs, style, refactor, perf, test) may be used in commit messages, but only 'feat', 'fix', and breaking changes have implicit effects on Semantic Versioning.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.037Z
Learning: Applies to **/*.cs : If a step can fail, code the failure path first and make it obvious. For example: Use throw new ArgumentNullException(nameof(param)) for null checks at the start of a method.
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-25T12:42:47.110Z
Learning: If a step can fail, code the failure path first and make it obvious (e.g., throw new ArgumentNullException, Debug.Assert, Contract.Requires, Assert.Throws in tests).
Learnt from: CR
PR: rjmurillo/moq.analyzers#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-19T08:09:21.038Z
Learning: Reference affected analyzer rule IDs in PR descriptions.
🪛 actionlint (1.7.7)
.github/workflows/main.yml

131-131: label "windows-11-arm" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

🪛 YAMLlint (1.37.1)
.github/workflows/main.yml

[error] 139-139: wrong indentation: expected 6 but found 4

(indentation)

Comment on lines +171 to +197
- name: Publish baseline performance summaries to GitHub
if: success() || failure()
shell: pwsh
run: |
$resultsDir = "artifacts/performance/perfResults/baseline/results"
if (Test-Path $resultsDir) {
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "### Baseline Performance Results"
$files = Get-ChildItem -Path $resultsDir -Filter "*-report-github.md" | Sort-Object Name
foreach ($file in $files) {
Get-Content $file.FullName | Out-File -Append -FilePath $env:GITHUB_STEP_SUMMARY
}
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "---"
}

- name: Publish performance summaries to GitHub
if: success() || failure()
shell: pwsh
run: |
$resultsDir = "artifacts/performance/perfResults/perfTest/results"
if (Test-Path $resultsDir) {
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "### Current Performance Results"
$files = Get-ChildItem -Path $resultsDir -Filter "*-report-github.md" | Sort-Object Name
foreach ($file in $files) {
Get-Content $file.FullName | Out-File -Append -FilePath $env:GITHUB_STEP_SUMMARY
}
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "---"
}
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.

🧹 Nitpick (assertive)

Duplicate summary-publishing blocks – DRY this via a reusable step

The two blocks differ only in directory path and header. Extract into a small composite action or PowerShell function that accepts resultsDir and header as inputs to cut duplication and future drift.

🤖 Prompt for AI Agents
In .github/workflows/main.yml around lines 171 to 197, there are two nearly
identical steps for publishing performance summaries differing only by directory
path and header text. Refactor by creating a reusable PowerShell function or
composite GitHub Action that takes parameters for the results directory and
header. Replace both steps with calls to this reusable component, passing the
appropriate directory and header values to eliminate duplication and simplify
maintenance.

Comment on lines +124 to +127
# Run if manually dispatched (with input), on schedule, or if explicitly requested
if: |
(github.event_name == 'schedule' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_performance == 'true')
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.

⚠️ Potential issue

performance job never runs on PRs – contradicts PR objectives

The condition omits the pull_request event, yet the PR description states “triggered on pull requests”.
Add the PR path to avoid silently skipping performance validation for every PR.

-      (github.event_name == 'workflow_dispatch' && github.event.inputs.run_performance == 'true')
+      (github.event_name == 'workflow_dispatch' && github.event.inputs.run_performance == 'true') ||
+      (github.event_name == 'pull_request')
🤖 Prompt for AI Agents
In .github/workflows/main.yml around lines 124 to 127, the condition for running
the performance job excludes the pull_request event, which contradicts the PR
description stating it should trigger on pull requests. Modify the if condition
to also include the pull_request event so that the performance job runs on PRs
as intended, ensuring performance validation is not skipped during pull
requests.

@rjmurillo rjmurillo self-assigned this Jul 19, 2025
@rjmurillo rjmurillo merged commit 7170b2d into main Jul 19, 2025
24 checks passed
@rjmurillo rjmurillo deleted the feature/issue-553 branch July 19, 2025 23:37
@rjmurillo rjmurillo added this to the vNext milestone Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build documentation feature github_actions Pull requests that update GitHub Actions code releasable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redesign “Validate performance” CI Step for Actionable Results and Lower Cost

3 participants