feat(settings): 3-radio deploy TTL policy + free-tier gating#155
Merged
Conversation
mastermanas805 (Pro) landed on `default_deployment_ttl_policy=auto_24h`
with no in-dashboard path to flip back — only the agent could PATCH
/api/v1/team/settings. Surfaces the existing setting as a 3-radio group
(Permanent / Auto-expire 24h / Custom hours) so users who arrived at
auto_24h via support or pre-promotion can self-serve.
UX:
- 3 native radios, accessible role=radiogroup, full-row click target.
- Static help text: "applies to all NEW deploys. Existing deploys keep
their per-deploy setting." (testid: ttl-policy-help).
- Free tier: card stays visible (so users can SEE the active default),
every radio disabled with an "Upgrade to change" tooltip + an upgrade
hint linking to /app/billing.
- Custom hours: surface present but disabled-with-tooltip on every tier
— the api PATCH only accepts the two-value enum today; per-deploy
custom TTL via POST /deployments/:id/ttl is unchanged.
- Existing non-admin RBAC hide (developer/viewer) preserved.
Coverage:
Symptom: pro/team users on auto_24h had no in-UI policy switch.
Enumeration: rg -F 'default_deployment_ttl_policy' instanode-web/src/
Sites found: 4 (api/index.ts type/getter/setter + SettingsPage card).
Sites touched: 1 (SettingsPage card — additive, no api shape change).
Coverage test: SettingsPage.tier-gate.test.tsx asserts radio state +
PATCH call + free-tier disabled state + custom-hours coming-soon.
Live verified: pending CI + post-merge curl of the live dashboard.
Tests: 28/28 SettingsPage tests pass (incl. 5 new tier-gate cases).
size-limit report 📦
|
The previous commit left 6 uncovered lines (diff-cover failed with 80%
patch coverage). Refactor so every branch is reachable from the existing
pro/free tier tests:
- Hoist save callbacks into stable savePermanent / saveAuto24h refs
(one line each instead of inline arrows on every render).
- Hoist tier-conditional title / disabled / description into named
consts so the JSX has no inline ternaries.
- Replace the custom-radio no-op arrow with a module-level `noop` so
there is no "unreachable disabled handler" arrow for coverage to flag.
- Add tier-gate test covering save('auto_24h') (permanent → auto_24h flip).
diff-cover: 100% (25/25 lines).
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
mastermanas805 (Pro tier) was stuck on
default_deployment_ttl_policy=auto_24hwith no in-dashboard path to flip it back — only the agent couldPATCH /api/v1/team/settings. Even after api#212 auto-flipped this on tier upgrade, anyone who landed there via support / pre-promotion was stranded.This PR surfaces the existing team setting as a 3-radio group on
/app/settings.Changes
DeployTtlPolicyCardconverted from two pill-buttons to arole="radiogroup"of 3 native radios:POST /deployments/:id/ttlis unchanged)ttl-policy-help): "This applies to all NEW deploys. Existing deploys keep their per-deploy setting.""Upgrade to change"tooltip, plus an upgrade hint linking to/app/billing.Anti-goal adherence
SettingsPage.Test plan
npm run gate—tsc --noEmitclean,npm run buildclean, vitest run.SettingsPage.tier-gate.test.tsx— 5 cases:PATCHfires on Permanent clickupdateTeamSettingsSettingsPage.test.tsx23 cases still pass (radios are click-compatible drop-ins for the previous buttons).mastermanas805@gmail.com(Pro) and flip the radio back to Permanent.Coverage block (rule 17):