Skip to content

Commit 1a3cfd0

Browse files
feat(packaged): ship Workspace Team on production builds (#6459) (#6461)
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. (cherry picked from commit 5f5a589) Co-authored-by: lefarcen <935902669@qq.com>
1 parent 0ccca3b commit 1a3cfd0

5 files changed

Lines changed: 98 additions & 24 deletions

File tree

.github/workflows/notify-release-feishu.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,16 @@ jobs:
7575
# version). Only set when building from a non-release ref like main, where
7676
# release-prerelease cannot derive the base version from the branch name.
7777
release_version: ${{ inputs.release_version }}
78-
# Workspace Team gate: the packaged prerelease only enables the vela-cli
79-
# transports when a test/feature-test AMR profile is baked in (see
80-
# apps/packaged/src/workspace-team.ts + release-prerelease.yml). A manual
81-
# dispatch can pass amr_profile explicitly; otherwise release/v0.18.0 — the
82-
# workspace-team release cycle — defaults to `test` so its auto push-built
83-
# prereleases ship the transport enabled, while every other release branch
84-
# stays on prod. Drop the branch default once workspace-team ships to prod.
85-
amr_profile: ${{ inputs.amr_profile || (github.ref_name == 'release/v0.18.0' && 'test') || '' }}
78+
# Workspace Team profile baked into the packaged build (see
79+
# apps/packaged/src/workspace-team.ts + release-prerelease.yml). Release
80+
# builds ship `prod`: production's Vela backend now serves the feature, so
81+
# a release prerelease points users at the production console rather than
82+
# an internal test environment. A manual dispatch can still override to
83+
# test / feature-test to cut a build against those backends.
84+
#
85+
# (This replaces a temporary `test` default on release/v0.18.0 that
86+
# existed only while prod's resource-hub storage was unconfigured.)
87+
amr_profile: ${{ inputs.amr_profile || 'prod' }}
8688
# Windows packaged smoke is a hard publish gate (publish needs build_win
8789
# success) but currently flakes on release/v0.18.0 ("did not reach main app
8890
# shell"), skip-blocking EVERY platform's publish + the Feishu card. TEMPORARY:

.github/workflows/release-prerelease.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,21 @@ env:
123123
# Workspace Team gate for packaged prerelease builds. tools-pack reads
124124
# OPEN_DESIGN_AMR_PROFILE and bakes OD_VELA_WEB_URL into open-design-config.json;
125125
# both are required for the packaged daemon to enable the workspace-team
126-
# transport (see apps/packaged/src/workspace-team.ts). Empty amr_profile leaves
127-
# the default (prod), which the packaged gate rejects, so the normal push-driven
128-
# prerelease pipeline stays unchanged. A test / feature-test dispatch points at
129-
# the matching per-profile Vela console origin held in a repository secret.
130-
# Secrets read here: VELA_WEB_URL_FEATURE_TEST, VELA_WEB_URL_TEST.
126+
# transport (see apps/packaged/src/workspace-team.ts).
127+
#
128+
# Every profile now resolves an origin, production included: prod's Vela
129+
# backend serves the feature (WORKSPACE_TEAM_ENABLED plus a configured
130+
# resource-hub blob store), so a prod build ships the transports enabled.
131+
# An empty amr_profile still yields no origin, which the packaged gate treats
132+
# as dormant — a build that forgets the profile degrades to local-only rather
133+
# than pointing at an unknown backend.
134+
#
135+
# Origins stay in repository secrets rather than literals: the non-prod AMR
136+
# environments are internal deployments and this repository is public.
137+
# Secrets read here: VELA_WEB_URL_FEATURE_TEST, VELA_WEB_URL_TEST,
138+
# VELA_WEB_URL_PROD.
131139
OPEN_DESIGN_AMR_PROFILE: ${{ inputs.amr_profile }}
132-
OD_VELA_WEB_URL: ${{ inputs.amr_profile == 'feature-test' && secrets.VELA_WEB_URL_FEATURE_TEST || inputs.amr_profile == 'test' && secrets.VELA_WEB_URL_TEST || '' }}
140+
OD_VELA_WEB_URL: ${{ inputs.amr_profile == 'feature-test' && secrets.VELA_WEB_URL_FEATURE_TEST || inputs.amr_profile == 'test' && secrets.VELA_WEB_URL_TEST || inputs.amr_profile == 'prod' && secrets.VELA_WEB_URL_PROD || '' }}
133141
jobs:
134142
metadata:
135143
name: Prepare prerelease metadata

apps/packaged/src/workspace-team.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
/**
22
* AMR profiles whose Vela backend serves the Workspace Team transports.
3-
* Production deliberately stays outside this allowlist until the feature is
4-
* released independently of the integration branch.
3+
*
4+
* Production joined this allowlist once its Vela backend was actually able to
5+
* serve the feature: `WORKSPACE_TEAM_ENABLED` (plus the three billing-scope
6+
* flags) is true on prod amr-api, and the resource hub it needs for team file
7+
* sharing is configured — an S3-backed blob store rather than the chart's mock
8+
* default, which would have failed every push with `unsupported protocol
9+
* scheme "mock"` while comments (Postgres) kept syncing.
10+
*
11+
* The second half of the gate below still applies to prod: without an injected
12+
* Vela web origin the transports stay dormant, so a build that forgets it
13+
* degrades to local-only instead of pointing at an unknown backend.
514
*/
615
const WORKSPACE_TEAM_AMR_PROFILES: ReadonlySet<string> = new Set([
716
"feature-test",
17+
"prod",
818
"test",
919
]);
1020

apps/packaged/tests/sidecars.test.ts

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -634,12 +634,30 @@ describe('buildPackagedDaemonSpawnEnv', () => {
634634
}
635635
});
636636

