fix: prevent false enabled_clients diff in database dry-run - #1479
Conversation
fe7bcf7 to
f5fd72a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1479 +/- ##
==========================================
+ Coverage 80.81% 80.85% +0.03%
==========================================
Files 163 163
Lines 7805 7807 +2
Branches 1741 1742 +1
==========================================
+ Hits 6308 6312 +4
+ Misses 797 796 -1
+ Partials 700 699 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ankita10119
left a comment
There was a problem hiding this comment.
Shouldn't calcChanges also enrich with enabled_clients the same way dryRunChanges does after this fix? If connections.list no longer returns enabled_clients inline, then getEnabledClients in calcChanges would see no enabled_clients on the remote connection, which means excluded clients wouldn't be preserved and could get silently disabled on a real import. Am I reading this correctly?
|
|
…ded clients being disabled on import
Yes that understanding is correct. And it's a valid catch too. Fixed both in the last 2 commits.
I also pulled the enrichment into a single shared helper ( |
🔧 Changes
Fixes a false positive in
--dry-runmode where database connections withenabled_clientswere incorrectly reported as changed.In the database dry-run path (
dryRunChanges), the local connection had itsenabled_clientspopulated, but the remote connection it was compared against was fetched fromconnections.list, which no longer returnsenabled_clientsinline. The field now lives behind the dedicated enabled-clients endpoint. Because the remote object lacked the key entirely, the diff reported a false difference:The fix enriches the remote connections with their
enabled_clientsviagetConnectionEnabledClientsbefore diffing, mirroring what the real import path already does ingetType(). The change is scoped entirely todryRunChanges, so real import and export behavior is untouched.📚 References
🔬 Testing
Added a regression test in
test/tools/auth0/handlers/dryRun.tests.tsthat fails on the old code (reports a spurious update) and passes with the fix.Verified end to end against live tenants: exported a tenant to a directory, then ran a dry-run against the identical export. On tenants whose
connections.listomitsenabled_clientsinline, the old code produced the false positive and the fix removes it. Confirmed the real import and export paths are unaffected.To reproduce manually:
📝 Checklist