Skip to content

Add experimental lifecycle to applies-to#3398

Merged
lcawl merged 4 commits into
mainfrom
experimental-applies
May 26, 2026
Merged

Add experimental lifecycle to applies-to#3398
lcawl merged 4 commits into
mainfrom
experimental-applies

Conversation

@lcawl
Copy link
Copy Markdown
Contributor

@lcawl lcawl commented May 26, 2026

Relates to #3310

This PR adds the experimental lifecycle value for use in the "applies-to" docs feature.

Generative AI disclosure

  1. Did you use a generative AI (GenAI) tool to assist in creating this contribution?
  • Yes
  • No
  1. If you answered "Yes" to the previous question, please specify the tool(s) and model(s) used (e.g., Google Gemini, OpenAI ChatGPT-4, etc.).

Tool(s) and model(s) used: composer-2

AI summary

Core parsing & serialization

Rendering & metadata

Documentation

Tests

@lcawl lcawl temporarily deployed to integration-tests May 26, 2026 20:44 — with GitHub Actions Inactive
@lcawl lcawl marked this pull request as ready for review May 26, 2026 20:54
@lcawl lcawl requested review from a team as code owners May 26, 2026 20:54
@lcawl lcawl requested a review from Mpdreamz May 26, 2026 20:54
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

Review Change Stack

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: c89a382a-3a34-4eed-8dd7-99a179de20eb

📥 Commits

Reviewing files that changed from the base of the PR and between e69a512 and 5b740ec.

📒 Files selected for processing (4)
  • src/Elastic.ApiExplorer/Elastic.ApiExplorer.csproj
  • src/Elastic.ApiExplorer/Elasticsearch/OpenApiDocumentExporter.cs
  • src/Elastic.ApiExplorer/Operations/AvailabilityBadgeHelper.cs
  • tests/Elastic.ApiExplorer.Tests/AvailabilityBadgeHelperTests.cs

📝 Walkthrough

Walkthrough

This PR adds support for a new experimental lifecycle state to the documentation applicability system. The change flows through the entire stack: the ProductLifecycle enum gains an Experimental member; serialization and parsing logic is extended in Applicability, ApplicableTo, and JSON converters; UI rendering and description text are updated; and comprehensive test coverage is added across parsing, JSON round-trip, and authoring scenarios. Documentation examples and reference tables are also updated to reflect the new lifecycle across all version syntax patterns.

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 clearly and specifically summarizes the main change: adding an experimental lifecycle value to the applies-to documentation feature.
Description check ✅ Passed The description is directly related to the changeset, detailing the experimental lifecycle implementation across parsing, serialization, rendering, documentation, and tests.
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 experimental-applies

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 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/Elastic.Documentation/AppliesTo/ApplicableToJsonConverter.cs (1)

223-236: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Do not default unknown JSON lifecycle values to GA.

Line 235 and Line 259 both coerce unknown lifecycle values to GA. This masks invalid input and can broaden applicability incorrectly. Fail fast with JsonException instead.

🔧 Proposed fix
 private static ProductLifecycle ParseLifecycle(string lifecycleStr) => lifecycleStr.ToLowerInvariant() switch
 {
 	"preview" => ProductLifecycle.TechnicalPreview,
 	"experimental" => ProductLifecycle.Experimental,
 	"beta" => ProductLifecycle.Beta,
 	"ga" => ProductLifecycle.GenerallyAvailable,
 	"deprecated" => ProductLifecycle.Deprecated,
 	"removed" => ProductLifecycle.Removed,
 	"unavailable" => ProductLifecycle.Unavailable,
 	"development" => ProductLifecycle.Development,
 	"planned" => ProductLifecycle.Planned,
 	"discontinued" => ProductLifecycle.Discontinued,
-	_ => ProductLifecycle.GenerallyAvailable
+	_ => throw new JsonException($"Unknown lifecycle '{lifecycleStr}'.")
 };
@@
 			var lifecycleName = applicability.Lifecycle switch
 			{
 				ProductLifecycle.TechnicalPreview => "preview",
 				ProductLifecycle.Experimental => "experimental",
 				ProductLifecycle.Beta => "beta",
 				ProductLifecycle.GenerallyAvailable => "ga",
 				ProductLifecycle.Deprecated => "deprecated",
 				ProductLifecycle.Removed => "removed",
 				ProductLifecycle.Unavailable => "unavailable",
 				ProductLifecycle.Development => "development",
 				ProductLifecycle.Planned => "planned",
 				ProductLifecycle.Discontinued => "discontinued",
-				_ => "ga"
+				_ => throw new JsonException($"Unknown lifecycle '{applicability.Lifecycle}'.")
 			};

Also applies to: 247-260

🤖 Prompt for 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.

In `@src/Elastic.Documentation/AppliesTo/ApplicableToJsonConverter.cs` around
lines 223 - 236, The ParseLifecycle method (and the other switch handling
lifecycle values) currently maps unknown strings to
ProductLifecycle.GenerallyAvailable; change the fallback behavior to throw a
JsonException instead to fail-fast on invalid JSON input. Update the default arm
of ParseLifecycle (and the analogous switch in the other lifecycle parsing
method) to throw a JsonException with a clear message that includes the
unrecognized lifecycleStr so callers can surface invalid input rather than
silently coercing to GA.
src/Elastic.Documentation/AppliesTo/ApplicableTo.cs (1)

134-147: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fail fast instead of coercing unknown lifecycle to ga.

Line 146 silently maps unexpected enum values to "ga", which can corrupt applies-to wire output. Throw here to surface bad state immediately.

🔧 Proposed fix
 private static string LifecycleName(ProductLifecycle lc) => lc switch
 {
 	ProductLifecycle.TechnicalPreview => "preview",
 	ProductLifecycle.Experimental => "experimental",
 	ProductLifecycle.Beta => "beta",
 	ProductLifecycle.GenerallyAvailable => "ga",
 	ProductLifecycle.Deprecated => "deprecated",
 	ProductLifecycle.Removed => "removed",
 	ProductLifecycle.Unavailable => "unavailable",
 	ProductLifecycle.Development => "development",
 	ProductLifecycle.Planned => "planned",
 	ProductLifecycle.Discontinued => "discontinued",
-	_ => "ga"
+	_ => throw new ArgumentOutOfRangeException(nameof(lc), lc, "Unknown product lifecycle.")
 };
🤖 Prompt for 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.

In `@src/Elastic.Documentation/AppliesTo/ApplicableTo.cs` around lines 134 - 147,
The switch expression in LifecycleName(ProductLifecycle lc) currently falls back
to "ga" for unknown enum values and should instead fail fast; replace the
wildcard arm (_ => "ga") with code that throws an ArgumentOutOfRangeException
(or similar) including the invalid lc value and the parameter name, so any
unexpected ProductLifecycle value surfaces immediately in LifecycleName.
🤖 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.

Outside diff comments:
In `@src/Elastic.Documentation/AppliesTo/ApplicableTo.cs`:
- Around line 134-147: The switch expression in LifecycleName(ProductLifecycle
lc) currently falls back to "ga" for unknown enum values and should instead fail
fast; replace the wildcard arm (_ => "ga") with code that throws an
ArgumentOutOfRangeException (or similar) including the invalid lc value and the
parameter name, so any unexpected ProductLifecycle value surfaces immediately in
LifecycleName.

In `@src/Elastic.Documentation/AppliesTo/ApplicableToJsonConverter.cs`:
- Around line 223-236: The ParseLifecycle method (and the other switch handling
lifecycle values) currently maps unknown strings to
ProductLifecycle.GenerallyAvailable; change the fallback behavior to throw a
JsonException instead to fail-fast on invalid JSON input. Update the default arm
of ParseLifecycle (and the analogous switch in the other lifecycle parsing
method) to throw a JsonException with a clear message that includes the
unrecognized lifecycleStr so callers can surface invalid input rather than
silently coercing to GA.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0cdc053e-33c2-4a31-9222-92768ed45f91

📥 Commits

Reviewing files that changed from the base of the PR and between 966fe80 and e69a512.

📒 Files selected for processing (15)
  • docs/_snippets/applies_to-lifecycle.md
  • docs/syntax/applies-switch.md
  • docs/syntax/applies.md
  • src/Elastic.Documentation/AppliesTo/Applicability.cs
  • src/Elastic.Documentation/AppliesTo/ApplicableTo.cs
  • src/Elastic.Documentation/AppliesTo/ApplicableToJsonConverter.cs
  • src/Elastic.Documentation/AppliesTo/ProductLifecycle.cs
  • src/Elastic.Documentation/AppliesTo/ProductLifecycleInfo.cs
  • src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs
  • src/Elastic.Markdown/Myst/Components/LifecycleDescriptions.cs
  • tests/Elastic.Markdown.Tests/AppliesTo/ApplicabilityTryParseTests.cs
  • tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterRoundTripTests.cs
  • tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterSerializationTests.cs
  • tests/Elastic.Markdown.Tests/AppliesTo/ProductLifecycleInfoTests.cs
  • tests/authoring/Applicability/ApplicableToComponent.fs

@lcawl lcawl had a problem deploying to integration-tests May 26, 2026 22:29 — with GitHub Actions Error
@lcawl lcawl had a problem deploying to integration-tests May 26, 2026 22:32 — with GitHub Actions Error
@lcawl lcawl temporarily deployed to integration-tests May 26, 2026 22:35 — with GitHub Actions Inactive
@lcawl lcawl merged commit 2b397ca into main May 26, 2026
24 checks passed
@lcawl lcawl deleted the experimental-applies branch May 26, 2026 22:44
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.

3 participants