Skip to content

Add skip-labels to evaluate-pr's output#3013

Open
cotti wants to merge 12 commits intomainfrom
feature/describe-skip-label
Open

Add skip-labels to evaluate-pr's output#3013
cotti wants to merge 12 commits intomainfrom
feature/describe-skip-label

Conversation

@cotti
Copy link
Copy Markdown
Contributor

@cotti cotti commented Apr 1, 2026

This pull request enhances the PR evaluation process in the ChangelogPrEvaluationService by adding support for collecting and outputting labels that cause a PR to be skipped due to exclusion rules. The main focus is on improving traceability and diagnostics when PRs are skipped based on label configurations.

Key changes:

Skip label handling and output:

  • Added a new method, CollectExcludeLabels, which gathers all unique exclude-mode labels from both global and per-product CreateRules. This method returns a comma-separated string of labels or null if none are configured.
  • Modified the skip check logic in EvaluatePr to collect skip labels and pass them to the output when a PR is skipped due to all products being blocked by label rules.
  • Updated the SetOutputs method to accept an optional skipLabels parameter and output it as skip-labels when present. [1] [2]
  • Ensured that when a PR is evaluated without required labels, the collected skip labels are included in the outputs for better diagnostics.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b6265bb8-a645-4cfb-a894-ec5e3e5defba

📥 Commits

Reviewing files that changed from the base of the PR and between cb6bf44 and 5dcf757.

📒 Files selected for processing (2)
  • src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs
  • tests/Elastic.Changelog.Tests/Evaluation/ChangelogPrEvaluationServiceTests.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs

📝 Walkthrough

Walkthrough

The PR evaluation service now aggregates exclude-mode labels from create rules (global and per-product), case-insensitively deduplicates them, and produces a comma-joined skipLabels string via a new internal CollectExcludeLabels method. SetOutputs now accepts an optional skipLabels parameter and, when provided, emits the GitHub Actions output skip-labels. EvaluatePr threads skipLabels into SetOutputs when skipping due to label rules or when the result is NoLabel.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant PR as PR (labels)
participant CFG as CreateRules (global & by-product)
participant Svc as ChangelogPrEvaluationService
participant GH as GitHub Actions (outputs)

PR->>Svc: Trigger EvaluatePr
Svc->>CFG: Read create rules
CFG-->>Svc: Return rules
Svc->>Svc: CollectExcludeLabels(createRules)
Svc-->>Svc: Evaluate PR labels vs excludeLabels
alt PR matches exclude
    Svc->>Svc: SetOutputs(status: skipped, skipLabels)
    Svc->>GH: Emit outputs (status=skipped, skip-labels)
else PR has no type label
    Svc->>Svc: SetOutputs(status: no-label, skipLabels)
    Svc->>GH: Emit outputs (status=no-label, skip-labels)
else normal processing
    Svc->>Svc: SetOutputs(status: processed)
    Svc->>GH: Emit outputs (status=processed)
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding skip-labels output to the evaluate-pr functionality.
Description check ✅ Passed The description clearly explains the feature being added, the methods involved, and the purpose of the changes with relevant context about skip label handling.

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

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature/describe-skip-label

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

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.

🧹 Nitpick comments (1)
src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs (1)

220-221: Discard assignment is unnecessary.

HashSet.Add return value doesn't need explicit discard.

Suggested simplification
 		if (createRules is { Mode: FieldMode.Exclude, Labels.Count: > 0 })
 		{
 			foreach (var label in createRules.Labels)
-				_ = labels.Add(label);
+				labels.Add(label);
 		}

 		if (createRules.ByProduct is { Count: > 0 })
 		{
 			foreach (var (_, productRules) in createRules.ByProduct)
 			{
 				if (productRules is { Mode: FieldMode.Exclude, Labels.Count: > 0 })
 				{
 					foreach (var label in productRules.Labels)
-						_ = labels.Add(label);
+						labels.Add(label);
 				}
 			}
 		}

Also applies to: 230-231

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs`
around lines 220 - 221, The discard assignment is unnecessary when calling
HashSet.Add; inside the loops that iterate createRules.Labels (the block using
labels.Add) remove the "_ =" discard and call labels.Add(label) directly; apply
the same change to the similar loop at the other occurrence (the one around
lines referencing createRules.Labels again) so both uses of HashSet.Add omit the
redundant discard.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs`:
- Around line 220-221: The discard assignment is unnecessary when calling
HashSet.Add; inside the loops that iterate createRules.Labels (the block using
labels.Add) remove the "_ =" discard and call labels.Add(label) directly; apply
the same change to the similar loop at the other occurrence (the one around
lines referencing createRules.Labels again) so both uses of HashSet.Add omit the
redundant discard.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cb8c87b6-5f56-49e1-b75f-951a9e8c7c15

📥 Commits

Reviewing files that changed from the base of the PR and between e578fac and a58de4d.

📒 Files selected for processing (1)
  • src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs

Copy link
Copy Markdown
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

Lgtm, maybe add a quick unit test?

cotti and others added 10 commits April 2, 2026 12:30
* Fix redirect tests

* Remove changelog redirects implemented elsewhere
)

Elasticsearch Serverless now defaults semantic_text to Jina, making
the explicit Jina sub-fields redundant and the ELSER inference ID
unnecessary. This removes both inference ID constants, all .jina
field mappings, and lets semantic_text fields use the platform default.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Made with ❤️️ by updatecli

Co-authored-by: elastic-observability-automation[bot] <180520183+elastic-observability-automation[bot]@users.noreply.github.com>
The deploy apply command used RealRead which lacks AllowedSpecialFolder.Temp,
causing ScopedFileSystemException when AwsS3SyncApplyStrategy stages files
in /tmp/ for S3 upload. Switch to RealWrite which permits temp directory access.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… PRs (#2971)

Add IsAotCompatible to 12 library projects referenced by docs-builder so
Roslyn's trim/AOT analyzers (IL2026/IL3050) run during regular builds.
This catches AOT issues at compile time, removing the need for the
expensive native ILC publish step on pull requests.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* HTML: Omit version meta tags for versionless pages

Versionless pages (serverless, cloud, etc.) were rendering the sentinel
value 99999.0+ in product_version and DC.identifier meta tags. Now these
tags are omitted entirely when the page's versioning system is versionless.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* HTML: Restore required modifier on CurrentVersion property

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…3025)

* Layout: Adapt to static elastic-nav by making secondary nav sticky

The global elastic-nav.js (v2026-03) changed the header from fixed to
static positioning. This makes the secondary docs nav sticky at the top
and simplifies --offset-top to match its height.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Layout: Only make secondary nav sticky on md+ viewports

On mobile the sticky secondary nav takes too much vertical space.
Keep it static on small screens (--offset-top: 0) and only sticky
on md+ where it provides persistent navigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: Upgrade lodash to 4.18.x to fix high severity vulnerabilities

Fixes code injection via _.template (GHSA-r5fr-rjxr-66jc) and
prototype pollution via _.unset/_.omit (GHSA-f23m-r3pf-42rh).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Layout: Add bottom border to secondary nav

The visual separator was coming from #main-container's border-top,
which scrolls away. Adding border-b to the nav itself keeps the
line visible while sticky.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Layout: Remove border-top from main-container

The secondary nav now has border-b, so the main-container border-t
was causing a double border.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cotti cotti requested a review from a team as a code owner April 2, 2026 15:44
…-label

# Conflicts:
#	tests/Elastic.Changelog.Tests/Evaluation/ChangelogPrEvaluationServiceTests.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants