Feature Gates and Limits
Plan model, route-level feature gates, runtime license behavior, and effective limits.
Primary sources:
pkg/features/features.gopkg/features/community.gocmd/gitopshq/community.gointernal/server/routes_protected.gointernal/handler/webhook.gointernal/handler/features.go
Plan and Feature Model
The product model defines four plan enums:
freeproenterprisecloud
Feature constants are grouped as:
- Free core
- Pro
- Pro+ values-governance
- Enterprise
There are 59 feature constants in pkg/features/features.go.
Route-Level Gates in Active Router
The protected router currently gates these capabilities:
| Gate | Feature Constant | Example Routes |
|---|---|---|
| Advanced editor | FeatureAdvancedEditor | GET /api/v2/projects/{slug}/files/blame |
| Promotion | FeaturePromotion | /api/v2/projects/{slug}/promotion/*, /api/v2/promotions/* |
| Basic rollback | FeatureBasicRollback | /revert-preview, /rollback/preview |
| Advanced rollback | FeatureRollback | selective preview/history/annotate routes |
| Selective rollback | FeatureSelectiveRollback | field-level selective revert routes |
| Rollback approval | FeatureRollbackApproval | /api/v2/rollback-requests/* |
| Teams | FeatureTeams | /api/v2/teams/* |
| Resource permissions | FeatureResourcePermissions | /api/v2/permissions/* |
| Notifications | FeatureNotifications | /api/v2/notifications/preferences* |
| Alert escalation | FeatureAlertEscalation | /api/v2/notifications/policies* |
| K8s validation | FeatureK8sValidation | /api/v2/k8s/* |
| CRD schemas | FeatureCRDSchemas | POST /api/v2/k8s/crd |
| Values governance | FeatureValuesGovernance | /api/v2/policies/* |
Community Build Behavior (Important)
Current OSS Runtime Semantics
The default non-enterprise build (cmd/gitopshq/community.go) initializes CommunityLicense, which:
- reports plan as
enterprise, - includes all listed features in the active set,
- reports
maxTenants=9999,maxUsers=9999,maxRepos=9999.
This means behavior in the current OSS binary can differ from roadmap/commercial tier narratives unless an enterprise licensing implementation overrides initLicense().
Effective Limits in Current Code Paths
| Limit Surface | Source | Runtime Behavior |
|---|---|---|
| Project count guard | internal/handler/project.go + LicenseService.MaxRepos() | Uses license service; OSS community build returns 9999 |
| Tenant count guard | internal/handler/tenant.go + LicenseService.MaxTenants() | Uses license service; OSS community build returns 9999 |
| Feature/plan API | GET /api/v2/features (internal/handler/features.go) | Returns runtime plan + enabled features + max limits |
| Webhook target cap | webhookLimitForPlan() in internal/handler/webhook.go | free:1, pro:10, enterprise:100 |
Organization Plan vs Runtime Gate
Organizations are created with OrgPlanFree in organization handlers, but route behavior is primarily controlled by the runtime LicenseService feature checks and limit values. Treat /api/v2/features as the runtime truth for active gates.
Operational Check
Use this call to verify the effective runtime state in any environment:
curl -H "Authorization: Bearer <token>" \
-H "X-Organization-ID: <org-id>" \
https://<host>/api/v2/featuresExpect:
planfeatures[]limits.maxTenantslimits.maxUserslimits.maxRepos