Skip to content

fix(api): keep separator between path and summary in clerk api ls#340

Open
rafa-thayto wants to merge 2 commits into
mainfrom
fix/api-ls-path-separator
Open

fix(api): keep separator between path and summary in clerk api ls#340
rafa-thayto wants to merge 2 commits into
mainfrom
fix/api-ls-path-separator

Conversation

@rafa-thayto

Copy link
Copy Markdown
Contributor

Summary

clerk api ls rendered long endpoint paths with the summary glued directly onto the path, e.g.:

GET     /platform/applications/{applicationID}/instances/{envOrInsID}/configGet instance config

pathWidth is capped at 50, and String.prototype.padEnd is 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.ts passes
  • Existing ls tests are spacing-agnostic (substring assertions); no snapshot to update

Fixes #330

@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 098fc03

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
clerk Patch

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

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rafa-thayto, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 73d82a8b-53b4-4161-9dbd-1c94fe07d9b4

📥 Commits

Reviewing files that changed from the base of the PR and between 0f3bf5c and 098fc03.

📒 Files selected for processing (3)
  • .changeset/api-ls-path-separator.md
  • packages/cli-core/src/commands/api/ls.test.ts
  • packages/cli-core/src/commands/api/ls.ts
📝 Walkthrough

Walkthrough

In packages/cli-core/src/commands/api/ls.ts, the printTable function's path formatting is updated with a conditional expression: paths shorter than pathWidth continue to use padEnd for column alignment, while paths that meet or exceed pathWidth are emitted as-is with a fixed number of trailing spaces appended, ensuring a visible separator before the summary column. A new changeset file records this as a patch release for the clerk package.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the main change: fixing the separator between path and summary in the clerk api ls command output.
Description check ✅ Passed The description provides clear context about the formatting issue, the root cause involving padEnd, the fix approach, and test validation.
Linked Issues check ✅ Passed The code changes directly address issue #330 by ensuring a two-space separator between long endpoint paths and summaries, fixing the glued-together text problem.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the separator issue in clerk api ls: the changeset entry and the table rendering logic adjustment are within scope.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/cli-core/src/commands/api/ls.ts (1)

38-41: ⚡ Quick win

Add 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.ts that asserts at least one whitespace separator (ideally two for over-limit paths) between path and summary in 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

📥 Commits

Reviewing files that changed from the base of the PR and between 41ad30e and 0f3bf5c.

📒 Files selected for processing (2)
  • .changeset/api-ls-path-separator.md
  • packages/cli-core/src/commands/api/ls.ts

@wyattjoh wyattjoh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/cli-core/src/commands/api/ls.ts
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.
@rafa-thayto rafa-thayto force-pushed the fix/api-ls-path-separator branch from 0f3bf5c to 098fc03 Compare June 18, 2026 12:17
@rafa-thayto rafa-thayto requested a review from wyattjoh June 18, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clerk api ls: long endpoint paths run into the description column with no separator

3 participants