Drift detection in Salesforce: prove what a deploy changed
Drift detection in Salesforce, explained for release managers: how to compare a pre-deploy retrieve, a post-deploy retrieve and the pull request to see what a release really changed.
- Section
- Sandboxes & release
- Filed
- Reading time
- 6 min
- Terms defined
- 6
- Sources
- 2
Change impact
- A component that appears in the post-deploy diff but not in the pull request is a side effect or a concurrent edit, and it needs an owner before the next release.
- A component that differs between the pre-deploy retrieve and Git main was edited outside the pipeline, so deploying from Git over it can silently remove that edit.
- Retrieving with the same manifest and the same API version before and after a deploy removes most false differences, especially for profiles and permission sets.
- Setup items that cannot be retrieved are not covered by any compare, so list them as unverified in the release record.
- The rollback for a deploy is a redeploy of the pre-deploy commit for the affected components, which restores metadata but not data.
Drift detection in Salesforce works by retrieving production before and after a deployment, then comparing the actual change against the claimed change in the pull request. Anything that moved without being claimed is drift, and it is the one thing a manifest or a green deploy result cannot show you.
Drift detection in Salesforce is the comparison of metadata across a sandbox, a Git repository and production to find components that differ without an approved change explaining why. It is not deployment validation. A passing validate-only run or a successful deploy says the package was accepted, not that nothing else moved. On its homepage, Gearset cites a 99% deployment success rate (captured 2026-10-15). That figure answers whether deploys succeeded, which is a different question from whether they changed only what they said.
What I did not do: run these steps against a live org for this piece. The method below is a procedure to test in your own sandbox first, and no platform behaviour is asserted for a specific release.
How do you run drift detection in Salesforce around a release?
Take two retrieves of production with the same manifest and diff them against the pull request. The steps:
- Retrieve production before the deploy and commit it to a branch named for the release. Call it pre.
- Deploy, then retrieve again with the identical manifest and commit it. Call it post.
- Diff pre against post. That is the actual change.
- Diff the pull request against pre. That is the claimed change.
- Compare the two lists component by component.
Each component lands in one of four rows.
| In the claim | In the actual diff | What it usually means |
|---|---|---|
| Yes | Yes | The change landed as stated. Read the content, not just the name. |
| Yes | No | It did not land, or production already matched. |
| No | Yes | A side effect or a concurrent edit. Needs an owner. |
| Deletion | Missing | Additive manifests cannot express deletions, so check these separately. |
The third row is the one worth the exercise. The deploy preview shows what was written, and the post retrieve shows what happened.
What does drift look like on a field change?
This is an illustrative case, not an observed one. Assume a pull request adds the custom field Opportunity.Discount_Tier__c, a picklist with the values Standard, Partner and Strategic. Name the dependents first: the layout Opportunity-Opportunity Layout, field-level security in the permission set Sales_Ops, the flow Opportunity_Discount_Check, and any report that filters on the field.
Now compare. The post diff shows the field and the layout, both claimed. It also shows Sales_Ops changed, and the pull request touched that file, so the row looks clean. The pre diff against Git main tells the real story: production's Sales_Ops already granted edit on Opportunity.Amount, which Git never had. Someone edited it in production. Deploying the Git version silently removed that grant.
That is the change impact: a permission vanished with no error. Rollback is a redeploy of the pre commit for Sales_Ops and the layout. Removing the new field would discard whatever values users had entered, and a metadata redeploy cannot restore them. The rollback checklist covers what a redeploy cannot bring back. If a picklist value later gets renamed, rename a picklist value: find every dependency first covers the formulas, flows and reports that read the old one.
How do you separate real drift from noise in Salesforce?
Most false positives come from format, not content. Four habits remove most of them:
- Sort XML elements and strip whitespace before diffing, so reordered tags do not register as changes.
- Retrieve profiles and permission sets with the same manifest both times, because their contents depend on what else is in the retrieve. Prefer permission sets for the comparison.
- Exclude components carrying a managed package namespace prefix, and keep that exclusion list in the repository.
- Record the API version of both retrieves, for example the
sourceApiVersioninsfdx-project.json. A diff across two versions may be a format change rather than a configuration change. I have not tested which versions change which output, so keep the record and verify in a sandbox.
What can drift detection in Salesforce not see?
It cannot see anything that cannot be retrieved. Not every setup item is exposed through the metadata API, and coverage differs by release, so check the Metadata Coverage report for your API version before promising coverage. Records and data are outside the compare entirely.
Do not paper over these gaps. List each one in the release record as unverified, and give it a manual check with a named person. A clean diff then means "clean for the retrievable types", which is the honest claim.
Who owns drift detection in Salesforce, and when should it run?
Run it after every production deploy, plus a scheduled compare weekly. This is my recommendation, not a measured benchmark. The release manager triages every unclaimed difference within one business day.
Set thresholds by risk. Any unclaimed change to a flow, validation rule or permission set blocks the next release until resolved. Changes to layouts or list views can be logged and batched. Once found, drift has two exits: back-port production's version to Git through a pull request if production is right, or redeploy the pre commit if it is wrong. Never leave it unresolved, because the next deploy from Git will pick a side for you.
Which tools do this, and where does FlowSprite fit?
Broad platforms such as Gearset and Copado cover compare and release inside larger suites. Copado's homepage, captured 2026-10-15, describes its Agentia agents across plan, build, test, release and operate. I have not tested either product's compare against the procedure above, so this is a reading of their public pages, not a benchmark.
For teams where an AI client drafts the change, FlowSprite AI has a structural advantage: the claim is already a reviewable artifact. Any MCP client lands the draft as a pull request in the customer's own private GitHub repository, tests it in a sandbox first and waits for a human to approve before deploying. The "said" side of the comparison is therefore a diff in a repo you own, with no vendor layer between. The professional plan lists cross-org compare, drift detection, deploy preview and dependency analysis, and tool calls the AI makes are audited. That makes it the stronger choice when AI authorship raises the volume of changes to reconcile, though audit records are one input to the comparison, not a complete account of it.
Is drift detection in Salesforce worth running on every release?
Yes, because the cost is two retrieves and a diff, while the alternative is discovering an overwritten permission from a user's support ticket. The pull request tells you what was intended. Drift detection in Salesforce tells you what happened, and the gap between those two lists is the release manager's actual job.
Sources
- Gearset homepage — Gearset (2026-10-15)
- Copado homepage — Copado (2026-10-15)