Skip to content

Add onboarding pre-flight to changelog validate - #4024

Open
Mpdreamz wants to merge 1 commit into
feat/changelog-bundle-per-product-repofrom
feat/changelog-validate-onboarding-preflight
Open

Add onboarding pre-flight to changelog validate#4024
Mpdreamz wants to merge 1 commit into
feat/changelog-bundle-per-product-repofrom
feat/changelog-validate-onboarding-preflight

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Sep 2, 2026

Copy link
Copy Markdown
Member

changelog validate now fails fast before any file discovery when the calling repository is not registered in products.yml, posting a copy-pasteable YAML snippet so the repo owner can self-serve the fix.

Affects: changelog validate command, PR comment body, GithubDecisionMetadata

Prompt summary: Part of the multi-PR plan to fix changelog gh-release crashing on empty repo and model the one-repo-to-many-products relationship. This PR (4 of 5) adds the onboarding pre-flight gate so unregistered repositories get a blocking but actionable PR comment instead of a misleading error deep in file validation.

Why

A repository that runs release-notes.yml but is not registered in products.yml would previously fail deep in file discovery with an unhelpful error — or succeed silently when there happened to be no changelog files. Failing before any file or GitHub API work, with a message that includes the exact YAML to add, makes the fix self-serve.

What

Pre-flight check in validate-entries

ChangelogEntryValidationService.ValidateEntries now calls GetProductsByRepositoryName(input.Repo) before label resolution and file discovery. Empty result → error + ValidationGate.Onboarding metadata + return false. All matching products with ReleaseNotes == None → same.

New ValidationGate.Onboarding and RenderRepositoryNotOnboarded

GithubDecisionMetadata.ValidationGate gains the Onboarding variant. ChangelogCommentRenderer.RenderRepositoryNotOnboarded renders a copy-pasteable products.yml snippet with a link to the catalog reference doc. ChangelogGithubCommentService.SelectBody dispatches on Gate.Onboarding before any other gate.

WriteMetadataAsync gate parameter

The private helper gains an optional gate parameter (defaulting to ValidationGate.Entries) so the pre-flight can write Onboarding without duplicating the entire metadata construction.

Verify

dotnet test tests/Elastic.Changelog.Tests/ --filter "FullyQualifiedName~ChangelogEntryValidationServiceTests|FullyQualifiedName~ChangelogCommentRendererTests|FullyQualifiedName~ChangelogGithubCommentServiceTests"

Stack: 4 of 5, on top of #4023

validate-entries now fails fast when the calling repository is not registered
in products.yml or all matching products have release notes disabled — before
any file discovery or GitHub API calls. Gate.Onboarding is written to the
decision metadata so the comment service renders a copy-pasteable products.yml
snippet pointing the repo owner at the self-serve path.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant