Skip to content

fix: prevent false enabled_clients diff in database dry-run - #1479

Draft
harshithRai wants to merge 2 commits into
masterfrom
DXCDT-2281
Draft

fix: prevent false enabled_clients diff in database dry-run#1479
harshithRai wants to merge 2 commits into
masterfrom
DXCDT-2281

Conversation

@harshithRai

Copy link
Copy Markdown
Contributor

🔧 Changes

Fixes a false positive in --dry-run mode where database connections with enabled_clients were incorrectly reported as changed.

In the database dry-run path (dryRunChanges), the local connection had its enabled_clients populated, but the remote connection it was compared against was fetched from connections.list, which no longer returns enabled_clients inline. The field now lives behind the dedicated enabled-clients endpoint. Because the remote object lacked the key entirely, the diff reported a false difference:

Key [<connection>.enabled_clients] found in 'localObj' but not in 'remoteObj'.

The fix enriches the remote connections with their enabled_clients via getConnectionEnabledClients before diffing, mirroring what the real import path already does in getType(). The change is scoped entirely to dryRunChanges, so real import and export behavior is untouched.

📚 References

🔬 Testing

Added a regression test in test/tools/auth0/handlers/dryRun.tests.ts that 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.list omits enabled_clients inline, the old code produced the false positive and the fix removes it. Confirmed the real import and export paths are unaffected.

To reproduce manually:

npx a0deploy export -c=config.json --format=directory --output_folder=local
npx a0deploy import -c=config.json --input_file=local --dry-run --debug

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@harshithRai
harshithRai force-pushed the DXCDT-2281 branch 2 times, most recently from fe7bcf7 to f5fd72a Compare August 28, 2026 09:11
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.84%. Comparing base (4955e4b) to head (f5fd72a).

Files with missing lines Patch % Lines
src/tools/auth0/handlers/databases.ts 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1479      +/-   ##
==========================================
+ Coverage   80.81%   80.84%   +0.02%     
==========================================
  Files         163      163              
  Lines        7805     7811       +6     
  Branches     1741     1743       +2     
==========================================
+ Hits         6308     6315       +7     
+ Misses        797      796       -1     
  Partials      700      700              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants