Skip to content

feat(deployment): gate GPU preset and card for trial users on the configure screen - #3409

Merged
ygrishajev merged 1 commit into
mainfrom
feat/deployment-gate-trial-gpu-options
Jul 13, 2026
Merged

feat(deployment): gate GPU preset and card for trial users on the configure screen#3409
ygrishajev merged 1 commit into
mainfrom
feat/deployment-gate-trial-gpu-options

Conversation

@ygrishajev

@ygrishajev ygrishajev commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Why

Managed-wallet trials don't allow every GPU: applyTrialGpuPolicy strips models on the trial blocklist (NEXT_PUBLIC_MANAGED_WALLET_TRIAL_BLOCKED_GPU_MODELS — H100/A100/RTX 4090/… while e.g. T4 is allowed) from the SDL at deploy time. On the configure screen that limit was invisible: a trial user could pick a blocklisted GPU preset or model and only find out it was silently dropped when the deployment ran. This surfaces the same policy in the UI at the point of selection — blocked GPUs lock with an unlock CTA, allowed GPUs stay usable — matching how the onboarding picker gates its top-tier-GPU template.

Fixes CON-638

What

  • A shared isTrialBlockedGpuModel(vendor, model) predicate in v1beta3.ts is the single source of truth; applyTrialGpuPolicy now uses it, so the UI locks exactly what the SDL strips (they can't drift).
  • useTrialGate returns { isRestricted, isWalletReady }isRestricted = isTrialing || !isWalletReady (readiness read as hasManagedWallet, a pure context read, since DeploymentFlowProvider already provisions the trial here). It only says whether the trial restriction is in force; what it blocks is the consumer's call.
  • HardwareSection derives isBlockedModel = isRestricted && !locked && isTrialBlockedGpuModel(...) and threads it (plus onUnlock) to the hardware cards; it owns a single AddCreditsSheet.
  • Presets card: GPU presets whose model is blocklisted render locked (e.g. A100/H100); allowed GPU presets (T4) and all Compute presets stay selectable. An "Unlock high-end GPUs" CTA shows when any GPU preset is blocked.
  • GPU card: the enable toggle is unaffected (trial users can still add allowed GPUs); blocklisted model options lock in the model picker, allowed models stay selectable, and an inline unlock CTA appears when the picked vendor exposes a blocked model. It also now mirrors the sibling hardware cards — a "GPU is off." empty state when disabled, and read-only (disabled) controls while the pane is locked.
  • A shared UnlockGpusButton renders the CTA plus a tooltip explaining why. All unlock CTAs open the existing AddCreditsSheet; adding credits ends the trial, so the locks lift reactively.
  • Adding the new export widened the v1beta3 module type, so two specs that mock the whole module (ManifestUpdate, OnboardingContainer) were updated accordingly.

Tests

  • v1beta3.spec (isTrialBlockedGpuModel): matches a listed vendor/model case-insensitively; allows unlisted models; never blocks a missing vendor/model or an empty blocklist.
  • useTrialGate.spec: restricted while trialing; restricted while the wallet isn't ready; not restricted for a ready, non-trial wallet; readiness from hasManagedWallet.
  • PresetsCard.spec: a blocked GPU preset locks while allowed presets stay selectable; an allowed preset still applies while some GPUs are blocked; the unlock CTA calls onUnlock; no CTA when nothing is blocked.
  • GpuCard.gated.spec (isolated file — avoids the sibling file's jsdom Radix-leak tail): a blocked model option locks while allowed ones stay selectable; the unlock CTA calls onUnlock; no CTA when nothing is blocked. GpuCard.spec also asserts every GPU input is disabled while locked.
  • HardwareSection.spec: passes isBlockedModel/onUnlock to the cards; blocks nothing while the pane is locked or the restriction isn't in force; a card's unlock request opens the AddCreditsSheet.
Screen.Recording.2026-07-10.at.18.50.43.mov

Summary by CodeRabbit

  • New Features

    • Added trial restrictions for high-end GPU models, with blocked options clearly marked and unavailable for selection.
    • Added an “Unlock high-end GPUs” option that opens the credits flow.
    • Locked deployment configurations now disable GPU controls and prevent GPU additions or removals.
  • Bug Fixes

    • Improved GPU restriction handling across presets and custom GPU configuration.
  • Tests

    • Expanded coverage for GPU restrictions, unlock interactions, wallet readiness, and locked controls.

@ygrishajev
ygrishajev requested a review from a team as a code owner July 10, 2026 14:11
@ygrishajev
ygrishajev force-pushed the feat/deployment-gate-trial-gpu-options branch from ed51d3b to a0750b4 Compare July 10, 2026 14:11
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

This PR adds trial-based GPU model restrictions, blocked-option indicators, unlock controls, and credits-sheet wiring across GPU cards, presets, and hardware configuration. It also expands locked-state coverage, adds supporting hook and policy tests, and types existing manifest test mocks.

GPU trial gating

Layer / File(s) Summary
GPU trial policy
apps/deploy-web/src/utils/deploymentData/*, apps/deploy-web/src/components/onboarding/...
Adds case-insensitive blocked GPU model matching, applies it during trial policy filtering, and updates onboarding test mocks.
GPU gate state
apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/useTrialGate/*
Derives restriction and wallet readiness from trial and managed-wallet state.
Gated GPU controls
apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/*, apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/*, apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/UnlockGpusButton/*
Disables blocked GPU options, displays lock indicators, exposes unlock actions, and expands locked-state disabling across GPU inputs and controls.
Hardware unlock wiring
apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/*
Passes blocking and unlock callbacks to GPU cards and controls AddCreditsSheet visibility.

Manifest test dependency mocks

Layer / File(s) Summary
Typed manifest dependency mocks
apps/deploy-web/src/components/deployments/ManifestUpdate/ManifestUpdate.spec.tsx
Converts deployment-data test overrides to typed mocks while preserving existing manifest, hash, and error scenarios.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: size: XL

Suggested reviewers: stalniy

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/deployment-gate-trial-gpu-options

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.95%. Comparing base (81dadb7) to head (fc6390e).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3409      +/-   ##
==========================================
- Coverage   71.98%   70.95%   -1.03%     
==========================================
  Files        1153     1065      -88     
  Lines       29228    26921    -2307     
  Branches     7207     6762     -445     
==========================================
- Hits        21041    19103    -1938     
+ Misses       7191     6854     -337     
+ Partials      996      964      -32     
Flag Coverage Δ *Carryforward flag
api 85.57% <ø> (ø) Carriedforward from 81dadb7
deploy-web 60.68% <100.00%> (+0.06%) ⬆️
log-collector ?
notifications 91.44% <ø> (ø) Carriedforward from 81dadb7
provider-console 81.38% <ø> (ø) Carriedforward from 81dadb7
provider-inventory ?
provider-proxy 86.42% <ø> (ø) Carriedforward from 81dadb7
tx-signer ?

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...reDeployment/ConfigurationPane/GpuCard/GpuCard.tsx 98.91% <100.00%> (+0.07%) ⬆️
...figurationPane/HardwareSection/HardwareSection.tsx 100.00% <100.00%> (ø)
...nPane/HardwareSection/useTrialGate/useTrialGate.ts 100.00% <100.00%> (ø)
...ment/ConfigurationPane/PresetsCard/PresetsCard.tsx 96.00% <100.00%> (+1.00%) ⬆️
...gurationPane/UnlockGpusButton/UnlockGpusButton.tsx 100.00% <100.00%> (ø)
...pps/deploy-web/src/utils/deploymentData/v1beta3.ts 61.22% <100.00%> (+1.22%) ⬆️

... and 90 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/deployment-gate-trial-gpu-options

Comment @coderabbitai help to get the list of available commands.

@ygrishajev
ygrishajev force-pushed the feat/deployment-gate-trial-gpu-options branch 2 times, most recently from 7d1683c to 5ed56ae Compare July 10, 2026 16:59
@github-actions github-actions Bot added size: L and removed size: M labels Jul 10, 2026
@ygrishajev
ygrishajev force-pushed the feat/deployment-gate-trial-gpu-options branch from 5ed56ae to e9cd09f Compare July 10, 2026 17:02
Trial users can still pick allowed GPUs, but models on the managed-wallet trial
blocklist lock in the Presets and GPU cards with an unlock CTA (and tooltip) that
opens the add-credits sheet. isTrialBlockedGpuModel is shared with
applyTrialGpuPolicy so the UI locks exactly what the SDL strips. The GPU card also
mirrors the sibling hardware cards: an off-state message when disabled and
read-only controls while the pane is locked.
@ygrishajev
ygrishajev force-pushed the feat/deployment-gate-trial-gpu-options branch from e9cd09f to fc6390e Compare July 10, 2026 17:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/HardwareSection.spec.tsx (1)

43-51: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Exercise the positive gating branch.

These assertions only verify that callbacks exist; the following tests cover only false cases. A regression that always returns false would still pass. Assert that the predicate returns true for a blocked model when the trial restriction is active and the pane is unlocked.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/HardwareSection.spec.tsx`
around lines 43 - 51, The test does not verify that the gating predicate blocks
restricted models. In the “passes an isBlockedModel predicate and unlock handler
to the GPU cards” test, capture the props passed to PresetsCard and GpuCard,
invoke each isBlockedModel with a blocked model while useTrialGate reports
isRestricted true and the pane is unlocked, and assert both return true.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/HardwareSection.spec.tsx`:
- Around line 43-51: The test does not verify that the gating predicate blocks
restricted models. In the “passes an isBlockedModel predicate and unlock handler
to the GPU cards” test, capture the props passed to PresetsCard and GpuCard,
invoke each isBlockedModel with a blocked model while useTrialGate reports
isRestricted true and the pane is unlocked, and assert both return true.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 651e7016-012d-49ad-9526-4a98895e0ddd

📥 Commits

Reviewing files that changed from the base of the PR and between 7d1683c and fc6390e.

📒 Files selected for processing (14)
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.gated.spec.tsx
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.spec.tsx
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.tsx
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/HardwareSection.spec.tsx
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/HardwareSection.tsx
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/useTrialGate/useTrialGate.spec.ts
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/useTrialGate/useTrialGate.ts
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/PresetsCard.spec.tsx
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/PresetsCard.tsx
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/UnlockGpusButton/UnlockGpusButton.tsx
  • apps/deploy-web/src/components/deployments/ManifestUpdate/ManifestUpdate.spec.tsx
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/utils/deploymentData/v1beta3.spec.ts
  • apps/deploy-web/src/utils/deploymentData/v1beta3.ts
✅ Files skipped from review due to trivial changes (2)
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/HardwareSection/useTrialGate/useTrialGate.ts
  • apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.spec.tsx

@ygrishajev
ygrishajev added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit e940a94 Jul 13, 2026
56 checks passed
@ygrishajev
ygrishajev deleted the feat/deployment-gate-trial-gpu-options branch July 13, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants