Skip to content

feat(organization): show quota usage, max, and refresh time#1236

Open
John-David Dalton (jdalton) wants to merge 3 commits intomainfrom
feat/quota-output-enrichment
Open

feat(organization): show quota usage, max, and refresh time#1236
John-David Dalton (jdalton) wants to merge 3 commits intomainfrom
feat/quota-output-enrichment

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 18, 2026

Summary

  • socket organization quota was hidden and only printed remaining units, so users had no way to see how close they were to their cap. The SDK already returns maxQuota and nextWindowRefresh on the same call — 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 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 — passes
  • pnpm run lint — passes

Follow-ups (not in this PR)

  • Preflight warning inside handleApiCall when a command's known quota cost exceeds the remaining budget. Would need caching to avoid an extra getQuota per 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 quota visible 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 maxQuota is missing; JSON output is unchanged. Updates and adds unit tests to cover the new formatting and refresh-time edge cases, and documents the behavior in CHANGELOG.md.

Reviewed by Cursor Bugbot for commit b5cc26b. Configure here.

…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
Comment thread packages/cli/src/commands/organization/output-quota.mts Outdated
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.
@jdalton
Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

Comment thread packages/cli/src/commands/organization/output-quota.mts
@jdalton
Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ 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.

@jdalton
Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

1 similar comment
@jdalton
Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ 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.

@jdalton
Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ 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.

@jdalton
Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ 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.

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.

1 participant