fix(api): keep separator between path and summary in clerk api ls#340
fix(api): keep separator between path and summary in clerk api ls#340rafa-thayto wants to merge 2 commits into
clerk api ls#340Conversation
🦋 Changeset detectedLatest commit: 098fc03 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reached
More reviews will be available in 56 minutes and 38 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughIn Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 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. 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.
🧹 Nitpick comments (1)
packages/cli-core/src/commands/api/ls.ts (1)
38-41: ⚡ Quick winAdd a spacing-sensitive test for long-path rows.
This fix is correct, but current tests are substring-based and won’t catch separator regressions. Please add/adjust a test in
src/commands/api/ls.test.tsthat asserts at least one whitespace separator (ideally two for over-limit paths) betweenpathandsummaryin rendered output.
As per coding guidelines,**/*: “If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli-core/src/commands/api/ls.ts` around lines 38 - 41, The fix for path separator handling in the log output lacks test coverage to ensure spacing is preserved correctly. Add or adjust a test in src/commands/api/ls.test.ts that verifies whitespace separators exist between the path and summary in the rendered output. Instead of using substring-based assertions that only check for presence of values, create a test that explicitly validates at least one whitespace character separates the path from the summary, and ideally validates two whitespace characters for paths that exceed the pathWidth limit. This ensures the separator logic in the path formatting (the conditional using padEnd and the two-space fallback) is properly tested.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/cli-core/src/commands/api/ls.ts`:
- Around line 38-41: The fix for path separator handling in the log output lacks
test coverage to ensure spacing is preserved correctly. Add or adjust a test in
src/commands/api/ls.test.ts that verifies whitespace separators exist between
the path and summary in the rendered output. Instead of using substring-based
assertions that only check for presence of values, create a test that explicitly
validates at least one whitespace character separates the path from the summary,
and ideally validates two whitespace characters for paths that exceed the
pathWidth limit. This ensures the separator logic in the path formatting (the
conditional using padEnd and the two-space fallback) is properly tested.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6e6b01d7-0e7e-4463-bc08-aaa0632c59db
📒 Files selected for processing (2)
.changeset/api-ls-path-separator.mdpackages/cli-core/src/commands/api/ls.ts
wyattjoh
left a comment
There was a problem hiding this comment.
Clean, well-scoped fix. The conditional correctly guarantees a separator for paths at or beyond pathWidth (where padEnd was a no-op), and the comment accurately explains why. One optional follow-up below.
Long endpoint paths (>= the padded column width) glued straight onto the description because padEnd is a no-op once the string meets the target width. Guarantee a two-space separator for over-long paths. Fixes #330
Adds a test case with a 54-char path (above the 50-char pathWidth cap) to exercise the `ep.path.length >= pathWidth` branch in printTable, verifying two spaces are emitted between the path and its summary.
0f3bf5c to
098fc03
Compare
Summary
clerk api lsrendered long endpoint paths with the summary glued directly onto the path, e.g.:pathWidthis capped at 50, andString.prototype.padEndis a no-op once the path already meets/exceeds that width, so no separator was emitted. This guarantees a two-space separator for over-long paths while leaving normal-width alignment untouched.Test plan
bun test src/commands/api/ls.test.tspasseslstests are spacing-agnostic (substring assertions); no snapshot to updateFixes #330