Skip to content

[Feat] Support Data Cloud DataSpace-scoped Metadata Types - #1839

Open
aparnagoy wants to merge 39 commits into
forcedotcom:mainfrom
aparnagoy:d360-dataspace-scoped-metadata
Open

aparnagoy wants to merge 39 commits into
forcedotcom:mainfrom
aparnagoy:d360-dataspace-scoped-metadata

Conversation

@aparnagoy

@aparnagoy aparnagoy commented Sep 21, 2026 •

Copy link
Copy Markdown

What this does

Adds support for D360 metadata types. They don't fit any existing adapter or transformer, because each component is stored as a pair of JSON files and there's no -meta.xml:

File Holds
<name>.json The component definition (the payload)
<name>.meta.json The sidecar: componentType, componentName, dataspaceName, deploysWith, dependsOn

Components live under a d360 folder, either in a dataspace or outside one:

Layout fullName
d360/dataspace/<dataspace>/<typeDir>/<name>.json <dataspace>.<name>
d360/<typeDir>/<name>.json <name>

The path from d360 down is kept as is in both directions. A file of one of these types outside a d360 folder is skipped with a warning, and the rest of the project resolves as before.

Nothing in the code is specific to one type. Adding another D360 type is a registry entry, not a code change.

Registered types

Type Directory In package.xml
CalculatedInsight calculatedInsights yes
DataModelObject dataModelObjects yes
DataLakeObject dataLakeObjects yes
DataStream dataStreams yes
DataConnection dataConnections yes
DataTransform dataTransforms yes
ActivationTarget activationTargets yes
DataAction dataActions yes
DataActionTarget dataActionTargets yes
DataGraph dataGraphs yes
IdentityResolution identityResolutions yes
MarketSegment marketSegments yes
MarketSegmentActivation marketSegmentActivations yes
DataspaceMember dataspaceMembers no, sent with its parent
DataModelObjectMapping dataModelObjectMappings no, sent with its parent
SecondaryIndex secondaryIndexes no, sent with its parent
DataModelObjectRelationship dataModelObjectRelationships no, sent with its source Data Model Object

MarketSegment is the D360 JSON type. It is separate from the existing XML MarketSegmentDefinition, and the two use different folders and suffixes.

How it fits in

Piece What it does
Registry Registers the types with the shared d360 adapter and transformer, and indexes the json suffix so these files are seen as metadata. The strict folder name picks the type.
D360SourceAdapter Builds the fullName from the path, and treats the .meta.json sidecar as part of its payload instead of a component of its own.
D360MetadataTransformer Keeps the d360 path in both directions and writes the sidecar next to the payload.
expandD360ComponentSet Adds the components a deploy needs to the set, by following each sidecar's deploysWith. ComponentSetBuilder.build runs it when called with forDeploy, and ComponentSet.deploy runs it for sets built any other way. Expanding a set twice adds nothing.
resolveDataspaceQualifiedComponents Resolves a <dataspace>.<name> deploy request to the local file of a component stored outside any dataspace.
excludeFromManifest and addWithoutManifestEntry Send a component's files without giving it its own package.xml entry.

Behaviour

Deploy

A component deploys together with the peers in its deploysWith. Those peers are added to the set as files only, so package.xml lists just what was asked for, as on retrieve. The four peer only types are never written to a manifest.

The peers are added to the set the deploy was given, so destructive changes, apiVersion, sourceApiVersion and wildcards are kept. Members marked for delete aren't followed, and a peer already in the set is left as it is.

A payload without its .meta.json now fails with an error that names the missing file. The org rejects it anyway, so this just reports it earlier.

When a deploysWith entry names nothing in the component's d360 folder, the deploy goes on without it and warns, naming the component, the missing peer and the folder searched. Each one is reported once.

Deploying for one dataspace

DataLakeObject:default.myDlo__dll works on retrieve because the org resolves the name. Locally the DLO is stored once as myDlo__dll. On deploy:

  1. The request resolves to the local myDlo__dll.
  2. package.xml keeps default.myDlo__dll.
  3. Only peers in default, or outside every dataspace, are added.
  4. The sidecar is sent with deploysWith narrowed to those peers. The local file isn't changed.

Requesting the bare name follows every dataspace.

Retrieve

A component already in the project is written over its own files, wherever they are. New components go under the default package directory.

