Skip to content

changelog: restructure S3 layout to artifact-root#3562

Open
cotti wants to merge 3 commits into
mainfrom
feature/folder_structure
Open

changelog: restructure S3 layout to artifact-root#3562
cotti wants to merge 3 commits into
mainfrom
feature/folder_structure

Conversation

@cotti

@cotti cotti commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restructures the changelog/bundle S3 layout from product-first to artifact-root: bundles are product-scoped at bundle/{product}/{file}; changelog entries are stored once per authoring repo at changelog/{repo}/{file}. This decouples repository concerns (entries) from product concerns (bundles) and removes the developer-foreknowledge requirement for entry distribution.
  • Producer (changelog upload): entries keyed by repo (--repo > bundle.repo > git remote), bundles keyed by product; scope-aware registry.json and RegistryKey.IsRegistry.
  • Consumers/bundling: CDN fetchers use the new paths, entry sourcing reads the authoring repo's pool, the gate is decoupled from product declaration, and ResolveCdnBundleUrl -> bundle/{product}/{file}.
  • Scrubber Lambda: detect bundles by the bundle/ key prefix (the old /bundle/ substring check silently breaks under the new layout).
  • CLI: add --repo/--owner to changelog upload; docs/cli-schema.json regenerated.
  • Tests + docs updated; new anonymized elastic/cloud-shaped profile fixture.

Part of the changelog folder restructure. Refs elastic/docs-eng-team#413. Companion PRs in elastic/docs-actions and elastic/docs-infra.

Important

Org CI consumes docs-builder via edge, so this propagates to all consumers on release — deploy the scrubber Lambda in lockstep. End-to-end CDN smoke (bundle-fetch / {changelog} cdn:) only validates after the first publish under the new layout.

Test plan

  • dotnet format clean
  • ./build.sh build --skip-dirty-check (lint + compile) clean
  • Native-AOT publish of the CLI and the scrubber Lambda — no trim/AOT warnings
  • Elastic.Changelog.Tests (760) and Elastic.Documentation.Configuration.Tests (416) green
  • docs/cli-schema.json stable vs. regenerated (CI schema check)

Made with Cursor

Move changelog/bundle S3 keys from product-first to artifact-root: bundles are
product-scoped under bundle/{product}/{file}; changelog entries are stored once
per authoring repo under changelog/{repo}/{file}. This decouples repository
concerns (entries) from product concerns (bundles) and removes the developer-
foreknowledge requirement for entry distribution.

- upload: entries -> changelog/{repo}/{file} (repo via --repo > bundle.repo > git
  remote); bundles -> bundle/{product}/{file}
- registries: bundle/{product}/registry.json and changelog/{repo}/registry.json;
  scope-aware grouping and RegistryKey.IsRegistry validation
- CDN consumers + bundling: repo-scoped entry sourcing, decoupled gate,
  ResolveCdnBundleUrl -> bundle/{product}/{file}
- scrubber Lambda: detect bundles by the bundle/ key prefix
- CLI: add --repo/--owner to `changelog upload`; regenerate cli-schema.json
- tests + docs updated; new cloud-shaped profile fixture

Refs elastic/docs-eng-team#413

Co-authored-by: Cursor <cursoragent@cursor.com>
@cotti cotti requested review from a team as code owners June 24, 2026 16:29
@cotti cotti requested a review from reakaleek June 24, 2026 16:29
@cotti cotti temporarily deployed to integration-tests June 24, 2026 16:29 — with GitHub Actions Inactive
@cotti cotti added the feature label Jun 24, 2026
@cotti cotti self-assigned this Jun 24, 2026
@cotti cotti changed the title changelog: restructure S3 layout to artifact-root (Option AD) changelog: restructure S3 layout to artifact-root Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

An error occurred during the review process. Please try again later.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1ce43895-f587-46ac-aea2-c665e19d18e8

📥 Commits

Reviewing files that changed from the base of the PR and between 0fc045f and 820e382.

📒 Files selected for processing (2)
  • src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs
  • src/services/Elastic.Changelog/Uploading/RegistryKey.cs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/services/Elastic.Changelog/Uploading/RegistryKey.cs
  • src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs

📝 Walkthrough

Walkthrough

The changelog pipeline now uses changelog/{repo}/... for entry objects and bundle/{product}/... for bundle objects. Upload target generation, registry refresh, registry key validation, CDN entry fetching, bundle CDN URL construction, bundle sourcing gates, scrubber path matching, CLI upload arguments, and related documentation and tests were updated to match the new layout.

Possibly related PRs

  • elastic/docs-builder#3434: Updates the same changelog scrubber key classification and bundle-path handling that this PR further changes.
  • elastic/docs-builder#3470: Touches the same CDN changelog entry fetching and registry indexing flow that this PR retargets from product scope to repo scope.
  • elastic/docs-builder#3436: Updates the same CDN directive and bundle registry URL construction that this PR rewrites for the new bundle/{product}/... layout.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.68% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: restructuring the changelog S3 layout to an artifact-root scheme.
