Skip to content

[Feat] Deploy DataSpace-Scoped Components with their retrieveWith Closure - #1649

Merged
WillieRuemmele merged 8 commits into
salesforcecli:ag/d360from
aparnagoy:d360-cdp-dataspace-deploy-closure
Dec 3, 2026
Merged

WillieRuemmele merged 8 commits into
salesforcecli:ag/d360from
aparnagoy:d360-cdp-dataspace-deploy-closure

Conversation

@aparnagoy

@aparnagoy aparnagoy commented Sep 21, 2026 •

Copy link
Copy Markdown

What this changes

These changes all make sure that sf project deploy preview lists exactly what sf project deploy start sends.

File Change Commit
src/utils/deploy.ts buildComponentSet passes forDeploy: true to ComponentSetBuilder.build(), so the set holds the peers each D360 component deploys with 45aec25
src/utils/previewOutput.ts Preview lists a <dataspace>.<name> request under that name, with the local file the deploy sends for it 666e769
src/utils/deploy.ts With no flags, preview lists the peers of each changed D360 component e03ca1e
src/utils/previewOutput.ts, src/utils/deploy.ts Preview, report and resume read ComponentSet.getComponentsToDeploy() from SDR for a deploy and only format the rows. The D360 matching and the no-flags expansion move to SDR c06206d

Everything else about D360 deploys lives in source-deploy-retrieve. This PR needs that change to be released first.

Why the forDeploy line is here

Deploy works with just the SDR bump

sf project deploy start --metadata DataLakeObject:myDlo__dll

This deploys the Data Lake Object myDlo__dll to the org. SDR adds the DMO it deploys with (default.myDmo__dlm) on its own, because ComponentSet.deploy() does that. The org receives both the DLO and the DMO, so the deploy succeeds. This also holds for source tracking deploys.

Preview would list less than what gets deployed

sf project deploy preview --metadata DataLakeObject:myDlo__dll

This shows what a deploy would send, without deploying anything. Preview only builds the list. It never calls deploy(), so SDR never gets the chance to add the DMO. The preview shows only the DLO, while the real deploy also sends the DMO. Nothing wrong reaches the org, but the list is incomplete. The same goes for deploy report and deploy resume.

Passing forDeploy: true makes build() add the peers up front, so preview, report and resume list the same components the deploy sends.

Why it is opt in

Expansion in build() is opt in through the forDeploy option, because project delete source also uses build() and would otherwise delete the peers' local files.

Why the preview change is here

A D360 component that is in several dataspaces is stored once, under its bare name, for example d360/dataLakeObjects/myDlo__dll.json. It can be deployed for one dataspace:

sf project deploy preview --metadata DataLakeObject:default.myDlo__dll

SDR resolves default.myDlo__dll to the local myDlo__dll file and sends that file under the requested name. No local file has the name default.myDlo__dll, so preview treated it as a component that isn't on disk and asked SDR for its file path, which D360 types don't support.

Command Before this commit After this commit
deploy preview --metadata DataLakeObject:default.myDlo__dll Fails: Type not supported for filepath generation: DataLakeObject Lists the DLO once, as default.myDlo__dll with its local file, plus its peers for default
deploy start --metadata DataLakeObject:default.myDlo__dll Sends the DLO and its peers for default Unchanged. Preview now lists the same components
Preview of any other type, or of a D360 component by its bare name Works Unchanged
Preview of a D360 component that isn't in the project Fails: Type not supported for filepath generation Unchanged. Deploy also fails for it, with No source-backed components present in the package

Preview now uses the local file the deploy sends for the request, lists it under the requested name, and doesn't list it a second time under its bare name. The peers are listed under their own names. Requests by bare name and other types take the same path as before.

Why the no-flags change is here

sf project deploy preview

With no flags, preview and deploy both start from the local changes that source tracking reports. That path doesn't go through ComponentSetBuilder.build(), so forDeploy doesn't reach it. The deploy adds the peers inside ComponentSet.deploy(). Preview never calls deploy(), so it listed only the changed component.

Command, no flags, one changed DLO Before this commit After this commit
deploy preview Lists 1 component: the DLO Lists 17: the DLO and its 16 peers in both of its dataspaces
deploy start Sends the DLO and its 16 peers Unchanged
package.xml of that deploy Names only the DLO Unchanged

The set now gets the same peer expansion that deploy() runs. The expansion skips what is already in the set, so the deploy sends the same components as before. Deleted components are skipped by the expansion, and a delete of a D360 component is still refused.

What was asked in review

On the SDR PR, the reviewer asked to:

Ask Reason given
Not add another option to build() Every caller should get the same set
Always expand in build() Preview, report and resume then match deploy with no PDR change beyond the bump
Keep the peer marker on the SourceComponent, not on the set Delete source in PDR and deleteSource in VS Code copy components into a new set with toArray() and add(c, POST), which loses a marker held by the set
Have add() skip peers when a deletion type is passed Delete stays safe for every caller
Add a test for the delete round trip Covers the copy into a new set

What is decided

Decision Where
forDeploy is removed and build() always adds the peers SDR
The peer marker moves onto the SourceComponent, so it survives a copy into a new set SDR
add() skips peers when a deletion type is passed SDR
A delete round trip test is added, along with a test that project generate manifest does not list peers SDR
Any delete that includes a D360 component is still refused before anything is sent SDR, unchanged
Once the SDR change is released, this PR drops the forDeploy line and keeps the version bump PDR
Preview of a <dataspace>.<name> request lists the local file the deploy sends, under the requested name PDR, this PR
Preview with no flags lists the peers of each changed D360 component PDR, this PR

Commits in this update

Commit What was asked Rationale and context What is addressed What is not addressed
45aec25 Build the deploy set through ComponentSetBuilder instead of expanding it in the plugin The peer logic belongs in SDR, so every caller gets the same set buildComponentSet passes forDeploy: true, so preview, report and resume list the peers the deploy sends project delete source still builds its set without peers, by design
666e769 Preview of <dataspace>.<name> should list what the deploy sends The local file is stored under the bare name, so preview treated the request as a component with no file and failed with Type not supported for filepath generation The request is listed once, under the requested name, with its local file, plus its peers for that dataspace Preview of a D360 component that isn't in the project still fails, and so does the deploy
e03ca1e Preview with no flags should list the peers too With no flags the set comes from source tracking and never goes through build(), so preview listed only the changed component Preview lists each changed D360 component with the peers the deploy sends with it A no-flags deploy of a DLO in more than one dataspace is still refused by the org. Name the dataspace with --metadata DataLakeObject:<dataspace>.<name>
c06206d Move the <dataspace>.<name> mapping and de-duplication out of the plugin, so preview reads what SDR says the deploy sends Keeping the logic in one place in SDR means preview and deploy can't drift apart For a deploy, preview reads ComponentSet.getComponentsToDeploy() and only formats the rows. The plugin no longer expands the source tracking set itself Retrieve preview is unchanged. The SDR release and version bump are still needed before this merges

Testing

Check Result
Unit tests, on the latest main 183 passing, including the preview tests that read the SDR view
Build and lint Clean
deploy preview --metadata DataLakeObject:default.<name> against an org with D360 enabled Lists 10 components: the DLO and its 9 peers
deploy start --dry-run with the same flag Succeeds. The package it builds holds the same 10 components, and package.xml names only the DLO
deploy preview for a second dataspace of the same DLO Lists 9 components: the DLO and its peers for that dataspace
deploy preview with no flags, one changed DLO in two dataspaces Lists 17 components. They have the same names as the 15 entries the org reports for deploy start --dry-run with no flags (the org drops the dataspace prefix, and the DLO and its two DataspaceMembers share one name)
deploy start --dry-run with no flags, same project Unchanged. The org refuses it, since one deploy can't hold two dataspaces

@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Unfortunately we can't verify the commit author(s): Aparna Goyal <r***@A***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated.

@aparnagoy aparnagoy changed the title feat: deploy dataspace-scoped components with their retrieveWith closure [Feat] Deploy DataSpace-Scoped Components with their retrieveWith Closure Sep 21, 2026
@WillieRuemmele

Copy link
Copy Markdown
Contributor

if the expansion moves into SDR (see forcedotcom/source-deploy-retrieve#1839), I don't think we need this PR. we'd just bump SDR (and @salesforce/source-tracking) once it's released.

@aparnagoy
aparnagoy requested a review from a team as a code owner November 20, 2026 08:16
@aparnagoy

Copy link
Copy Markdown
Author

Agreed. Once the expansion moves into SDR (plan in forcedotcom/source-deploy-retrieve#1839), this PR isn't needed and we can just bump SDR and @salesforce/source-tracking.

Until then
Change ab9a275 follows the SDR fix: the closure is now added to the deploy set in place, so destructive changes, API versions and wildcards are kept.
Tests All existing unit tests pass.

@aparnagoy
aparnagoy force-pushed the d360-cdp-dataspace-deploy-closure branch from ab9a275 to 867802b Compare December 2, 2026 00:11
Follows the SDR change: expandD360ComponentSet now adds the peers to the set it
is given, so the deploy keeps its destructive changes, API versions, and
wildcard entries.
The org now writes deploysWith in place of retrieveWith. Only comments change.
The deploy set is now built with forDeploy, so the source library adds each Data Cloud component's
deploysWith peers while it builds the set. The plugin no longer resolves the whole project to
expand the closure on its own.
A D360 component requested as <dataspace>.<name> is stored locally under its bare name,
so no local file has the requested name. Preview tried to generate file paths for it and
failed with "Type not supported for filepath generation".

Preview now lists that request once, under the requested name, with the local file the
deploy sends for it, and its peers under their own names. The preview list matches the
components the deploy sends.
@aparnagoy
aparnagoy force-pushed the d360-cdp-dataspace-deploy-closure branch from 867802b to c38e402 Compare December 2, 2026 01:33
With no flags, deploy preview listed source tracking's local changes as they were. The deploy
adds the peers each D360 component deploys with inside ComponentSet.deploy(), which preview
never calls, so preview listed only the changed component.

The no-flags set now gets the same peer expansion. The expansion skips what is already in the
set, so the deploy sends the same components as before, and the peers stay out of package.xml.
Preview reads ComponentSet.getComponentsToDeploy() for a deploy, so the D360 peers and the
<dataspace>.<name> mapping come from SDR and the plugin only formats the rows.

The no-flags path no longer expands the source tracking set itself, since the view and
deploy() add the peers. Retrieve preview is unchanged.
@aparnagoy
aparnagoy force-pushed the d360-cdp-dataspace-deploy-closure branch from e7c7f4f to c06206d Compare December 3, 2026 00:55
@salesforce-cla

salesforce-cla Bot commented Dec 3, 2026

Copy link
Copy Markdown

Thanks for the contribution! It looks like @aparnagoy is an internal user so signing the CLA is not required. However, we need to confirm this.

@WillieRuemmele
WillieRuemmele changed the base branch from main to ag/d360 December 3, 2026 16:03

@WillieRuemmele WillieRuemmele left a comment

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.

Merging into ag/d360 for pre-release publishing

@WillieRuemmele
WillieRuemmele merged commit c2856c8 into salesforcecli:ag/d360 Dec 3, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants