Skip to content

List pull requests that lack a label on the release notes preview - #5032

Merged
Mpdreamz merged 7 commits into
mainfrom
feature/preview-diagnostics
Nov 24, 2026
Merged

Mpdreamz merged 7 commits into
mainfrom
feature/preview-diagnostics

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

The release notes preview no longer fails when a pull request lacks a product or area label. It lists those pull requests, with the labels to add, on a new Diagnostics page, and it calls the serverless preview releases Staging and Edge, with the date each would get if it shipped today.

Affects: Release notes, Isolated builds, CLI

Prompt summary: The first dry run of the Elastic Cloud Hosted preview failed because four elastic/cloud pull requests had no product label, and one such pull request failed the whole hourly run. Make the preview tolerate them, and add a page on changelogs.elastic.dev that surfaces them so people can find and fix them. Also name the serverless preview releases in words a casual reader understands (Staging and Edge), and show the date each would get if it shipped today.

Why

elastic/cloud maps two products (ECE and ECH) and has no default, so a merged pull request without @Product:ECE or @Product:ECH is an error in the bundler. For the published release notes that is right. For a preview it hides the very thing a writer has to find, and it stops the DRA products from publishing as well. The same holds for the area label where a repository requires one.

What

Tolerating a missing label in a preview

release preview bundle now bundles a pull request without a required product or area label anyway: under the product of the bundle profile, and without an area. It also records a pull request with no type label, which the bundler already defaulted to other. release unified bundle and release serverless are unchanged: without the new PreviewProblemLog the old errors stay.

The problems file

The run writes _diagnostics/preview-problems.json in the output folder: product, release, problem, pull request and the labels that would fix it. The scrubber's allowlist from assembler.yml applies when the file is written. A pull request of a private repository is kept as repository and number only, so its link and title never reach disk.

The Diagnostics page

release preview build reads the file and adds a diagnostics.md page with a nav entry and a link on the index. It groups problems by product, release and kind, with a count and the labels to add. Titles come from GitHub, so they are escaped, including the characters that would turn a URL or an address in a title into a link.

The page exists whenever release preview bundle checked, even with nothing to list: it says what it is for and that no pull request lacks a label. Without the file the folder was not checked, as with release unified bundle, and the site has no page, as before. Only release preview build shows the page, so a folder reused by release unified build puts nothing of it on its site.

Each repository of a release names its own labels, because each maps its own. A run limited by --products or --services keeps the problems of the bundles it did not refresh. A missing type label is reported only for a repository that maps labels to types.

Names and date of the serverless releases

The release that ends at the tip of the base branch is Edge (label and URL edge, before head), next to Staging. Each page opens with one plain sentence on what it holds, and says what the release would be named if it shipped today, because a serverless release is named by the day it ships. That day is the UTC day of the build. A run also removes the head bundles of a folder reused from before the rename.

Verify

dotnet test --project tests/Elastic.Changelog.Tests --treenode-filter "/*/*/BundleGitRefTests/*"
dotnet test --project tests/Elastic.Changelog.Tests --treenode-filter "/*/*/PreviewProblemLogTests/*"
dotnet test --project tests/Elastic.Documentation.Build.Tests --treenode-filter "/*/*/UnifiedReleaseNotesTests/*"
GITHUB_TOKEN=$(gh auth token) docs-builder release preview bundle --services kibana --products kibana --output-dir bundles
docs-builder release preview build --bundles-dir bundles --output site

Open site/diagnostics/index.html. A run against Kibana and ECH listed 7 Kibana pull requests with no type label. ECH had none, because cloud has since excluded the four pull requests with @No_Release_Notes, so the page for a private repository is covered by tests and has not been seen on live data.

Out of scope: A service that fails for another reason, such as a lost token, still fails the whole run. I did not isolate services from each other: a swallowed failure would drop its sections from the site without an alert. A pull request that no label can place, such as an entry without any fallback product, is still an error.

Stack: includes #5035, the Edge and Staging rename, merged into this branch.

