Add sandbox usage cap columns to Project#4726
Conversation
Adds three nullable integer columns (run_cap, ai_tokens_cap, storage_cap_mb) to projects, with cast in Project.changeset/2 and form_changeset/2 and a non-negative-integer validation. Adds a usage_caps_input slot in the project settings page following the existing concurrency_input route-metadata pattern. Lightning ships the slot with no default component; downstream apps register their own component via route metadata.
|
Based on my analysis: Files in scope:
Analysis:
Security Review
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4726 +/- ##
==========================================
- Coverage 89.94% 89.92% -0.02%
==========================================
Files 444 444
Lines 21979 21981 +2
==========================================
- Hits 19768 19767 -1
- Misses 2211 2214 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This PR adds three nullable integer columns (
run_cap,ai_tokens_cap,storage_cap_mb) to theprojectstable for storing optional per-project usage caps on runs, AI tokens, and collection storage. The columns are castable throughProject.changeset/2andProject.form_changeset/2with non-negative-integer validation.Closes #4724
Validation steps
mix ecto.migrateand confirm the three new columns appear onprojects(all nullable, defaultnil).MIX_ENV=test mix test test/lightning/projects/project_test.exsand confirm all 22 tests pass, including the three new ones for cast / nil values / negative-value rejection.Additional notes for the reviewer
usage_caps_inputslot is added to the project settings template following the existingconcurrency_inputroute-metadata pattern. It stays empty unless a downstream app registers a component into it, so OSS users see no UI from this PR.concurrency,history_retention_period, anddataclip_retention_periodonProject.AI Usage
Pre-submission checklist