Compare with server Expericence results not correct structure
Hi, I have multiple folders inside force-app (main, custom project folders) and when I’m comparing my experience which is not in main folder (from custom project folder), I’m receiving experience results divided by 2.
Comments (7)
-
reporter -
repo owner Hi. Can you please enable debug logging for Metadata Retrieval, reproduce the behavior, and either attach or email the resulting
idea*.log*
file(s) from the duration of that retrieval? That should show exactly how IC2 is matching retrieved files against local project files. My guess is that there’s just enough intersection in file/path naming in the two that it’s matching some files incorrectly. -
repo owner - changed status to open
-
repo owner Thanks to provided debug logs, I can see why this is happening. The experience bundle in the local project is stored as (source root-relative path)
alternativeDir/experiences/RetrievedBundleName/....
The Salesforce CLI retrieves that experience bundle as (temp dir-relative path)force-app/main/default/experiences/RetrievedBundleName/....
Because files with the same name can be found in multiple locations -- specifically under bundle directories -- IC2's retrieved-to-local file matching strategy tries to match using path components leading up to the ambiguous retrieved filename. In this case, the difference between the localalternativeDir/experiences
and the retrievedforce-app/main/default/experiences
combined with the fact that there are also experience bundles stored in the local project underforce-app/main/default/experiences
results in a matching ambiguity on most of the retrieved experience bundle's files, e.g.:2023-12-11 20:43:57,357 [ 58457] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Processing /path/to/tempDir/tmp/force-app/main/default/experiences/RetrievedBundleName/brandingSets/buildYourOwn.json. 2023-12-11 20:43:57,357 [ 58457] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Using filename buildYourOwn.json. 2023-12-11 20:43:57,358 [ 58458] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Found multiple existing files named buildYourOwn.json. Searching for correct match. ... 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Comparing 'force-app/main/default/experiences/ExistingBundleName1/brandingSets/buildYourOwn.json' to 'force-app/main/default/experiences/RetrievedBundleName/brandingSets/buildYourOwn.json'. 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - There are 6/7 = 85,71% matching path components. 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - This is the new best match. ... 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Comparing 'force-app/main/default/experiences/ExistingBundleName2/brandingSets/buildYourOwn.json' to 'force-app/main/default/experiences/RetrievedBundleName/brandingSets/buildYourOwn.json'. 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - There are 6/7 = 85,71% matching path components. 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - This is the same as the current best match. ... 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Comparing 'force-app/main/default/experiences/ExistingBundleName3/brandingSets/buildYourOwn.json' to 'force-app/main/default/experiences/RetrievedBundleName/brandingSets/buildYourOwn.json'. 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - There are 6/7 = 85,71% matching path components. 2023-12-11 20:43:57,369 [ 58469] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - This is the same as the current best match. ... 2023-12-11 20:43:57,373 [ 58473] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Comparing 'force-app/alternativeDir/experiences/RetrievedBundleName/brandingSets/buildYourOwn.json' to 'force-app/main/default/experiences/RetrievedBundleName/brandingSets/buildYourOwn.json'. 2023-12-11 20:43:57,373 [ 58473] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - There are 5/7 = 71,43% matching path components. ... 2023-12-11 20:43:57,376 [ 58476] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Failed to find an unambiguous best match existing file. 2023-12-11 20:43:57,376 [ 58476] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - No matching existing file found. 2023-12-11 20:43:57,376 [ 58476] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Placing in source root force-app. 2023-12-11 20:43:57,379 [ 58479] FINE - #com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever - Moving/copying /path/to/tempDir/tmp/force-app/main/default/experiences/RetrievedBundleName/brandingSets/buildYourOwn.json to /path/to/tempDir/diff/force-app/main/default/experiences/RetrievedBundleName/brandingSets as buildYourOwn.json.
As shown above, multiple files named
buildYourOwn.json
are found underforce-app/main/default/experiences
locally and result in a "stronger" match against the CLI's retrieved file path offorce-app/main/default/experiences/RetrievedBundleName/brandingSets/buildYourOwn.json
than the last one shown above which is the correct match. As a result, given that there's no unambiguous "strongest" match, IC2 plays it safe and doesn't risk overwriting any local file, instead using a default source root-relative path.While that's the safe behavior and one that has worked well for a good long while, it's obviously not the desired behavior in this specific situation. One way to make this more accurate would be to discern the bundle root directory and use that as the focus when matching, specifically the
experiences/RetrievedBundleName
portion in this example.Before going that route, though, I'm curious as to whether this can be resolved by changing the CLI's package directories and/or the IDE project's source roots to be more specific. Given that the CLI retrieval is happening in a temporary directory, it might not, but let me try to reproduce this behavior locally and then see if it can/should be addressed by using more discrete package directories/source roots instead.
-
repo owner Yeah, it looks like more than a config change is required here. I was able to reproduce incorrect matches/collisions with one experience bundle in the local project by retrieving one or more other experience bundles. I’ll take a look at a proper fix for the next build.
-
repo owner Okay, I’ve implemented a prospective proper fix for this. I’m going to run it through the paces on side, but it would be great if you could also install it via a test build and confirm that it’s producing the correct behavior in your environment as well. That would likely come tomorrow if my current testing bears out well. I’ll let you know when it’s ready either way.
-
repo owner - changed status to resolved
Delivered in 2.2.9.3.
- Log in to comment
force-app
projectName
experiences
main
default
experiences