637-
// The profile allowlist is the load-bearing half of the gate: moving the
638-
// origin out of the source tree and into a build-time injection must not
639-
// create a path where a `prod` bundle can be handed an origin and quietly
640-
// turn the unreleased workspace-team transports on for every stable user.
641-
it('never enables the workspace-team transport for a prod build, even with an injected vela web origin', () => {
642-
for (const amrProfile of ['prod', 'local', null] as const) {
637+
// Workspace Team is released, so a prod bundle handed an origin now turns the
638+
// transports on — that is the shipping path for stable users.
639+
it('enables the workspace-team transport for a prod build with an injected vela web origin', () => {
640+
const env = buildPackagedDaemonSpawnEnv(fakePaths(), {
641+
appVersion: null,
642+
amrProfile: 'prod',
643+
daemonCliEntry: null,
644+
legacyDataDir: null,
645+
requireDesktopAuth: true,
646+
velaWebUrl: 'https://open-design.ai/cloud',
647+
});
648+
expect(env.OD_WORKSPACE_CONTEXT_SOURCE).toBe('vela');
649+
expect(env.OD_TEAM_PROJECTS_TRANSPORT).toBe('vela-cli');
650+
expect(env.OD_COLLAB_TRANSPORT).toBe('vela-cli');
651+
expect(env.OD_RESOURCE_TRANSPORT).toBe('vela-cli');
652+
expect(env.OD_VELA_WEB_URL).toBe('https://open-design.ai/cloud');
653+
});
654+
655+
// The profile allowlist remains the load-bearing half of the gate for every
656+
// profile that is NOT a released Vela backend: a `local` or profile-less
657+
// bundle handed an origin must still stay dormant rather than point the
658+
// transports at a backend that does not serve them.
659+
it('never enables the workspace-team transport for a local or profile-less build', () => {
660+
for (const amrProfile of ['local', null] as const) {
643661
const env = buildPackagedDaemonSpawnEnv(fakePaths(), {
644662
appVersion: null,
645663
amrProfile,
@@ -656,6 +674,23 @@ describe('buildPackagedDaemonSpawnEnv', () => {
656674
}
657675
});
658676

677+
// The origin half of the gate is what protects a misconfigured prod build:
678+
// no injected origin means dormant, never a guessed backend.
679+
it('keeps a prod build dormant when no vela web origin was injected', () => {
680+
const env = buildPackagedDaemonSpawnEnv(fakePaths(), {
681+
appVersion: null,
682+
amrProfile: 'prod',
683+
daemonCliEntry: null,
684+
legacyDataDir: null,
685+
requireDesktopAuth: true,
686+
});
687+
expect('OD_WORKSPACE_CONTEXT_SOURCE' in env).toBe(false);
688+
expect('OD_TEAM_PROJECTS_TRANSPORT' in env).toBe(false);
689+
expect('OD_COLLAB_TRANSPORT' in env).toBe(false);
690+
expect('OD_RESOURCE_TRANSPORT' in env).toBe(false);
691+
expect('OD_VELA_WEB_URL' in env).toBe(false);
692+
});
693+
659694
it('forwards POSTHOG_KEY/POSTHOG_HOST to the daemon spawn env when baked into the bundle', () => {
660695
const env = buildPackagedDaemonSpawnEnv(fakePaths(), {
661696
appVersion: null,

apps/packaged/tests/workspace-team.test.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,27 @@ describe('workspaceTeamTransportEnv', () => {
1515
});
1616
});
1717

18-
it('keeps production and an origin-less feature-test dormant', () => {
19-
expect(workspaceTeamTransportEnv('prod', 'https://vela.example')).toEqual({});
18+
it('enables the transports on production now that its Vela backend serves them', () => {
19+
expect(workspaceTeamTransportEnv('prod', 'https://open-design.ai/cloud')).toEqual({
20+
OD_WORKSPACE_CONTEXT_SOURCE: 'vela',
21+
OD_TEAM_PROJECTS_TRANSPORT: 'vela-cli',
22+
OD_COLLAB_TRANSPORT: 'vela-cli',
23+
OD_RESOURCE_TRANSPORT: 'vela-cli',
24+
OD_VELA_WEB_URL: 'https://open-design.ai/cloud',
25+
});
26+
});
27+
28+
it('keeps an origin-less build dormant on every profile', () => {
29+
// Half a configuration is the dangerous one: without an injected origin the
30+
// packaged daemon would otherwise point Workspace Team at an unknown
31+
// backend. Missing origin must degrade to local-only, never to a guess.
2032
expect(workspaceTeamTransportEnv('feature-test', undefined)).toEqual({});
33+
expect(workspaceTeamTransportEnv('prod', undefined)).toEqual({});
34+
expect(workspaceTeamTransportEnv('prod', ' ')).toEqual({});
35+
});
36+
37+
it('keeps an unknown profile dormant even with an origin', () => {
38+
expect(workspaceTeamTransportEnv('staging', 'https://vela.example')).toEqual({});
39+
expect(workspaceTeamTransportEnv(null, 'https://vela.example')).toEqual({});
2140
});
2241
});

0 commit comments

Comments
 (0)