Skip to content

feat(quotas): add per-child user-path templates - #670

Open
SantiagoDePolonia wants to merge 1 commit into
mainfrom
feat/per-child-quotas
Open

feat(quotas): add per-child user-path templates#670
SantiagoDePolonia wants to merge 1 commit into
mainfrom
feat/per-child-quotas

Conversation

@SantiagoDePolonia

Copy link
Copy Markdown
Contributor

Summary

  • add per_child budget and rate-limit templates for dynamic user paths
  • partition spend and rate-limit counters by each direct child while sharing the partition with that child’s descendants
  • expose templates through YAML/environment configuration, admin APIs, self-service usage status, persistence, dashboard controls, and documentation

Behavior

A template on /users does not apply to /users itself. It creates independent limits for /users/alice, /users/bob, and other direct children. Descendants such as /users/alice/projects/demo consume Alice’s partition.

Global dashboard rows describe the template without inventing aggregate usage. Child-specific counters remain available through /v1/usage under the effective child path.

Validation

  • go test ./...
  • repository pre-commit suite, including race-enabled Go tests
  • golangci-lint run ./...
  • npm test -- --run — 478 passing
  • npm run check — 0 errors and 0 warnings
  • npm run build

@mintlify

mintlify Bot commented Aug 8, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
gomodel 🟢 Ready View Preview Aug 8, 2026, 8:21 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@SantiagoDePolonia, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

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

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

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, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9b3208c2-b92a-4615-9d45-5bdcf293086a

📥 Commits

Reviewing files that changed from the base of the PR and between c7eeb8a and 87e969c.

⛔ Files ignored due to path filters (3)
  • internal/admin/dashboard/static/dist/assets/index-DjNMO7jk.css is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/assets/index-zosBu2xB.js is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/index.html is excluded by !**/dist/**
📒 Files selected for processing (42)
  • cmd/gomodel/docs/docs.go
  • config/budget.go
  • config/config.example.yaml
  • config/config_test.go
  • config/ratelimit.go
  • config/ratelimit_test.go
  • docs/features/budgets.mdx
  • docs/features/rate-limits.mdx
  • docs/openapi.json
  • internal/admin/handler_budgets.go
  • internal/admin/handler_budgets_test.go
  • internal/admin/handler_ratelimits.go
  • internal/admin/handler_ratelimits_test.go
  • internal/budget/factory.go
  • internal/budget/service.go
  • internal/budget/service_test.go
  • internal/budget/store_mongodb.go
  • internal/budget/store_sql.go
  • internal/budget/store_sql_test.go
  • internal/budget/types.go
  • internal/core/user_path.go
  • internal/core/user_path_test.go
  • internal/ratelimit/factory.go
  • internal/ratelimit/limiter.go
  • internal/ratelimit/service.go
  • internal/ratelimit/service_test.go
  • internal/ratelimit/store_mongodb.go
  • internal/ratelimit/store_sql.go
  • internal/ratelimit/store_sql_test.go
  • internal/ratelimit/types.go
  • internal/server/usage_status_handler.go
  • web/dashboard/src/pages/budgets/BudgetEditor.svelte
  • web/dashboard/src/pages/budgets/BudgetList.svelte
  • web/dashboard/src/pages/budgets/budgets-helpers.js
  • web/dashboard/src/pages/budgets/budgets.svelte.js
  • web/dashboard/src/pages/rate-limits/RateLimitEditor.svelte
  • web/dashboard/src/pages/rate-limits/RateLimitInspector.svelte
  • web/dashboard/src/pages/rate-limits/RateLimitList.svelte
  • web/dashboard/src/pages/rate-limits/rateLimits.svelte.js
  • web/dashboard/src/pages/rate-limits/rateLimitsLogic.js
  • web/dashboard/tests/budgets.test.js
  • web/dashboard/tests/rate-limits.test.js

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.

@codecov-commenter

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe to merge based on the exercised child-partition, descendant-sharing, and reset behavior.

The highest-impact correctness paths were executed against the real budget and rate-limit services: sibling isolation, descendant partition sharing, request and token accounting, template resets, and global resets. The affected package suites passed as well.

Files Needing Attention: No files require changes. The exercised implementation paths were internal/budget/service.go, internal/ratelimit/service.go, internal/ratelimit/limiter.go, and internal/core/user_path.go.

T-Rex T-Rex Logs

What T-Rex did

  • Ran focused existing tests for direct-child path resolution and per-child budget and rate-limit behavior.
  • Ran authored Go harnesses against the real budget and rate-limit services; Alice’s descendant exhausted the /users/alice partition while Bob remained available; descendants shared Alice’s partition; ResetBudget, ResetRule, and global resets cleared the tested child partitions.
  • Ran complete verbose tests for the affected budget, rate-limit, and user-path packages; the initial focused existing-test capture and final package-suite capture exited 0.
  • The budget harness passed: Alice's descendant exhausted /users/alice, Bob remained independently available, and template ResetBudget/ResetAll removed historical spend for all tested children.
  • The rate-limit harness passed: Alice's request and token descendants shared their partitions, Bob remained isolated, and ResetRule/ResetAll cleared all tested child counters.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: 903a874 | Re-trigger Greptile

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.

2 participants