Skip to content

fix(applies-to): avoid weird "Removed Planned" multi-lifecycle badge#3539

Open
shainaraskas wants to merge 4 commits into
mainfrom
fix-applies-to-multi-lifecycle-fallback
Open

fix(applies-to): avoid weird "Removed Planned" multi-lifecycle badge#3539
shainaraskas wants to merge 4 commits into
mainfrom
fix-applies-to-multi-lifecycle-fallback

Conversation

@shainaraskas

@shainaraskas shainaraskas commented Jun 19, 2026

Copy link
Copy Markdown
Member

Why

When an applies_to directive declares multiple lifecycles where the highest-version one is unreleased — most commonly stack: deprecated, removed <future> — the badge currently renders as a confusing concatenation like Stack | Removed Planned. The feature/option isn't actually removed yet (it's currently deprecated), and the doubled label looks like a bug to readers.

Closes #3537.

What

In ApplicabilityRenderer, the catch-all fallback used to force BadgeLifecycleText = "Planned" on the highest-version candidate while leaving ShowLifecycleName = true, so the lifecycle name and the synthesised text rendered side by side.

The fallback now honours the documented "use previous lifecycle" rule: when the highest candidate is future/unreleased and there is a lower-version applicability that is current or version-less, we render that one's badge instead. So stack: deprecated, removed 10.0 (with stack current 9.4.2) now renders as Stack | Deprecated, with the planned removal still surfaced in the popover.

Only when every applicability is unreleased do we fall back to a synthesised label, and that path now uses the lifecycle-appropriate phrase (Removal planned / Deprecation planned / Planned) with ShowLifecycleName = false so the doubled rendering can't recur.

Made with Cursor

When the highest-version lifecycle in a multi-lifecycle applies_to was
unreleased (e.g. `stack: deprecated, removed 10.0` with current 9.4.2),
the catch-all fallback synthesised "Planned" badge text but left
ShowLifecycleName=true, so the badge rendered the lifecycle name
("Removed") and the forced text ("Planned") side by side.

Honour the documented "use previous lifecycle" rule: when the highest
candidate is future/unreleased, prefer a lower-version applicability
that is current or has no version (so `stack: deprecated, removed 10.0`
now renders as "Stack | Deprecated"). Only fall back to a synthesised
"Removal planned"/"Deprecation planned"/"Planned" label — with
ShowLifecycleName=false — when every applicability is unreleased.

Closes #3537

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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: a8e3d2f9-2996-4aaa-87ab-7f779058e820

📥 Commits

Reviewing files that changed from the base of the PR and between 63c3caf and add93db.

📒 Files selected for processing (1)
  • src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs
💤 Files with no reviewable changes (1)
  • src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs

📝 Walkthrough

Walkthrough

In ApplicabilityRenderer.RenderApplicability, the fallback path triggered when no badge data is displayable and the highest-version applicability is future/unreleased has been rewritten. Instead of unconditionally forcing BadgeLifecycleText = "Planned" on the first candidate's data (which left ShowLifecycleName = true, producing combined text like "Removed Planned"), the renderer now scans the remaining applicabilities for one that is current or has no version and uses that badge data directly. If no such prior lifecycle exists, it generates a lifecycle-specific string ("Deprecation planned", "Removal planned", or "Planned") and sets ShowLifecycleName = false. When the highest-version applicability is not future, firstBadgeData is used unchanged.

🚥 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 describes the main fix: preventing confusing multi-lifecycle badges like 'Removed Planned' by implementing proper lifecycle selection logic.
Description check ✅ Passed The description provides comprehensive context on the issue, the root cause, and the solution, explaining how the fallback now honors the 'use previous lifecycle' rule.
Linked Issues check ✅ Passed The PR directly addresses all requirements from issue #3537: it implements the documented 'use previous lifecycle' rule [#3537], ensures proper badge text rendering with lifecycle-appropriate phrases [#3537], and prevents doubled labels in the badge [#3537].
Out of Scope Changes check ✅ Passed All changes in ApplicabilityRenderer.cs are directly scoped to fixing the multi-lifecycle badge rendering issue described in issue #3537, with no extraneous modifications.

✏️ 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 fix-applies-to-multi-lifecycle-fallback

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.

Comment thread src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs Outdated
@shainaraskas shainaraskas temporarily deployed to integration-tests June 19, 2026 14:39 — with GitHub Actions Inactive
Comment thread src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs
Comment thread src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs Outdated
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.

Multi-lifecycle applies_to renders weird "Removed Planned" badge

2 participants