feat(rollback): show a plan-not-available message when instant rollback isn't entitled - #237
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
…ck isn't entitled launch rollback previously showed the same generic "No rollback-eligible deployments are available" message whether an org's plan simply doesn't include instant rollback, or the environment genuinely has nothing eligible yet. Now queries the same RollbackSettings.isEnabled entitlement signal the Launch UI added recently and shows a distinct message when the org's plan explicitly disables it. Fails open on any fetch error (falls back to the existing generic message), and only fires on the already- failing path (no extra request when a rollback target exists). Does not change the rollback mutation's own authorization: it is still gated solely by a deployment's isRollbackEligible flag, with no live entitlement check on the mutation itself. This is a message-clarity improvement only. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
27c9787 to
1ba6489
Compare
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
What
launch rollbackshows a distinct message when an org's plan doesn't include instant rollback, instead of the same generic "no eligible deployments" message used for a genuinely-empty environment.Why
Today, if
getEligibleSortedDeployments()comes back empty, the CLI always prints:...regardless of the actual reason — an org whose plan simply doesn't include instant rollback sees the exact same message as an environment that just hasn't archived anything yet. There's no way for a user to tell "you're not entitled to this" apart from "there's nothing to roll back to yet."
The Launch UI recently shipped an equivalent fix (org entitlement now drives a distinct "not available on your plan" state instead of the previous ambiguous empty state), backed by a new
RollbackSettings { isEnabled, retentionCount }GraphQL query incontentfly-management-service. This PR gives the CLI the same clarity by querying that same signal.How
rollbackSettingsQuery(src/graphql/queries.ts).fetchRollbackSettings()onRollback(src/commands/launch/rollback.ts) — fails open (.catch(() => undefined)) on any fetch error, mirroring the existingfetchCurrentLiveDeploymentpattern in the same file.isEmpty(eligibleSorted)) — no extra network call when a rollback target actually exists."Instant rollback isn't available on your organization's plan."only when the backend explicitly saysisEnabled: false; falls back to the existing generic message in every other case (org is entitled, settings fetch fails, or the field is simply absent).Explicitly out of scope
This does not change the rollback mutation's own authorization.
rollbackDeploymentis still gated solely by a deployment'sisRollbackEligibleflag — there is no live entitlement check on the mutation itself (same gap the UI has). This PR is a message-clarity improvement only; closing that gap would be a separate, backend-side change (it would need to land incontentfly-management-serviceand would benefit both the UI and this CLI simultaneously, since they share the same mutation).Test plan
isEnabled: false; falls back to the generic message when the settings fetch fails; existing "no eligible deployments" case updated to keep passing (isEnabled: true)npm run test:jest -- src/commands/launch/rollback.test.ts— 7/7 passingnpx eslinton all three changed files — cleannpx tsc --noEmit— cleannpm run test(mocha + jest + integration) — 8+6 suites, 139+31 tests, all passing#claude_code#
🤖 Generated with Claude Code