Risk: The page names pull requests of private repositories by repository and number. The site is behind Okta. A pull request title of a public repository is rendered as text on the page. The page of the Edge release moves from /head to /edge: the /head pages were live for a few hours, so a link to one breaks. The page content changes daily with the date, so the hourly workflow must publish daily (docs-internal-workflows#1281).

release preview bundle no longer fails when a pull request lacks the product or area label that its repository requires. It bundles the pull request under the product of the profile and records it. It also records a pull request without a type label. release preview build turns the records into a diagnostics page, by product and release, with the labels to add. A pull request of a private repository is named by repository and number, without a link or a title.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner November 24, 2026 11:02
@Mpdreamz
Mpdreamz requested a review from reakaleek November 24, 2026 11:02
Comment on lines +373 to +377
if (!options.TolerateMissingLabels)
{
collector.EmitError(pr.Url, ProductResolution.MissingProductLabelMessage($"PR {pr.Url}", config));
return (Row(pr, GitRangePrSourceKind.Missing), null, true);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

When pivot.required includes products, tolerating a missing label still leaves the entry on products.default rather than the preview profile’s output product. If the default is for another product, rules.bundle can drop the entry and fail the whole preview when it was the only note. Use the profile fallback for this tolerance case, including when evaluating product-specific rules.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changing this. It needs pivot.required to list products and products.default to name a different product than the profile's. In that case the default is the repository's own statement of where an unlabeled pull request goes, and the preview should not override it. If a preview run ever fails on it, the error names the pull request.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree that products.default is the normal resolution for an unlabeled PR; the concern is specifically the preview-tolerance path. The option’s documented contract says a tolerated missing product label is built under the profile/CLI fallback (resolver options), but resolution currently checks products.default before that fallback, even when tolerance lets the PR through (product resolution, fallback order). If that default is a different product, the bundle filter can then remove the synthesized entry and fail on an empty result (filter and empty-result error). The missing-label problem can identify the PR, but that does not prevent the preview output from failing. Whether preview should honor the repository default rather than its target fallback is a policy choice; the current documented tolerance behavior and this failure mode are why I raised it.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Comment on lines +382 to +386
ReportProblem(options, pr, summary, PreviewProblemKind.MissingAreaLabel, config.LabelToAreas?.Keys);
if (!options.TolerateMissingLabels)
{
collector.EmitError(pr.Url, AreaResolution.MissingAreaLabelMessage($"PR {pr.Url}", config));
return (Row(pr, GitRangePrSourceKind.Missing), null, true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

A required area label can still stop the preview: with rules.bundle.include_areas, the synthesized entry has no area and is filtered out. If it is the only entry in the range, bundling fails before the diagnostics file is written. Handle this case explicitly in preview mode without weakening the published bundle’s filter.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changing this either. A repository that requires an area label and filters bundles by include_areas drops an unlabeled entry on purpose in the published bundle, and the preview applies the same filter, which is what keeps it 1:1. The failure only happens when that entry is the only note of a range, and the run then fails with its usual message.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree the published bundle should continue excluding an unlabeled entry under include_areas; the concern is the preview’s diagnostics, not changing that filter. The synthesized entry has no areas, and an include-area blocker explicitly blocks entries with no areas (entry synthesis, blocker behavior). When it is the only note, the range then fails as you describe; that failure makes preview return before it writes the diagnostics file (empty-range handling, preview early return and later file write). So keeping the published filter 1:1 does not address the finding: the preview can preserve that filtering while still recording the missing-area problem and writing its diagnostics.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

@github-actions

Copy link
Copy Markdown
Contributor

The page used to vanish, with its nav entry and index link, when no pull request lacked a label. It now exists whenever release preview bundle checked, says what it is for, and says that nothing needs fixing. Without a problems file the folder was not checked and there is still no page.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment on lines +88 to +90
problems = JsonSerializer.Deserialize(fileSystem.File.ReadAllText(path), PreviewProblemsJsonContext.Default.PreviewProblems)?.Items
?? [];
return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

Only a valid items array should count as a completed check. A diagnostics file containing null, {}, or {"items":null} is treated the same as {"items":[]}, so the build publishes an all-clear even though the file contains no check results.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

The page is built only when release preview build asks for it, so a folder reused by release unified build puts no private pull request on its site. Each repository of a release names its own labels. A run limited by --products or --services keeps the problems of the bundles it did not refresh. A repository without a type mapping reports no missing type, because no label could fix it. Titles also escape the caret, the log counts pull requests once, and the fixtures use a synthetic private repository.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment on lines +31 to +33
var products = new HashSet<string>(refreshedProducts, StringComparer.Ordinal);
var repositories = new HashSet<(string, string)>(refreshedRepositories);
return [.. existing.Where(p => !products.Contains(p.Product) && !repositories.Contains((p.Product, p.Repo))), .. fresh];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P2 (Medium)

Track refreshed DRA bundles by product and release, not just product. A partial run can refresh a new version of a selected product while leaving its older bundles on disk. This filter drops the older versions’ diagnostics anyway, so the preview can still show their release notes while no longer listing the missing labels.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Comment on lines +119 to +123
var fresh = problems.ToProblems(allowRepos);
var written = PartialRun(products, services) && PreviewProblemsFile.TryRead(fileSystem, rootOutput.FullName, out var existing)
? PreviewProblemMerge.Merge(existing, fresh, RefreshedDraProducts(products), RefreshedRepositories(selected))
: fresh;
PreviewProblemsFile.Write(fileSystem, rootOutput.FullName, written);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P2 (Medium)

Apply the current allowlist to retained diagnostics as well as fresh ones. If assembler.yml now marks an unrefreshed repository private, a partial run copies its old PR links and titles into the new diagnostics file, and preview build renders them. Clear those fields on the merged list before writing it.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Mpdreamz and others added 2 commits November 24, 2026 15:03
The page builder used AppendLine, which writes CRLF on Windows. The
page test matches on LF and failed on the Windows build.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…5035)

* Call the serverless preview releases Staging and Edge, and date them

HEAD and staging mean little to someone who browses the release notes. The release that ends at the tip of the base branch is now Edge, its page is /edge, and each page says in plain words what it holds. A serverless release is named by the day it ships, so each page also says what the release would be named if it shipped on the day of the build.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Compare the diagnostics page with LF line endings in its test

AppendLine writes CRLF on Windows, so the multi-line Contain
expectations failed there.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Address review of the Edge rename and fix the diagnostics page on Windows

A run removes the head bundle of a reused folder as well, the Edge description says the default branch because Elastic Cloud Hosted uses master, and the date reaches the rendered pages through the build service, with a test. The diagnostics page was written with the line endings of the platform, which broke its test on Windows. It uses line feeds everywhere now.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
/// The labels whose bundles a run removes: the current ones, and <c>head</c>, which the edge release was called. A folder reused
/// since then still holds a <c>head</c> bundle, and the site build would publish it as a release of its own.
/// </summary>
private static readonly string[] CleanupLabels = [StagingLabel, EdgeLabel, "head"];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

Once a service is refreshed, deleting its head bundle removes the old preview URL and its section URLs without a redirect. Shared links such as /cloud-serverless/head/known-issues/ stop working even when the same preview remains available under /edge/. Keep the existing URLs or redirect them to the corresponding Edge pages.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same answer as before, and I am not adding redirects. The head URLs were live for a few hours on an internal, Okta-gated site that is rebuilt from scratch every hour. The pages are at /edge and the index lists them. A redirect is a line in the site's redirect file if a link turns out to matter.

A run removes the bundles of the release that was called head for all services, so refreshing one service no longer leaves another's stale head bundle to be published next to Edge. The Edge text no longer says it includes everything on Staging, which is not true when the default branch reverts a change that staging still runs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A service drops its own head bundle together with its replacement, and the head bundles of the services a run did not refresh are removed after every service succeeded. A run that fails, for example on the first GitHub request, leaves the last good bundles where they were.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

// Only now, when every service succeeded: the services this run did not refresh may still hold a bundle of the release that was
// called head, and the site would publish it next to Edge. A run that failed leaves the last good bundles where they were.
ServerlessPreviewBundles.RemoveLegacy(rootOutput, _logger);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

Add a command-level regression test for a refresh that fails with legacy head bundles on disk. The helper tests don't exercise when global cleanup runs, so moving this call back before the service loop would still pass them while deleting the failed service's last good preview.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed that nothing in the unit tests pins the order, and I cannot add one: the command classes are internal to the tooling assembly, and a test would need the GitHub API. I checked it against the real API in both directions instead. With a bad token the run failed on the first comparison and both head bundles were still on disk. A good Kibana-only run removed Kibana's with its replacement and Elasticsearch's in the final sweep. The helper tests cover Replace and the sweep, and dropping the per-service removal fails one of them. Leaving it.

@Mpdreamz
Mpdreamz merged commit 251a5bb into main Nov 24, 2026
44 checks passed
@Mpdreamz
Mpdreamz deleted the feature/preview-diagnostics branch November 24, 2026 15:18
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