Conversation
logOutputValueParser() was the only value parser that did not call ensureNonEmptyString() on the metavar option, allowing empty strings to produce malformed help output. Add the same validation that all other value parsers use. Close #459 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses an inconsistency in the logOutput() value parser by adding validation to prevent an empty metavar option, which previously led to malformed help text. The fix introduces a runtime check using ensureNonEmptyString, aligning it with over 30 other value parsers in the project. The change is accompanied by a new regression test and appropriate JSDoc updates. The implementation is correct and follows existing patterns, so I have no suggestions for improvement.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #708 +/- ##
=======================================
Coverage 93.91% 93.91%
=======================================
Files 38 38
Lines 19193 19196 +3
Branches 5248 5249 +1
=======================================
+ Hits 18025 18028 +3
Misses 1144 1144
Partials 24 24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR validates the Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/logtape/src/index.test.ts`:
- Around line 447-451: Replace the current assert.throws(...) that passes
TypeError and a message string with an object matcher so the thrown error type
and message are both validated; specifically, change the assertion to call
assert.throws(() => logOutput({ metavar: "" as never }), { name: "TypeError",
message: "Expected a non-empty string." }); this targets the same failure from
ensureNonEmptyString invoked by logOutput and follows the pattern used elsewhere
in the file.
🪄 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: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 11051536-450d-4d30-ac1c-f7fb7568acff
📒 Files selected for processing (3)
CHANGES.mdpackages/logtape/src/index.test.tspackages/logtape/src/output.ts
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The third argument to assert.throws(fn, ErrorClass, msg) is the assertion failure message, not the expected error message. Switch to an object matcher to properly validate both the error type and message, matching the pattern used for createConsoleSink tests in the same file. #708 (comment) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds validation for the metavar option in logOutput() to prevent empty strings, which previously caused malformed help output. The change aligns logOutput() with other value parsers by throwing a TypeError for empty metavar values. The implementation, which includes adding a call to ensureNonEmptyString, updating JSDoc comments, adding a regression test, and documenting the fix in the changelog, is consistent with the project's development practices. I have reviewed the changes and found no issues.
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #459
logOutputValueParser()in packages/logtape/src/output.ts was the only value parser in the codebase that did not callensureNonEmptyString()on themetavaroption. This allowed empty strings to slip through at runtime and produce malformed help output like--log-outputwith a blank metavar.The fix adds the same
ensureNonEmptyString()call that all other 30+ value parsers already use, so an emptymetavarnow throwsTypeErrorat construction time instead of silently producing broken output.