A component outside any dataspace can be retrieved through several dataspaces, and each returns its own deploysWith. The payload is overwritten, and the sidecar is merged with the local one: the new entries replace those of the dataspaces it covers, and the rest are kept. With no local sidecar, the retrieved one is written as is.

Matching deploysWith entries

Each entry is { componentType, name, dataspaceName? }. Peers are matched by type and name, since different types can share a name. When an entry names a dataspace, a peer in that dataspace matches, and so does one stored outside every dataspace.

dependsOn is informational and isn't used for deploys.

Delete

D360 components can't be deleted through the Metadata API. A deploy that would delete one is refused before anything is sent to the org:

Error (D360DeleteError): D360 components can't be deleted: DataLakeObject:default.myDlo__dll. Leave them out of the delete and try again.
Case Result
A D360 component in destructiveChangesPre or destructiveChangesPost Refused, and every D360 component marked for delete is named
D360 deletes mixed with other components The whole deploy is refused, so nothing goes out half done
Deletes of other types only Unchanged, they deploy as before
Local files Kept. project delete source removes local files only after the org reports success

A component counts as D360 when its registry type uses the d360 adapter. That is exactly the 17 types above, so no existing type is affected.

Deploy flow

sequenceDiagram
    actor User
    participant CLI as CLI
    participant SDR as SDR
    participant Org as Org
    User->>CLI: sf project deploy start --metadata DataLakeObject:default.myDlo__dll
    CLI->>SDR: ComponentSetBuilder.build with forDeploy
    SDR->>SDR: resolve default.myDlo__dll to the local myDlo__dll
    SDR->>SDR: add deploysWith peers as files only
    CLI->>SDR: componentSet.deploy
    SDR->>Org: payloads and sidecars under d360/
    Org-->>User: DeployResult
Loading

Changes in this update

Commit What was asked Rationale and context What is addressed What is not addressed
f6a4c6b A stray file such as test/fixtures/dataConnections/sample.json should not stop the project from resolving The file threw and stopped the whole project from resolving. On main the same file is simply ignored D360SourceAdapter checks the path while resolving. A file with no d360 folder above it emits warning_d360_outside_root and resolves to nothing A real D360 file stored outside a d360 folder is skipped too. It has to be moved under d360 to deploy
faa58d4 Warn when a deploy peer isn't found on disk A deploysWith entry that named nothing in the component's d360 folder was dropped with only a debug log Each entry that matches no file is reported as warning_d360_peer_not_found, at most once per set, naming the component, the peer and the folder searched Peers are only looked up in the component's own d360 folder. One in another package directory is warned about, not pulled in
02b9157 Tests for every registered type The newer types had no resolve coverage Each of the 17 types resolves to its own type under d360/dataspace/<dataspace>/ and under d360/, and only the four peer only types stay out of package.xml Which API version an org supports for each type is decided by the org. The D360 types start at API 68.0
e80f82f A delete of a peer only type did nothing, and a delete by dataspace could remove the file every dataspace shares D360 components can't be deleted through the Metadata API. Without a check, the request reached the org and failed there with a confusing error ComponentSet.deploy() calls getD360ComponentsToDelete first. Any D360 component in destructiveChangesPre or destructiveChangesPost throws D360DeleteError naming them, before anything is sent. Local files are kept Deleting D360 components isn't supported, by design. Deletes of other types are unchanged
79fc90d A retrieve kept the old peers of a dataspace in the sidecar The merge only knew which dataspaces returned peers, so a dataspace with no peers left looked untouched The merge reads the package.xml the org returns. A requested dataspace counts as covered even when it returns no peers, and a bare name request takes the org's sidecar as is A dataspace the DLO has left can't be retrieved through any more, so its old peers stay in the local sidecar. A deploy for another dataspace doesn't send them
ba1b04b An end to end snapshot project for resolve, convert, deploy, retrieve and delete The D360 behaviour was covered by unit tests only. A snapshot shows the output of each step, so any change shows up as a diff test/snapshot/sampleProjects/d360 has one DLO in two dataspaces, each with its own peers, plus a shared index. It records resolve, convert and back, the package each deploy sends, a retrieve for one dataspace, and the delete refusal Its files were written to match what an org returns. Files exactly as an org returned them are in d314889
ebe18aa Make the peer expansion part of ComponentSet, so it works however the set was built, including sets from source tracking Preview, report and resume listed the set as built, while deploy() added the peers later, so the two could drift apart ComponentSet.getComponentsToDeploy() lists the components as the deploy sends them, without changing the set. deploy() adds the peers from the same lookup, and each <dataspace>.<name> request is listed once, under its name, with its local file build() without forDeploy still doesn't add the peers, by design, since project delete source also uses build()
d314889 Check in real output from an org instead of hand written fixtures The fixtures matched the shape an org returns but weren't taken from one test/snapshot/sampleProjects/d360-org holds the files an org returned for one DLO retrieved through default and custom_ds. The snapshots show the deploy for default sends 10 components and the deploy for custom_ds sends 9 No deploy result from an org is checked in. The deploy report doesn't name each D360 component yet, so there is nothing useful to match against
5fe84f7 Same as above The pre-commit formatter rewrote the org's JSON, so the fixture no longer matched what the org returned The folder is excluded from formatting and the files are back to the bytes the org returned Nothing open
15084f7 Edge cases: circular deploysWith, and peers in more than one package directory The walk already handled both, with no tests Two components that list each other are each sent once. A peer in another package directory isn't pulled in, and the deploy warns about it Peers are still only looked up in the component's own d360 folder, by design
8bc2168 Edge case: a malformed sidecar on deploy A sidecar that couldn't be parsed was read as having no peers, so the deploy went out without them and with no message The deploy fails with D360SidecarError, naming the component and the sidecar, and asks to retrieve the component again Only the deploy reads deploysWith, so resolve, convert and retrieve are unchanged
16fd0c4 Edge case: a peer excluded by .forceignore The peer was already left out, but the warning said it wasn't found The deploy warns that .forceignore excludes the peer, naming the ignored file .forceignore still wins, so the peer isn't sent. If the org needs it, the org refuses the deploy
3a5613e Consistent naming Messages, comments and tests said Data Cloud in some places and D360 in others D360 is used throughout the D360 code, messages, tests and HANDBOOK Type names and folder names are unchanged
1603d4e A snapshot of a mixed project (D360 plus Apex and objects) showing nothing changes for the non D360 parts The deploy runs the delete check and the peer lookup on every set, so a project with D360 files must not change what other metadata sends test/snapshot/sampleProjects/d360-mixed has the D360 files of the d360 project, an Apex class, and a custom object with a field. For the Apex class or the object by name, or the classes and objects folders, the set and the package match the same project with its d360 folder removed, byte for byte, with no D360 warning. Next to a D360 request for one dataspace, the Apex and object files are unchanged. Deleting the Apex class still gives destructiveChangesPost.xml. The same packages also match what main produces Nothing open

