Conversation
* Initial plan * 📦 new: add bundle size checker with tests and workflow Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 📖 docs: add bundle size checker to documentation Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🧪 test: fix inverted logic in size checker test Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔒 security: add permissions block to size-check workflow Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * ⚙️ setup: fix linting issues in size-checker test Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: address PR review feedback Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: improve error handling and validation Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔒 security: fix shell injection and improve error visibility Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔒 security: fix non-literal require in tests Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Warning Rate limit exceeded
⌛ 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. 📝 WalkthroughWalkthroughA bundle-size CI check and a context-aware emoji logging system were added: new GitHub Actions workflow, size-check script and tests, emoji mappings/selector, formatter/logger integrations, type and API additions, ESLint security plugin registration, and documentation/scripts updates. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (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 |
* Initial plan * 📦 new (emoji): add emoji selector and context-aware logic Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 📖 docs: add comprehensive emoji feature documentation Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: fix linting issues in emoji feature Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update (emoji): address code review feedback Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: enable emoji by default and move toggle to format.includeEmoji Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 📖 docs: update README for new emoji configuration pattern Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: fix trailing spaces in tests Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update (emoji): address code review feedback on performance and state management Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update (emoji): move config to Logger.configure() to preserve regex cache Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: fix eslint errors by removing invalid security rule comments Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔒 security: add eslint-disable comments for safe code patterns Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * � test: improve patch coverage for emoji feature - Remove deprecated dead-code methods (getMappings, matchesKeywords) from EmojiSelector - Add tests for unknown log level edge case in EmojiSelector - Add tests for Logger.configure emoji configuration path - Add tests for numeric and boolean data edge cases * 🧪 test: improve patch coverage for emoji feature - Remove deprecated dead-code methods (getMappings, matchesKeywords) from EmojiSelector - Add tests for unknown log level edge case in EmojiSelector - Add tests for Logger.configure emoji configuration path - Add tests for numeric and boolean data edge cases * 🗑️ remove: delete outdated Snyk security instructions * 🔧 update: address code review feedback on performance and safety Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> Co-authored-by: Waren Gonzaga <opensource@warengonzaga.com>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
1137-1137:⚠️ Potential issue | 🟡 MinorVersion string appears outdated, sir.
The README references
v2.1.0at Line 1137, yet this pull request is preparing thev2.3.0release. Might I suggest updating this to reflect the current version?-**Latest Version:** v2.1.0 - Enhanced with advanced output handlers, comprehensive security-first logging, complete TypeScript support, and 95%+ test coverage for local development workflows. +**Latest Version:** v2.3.0 - Enhanced with context-aware emoji support, advanced output handlers, comprehensive security-first logging, complete TypeScript support, and 95%+ test coverage for local development workflows.
🤖 Fix all issues with AI agents
In `@README.md`:
- Line 19: The README has inconsistent counts for the emoji mappings: the "🎨
Context-Aware Emoji (New!)" sentence currently says "37 curated mappings" while
another place says "40+ curated emoji mappings"; update the text so both
occurrences use the same, accurate phrasing (e.g., replace "37 curated mappings"
in the "🎨 Context-Aware Emoji (New!)" sentence with "40+ curated emoji
mappings" or vice versa), ensuring you update every instance of the phrase to
keep the README consistent (search for the strings "🎨 Context-Aware Emoji
(New!)", "37 curated mappings", and "40+ curated emoji mappings" to locate and
fix all occurrences).
- Around line 602-609: Add a language specifier to the two fenced code blocks
that show the logging format and example — change the opening backticks for the
block containing "[ISO_TIMESTAMP][LOCAL_TIME][LEVEL][EMOJI]: message [data]" and
the block containing "[2026-02-11T14:00:00.000Z][2:00PM][ERROR][🗃️]: Database
connection failed" to include a language tag (e.g., use "text") so the fences
become ```text for both occurrences.
🧹 Nitpick comments (6)
eslint.config.js (1)
75-95: Test configuration registers the security plugin but omits the corresponding rule declarations.In the main configuration (Lines 50–62), security rules are explicitly set to
'off'so thateslint-disablecomments referencing them are recognized. The test configuration registers the plugin at Line 77 but does not mirror these'off'declarations. Should any test file contain aneslint-disablecomment for a security rule, it would trigger an "unknown rule" warning.This is a minor concern — if no test files currently use such comments, it's a non-issue. But for consistency, one might consider aligning the two configurations.
src/__tests__/formatter.test.ts (1)
169-173: Minor observation: this test case does not disable emoji.At Line 171,
LogFormatter.format(LogLevel.INFO, 'Message', 'test string')is called without{ includeEmoji: false }. The test still passes because it only assertstoContain('test string'), but the output will include an emoji segment (likely[ℹ️]). This appears intentional — verifying that emoji inclusion doesn't break string data formatting — but if consistency with other tests was the goal, one might add the option here as well.src/formatter/emoji-data.ts (1)
98-100: The catch-all keywords may be rather... enthusiastic, if I may say so.The keywords
'new'and'improve'/'improved'in the catch-all sparkles mapping are quite generic. A log message like"New user session created"or"Improved cache hit ratio"would match ✨ rather than falling through to a level-based fallback, which may not always be the desired behaviour. Worth considering whether these broad terms belong in a catch-all or if they warrant narrower phrasing.src/formatter/emoji-selector.ts (2)
186-221: The dual switch statements are rather thorough, though perhaps excessively so.Both the custom fallback lookup (lines 190–204) and the default fallback lookup (lines 208–221) enumerate every level identically. Since
levelNameis already validated as a known level (theUNKNOWNcase returns early at line 183), andFALLBACK_EMOJIis a typedRecord, this could be condensed. However, I recognise this was likely a deliberate choice to satisfy thesecurity/detect-object-injectionESLint rule by avoiding bracket notation. Entirely at your discretion.♻️ Optional: Condensed fallback lookup using a local map
private static getFallbackEmoji(level: LogLevel): string { const levelName = EmojiSelector.getLevelName(level); if (levelName === 'UNKNOWN') { return ''; } const { customFallbacks = {} } = EmojiSelector.config; - // Check custom fallbacks first using safe property access - if (Object.prototype.hasOwnProperty.call(customFallbacks, levelName)) { - switch (levelName) { - case 'DEBUG': - return customFallbacks.DEBUG || ''; - case 'INFO': - return customFallbacks.INFO || ''; - case 'WARN': - return customFallbacks.WARN || ''; - case 'ERROR': - return customFallbacks.ERROR || ''; - case 'LOG': - return customFallbacks.LOG || ''; - default: - return ''; - } - } - - // Use default fallback with explicit switch - switch (levelName) { - case 'DEBUG': - return FALLBACK_EMOJI.DEBUG; - case 'INFO': - return FALLBACK_EMOJI.INFO; - case 'WARN': - return FALLBACK_EMOJI.WARN; - case 'ERROR': - return FALLBACK_EMOJI.ERROR; - case 'LOG': - return FALLBACK_EMOJI.LOG; - default: - return ''; - } + // Safe: levelName is one of the known literal types after UNKNOWN check + const levels = ['DEBUG', 'INFO', 'WARN', 'ERROR', 'LOG'] as const; + for (const l of levels) { + if (l === levelName) { + if (Object.prototype.hasOwnProperty.call(customFallbacks, l)) { + return customFallbacks[l] || ''; + } + return FALLBACK_EMOJI[l]; + } + } + return ''; }
88-93: Minor observation: the'i'flag is redundant with pre-lowercased input.
prepareSearchText(line 145) already lowercases the search text, yet the compiled regexes use the'i'flag. Not harmful — merely a negligible redundancy. No action needed unless you wish to shave a micro-optimisation.src/__tests__/emoji-integration.test.ts (1)
73-84: Minor style observation: trailing argument artifacts.Lines 77–78 have a trailing
undefined,with no subsequent argument before the closing parenthesis. This appears in several places (lines 90–92, 103–105, etc.) and suggests a parameter was removed during iteration. Syntactically valid, but a trifle untidy.const formatted = LogFormatter.format( LogLevel.INFO, 'Deployed to production', - undefined, - + undefined );
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)
README.md (1)
1130-1130:⚠️ Potential issue | 🟡 MinorSir, I've detected a version inconsistency that requires your attention.
The documentation currently indicates "Latest Version: v2.1.0", yet this pull request is titled "🚀 release: v2.3.0". I would recommend updating this line to reflect v2.3.0 to ensure documentation accuracy upon merge.
Proposed correction
-**Latest Version:** v2.1.0 - Enhanced with advanced output handlers, comprehensive security-first logging, complete TypeScript support, and 95%+ test coverage for local development workflows. +**Latest Version:** v2.3.0 - Enhanced with context-aware emoji support, bundle size monitoring, advanced output handlers, comprehensive security-first logging, complete TypeScript support, and 95%+ test coverage for local development workflows.
🧹 Nitpick comments (1)
README.md (1)
411-611: Sir, I must commend the thoroughness of this new emoji documentation section.The Context-Aware Emoji Support section is exceptionally well-structured, providing comprehensive examples, configuration options, and practical use cases. The documentation clearly demonstrates both basic and advanced usage patterns, which should prove invaluable to users integrating this feature.
However, I would suggest elevating the compatibility note currently positioned at Line 610 to a more prominent location, perhaps immediately following the Quick Start section around Line 447. Given that emoji are now enabled by default, existing users may benefit from understanding this behavioral change earlier in their reading journey, sir.
Waiting for the other PR to finish...
Summary by CodeRabbit
New Features
Documentation
Tests
Chores