From 3ae525e0308896139373bf792e125b94de52931a Mon Sep 17 00:00:00 2001 From: George Fean <37250288+GFean@users.noreply.github.com> Date: Mon, 9 Nov 2026 07:16:25 +0400 Subject: [PATCH] feat(cli): add upload result identity metadata Include success, projectId, channelId and the actual upload serverUrl in bundle-drop-result.json. Retain null IDs for older backends and failed uploads, and preserve existing result fields. --- src/CLI/scripts/upload-cli.ts | 8 ++++++++ src/tests/CLI/scripts/upload-cli.test.ts | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/CLI/scripts/upload-cli.ts b/src/CLI/scripts/upload-cli.ts index 7be8d17..af85e7a 100644 --- a/src/CLI/scripts/upload-cli.ts +++ b/src/CLI/scripts/upload-cli.ts @@ -574,6 +574,9 @@ export async function runUpload( try { writeArtifactResult(artifactDir, { success: false, + projectId: null, + channelId: null, + serverUrl: normalizeServerUrl(serverUrl), status: 'failed', error: uploadError, platform, @@ -609,6 +612,11 @@ export async function runUpload( const hasSourceMap = Boolean(options.sourcemap && artifact.sourceMapPath && fs.existsSync(artifact.sourceMapPath)); const result: Record = { + success: true, + projectId: responseData.projectId ?? null, + channelId: responseData.channelId ?? null, + // Keep the artifact bound to the endpoint actually used for this upload. + serverUrl: normalizeServerUrl(serverUrl), platform, appVersion: version, channel, diff --git a/src/tests/CLI/scripts/upload-cli.test.ts b/src/tests/CLI/scripts/upload-cli.test.ts index a5b5e24..9f54529 100644 --- a/src/tests/CLI/scripts/upload-cli.test.ts +++ b/src/tests/CLI/scripts/upload-cli.test.ts @@ -351,6 +351,10 @@ describe('CLI/scripts/upload-cli', () => { platform: 'android', appVersion: '1.2.3', channel: 'General', + success: true, + projectId: null, + channelId: null, + serverUrl: 'https://api.example.com', runtimeVersion: '2.0.0', packageVersion: '0.4.1', bundleId: 'bundle-1', @@ -454,6 +458,7 @@ describe('CLI/scripts/upload-cli', () => { fs.writeFileSync(path.join(distDir, 'main.jsbundle.map'), 'source-map', 'utf8'); const artifactDir = path.join(tempPackageRoot, 'ci-artifacts'); mockAxiosNodePost.mockResolvedValue({ data: { + success: true, projectId: 'project-123', channelId: 'channel-456', serverUrl: 'https://untrusted.example.test', bundleId: 'bundle-123', bundleVersion: 12, bundleVersionLabel: 'v12', hash: 'returned-hash', runtimeVersion: '2.0.0', } }); @@ -468,6 +473,7 @@ describe('CLI/scripts/upload-cli', () => { const result = JSON.parse(fs.readFileSync(path.join(artifactDir, 'bundle-drop-result.json'), 'utf8')); expect(result).toEqual(expect.objectContaining({ + success: true, projectId: 'project-123', channelId: 'channel-456', serverUrl: 'https://api.example.com', orgSlug: 'alpha-org', projectSlug: 'demo-app', channel: 'develop', platform: 'android', appVersion: '1.2.3', runtimeVersion: '2.0.0', bundleVersion: 12, bundleVersionLabel: 'v12', hash: 'returned-hash', @@ -503,6 +509,7 @@ describe('CLI/scripts/upload-cli', () => { const result = JSON.parse(fs.readFileSync(path.join(distDir, 'bundle-drop-result.json'), 'utf8')); expect(result.dashboardUrl).toBe(dashboardUrl); + expect(result.serverUrl).toBe('https://api-staging.bundledrop.app'); expect(consoleLogSpy.mock.calls.flat().join(' ')).toContain(result.dashboardUrl); }); @@ -526,6 +533,7 @@ describe('CLI/scripts/upload-cli', () => { expect(result.dashboardUrl).toBe( 'https://developer.bundledrop.app/organizations/alpha-org/projects/demo-app', ); + expect(result.serverUrl).toBe('https://api.bundledrop.app'); expect(consoleLogSpy.mock.calls.flat().join(' ')).toContain(result.dashboardUrl); }); @@ -1596,6 +1604,9 @@ describe('CLI/scripts/upload-cli', () => { success: false, status: 'failed', error: 'network down', + projectId: null, + channelId: null, + serverUrl: 'https://api.example.com', orgSlug: 'alpha-org', projectSlug: 'demo-app', channel: 'General',