[Changelog] Strip dash from title prefix#3226
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR expands and clarifies title-prefix stripping: Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant EvalService as ChangelogEvaluationService
participant TextUtil as ChangelogTextUtilities
participant Serializer as ReleaseNotesSerialization
participant YAML as YAML_Output
User->>CLI: provide PR/issue title (with [prefix] - separator)
CLI->>EvalService: EvaluatePr / extract title
EvalService->>TextUtil: StripSquareBracketPrefix(title)
TextUtil-->>EvalService: strippedTitle (+ flag whether prefix removed)
EvalService->>TextUtil: TitleNeedsDefensiveYamlQuoting(strippedTitle)
TextUtil-->>EvalService: needsQuoting (true/false)
EvalService->>Serializer: SerializeEntry(dto with strippedTitle)
Serializer->>Serializer: YamlSerializer.Serialize(dto)
alt needsQuoting == true
Serializer->>Serializer: ApplyDefensiveTitleQuotingIfNeeded(serializedYaml, title)
end
Serializer-->>YAML: final YAML output (title possibly quoted)
YAML-->>User: emitted changelog/release-notes YAML
🚥 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
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. Review rate limit: 0/1 reviews remaining, refill in 48 minutes and 44 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/contribute/configure-changelogs-ref.md`:
- Line 125: The markdown line currently uses a code span that includes a
trailing space (the problematic snippet showing a hyphen plus space inside
backticks); update the sentence to avoid a code span with a trailing space by
putting only the hyphen inside the code span and describing the following space
in plain text (e.g., "hyphen" in code, then the word "followed by a space") or
rephrase the sentence to use a quoted or plain-text representation of the
hyphen-plus-space, ensuring MD038 is no longer triggered.
In
`@src/Elastic.Documentation.Configuration/ReleaseNotes/ReleaseNotesSerialization.cs`:
- Around line 114-123: The current rewrite of an unquoted title (in
ReleaseNotesSerialization.cs) blindly replaces the "title:" header without
guarding against YAML block scalars, which corrupts multi-line values; modify
the logic where valuePart is computed (variable valuePart and the branch that
calls ToYamlDoubleQuotedString(title!)) to detect block-style indicators (e.g.,
valuePart starts with '|' or '>': possibly followed by modifiers) and skip
rewriting in that case (return the original yaml or leave lines unchanged) so
continuation lines for a block scalar are preserved.
🪄 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: 5ec29846-df02-4b03-bf31-60c49bbad899
📒 Files selected for processing (11)
docs/cli/changelog/add.mddocs/cli/changelog/evaluate-pr.mddocs/cli/changelog/gh-release.mddocs/contribute/configure-changelogs-ref.mdsrc/Elastic.Documentation.Configuration/Changelog/ExtractConfiguration.cssrc/Elastic.Documentation.Configuration/ReleaseNotes/ReleaseNotesSerialization.cssrc/Elastic.Documentation/ReleaseNotes/ChangelogTextUtilities.cstests/Elastic.Changelog.Tests/Changelogs/Create/TitleProcessingTests.cstests/Elastic.Changelog.Tests/Evaluation/ChangelogPrEvaluationServiceTests.cstests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/ChangelogTextUtilitiesTests.cstests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/ReleaseNotesSerializationTests.cs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* [Changelog] Strip dash from title prefix * Update docs/contribute/configure-changelogs-ref.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Address code feedback --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary
This PR fixes the
docs-builder changelog addcommand's--strip-title-prefixoption (and matching config file option) so that it handles titles like:[Cases] - Enable cases numerical id service. When creating changelogs, the square brackets are stripped but the hyphen remained and was ultimately renadered as a bullet point.Screenshots
Before:
After:
AI implementation details
Layer 1 —
StripSquareBracketPrefix(ChangelogTextUtilities.cs)[...]prefix was removed.-when the next character is whitespace (e.g.[Cases] - Enable …→Enable …).- No bracketsunchanged (no bracket strip).[Team]-NoSpaceas-NoSpace(no space after-, so the separator rule does not run).Layer 2 — Defensive YAML (
ReleaseNotesSerialization.cs)SerializeEntryrunsApplyDefensiveTitleQuotingIfNeededafter YamlDotNet serialization.TitleNeedsDefensiveYamlQuotinginChangelogTextUtilities.csfor-,*,+, en dash, em dash.title:line is unquoted, it is rewritten with a double-quoted scalar (ToYamlDoubleQuotedString). If YamlDotNet already used'or", the YAML is left as-is.Tests
ChangelogTextUtilitiesTests.cs— strip + quoting detector.ReleaseNotesSerializationTests.cs— dash title quoted + round-trip; plain title unquoted.TitleProcessingTests.cs— Kibana-style PR title end-to-end.ChangelogPrEvaluationServiceTests.cs—evaluate-prstrips[Cases] - ….Docs & config
docs/cli/changelog/add.md,gh-release.md,evaluate-pr.md,configure-changelogs-ref.mddotnet formatwas applied toChangelogTextUtilities.cs. Targeted tests inElastic.Documentation.Configuration.TestsandElastic.Changelog.Testspass.Generative AI disclosure
Tool(s) and model(s) used: composer-2, claude-4-sonnet-thinking