Skip to content

Add credit limits and funding controls commands - #67

Merged
purpshell merged 5 commits into
devfrom
t3code/limits-priorities
Oct 4, 2026
Merged

purpshell merged 5 commits into
devfrom
t3code/limits-priorities

Conversation

@purpshell

@purpshell purpshell commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Operators can read and update monthly credit limits and funding priorities from the CLI, including one project's combined customer/number order. Large orders can be loaded from a JSON file rather than a long shell argument, and real number creation accepts initial limit and priority flags.

This adds billing limits list/set, billing priority list/set/reorder and billing controls get/set. --project filters the priority read; human output includes customers as well as projects and numbers. Mixed resource order uses --scope resource with customer:UUID and number:UUID entries. --ids-file accepts the complete ordered string array and is mutually exclusive with --ids. Revision guards, atomic combined saves, conflict errors and before-HTTP validation are preserved.

Project priority takes precedence. Numbers inherit customer priority and can override it with a higher number priority within the project; funding order never bypasses a spending cap. Customer limits include assigned numbers. Limits reset monthly in UTC; --credits 0 blocks new charges and --unlimited removes the cap. Initial QuickLink flags apply only to real new numbers and require team billing:manage authority.

The financial contract is supplied by immutable API source ac1c7010d5c3cdf0262f1b5deb2c4d7ce6a249a5 in API/Console #476. Typed SDK methods are tracked separately in SDK #331. This CLI pins the already-published @polymorfa/sdk@0.1.0-dev.20261003052138: financial commands use its authenticated raw.request, and its existing quickLinks.create forwards the validated initial controls unchanged. No dependency on unpublished SDK methods or private Console routes is introduced.

Required area Assessment
API Updated in the companion API/Console PR with organization-key budget/priority operations and initial QuickLink controls. CLI requests follow the same public contract and preserve server authorization, Pay-As-You-Go admission and observed revisions.
SDKs Updated in the companion SDK PR with typed financial methods and exact-source manifests. CLI publication can use its existing published SDK transport; the new private Console Usage/selector/Logs operations remain excluded.
CLI Updated: financial command trees, project filters, complete mixed ordering, scalable JSON-file input, customer output, native resource saves, creation flags, validation, help and examples.
Docs Updated: README and help. The companion monorepo PR updates docs/tools/cli-api.mdx, docs/console/usage-and-credits.mdx and financial API references for the same contract.
Feature releases The companion monorepo release record internal/docs/releases/2026-10-03-project-spending-budgets.md owns availability. No CLI flag or entitlement authority is added. API deployment and a separately authorized CLI prerelease remain separate gates.
Admin controls Existing companion API-owned budget/priority staff controls and runbooks cover the state operated by these commands. The CLI adds no staff credential, Admin capability or independent financial authority. Private Console metadata reconciliation adds no CLI command or staff state.

Validation:

  • All 1,013 CLI tests pass under the supported Node 24.15 runtime, including fifteen focused financial/QuickLink tests against the actual pinned published SDK. They cover revision-guarded single and mixed requests, customer output, initial controls, conflicts, invalid input and a 2,000-resource JSON-file order.
  • Missing, malformed, wrong-scope, duplicate and mutually exclusive file inputs fail before HTTP.
  • Full npm run verify passes: repository formatting, lint, typecheck, all tests, build, package dry run and production audit (zero vulnerabilities). git diff --check passes.
  • Registry integrity for the pinned SDK matches package-lock.json; the installed artifact uses the declared exact version and preserves initial QuickLink body fields.
  • Final API contract assessment: The integrated source preserves the public financial/QuickLink contract used by these commands; five new private Logs operations and the changed private logs read remain outside CLI transport..

These commands operate the implemented monthly credit-debit limits and funding
priorities. The separate included-usage/overage quota prototype remains inactive and is not exposed by these commands.

This PR does not publish a CLI/SDK package, change production controls, deploy the API or prove authenticated deployed financial behavior. CLI publication requires its separate immutable-source/version workflow; no release workflow was triggered.

Align funding-control requests with API source ba09326dd3c6688f05320c1f7685aeb0290a0ed2. Add project-filtered reads, customer output and mixed resource ordering through the published SDK raw transport. Test 2,000-resource file input and reject malformed, missing, duplicate or conflicting inputs before HTTP.
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

The included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits.

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 68 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 4436c157-841e-48d9-8431-8a5bd356a85d
📥 Commits

Reviewing files that changed from the base of the PR and between cf43b89 and 3b2ddde.

📒 Files selected for processing (13)
  • README.md
  • src/commands/billing/controls/get.ts
  • src/commands/billing/controls/set.ts
  • src/commands/billing/limits/list.ts
  • src/commands/billing/limits/set.ts
  • src/commands/billing/priority/list.ts
  • src/commands/billing/priority/reorder.ts
  • src/commands/billing/priority/set.ts
  • src/commands/quicklink/create.ts
  • src/services/billing-controls.ts
  • src/services/quicklinks.ts
  • test/commands/billing-controls.test.ts
  • test/commands/quicklinks.test.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@purpshell
purpshell marked this pull request as ready for review October 4, 2026 00:14
@purpshell
purpshell merged commit 49c2671 into dev Oct 4, 2026
3 checks passed
@purpshell
purpshell deleted the t3code/limits-priorities branch October 26, 2026 15:52
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