Files
open-design/apps/packaged/tests/workspace-team.test.ts
lefarcenandGitHub 5f5a589cd8 feat(packaged): ship Workspace Team on production builds (#6459)
Production was deliberately held outside the workspace-team profile allowlist
until its Vela backend could actually serve the feature. It can now:
WORKSPACE_TEAM_ENABLED and the three billing-scope flags are true on prod
amr-api, and the resource hub it needs for team file sharing is configured
(S3-backed blob store instead of the chart's mock default, which would have
failed every push with 'unsupported protocol scheme mock' while comments kept
syncing through Postgres).

- Add prod to WORKSPACE_TEAM_AMR_PROFILES.
- Resolve OD_VELA_WEB_URL for prod from secrets.VELA_WEB_URL_PROD, so release
  builds bake the production console origin.
- Drop the temporary amr_profile=test default on release/v0.18.0; release
  builds now ship prod, with manual dispatch still able to target test or
  feature-test.

The origin half of the gate is unchanged and still load-bearing: a build
without an injected origin stays dormant on every profile rather than pointing
at an unknown backend. Tests updated to lock the new prod behaviour and to keep
local/profile-less builds dormant.
2026-08-05 17:58:16 +08:00

42 lines
1.8 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { workspaceTeamTransportEnv } from '../src/workspace-team.js';
describe('workspaceTeamTransportEnv', () => {
it('enables every Workspace Team transport in feature-test with a normalized Vela URL', () => {
expect(
workspaceTeamTransportEnv('feature-test', 'https://feature-test.vela.example/'),
).toEqual({
OD_WORKSPACE_CONTEXT_SOURCE: 'vela',
OD_TEAM_PROJECTS_TRANSPORT: 'vela-cli',
OD_COLLAB_TRANSPORT: 'vela-cli',
OD_RESOURCE_TRANSPORT: 'vela-cli',
OD_VELA_WEB_URL: 'https://feature-test.vela.example',
});
});
it('enables the transports on production now that its Vela backend serves them', () => {
expect(workspaceTeamTransportEnv('prod', 'https://open-design.ai/cloud')).toEqual({
OD_WORKSPACE_CONTEXT_SOURCE: 'vela',
OD_TEAM_PROJECTS_TRANSPORT: 'vela-cli',
OD_COLLAB_TRANSPORT: 'vela-cli',
OD_RESOURCE_TRANSPORT: 'vela-cli',
OD_VELA_WEB_URL: 'https://open-design.ai/cloud',
});
});
it('keeps an origin-less build dormant on every profile', () => {
// Half a configuration is the dangerous one: without an injected origin the
// packaged daemon would otherwise point Workspace Team at an unknown
// backend. Missing origin must degrade to local-only, never to a guess.
expect(workspaceTeamTransportEnv('feature-test', undefined)).toEqual({});
expect(workspaceTeamTransportEnv('prod', undefined)).toEqual({});
expect(workspaceTeamTransportEnv('prod', ' ')).toEqual({});
});
it('keeps an unknown profile dormant even with an origin', () => {
expect(workspaceTeamTransportEnv('staging', 'https://vela.example')).toEqual({});
expect(workspaceTeamTransportEnv(null, 'https://vela.example')).toEqual({});
});
});