- Migration 025: ADD COLUMN budget_limit BIGINT DEFAULT NULL and monthly_spend BIGINT NOT NULL DEFAULT 0 to workspaces table - Models: BudgetLimit *int64 in CreateWorkspacePayload; MonthlySpend int64 in HeartbeatPayload - workspace.go: scanWorkspaceRow, workspaceListQuery, Get, Create, and Update all handle budget_limit/monthly_spend; budget_limit is gated as a sensitiveUpdateField - registry.go: heartbeat conditionally writes monthly_spend only when payload.MonthlySpend > 0 (avoids overwriting with zero) - a2a_proxy.go: checkWorkspaceBudget() returns 429 when monthly_spend >= budget_limit (NULL = no limit; fail-open on DB error) - Tests: 8 new workspace_budget_test.go tests + patched existing tests for the 20-column scanWorkspaceRow and 10-param CREATE INSERT Field type: BIGINT (int64), units: USD cents (budget_limit=500 = $5.00/month) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| event.go | ||
| workspace.go | ||