Conversation
📝 WalkthroughWalkthroughA refactoring that consolidates text normalization logic across three service modules by introducing a reusable Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/frontend/core/src/modules/docs-search/services/docs-search.ts (1)
142-149:⚠️ Potential issue | 🟡 MinorBlock-match branch does not normalize
title— potential inconsistency with the title-match branch.In the title-match branch (Line 135), the title is normalized via
normalizeSearchText. However, in this block-match branch,doc.title$.valueis used directly without normalization. Ifdoc.title$can return serialized JSON strings (which is the reasonnormalizeSearchTextwas introduced), this title could remain un-normalized in search results.Suggested fix
const title = - this.docsService.list.doc$(bucket.key).value?.title$.value ?? - ''; + normalizeSearchText( + this.docsService.list.doc$(bucket.key).value?.title$.value + );
🧹 Nitpick comments (2)
packages/frontend/core/src/utils/__tests__/normalize-search-text.spec.ts (1)
1-33: Consider adding tests fornull/undefinedinputs and theoptionsparameter.The current suite covers the main parsing paths well, but doesn't exercise:
null/undefined→ fallback behavior- Custom
fallbackandarrayJoineroptions- Non-string primitive input (e.g., numbers)
- Empty string / empty array edge cases
These are the remaining branches in
normalizeSearchTextthat lack coverage.packages/frontend/core/src/utils/normalize-search-text.ts (1)
6-6: Nit:unknown | nullis redundant —nullis already a subset ofunknown.The return type
unknown | nullis equivalent to justunknown. Consider simplifying for clarity.Suggested fix
-function tryParseSerializedText(value: string): unknown | null { +function tryParseSerializedText(value: string): unknown {
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## canary #14449 +/- ##
==========================================
+ Coverage 54.40% 57.04% +2.64%
==========================================
Files 2835 2836 +1
Lines 153864 153926 +62
Branches 23183 23088 -95
==========================================
+ Hits 83708 87806 +4098
+ Misses 66748 63258 -3490
+ Partials 3408 2862 -546
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Dependency Tree
This tree was auto-generated by Charcoal
Summary by CodeRabbit
Improvements
Tests