Skip to content

@W-23296058 - feat: UI Bundle upload command - #62

Merged
william-xie-sf merged 15 commits into
mainfrom
t/ui-bundles-miyo/w-23296058/sdd-new-cli-plugin-command
Jul 15, 2026
Merged

@W-23296058 - feat: UI Bundle upload command#62
william-xie-sf merged 15 commits into
mainfrom
t/ui-bundles-miyo/w-23296058/sdd-new-cli-plugin-command

Conversation

@william-xie-sf

Copy link
Copy Markdown
Contributor

What does this PR do?

SDD-led implementation of the new sf ui-bundle upload command which is a foundational piece of the new Salesforce Pages feature

What issues does this PR fix or reference?

@W-23296058@

Comment thread src/commands/ui-bundle/upload.ts Outdated
Comment thread src/commands/ui-bundle/upload.ts Outdated
Comment thread src/commands/ui-bundle/upload.ts Outdated
Comment thread src/commands/ui-bundle/upload.ts Outdated
try {
response = await orgConnection.request<{ jobId: string; status: string; message?: string }>({
method: 'POST',
url: `${orgConnection.baseUrl()}/connect/ui-bundle/deployments`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pin the API version. baseUrl() → v.0, but endpoint is minVersion 262 (v62.0) per section 2.5,
and we never pin apiVersion. On an org defaulting below 62.0 this silently 404s as an opaque
error. Pin v62.0 explicitly + clear 404 message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intended as a failure case since we aren't going to support orgs running < 262 anyway. We should just match the version that corresponds to the target org.

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.

You should add the --api-version flag (https://github.com/salesforcecli/plugin-data/blob/6d78b50ded33d2944c6e253d0d8fd14387d52645/src/commands/data/search.ts#L3
3-L61) and just do a check for >262
If a user tries to use an older api version, throw a meaningful error

url: `${orgConnection.baseUrl()}/connect/ui-bundle/deployments`,
body: form.getBuffer(),
headers: form.getHeaders(),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Multipart POST has no end-to-end coverage. NUT tests this.skip() on an env var never set; unit
tests stub request and only assert the input buffer. Nothing verifies jsforce transmits
form.getBuffer() as raw multipart (the L122 comment's exact worry). A nock/http-level test
capturing outbound bytes would close this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Once the full Connect API changes are in we can wire a full E2E NUT on a real org rather than a mocked test. For now will keep as-is.

Comment thread src/commands/ui-bundle/upload.ts Outdated
Comment thread src/commands/ui-bundle/upload.ts Outdated
Comment thread messages/ui-bundle.upload.md Outdated
Comment thread messages/ui-bundle.upload.md Outdated
Comment thread .sdd/ui-bundle-upload/spec.md
@william-xie-sf
william-xie-sf marked this pull request as ready for review July 13, 2026 22:30
@william-xie-sf
william-xie-sf requested a review from a team as a code owner July 13, 2026 22:30

@jshackell-sfdc jshackell-sfdc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See my suggestions and comments!

Comment thread messages/ui-bundle.upload.md Outdated
Comment thread messages/ui-bundle.upload.md Outdated
Comment thread messages/ui-bundle.upload.md Outdated
Comment thread messages/ui-bundle.upload.md Outdated
Comment thread messages/ui-bundle.upload.md Outdated
Comment thread messages/ui-bundle.upload.md Outdated

# flags.use-salesforce-pages.summary

Toggle whether this UI Bundle should be uploaded to Salesforce Pages. Currently this is a required flag as only Salesforce Pages uploads are supported.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
Toggle whether this UI Bundle should be uploaded to Salesforce Pages. Currently this is a required flag as only Salesforce Pages uploads are supported.
Upload UI Bundle to Salesforce Pages. This is a required flag as only Salesforce Pages uploads are currently supported.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Are you soon going to add more options to where the bundle can be uploaded? It seems odd to add a required flag for something that has no other options, you know?

For example, you could make Salesforce Pages the default upload location, and for now have no flag because it's not needed. Then, when you add new locations, add a flag like --upload-location, and include options such as "salesforce-pages", "other-location", etc. Just a thought. I should have said something like this earlier, but I was looking only at the name of the flag, not how it work, sorry.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes it's a little weird right now. The intent down the line is to support both "Pages" and "Non-Pages" upload paths. This flag may change shape as well depending on the second look when that work.

For now we intend to be very specific for the initial Salesforce Pages feature

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Side note - applied all your suggestions manually so your existing suggestion comments here are linking to the wrong sections. But I have applied all that you suggested @jshackell-sfdc

Comment thread messages/ui-bundle.upload.md Outdated
Comment thread src/commands/ui-bundle/upload.ts Outdated
}
// An empty directory produces no zip entries; reject rather than POST an empty bundle.
if (fileCount === 0) {
throw new SfError(messages.getMessage('error.bundle-dir-empty'), 'UiBundleUploadValidationError');

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.

FYI: you can use the messages helper messages.createError() instead

Comment thread src/commands/ui-bundle/upload.ts Outdated
Comment on lines +99 to +108
const apiVersionExplicit = flags['api-version'] !== undefined && !metadata.flags['api-version']?.setFromDefault;
if (apiVersionExplicit && parseInt(flags['api-version']!, 10) < MINIMUM_SUPPORTED_API_VERSION) {
throw messages.createError('error.uiBundleUploadApiVersionError', [
flags['api-version']!,
String(MINIMUM_SUPPORTED_API_VERSION),
]);
}

// Step 1: Resolve the org connection.
const orgConnection = flags['target-org'].getConnection(flags['api-version']);

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.

@william-xie-sf
william-xie-sf merged commit 01253d8 into main Jul 15, 2026
13 checks passed
@william-xie-sf
william-xie-sf deleted the t/ui-bundles-miyo/w-23296058/sdd-new-cli-plugin-command branch July 15, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants