Skip to content

fix/1834 build does not find shared DEs when run on child BU#2552

Merged
JoernBerkefeld merged 6 commits intodevelopfrom
copilot/fix-shared-de-warning
Mar 21, 2026
Merged

fix/1834 build does not find shared DEs when run on child BU#2552
JoernBerkefeld merged 6 commits intodevelopfrom
copilot/fix-shared-de-warning

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

build --dependencies on a child BU emitted a misleading "Not found in your project folder" warning for shared/synchronized dataExtensions and suggested a retrieve that would never work. The fix checks _ParentBU_ for missing DEs and shows a targeted, actionable warning without including the DE in the deployment package.

Changes

lib/metadataTypes/MetadataType.js

  • Replaced the getAlternativeFilesToCommit hook (which incorrectly added found items to the deployment package) with a handleNotFoundDependencies(notFound, notFoundList) hook
  • getDependentFiles now delegates "not found" handling to this hook; only keys it returns get the generic warning

lib/metadataTypes/DataExtension.js

  • Removed getAlternativeFilesToCommit and readSecondaryFolder
  • Added handleNotFoundDependencies override (only active when eid !== mid):
    • Checks _ParentBU_/<type>/ for each missing key
    • shared_dataextension → warns that it must be built on parent BU and deployed separately
    • synchronizeddataextension → warns that the reference likely needs templating or manual change at deploy time
    • dataextension on parent BU or not found → falls through to the default "not found" warning
    • Never adds the found item to multiTypeKeyList; deployment package for the child BU is unaffected
  • Added TypeKeyCombo typedef import

lib/index.js

  • Asset.getJsonFromFSCache is now always reset after addDependentCbReferences, not only when assets were found (pre-existing bug)

Tests

  • Updated query buildTemplate --dependencies test: asserts the shared DE is absent from the template result and that the process still exits cleanly

Documentation

No documentation changes required.

Issues

Release details

Checklist

Before merge

  • Wiki updated with info in ticket listed under Documentation
  • ran npm run prepare-release (which runs npm audit fix, npm run lint-ts, npm run lint:fix, git add, git commit)
  • pushed potential changes made by prepare-release

After merge

  • merged all dependabot PRs that target main branch
  • updated bug template to include the new version
  • updated .mcdevrc for tests to the new version
  • ran npm run version:major/minor/patch
  • pushed version-prep commits
  • merged main branch into develop branch
  • closed GitHub milestone
  • created new GitHub Release
Original prompt

This section details on the original issue you should resolve

<issue_title>[TASK] build does not find shared DEs when run on child BU</issue_title>
<issue_description>While this isn't causing an error, it is throwing a confusing warning, telling user to download the respective DE - which of course wouldn't work.

This can happen when build is run for a components that links to a shared dataextension via r__dataExtension_key. Types that would have that include journey, dataFilter, filter, query, dataExtract, event and more.

First, check if the code in fact still has this problem or of this issue is outdated. If a warning is still shown

This might require caching shared DEs from the server (parent bu) OR reading the dataExtensions in the folder retrieve/<credential>/_ParentBU_/ - which is likely faster but not always possible (maybe fallback to retrieve-shared-DEs-for cache if folder wasn't found?)</issue_description>

<agent_instructions>Adhere to Standards set in .github/copilot-instructions.md
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…d BU

Co-authored-by: JoernBerkefeld <1917227+JoernBerkefeld@users.noreply.github.com>
Copilot AI changed the title [WIP] [TASK] Fix shared DE warning in child BU builds fix/1834 build does not find shared DEs when run on child BU Mar 15, 2026
Copilot AI requested a review from JoernBerkefeld March 15, 2026 10:57
@JoernBerkefeld JoernBerkefeld linked an issue Mar 19, 2026 that may be closed by this pull request
@JoernBerkefeld JoernBerkefeld added this to the 9.0.3 - dataExtensions milestone Mar 19, 2026
@github-actions
Copy link

github-actions bot commented Mar 20, 2026

Coverage Report

Commit:a3fd702
Base: develop@9d8ee7e

Type Base This PR
Total Statements Coverage  71.07%  71.09%  (+0.02%)
Total Branches Coverage  70.78%  70.75%  (-0.03%)
Total Functions Coverage  83.77%  83.81%  (+0.04%)
Total Lines Coverage  71.07%  71.09%  (+0.02%)
Details (changed files):
File Statements Branches Functions Lines
lib/index.js  70.76%  65.38%  77.08%  70.76%
lib/metadataTypes/DataExtension.js  78.99%  71.15%  94.59%  78.99%
lib/metadataTypes/MetadataType.js  85.21%  81.71%  77.27%  85.21%

@JoernBerkefeld
Copy link
Contributor

@copilot you misunderstood me. please revert your changes, except for your unrelated fix in lib/index.js

before your changes, it couldnt find the shared dataExtension and suggested to the user to download it from the child-bu which is not correct nor possible. instead, it should check if it can find the shared dataExtension in the parentBU's folder and if it does, print a warning mentioning that shared dataExtensions have to be handled in a separate run of build and have to be deployed separately as well - unless source BU and target BU happen to rely on the same shared dataExtension. That would not be recommended but it is technically an option and it's been known to happen.

under no circumstances should build include the potentially found shared/synced dataExtension in the deployment package for the child business unit.

remember that all of the above only applies if current eid != current mid - or in other words: if we are running build for a source BU other than cred/_ParentBU_.

tasks:

  • if a dataExtension is not found on the local bu when resolving dependencies as part of a build --dependencies run, check if you can find the dataExtension in the _ParentBU_/dataExtension folder.
  • If you do not find the missing dataExtension on parent bu, show the current warning (suggesting to run retrieve)
  • if you do find it on parent bu and r__folder_ContentType != "dataextension", show a warning about the reference to a shared dataExtension (r__folder_ContentType == "shared_dataextension")) or a synchronized dataExtension (r__folder_ContentType == "synchronizeddataextension"). If it is a synchronized dataExtension, warn that this reference likely has to be changed during deployment either via mcdev's templating or otherwise manually. If it is a shared dataExtension, warn that the same as for synchronized dataExtensions but append that to update that synced DE, the user has to run build for parent bu and also run mcdev deploy separately.
  • the warning should be readable on a normal laptop screen. make sure you split it into readable chunks before calling our logger function.
  • if the dataExtension found on parent bu has r__folder_ContentType == "dataextension" then ignore this as it could not be used from the child bu and proceed as if no dataExtension was found on child bu nor on parent bu

Co-authored-by: JoernBerkefeld <1917227+JoernBerkefeld@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Accenture/sfmc-devtools/sessions/7111d9b8-5d50-4cdc-8f35-a764875ef429
@JoernBerkefeld JoernBerkefeld marked this pull request as ready for review March 21, 2026 19:04
@JoernBerkefeld JoernBerkefeld merged commit a1b8b17 into develop Mar 21, 2026
10 checks passed
@JoernBerkefeld JoernBerkefeld deleted the copilot/fix-shared-de-warning branch March 21, 2026 19:04
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.

[TASK] build does not find shared DEs when run on child BU

2 participants