Delete flow after this change:

sequenceDiagram
    actor User
    participant CLI as CLI
    participant SDR as SDR
    participant Org as Org
    User->>CLI: sf project delete source --metadata DataLakeObject:default.myDlo__dll
    CLI->>SDR: componentSet.deploy with the component marked for delete
    SDR->>SDR: getD360ComponentsToDelete finds DataLakeObject:default.myDlo__dll
    SDR-->>CLI: D360DeleteError
    CLI-->>User: error, local files kept
    Note over Org: nothing is sent
Loading

Testing

Area Covered
Resolve Every type in and out of a dataspace, files outside d360 skipped with a warning, a dataspace named d360, DataModelObjectRelationship kept apart from the XML FieldSrcTrgtRelationship
Delete A D360 delete refused in pre and post destructive changes, a mixed deploy refused, a delete of other types still deployed, and nothing sent when refused
Missing peer Warned once, naming the component, the peer and the folder
Convert Round trip from a force-app/d360 project to a package and back, writing over existing files, sidecar merge, missing sidecar error
Deploy set Peers by dataspace, shared names across types, manifest entries, narrowed sidecars, deletes stay deletes, versions and wildcards kept
ComponentSet addWithoutManifestEntry, and add() giving the manifest entry back
Snapshot project Resolve, convert and convert back, the package sent for each deploy request, a retrieve for one dataspace written into the project, and the delete refusal. 9 tests, stable on a second run
Snapshot project from an org Files as an org returned them: resolve, convert and back to the same bytes, and the package each dataspace deploy sends. 4 tests
Mixed project D360 files next to an Apex class and a custom object: the non D360 packages match a project without D360 files and the output of main, no D360 warnings, and an Apex delete still deploys. 6 tests
Edge cases Components that list each other, a peer in another package directory, a peer excluded by .forceignore, and a malformed sidecar

yarn build and yarn test pass: 1485 unit tests and 100 snapshot tests.

Round trip against an org, for one DLO in two dataspaces:

Step Result
Retrieve DataLakeObject:default.<name> Succeeded. 10 components written
Retrieve DataLakeObject:custom_ds.<name> Succeeded. The DLO sidecar keeps its 7 default peers and adds 7 custom_ds peers, with the shared index listed once. No default file changes
Retrieve DataLakeObject:<name> Refused by the org, which asks for <dataspace>.<name> since the DLO is in two dataspaces. No local file changes
Deploy DataLakeObject:default.<name> Succeeded
Deploy DataLakeObject:custom_ds.<name> Succeeded

Next

The expansion now runs inside SDR, so the CLI doesn't call it directly. salesforcecli/plugin-deploy-retrieve#1649 only passes forDeploy: true to ComponentSetBuilder.build, so the deploy set it reports already holds the peers. Beyond that, the CLI only needs an SDR and @salesforce/source-tracking bump.

@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: support Data Cloud dataspace-scoped metadata types (CalculatedInsight, DataModelObject) feat: support Data Cloud dataspace-scoped metadata types Sep 21, 2026
@aparnagoy
aparnagoy force-pushed the d360-dataspace-scoped-metadata branch from e8279ce to 8f238d7 Compare September 21, 2026 21:23
@aparnagoy aparnagoy changed the title feat: support Data Cloud dataspace-scoped metadata types [Feat] Support Data Cloud DataSpace-scoped Metadata Types Sep 21, 2026

@WillieRuemmele WillieRuemmele left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for putting this together! the resolve/convert side looks solid. I pulled the branch and ran some probes against it. a few things I'd want sorted before merging:

blocking

  1. toSourceFormat ignores mergeWith and always writes to main/default/d360/.... if the component already lives somewhere else (like force-app/d360/..., which is what the tests use), retrieve writes a second copy. the sidecar merge also never runs in that case since it reads the hardcoded path.
  2. getD360Destination: if there's no d360 segment in the path, trimUntil returns the absolute path as is. a DLO at main/default/dataLakeObjects/X.json still resolves, then converts right back onto its own source path. could we either not resolve these or throw a clear error?
  3. expandD360ComponentSet builds a brand-new set, so it drops destructive changes (they come back as deploys!), apiVersion/sourceApiVersion, and wildcard entries. could it add the peers to the set it's given instead?
  4. deleting a peer-only type is a no-op. excludeFromManifest also filters the destructive manifest, so a deleted DataspaceMember/DataModelObjectMapping gives an empty destructiveChanges.xml. tracking then marks it synced, but the org still has it.

design
5. I think the expansion should live in SDR, not the plugin. something like:

  • expand in ComponentSetBuilder.build(), next to resolveDataspaceQualifiedComponents. deploy start and deploy preview both go through it, so preview would be accurate
  • skip members marked for delete
  • keep an idempotent version in ComponentSet.deploy() as a fallback, for deploys with no flags (those get their set from source tracking) and for anything calling deploy() directly
  • I'd avoid doing it in add(), since that would also hit retrieve/delete sets and change the set behind the caller's back
  • you could find peers by path instead of resolving the whole project: retrieveWith already has type + name + dataspace, and the layout is fixed, so just compute the path and check tree.exists. it's cheaper, and a bad file in another package dir can't break the deploy anymore

deletes
6. same root cause as #4, but for edits: deploying just a changed DataModelObjectMapping gives an empty package.xml. should we look up the component that owns it and include that?
7. when a DLO is deleted, does the org clean up its peers? if not, those local files are orphaned and nothing can deploy or delete them
8. just confirming: deleting DataLakeObject:default.myDlo__dll resolves to the shared bare-named local file, right? would project delete source remove it for every dataspace?
9. mergeSidecars keeps a dataspace's old peers if a retrieve returns none for it, so peers deleted in the org never get cleaned up locally
10. if only the .meta.json gets deleted, the payload deploys without it silently. should that error instead?

other
11. nit (non-blocking): calling add() after addWithoutManifestEntry doesn't clear the exclusion
12. the description says 8 types but the diff registers 16, and the last commit's 8 have no tests. could we confirm those all exist in the Metadata API? (MarketSegment vs the existing MarketSegmentDefinition caught my eye)
13. would love to see a retrieve → deploy round-trip test with a non-main/default layout, plus some delete cases
14. could we update HANDBOOK.md too? the new excludeFromManifest property should go in "Breaking Down a Metadata Type Entry", explaining that the type's files still go in the deploy/retrieve payload but it never gets a package.xml entry (constructive or destructive). a short section for the d360 adapter/transformer under Adapters/Transformers would help too

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

aparnagoy commented Nov 20, 2026 •

Copy link
Copy Markdown
Author

@WillieRuemmele Thanks for the thorough review, and for running the probes. I've pushed the fixes as separate commits. Here's where each point stands.

Fixed in this push

# Point What changed Commit
1 toSourceFormat ignored mergeWith A component already in the project is now written over its own files, wherever they are, and its sidecar is merged from that path. New components still go under main/default. 0a9a6a2
2 Files outside a d360 folder resolved The adapter now rejects them with a clear error. The transformer uses the same layout check, so a dataspace named d360 can't confuse the path either. 7ccc223
3 The expansion built a new set Peers are now added to the set it's given, so destructive changes, apiVersion, sourceApiVersion and wildcards are kept. Members marked for delete aren't walked, and a peer already in the set is left as it is. 5d851d1
10 A payload deployed without its .meta.json Converting to metadata format now fails and names the missing file. The server rejects a payload without its sidecar anyway, so this just surfaces the problem earlier and more clearly. ef1de0c
11 add() didn't clear the exclusion add() now clears it, so the last call wins. 8d41337
13 Round trip and delete tests Added a project to package to project round trip with a force-app/d360 layout, plus tests showing that deletes stay deletes through the expansion. 0a9a6a2, 5d851d1
14 HANDBOOK Documented excludeFromManifest under "Breaking Down a Metadata Type Entry", and added sections for the d360 adapter and transformer. 3bfc5db

While testing #11 I also found that requesting both myDlo__dll and default.myDlo__dll dropped the bare name from package.xml. That's fixed in b22ec0c.

Next: moving the expansion into SDR (#5)

Agreed, this is the right home for it. Here's the plan:

Area Plan
Where Expand in ComponentSetBuilder.build() next to resolveDataspaceQualifiedComponents, with an idempotent fallback in ComponentSet.deploy(). Not in add().
Deletes Already skipped by the expansion as of 5d851d1.
Peer lookup By path: type, name and dataspace give the path under the requester's d360 folder, checked with tree.exists. No more resolving the whole project.
Retrieve build() also builds retrieve sets, so I'll make sure the expansion only applies to deploys.

Once that's in, the plugin PR isn't needed and we can just bump SDR and @salesforce/source-tracking.

Deletes (#4, #6 to #9)

# Question Answer
4 Deleting a peer-only type is a no-op Agreed, that's a real gap. These types can't appear in a manifest, so the delete has to go through the owning component: deploy the owner with a sidecar that no longer lists the peer. I'm confirming with the server side that this removes the peer. If it doesn't, the CLI should fail rather than let tracking mark it synced.
6 A changed DataModelObjectMapping alone gives an empty package.xml Yes, same root cause. The plan is to find the owner through the reverse of retrieveWith and include it. That fits in with the path-based lookup from #5.
7 Does the org clean up a deleted DLO's peers? I'm confirming with the server side and will follow up here. If it doesn't, the local files would be orphaned as you describe, and the CLI should at least warn.
8 Deleting DataLakeObject:default.myDlo__dll Yes, it resolves to the shared bare file, so today project delete source would remove it for every dataspace. A delete by dataspace-qualified name shouldn't remove the shared local file; only a delete by the bare name should.
9 mergeSidecars keeps a dataspace's old peers Correct, that's a known limit. When a retrieve returns no peers for a dataspace, the transformer can't tell that the retrieve covered it. Fixing it means passing the requested dataspaces through the retrieve. I'll pick it up after #5.

Types (#12)

Sorry, the description is out of date: the PR registers 16 types, not 8. I'll update it.

Group Types
In a manifest CalculatedInsight, DataModelObject, DataLakeObject, DataStreamBundle, DataConnection, DataTransform, ActivationTarget, DataAction, DataActionTarget, DataGraph, IdentityResolution, MarketSegment, MarketSegmentActivation
Only with their parent (excludeFromManifest) DataspaceMember, DataModelObjectMapping, SecondaryIndex

The 8 from the last commit are confirmed against the server. I'm double checking DataConnection. MarketSegment is the Data Cloud JSON type and is separate from the existing XML MarketSegmentDefinition. They use different folders (marketSegments and marketSegmentDefinitions) and different suffixes, so they don't collide. I'll also add resolve tests for the 8 newer types.

@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @jamiesampey to sign the Salesforce Inc. Contributor License Agreement.

@aparnagoy
aparnagoy force-pushed the d360-dataspace-scoped-metadata branch from 7ff595f to 2a9558c Compare November 20, 2026 08:43
@WillieRuemmele

WillieRuemmele commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

thanks for the updates! path-based peer lookup looks good, and expand is safe to run twice now (verified merge-onto-existing and in-place expand locally).

thanks for flagging the delete case, I'd rather not add another option to build() though, every caller should get the same set. could we always expand in build() and make the peer marker stick to the SourceComponent instead of the set? both delete source in PDR and deleteSource in vscode do toArray() → cs.add(c, POST) into a fresh set, so right now the marker is lost and the peers would get deleted. if add() skips peers when a deletionType is passed, delete stays safe everywhere and preview/report/resume match deploy without any PDR change beyond the bump. could we get a test for the delete round trip too?

couple of things still open from before:

  • a stray force-app/test/fixtures/dataConnections/sample.json now throws A DataConnection must be stored under a d360 folder and breaks resolving the whole project, on main that file is just ignored. could we skip it with a warning instead of throwing?
  • deleting a peer-only type (DataspaceMember, DataModelObjectMapping) still produces an empty destructiveChanges, so the delete is a silent no-op. should that either deploy with its parent or error?

@WillieRuemmele

Copy link
Copy Markdown
Member

one more, could we add a snapshot project under test/snapshot/sampleProjects (like destructiveCompSets / digitalExperienceBundle) covering each operation end to end? right now it's all unit tests on the adapter/transformer/expansion. something like:

  • deploy: DLO with its DMO peer, both root and dataspace/<ds>/ layouts, snapshot the mdapi output + package.xml (peers present, no manifest entry for excludeFromManifest types)
  • retrieve: mdapi → source back onto an existing project, no duplicates under main/default and sidecars merged
  • delete: destructiveChanges for a normal type and a peer-only type, and the toArray() → add(c, POST) round trip doesn't pick up peers
  • convert: source → mdapi and mdapi → source round trip
  • resolve/manifest: stray dataConnections folder outside d360 doesn't blow up the project

that'd lock in the behavior we've been going back and forth on.

@WillieRuemmele

Copy link
Copy Markdown
Member

a few more after another pass:

  • I'd treat Updates needed to publish library #8 as blocking rather than a follow-up. project delete source on DataLakeObject:default.myDlo__dll deleting the shared bare file for every dataspace is silent local data loss. could we get that fixed (and tested) in this PR?
  • if a retrieveWith peer isn't found on disk, the peer finder just drops it with a debug log. lookup is also limited to the requester's own d360 folder, so in a multi package dir project a peer in another package dir silently falls out of the deploy. could we at least warn there?
  • just confirming: even with the expansion in build(), deploy preview with no flags gets its set from source tracking (localChangesAsComponentSet), which doesn't go through build(). so preview would still be short there unless STL expands too, right?
  • nit (non-blocking): the types table in the description is missing SecondaryIndex

Add SDR support for Data Cloud dataspace-scoped metadata (CalculatedInsight,
DataModelObject). Their on-disk shape differs from every existing type: each
component is a pair of generic .json files - a payload <name>.json and a
<name>.meta.json sidecar - nested under a d360/dataspace/<dataspace>/<typeDir>/
wrapper, with no -meta.xml. The component fullName is dataspace-scoped
(<dataspace>.<name>).

- registry: register the two types with dataspaceScoped adapter/transformer
  strategies and index the `json` suffix so bare .json files resolve as metadata.
- resolve: DataspaceScopedSourceAdapter derives the <dataspace>.<name> fullName
  from the path and folds the .meta.json sidecar into its payload component.
- convert: DataspaceScopedMetadataTransformer preserves the full d360/... path in
  both directions and co-writes the sidecar alongside the payload.
- collections: expandDataspaceScopedComponentSet builds the minimal deploy closure
  from each component's sidecar retrieveWith set.
…package.xml

Add DataLakeObject, DataspaceMember, DataModelObjectMapping, SecondaryIndex,
DataStreamBundle and DataConnection, and use the plural directory names the
Metadata API writes (calculatedInsights, dataModelObjects, ...).

Add an excludeFromManifest registry flag and ComponentSet.addWithoutManifestEntry
so components that only deploy as part of another one travel as files without
their own package.xml entry.
Accept <dataspace>.<name> on deploy for components stored outside any dataspace
(e.g. DataLakeObject:default.myDlo__dll, DataStreamBundle:default.myStream), the
same name retrieve accepts. The local component is resolved by its bare name,
package.xml keeps the requested name, and the retrieveWith closure is limited to
that dataspace.

Match retrieveWith entries by type and name, so components of different types
that share a name are told apart, and honour the dataspace a reference names.
A component outside any dataspace, such as a Data Lake Object, is stored once but
can be retrieved through several dataspaces. On retrieve, its payload is
overwritten and its .meta.json is merged with the local copy: retrieveWith
entries of the dataspaces the retrieve covers are replaced, and those of other
dataspaces are kept.

On deploy for one dataspace, the closure skips entries that name another
dataspace, and the sidecar is sent with retrieveWith trimmed to the requested
dataspaces. The local file is left unchanged.
A Data Stream bundle names its Data Lake Object with the dataspace it uses
it in, but the DLO is stored outside every dataspace, so its sidecar has
none. The closure only matched a peer whose dataspace equalled the one the
reference named, so it dropped the DLO and the deploy failed for a missing
component. A reference that names a dataspace now also matches a peer
stored outside every dataspace.
Adds DataTransform, ActivationTarget, DataAction, DataActionTarget,
DataGraph, IdentityResolution, MarketSegment and MarketSegmentActivation
to the registry, with the d360 adapter and transformer and strict
directory names, matching the existing Data Cloud types.
A manifest entry such as DataLakeObject:default.myDlo__dll matched no local
source, because the component is stored once under its bare name. Resolve
manifest entries the same way metadata entries already are, so the local
component is found and the manifest keeps the requested name.
A Data Cloud file outside a d360 folder used to resolve, then convert back onto
its own path. The adapter now rejects it with a clear error. The transformer uses
the same layout check, so a dataspace named d360 no longer confuses the path.
The transformer ignored mergeWith and always wrote under main/default, so a
component stored anywhere else got a second copy and its sidecar was never
merged. It now writes over the component's own files, wherever they are.
A payload whose .meta.json sidecar was deleted used to be sent on its own, and
the org then rejected it. The conversion now fails first, naming the missing
file and how to restore it.
Calling add() after addWithoutManifestEntry() kept the component out of the
manifest. add() now clears that, so the last call decides.
…equested

Asking for both myDlo__dll and default.myDlo__dll re-added the local component
without a manifest entry, which dropped myDlo__dll from package.xml. A component
already in the set is now left as is.
expandD360ComponentSet built a new set, which lost destructive changes, the API
versions, and wildcard entries. It now adds the peers to the set it is given and
returns that set. Components marked for delete are not walked, and a peer
already in the set keeps what the caller asked for it.
The layout under a d360 folder is fixed, so a retrieveWith entry gives the
path of each candidate peer. Only those paths are checked now, instead of
resolving the whole project to build a lookup index.

expandD360ComponentSet takes the set to expand and the registry. A peer is
still matched on its sidecar type and name, and its dataspace now comes
from its path.
A peer an earlier expansion added has no manifest entry of its own. It is
no longer seeded again, since walking a peer outside every dataspace from
scratch would pull peers from dataspaces it was not reached in.

ComponentSet.isWithoutManifestEntry tells such a component apart.
ComponentSetBuilder.build takes a forDeploy option. With it, the
Data Cloud components that deploy together with the requested ones are
added while the set is built, so the deploy start and its preview list
the same components.

Retrieve and delete leave the option off and build the set as before.
A set that was not built for a deploy, such as one from source tracking or
from a direct caller, still gets the Data Cloud components that deploy
together with the requested ones. A set built for a deploy already has
them, and expanding it again adds nothing.
…With

The sidecar field that lists the components deployed together with a Data Cloud
component is now deploysWith, matching the field the org writes on retrieve.
The type is named for the component it holds. Its files now live under dataStreams.
A custom relationship between two Data Model Objects is retrieved under
d360/dataspace/<dataspace>/dataModelObjectRelationships and deployed through the deploysWith of
its source Data Model Object. It is never listed in package.xml.
A file in a folder that shares a Data Cloud type's name, such as a test fixture under
force-app/test/fixtures/dataConnections, used to throw and stop the whole project from
resolving. It is now skipped with a warning, as it is on main, and the rest of the project
resolves as before.
A deploysWith entry that named nothing in the component's d360 folder was dropped with only
a debug log, so a missing peer, or one in another package directory, silently fell out of the
deploy. It now raises a warning that names the component, the peer and the folder searched.
Each one is reported once per set, since a deploy can expand the same set again.
Covers each of the 17 registered Data Cloud types: it resolves to its own type under
d360/dataspace/<dataspace>/ and under d360/, and only the four types sent with another
component are kept out of the manifest.
D360 components can't be deleted through the Metadata API. ComponentSet.deploy now throws
D360DeleteError, naming each D360 component marked for delete, before anything is sent to the
org. A deploy that deletes only other components goes through as before.
A D360 component outside every dataspace keeps one sidecar for all the
dataspaces it was retrieved through. The merge only counted a dataspace
as covered when the org returned a peer in it, so a dataspace with no
peers left kept its old ones.

The merge now reads the package.xml the org returns with the retrieve:
- <dataspace>.<name> asked for: that dataspace is covered, even empty.
- The bare name asked for: the retrieved sidecar is written as is.
- No package.xml, or the component was not asked for: unchanged.
@aparnagoy
aparnagoy force-pushed the d360-dataspace-scoped-metadata branch from 2f89203 to 45c0062 Compare December 2, 2026 00:36
…eve and delete

One Data Lake Object in two dataspaces, each with its own peers, and a shared index.
The snapshots show what each deploy sends, how a retrieve for one dataspace is written
into the project, and that a delete is refused before anything is sent.
…ntsToDeploy

The deploy closure is now a property of the set, so it works however the set was built,
including sets built by hand with new ComponentSet() and add(), as source tracking does.

getComponentsToDeploy() returns what a deploy sends without changing the set: D360 components
with their peers, and a <dataspace>.<name> request under that name with the local file sent
for it, listed once. Other members are listed as iterating the set lists them.

deploy() and the view share the same closure step, so preview and deploy can't drift apart.
The project holds one Data Lake Object and everything an org retrieve returned
with it: its members of the default and custom_ds dataspaces, the data model
objects, mappings and relationship in each, and the secondary index they share.
The files keep the current sidecar shape. Only the object name was shortened.

The tests resolve the project, convert it to a package and back without change,
and check that a deploy of the object in each dataspace sends that dataspace's
peers while package.xml names only the request.
…rned them

The pre-commit formatter rewrote the JSON the org returned, so the package a
deploy sends no longer matched the files on disk. Leave those files out of
prettier and restore them byte for byte.
… directory

A DLO and a data model object that each list the other deploy once each. A peer stored in another
package directory isn't pulled in, and the deploy warns that it was left out.
A sidecar that couldn't be parsed was read as having no peers, so the deploy went ahead without
them. The deploy now fails, naming the component and the sidecar, and asks to retrieve it again.
A peer that .forceignore excludes was reported as not found. It now gets its own warning that names
the ignored file, so leaving a peer out on purpose reads differently from a missing one.
@aparnagoy
aparnagoy force-pushed the d360-dataspace-scoped-metadata branch from 1658749 to 3a5613e Compare December 3, 2026 00:54
@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.

Add a snapshot project with the D360 files of the d360 project next to an Apex class and a
custom object with a field.

For a request that names no D360 component, by name or by folder, the deploy set and the
package match the same project with its d360 folder removed, and no D360 warning is emitted.
Next to a D360 request for one dataspace, the Apex and object files are unchanged. A delete
of the Apex class still produces destructiveChangesPost.xml.
The D360 adapter cut the name at the first dot of the file name, so a relationship named
ssot__Account__dlm.ssot__Id__c_ssot__Individual__dlm.ssot__FirstName__c resolved as
ssot__Account__dlm. Every relationship of an object got the same name, and a deploy by its full
name found nothing to send.

Only the .json suffix is removed now, so the whole name is kept, inside a dataspace and outside one.

This branch has not been deployed

No deployments
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