Serverless products should not allow versioning#2920
Conversation
There was a problem hiding this comment.
Pull request overview
Adds stricter validation to the applies_to YAML parsing so that “versionless” products/projects (e.g., ess, ech, serverless, and serverless sub-projects) cannot include a version, and updates tests to reflect this behavior.
Changes:
- Added versionless-key validation in
ApplicableToYamlConverterto emit errors when a version is specified for versionless keys. - Updated existing applicability tests to remove versions from versionless keys.
- Added new tests asserting that versioned declarations for versionless keys emit errors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Elastic.Documentation/AppliesTo/ApplicableToYamlConverter.cs |
Adds versionless-key detection and emits diagnostics errors when versions are used for those keys. |
tests/authoring/Inline/AppliesToRole.fs |
Updates inline {applies_to} role tests to remove versions from ess / ech. |
tests/authoring/Applicability/AppliesToFrontMatter.fs |
Updates frontmatter tests to remove versions for versionless keys and adds explicit error tests for versioned usage. |
tests/authoring/Applicability/AppliesToDirective.fs |
Updates directive-based YAML tests to remove versions from serverless sub-projects. |
🔍 Preview links for changed docs |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe changes add validation that forbids specifying explicit versions for versionless product keys (e.g., Sequence Diagram(s)sequenceDiagram
participant Author as Author (YAML)
participant Parser as AppliesToYamlConverter
participant Validator as ValidateApplicabilityCollection
participant Diag as Diagnostics
participant Builder as DeploymentApplicability Builder
Author->>Parser: Provide applies_to YAML (e.g., serverless: "ga 9.0")
Parser->>Parser: Parse applicability items -> AppliesCollection
Parser->>Validator: ValidateApplicabilityCollection(key, applies, diagnostics)
Validator->>Validator: Check VersionlessKeys for any versioned item
alt version found for versionless key
Validator->>Diag: Add Error diagnostic ("Can't specify a version for ...")
Validator-->>Parser: Return early (skip further rules)
Parser-->>Diag: Propagate error result
else no version found
Validator-->>Parser: Continue validation
Parser->>Builder: Construct DeploymentApplicability using applies
Builder-->>Parser: Return applicability object
end
Note right of Diag: Tests assert diagnostics or constructed object accordingly
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Comment |
Fixes #2627
This pull request introduces stricter validation for version specifications in "versionless" products (such as
ess,ech,serverless,elasticsearch,observability, andsecurity) within the applicability YAML parsing logic. It ensures that these products cannot be assigned a version, and emits clear errors if a version is mistakenly specified. The changes also update the test suite to reflect and verify this new validation behavior.Validation and Parsing Enhancements:
ApplicableToYamlConverter.csto prevent specifying versions for versionless products (ess,ech,serverless,elasticsearch,observability,security). If a version is provided for these, an error is added to diagnostics. [1] [2] [3] [4]Test Suite Updates:
serverless: ga 9.0.0→serverless: ga) and to expect errors when a version is specified for such products. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]These changes ensure that the applicability logic is more robust and that documentation authors receive clear feedback when misusing versioned declarations for versionless products.