feat(organization): show quota usage, max, and refresh time#1236
feat(organization): show quota usage, max, and refresh time#1236John-David Dalton (jdalton) wants to merge 3 commits intomainfrom
Conversation
…time `socket organization quota` was hidden and only showed remaining units, giving users no way to see how close they were to their cap. The SDK already returns `maxQuota` and `nextWindowRefresh` on the same call, so we now render all three. - Unhide the `quota` subcommand so it shows up in help - Show `remaining / max (N% used)` plus a human-readable refresh window in text and markdown output - Fall back to remaining-only when `maxQuota` is missing - Update the description to match the actual behavior
Addresses Cursor bugbot feedback on PR #1236. Cascaded rounding (hours derived from rounded minutes, days derived from rounded hours) produced incorrect output at boundaries — e.g. 89.5 min rounded to 90 min, then to 2 h, when 89.5 min is closer to 1 h. Each unit is now computed directly from the raw `diffMs` delta.
|
Cursor (@cursor) review |
|
Cursor (@cursor) review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b5cc26b. Configure here.
|
Cursor (@cursor) review |
1 similar comment
|
Cursor (@cursor) review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b5cc26b. Configure here.
|
Cursor (@cursor) review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b5cc26b. Configure here.
|
Cursor (@cursor) review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b5cc26b. Configure here.
Summary
socket organization quotawas hidden and only printed remaining units, so users had no way to see how close they were to their cap. The SDK already returnsmaxQuotaandnextWindowRefreshon the same call — we now render all three.quotasubcommand so it shows up in help.remaining / max (N% used)plus a human-readable refresh window in text and markdown output.maxQuotais missing so the command still works against older/partial responses.Test plan
pnpm --filter @socketsecurity/cli run test:unit test/unit/commands/organization/— 196 passed (two test files updated, one new test case added for maxQuota-missing fallback and one for refresh-time rendering)pnpm run type— passespnpm run lint— passesFollow-ups (not in this PR)
handleApiCallwhen a command's known quota cost exceeds the remaining budget. Would need caching to avoid an extragetQuotaper invocation — worth a separate discussion.Note
Low Risk
Low risk: changes are limited to CLI command discoverability and output formatting, with added tests to cover new rendering and edge cases.
Overview
Makes
socket organization quotavisible in CLI help (unhides the subcommand) and updates its description.Enhances quota output in text/markdown to include remaining/max quota, % used, and a human-readable next refresh time, with a fallback to remaining-only when
maxQuotais missing; JSON output is unchanged. Updates and adds unit tests to cover the new formatting and refresh-time edge cases, and documents the behavior inCHANGELOG.md.Reviewed by Cursor Bugbot for commit b5cc26b. Configure here.