Description check ✅ Passed The description is clearly aligned with the pull request changes and objectives, covering the new S3 layout and related updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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/folder_structure

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/development/changelog-bundle-registry.md`:
- Around line 111-112: The producer details section is inconsistent after the
repo-scope update: the bullet that still says “for each product” needs to match
the new changelog-entry path model. Update the affected wording in
changelog-bundle-registry.md so the bullet in the producer details section
refers to repo-scoped entry registries instead of product-scoped processing,
keeping it consistent with the bundle/product and entry/repo grouping described
nearby.

In `@src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs`:
- Around line 787-797: Normalize merged bundle repo values before they are used
to build CDN keys in ChangelogBundlingService, not just owner/repo inputs.
Update NormalizeRepo so it also maps combined defaults like elasticsearch+kibana
to the repo segment expected by the repo-scoped CDN layout, and ensure
BundleChangelogs and PlanBundleAsync both use the normalized value when
composing changelog/…/registry.json paths. Keep the behavior for null, empty,
and simple repo names unchanged.

In `@src/services/Elastic.Changelog/Uploading/RegistryKey.cs`:
- Around line 18-21: The RegistryKey validation currently allows dots in both
bundle and changelog registry segments, but bundle product scopes must stay
limited to the bundle upload pattern. Update the matching logic in RegistryKey
so IsRegistry only accepts dot-containing names for the changelog/{repo} form,
while bundle/{product}/registry.json remains restricted to the existing bundle
character class. Keep the regex or segment checks aligned with the scrubber
behavior so unchanged JSON is only passed through for valid bundle or changelog
registry keys.

In `@src/tooling/docs-builder/Commands/ChangelogCommand.cs`:
- Around line 1659-1664: The repo resolution in ChangelogCommand is using the
process current directory, which can pick up the wrong remote when --config or
--directory targets another checkout. Update the logic around
GitRemoteConfigurationReader.TryReadOriginUrl, Paths.FindGitRoot, and
resolvedRepo to derive the git root from the upload source (configPath or upload
directory) first, and only fall back to Directory.GetCurrentDirectory() when no
source-specific root is available. Ensure the repo lookup still flows through
GitHubRemoteParser.TryParseGitHubComOwnerRepo and the existing
repoCli/bundleConfig fallback order.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5adba39d-1fdc-491f-ada6-5aefa9463e1b

📥 Commits

Reviewing files that changed from the base of the PR and between 2d8a676 and c0413cb.

📒 Files selected for processing (25)
  • docs/cli-schema.json
  • docs/cli/changelog/cmd-upload.md
  • docs/contribute/configure-changelogs-ref.md
  • docs/development/changelog-bundle-registry.md
  • src/Elastic.Documentation.Configuration/ReleaseNotes/CdnChangelogEntryFetcher.cs
  • src/Elastic.Documentation.Configuration/ReleaseNotes/CdnChangelogFetcher.cs
  • src/Elastic.Documentation.Configuration/ReleaseNotes/ChangelogRegistry.cs
  • src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs
  • src/infra/docs-lambda-changelog-scrubber/Program.cs
  • src/infra/docs-lambda-changelog-scrubber/README.md
  • src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs
  • src/services/Elastic.Changelog/Uploading/ChangelogUploadService.cs
  • src/services/Elastic.Changelog/Uploading/Registry.cs
  • src/services/Elastic.Changelog/Uploading/RegistryBuilder.cs
  • src/services/Elastic.Changelog/Uploading/RegistryKey.cs
  • src/tooling/docs-builder/Commands/ChangelogCommand.cs
  • tests/Elastic.Changelog.Tests/Changelogs/BundleCdnSourcingTests.cs
  • tests/Elastic.Changelog.Tests/Changelogs/BundlePlanTests.cs
  • tests/Elastic.Changelog.Tests/Changelogs/CloudProfileFixtureTests.cs
  • tests/Elastic.Changelog.Tests/Changelogs/LinkAllowlistSanitizerTests.cs
  • tests/Elastic.Changelog.Tests/Uploading/ChangelogUploadServiceTests.cs
  • tests/Elastic.Changelog.Tests/Uploading/RegistryBuilderTests.cs
  • tests/Elastic.Changelog.Tests/Uploading/RegistryKeyTests.cs
  • tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/CdnChangelogEntryFetcherTests.cs
  • tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/CdnChangelogFetcherTests.cs

Comment thread docs/development/changelog-bundle-registry.md
Comment thread src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs Outdated
Comment thread src/services/Elastic.Changelog/Uploading/RegistryKey.cs Outdated
Comment thread src/tooling/docs-builder/Commands/ChangelogCommand.cs Outdated
- RegistryKey: scope dot characters to changelog/{repo} segments; bundle product
  segments stay [a-zA-Z0-9_-]+ (matches producer validation), so the scrubber no
  longer passes through bundle/foo.bar/registry.json
- CLI upload: anchor the git-remote repo fallback to the --config/--directory
  source rather than the process cwd, so an out-of-tree config resolves the right origin
- docs: fix the producer-details bullet to describe repo-scoped entry registries
- condense private-method XML doc summaries to a single line

Skipped CodeRabbit's NormalizeRepo '+' suggestion: the config loader already
rejects '+' in bundle.repo, so merged values never reach key construction.

Refs elastic/docs-eng-team#413

Co-authored-by: Cursor <cursoragent@cursor.com>
Per the docs-builder boolean-parameter rule, pass useLocalChangelogs/
explicitDirectory (ShouldSourceFromCdn) and allowDots (IsValidSegment) as
named arguments at their call sites.

Refs elastic/docs-eng-team#413

Co-authored-by: Cursor <cursoragent@cursor.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