Deploying from SF to Repo with unlocked packages can result in items deploying incorrectly
When deploying from SF to a branch that has the force-app and unlocked packages, if you deploy an item that would include the object file it deploys to the unlocked package directory instead of the default app listed in the project.json. The end result is everything related to the object is moved from the force-app to the unlocked package directory.
Steps to recreate:
Enable source tracked sandboxes
Create a new dev sandbox
Create a new branch and link it to the new sandbox
Create a new field on Contact
Edit a search layout on Contact
Use gearset to deploy the new field and search layout from sandbox -> branch
Note the Contact object file (this is where the search layout metadata is) and the new field are deployed to the force-app directory
In VS Code using SFDX, reset the tracking
Create another new field on Contact
In VS Code using SFDX, create a new unlocked package
In VS Code, set the new unlocked package to default in project.json
In VS Code using SFDX, do a pull (this should put the newest field in the unlocked package directory)
In VS Code, set the force-app to default in project.json
Commit and push the changes in VS Code to the remote branch
In SF, edit the Contact search layout again
Using Gearset, deploy the Contact search layout to the branch
Outcome:
The 1st new field and the Contact object file are moved to the unlocked package directory even though the force-app is the default app
Expected result:
The Contact object file in the force-app directory is updated