Auto-expire pool cap overrides once their requested period lapses - #29618
Open
avervaet wants to merge 1 commit into
Open
Auto-expire pool cap overrides once their requested period lapses#29618avervaet wants to merge 1 commit into
avervaet wants to merge 1 commit into
Conversation
Adds poolCapOverrideExpiresAt on membership: an optional expiry an admin can set on a spend-limit override (pre-filled from the linked upgrade request's requestedDurationDays, editable). A new hourly-scheduled Temporal sweep (spend_limit_expiration) reverts expired overrides back to the seat-type default, clears the Metronome alert, and emits a system-actored membership.pool_cap_override_expired audit event. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
poolCapOverrideExpiresAtonmembership: an optional expiry an admin can set on a per-user spend-limit override (pre-filled from the linked upgrade request'srequestedDurationDayswhen the modal is opened to resolve one, but always editable).spend_limit_expiration) with an hourly schedule that sweeps all workspaces for expired overrides and reverts them to the seat-type default: nullspoolCapOverrideAwuCredits/overrideLimitTimeframe/poolCapOverrideExpiresAt, clears the Metronome per-user cap/warning alert, and reconciles the user's credit state — mirroring exactly what happens when an admin manually reverts to "workspace default" today.membership.pool_cap_override_expiredaudit event (distinct from the admin-drivenmember.spend_limit_updated), since no human triggers the revert.Test plan
npm run test -- lib/api/users/spend_limit.test.ts(front) —expireUserSpendLimitOverridereverts/no-ops/errors correctly.npm run test -- temporal/spend_limit_expiration/activities.test.ts(front) — sweep reverts an expired override across workspaces and leaves unexpired ones untouched.npm run test -- "members/[uId]/spend_limit.test.ts"(front-api) —expiresAtpersists and round-trips through GET/PUT.Deploy plan
membership.pool_cap_override_expiredaudit log schema with WorkOS before deploying:npx tsx front/admin/register_audit_log_schemas.ts --execute --changed, then commit the regeneratedfront/lib/api/audit/schema_versions.json. Must land before the next front deploy — WorkOS validates events against the version we send, andaudit_log_schemas.test.tswill fail CI until this is done.spend_limit_expirationworker).front/temporal/spend_limit_expiration/admin/cli.sh start(creates the hourly Temporal Schedule). This is a new worker/queue — confirm ops has it wired into whatever deploys/scales Temporal workers, since that config lives outside this repo.🤖 Generated with Claude Code