Skip to content

Gate workspace ZIP exports and refinery dataset downloads behind Workflow Pro - #1802

Draft
groupthinking with Copilot wants to merge 2 commits into
mainfrom
copilot/gate-workspace-zip-exports
Draft

Gate workspace ZIP exports and refinery dataset downloads behind Workflow Pro#1802
groupthinking with Copilot wants to merge 2 commits into
mainfrom
copilot/gate-workspace-zip-exports

Conversation

Copilot AI commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Canonical issue

Linked by the system.

Outcome

Workspace ZIP exports and /api/v1/refinery/dataset now fail closed for free callers with a Stripe-backed 402 response, while paid callers can unlock access immediately via verified checkout session activation and retry the same download flow without losing context.

Scope

  • Included:
    • Paid route gate
      • Added a shared gate for paid download surfaces in apps/web/src/lib/billing/pro-feature-gate.ts.
      • Reuses trusted billing identity, cached checkout activation, live Stripe session lookup, and signed billing-cookie minting after successful verification.
    • Workspace ZIP export
      • Added POST /api/workspace/export.
      • Validates exported file paths, returns ZIP bytes for Pro, and returns 402 payment_required with Stripe checkout metadata for free callers.
    • Refinery dataset access
      • Added GET /api/v1/refinery/dataset.
      • Gates both dataset metadata and JSONL download behind the same Pro verification flow.
    • Client download behavior
      • Switched scaffold export to the new workspace export API instead of local-only blob assembly.
      • Added transient retry behavior for server-side export failures and checkout redirect handling for 402 responses.
    • Billing/status surface
      • Extended paid feature flags to expose workspaceZipExport and refineryDatasetAccess.
    • Focused coverage
      • Added route tests for free vs Pro access, paid-session verification, and client retry/download behavior.
  • Explicitly excluded:
    • New pricing/catalog changes
    • New non-Pro access paths
    • Broader billing/store refactors beyond these gated download surfaces

Risk

  • Risk level: medium
  • Failure mode:
    • Free users could be incorrectly blocked or Pro users could fail to unlock if Stripe/session activation regresses.
    • Download UX could stall if the export route contract drifts from the client helper.
  • Rollback:
    • Revert the new paid-route helper and the two gated routes; client export falls back to pre-gate behavior with a single revert.

Verification

List exact automated and manual checks, tied to the current head SHA.

  • Focused tests
    • npm test --prefix apps/web -- src/lib/__tests__/action-surface.test.ts src/app/api/__tests__/workspace-export-route.test.ts src/app/api/v1/refinery/dataset/__tests__/route.test.ts src/app/api/__tests__/billing-activate-route.test.ts src/app/api/__tests__/billing-checkout-route.test.ts src/app/api/__tests__/billing-renew-route.test.ts src/app/api/__tests__/billing-spoofing.test.ts src/app/api/__tests__/video-generate-route.test.ts src/app/api/__tests__/actions-route.test.ts
  • Required CI
  • Review threads resolved

Production evidence

Agent handoff

  • One canonical issue is linked
  • No competing PR implements the same issue
  • Acceptance criteria are satisfied
  • Required checks pass on the current head
  • Human decision is requested only for product, security, irreversible infrastructure, or production approval
const access = await requireProFeatureAccess(request, {
  featureKey: 'workspace_export',
  featureLabel: 'Workspace ZIP exports',
  sessionId: body.sessionId,
});

if (!access.ok) return access.response;

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Building Building Preview, v0 Sep 8, 2026 11:38pm UTC

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Stripe checkout for workspace ZIP exports and datasets Gate workspace ZIP exports and refinery dataset downloads behind Workflow Pro Sep 8, 2026
Copilot AI requested a review from groupthinking September 8, 2026 23:41
projectScaffold,
});
downloadScaffoldPackage(pkg);
const result = await downloadScaffoldPackage(pkg);

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.

In ActionsPanel.exportScaffold, any export failure other than a 402-with-checkoutUrl is silently swallowed, so users get no feedback when a download fails.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants