cli icon indicating copy to clipboard operation
cli copied to clipboard

.forceignore issue, --concise parameter isn't working as expected for force:source:status command

Open saurabh-deep opened this issue 3 years ago • 2 comments

Summary

Remote changes are not being ignored correctly by force:source:status command when using the --concise parameter. It happens when the added/metadata updated in the org doesn't exist in local source, and is supposed to be ignored as per .forceignore. Details and steps are provided for Profiles only, so that the issue can be reproduced easily without making any changes after cloning the dreamhouse-lwc repo, but it can just as easily be replicated with any metadata type (e.g. ApexClass) by making the required entries in the .forceignore file.

As per the documentation, ignored files shouldn't be returned in the output of force:source:status command when using --concise parameter. But the metadata is reported as Remote Add. Even stranger is the fact that the same file which is incorrectly reported as Remote Add by the force:source:status command is still ignored (correctly) by force:source:pull command.

This issue came into existence when the new force:source:beta commands became generally available in version 7.144.2.

This breaks our use cases which depend on the output of the status command to decide whether a pull/push needs to take place. Without the --concise parameter to work as expected we are having to use legacy versions of the source tracking and status/pull/push commands.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

  1. Clone the dreamhouse-lwc repo.
  2. Check .forceignore file to ensure that all profiles are ignored.
  3. Without making any code changes, create a new scratch org. sfdx force:org:create -f config/project-scratch-def.json -s -a dreamhouse-org -v DEVHUB
  4. Push the repo source to the new scratch org. sfdx force:source:push
  5. Check the source status, with complete output (without --concise parameter) sfdx force:source:status
  6. Check the source status, with concise output sfdx force:source:status --concise
  7. Try retrieving from remote. sfdx force:source:pull

Expected result

  1. Step # 5 force:source:status - should show the complete output, i.e. Admin profile should show up as Remote Add.
  2. Step # 6 force:source:status --concise - shouldn't show the Admin profile as Remote Add since we are using the --concise paramter and profiles are ignored using .forceignore.
  3. Step # 7 force:source:pull - should report No results found

Actual result

  1. Output of step # 5 is as expected.
  2. Output of step # 6 is not correct. Even when using --concise param with the force:source:status command, the ignored profile is being reported as Remote Add.
  3. Interestingly, output of step # 7 is also correct. force:source:pull command reports No results found, even when status command shows the profile as Remote Add.

This indicates that the .forceignore is being interpret correctly by the pull command, but not by the status command as should happen when using the --concise param.

System Information

▶ sfdx version --verbose --json { "cliVersion": "sfdx-cli/7.152.0", "architecture": "darwin-x64", "nodeVersion": "node-v14.19.1", "pluginVersions": [ "@oclif/plugin-autocomplete 0.3.0 (core)", "@oclif/plugin-commands 1.3.0 (core)", "@oclif/plugin-help 3.3.1 (core)", "@oclif/plugin-not-found 1.2.6 (core)", "@oclif/plugin-plugins 1.10.11 (core)", "@oclif/plugin-update 1.5.0 (core)", "@oclif/plugin-warn-if-update-available 1.7.3 (core)", "@oclif/plugin-which 1.0.4 (core)", "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)", "alias 2.0.0 (core)", "apex 0.12.0 (core)", "auth 2.0.2 (core)", "community 1.1.4 (core)", "config 1.4.6 (core)", "custom-metadata 1.1.0 (core)", "data 2.0.0 (core)", "generator 2.0.1 (core)", "info 2.0.0 (core)", "limits 2.0.0 (core)", "org 1.13.1 (core)", "salesforce-alm 54.4.0 (core)", "schema 2.1.0 (core)", "sfdx-cli 7.152.0 (core)", "signups 1.1.1 (core)", "source 1.9.9 (core)", "telemetry 2.0.0 (core)", "templates 54.7.0 (core)", "trust 1.1.0 (core)", "user 2.0.0 (core)" ], "osVersion": "Darwin 20.6.0" }

Additional information

The issue can be replicated with any metadata type when the following 2 conditions are true -

  1. Metadata which is being added/updated in the org is ignored using .forceignore.
  2. Metadata is not present in your local source.

At this point force:source:status --concise command still reports the ignored metadata as Remote Add and force:source:pull command refuses to retrieve that.

image

saurabh-deep avatar May 24 '22 12:05 saurabh-deep

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] avatar May 24 '22 12:05 github-actions[bot]

This issue has been linked to a new work item: W-11224417

uip-robot-zz avatar May 31 '22 13:05 uip-robot-zz

We fixed this last June and didn't update the gh issue.

mshanemc avatar Feb 13 '23 16:02 mshanemc