Skip to content

fix: remove stale connection files from directory export when connections are deleted#1389

Open
harshithRai wants to merge 5 commits into
masterfrom
ghIssue1376
Open

fix: remove stale connection files from directory export when connections are deleted#1389
harshithRai wants to merge 5 commits into
masterfrom
ghIssue1376

Conversation

@harshithRai
Copy link
Copy Markdown

Fixes a stale file issue in the directory format export where connection JSON files left over from previous exports were not removed when connections were deleted from the source tenant, causing subsequent imports to treat them as desired state and skip deletion from destination tenants.

🔧 Changes

When re-exporting a tenant after social connections have been removed, the dump() function in the directory connections handler now removes JSON files that no longer correspond to a current connection. Previously, stale files from prior exports remained in the connections/ folder, causing subsequent imports to treat those connections as desired state and never trigger their deletion from destination tenants.

  • src/context/directory/handlers/connections.ts — updated dump() to remove stale .json and .html files from the connections/ directory that no longer correspond to a connection in the current export
  • test/context/directory/connections.test.js — added tests covering empty connections export, partial removal of stale files, and full removal of stale files

📚 References

Fixes #1376

🔬 Testing

Added two new tests to validate that:

  • Re-exporting with a subset of connections removes the stale JSON files for deleted connections
  • Re-exporting with zero connections removes all stale JSON files and the empty folder parses back as [], enabling import to trigger deletions

📝 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)

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.87%. Comparing base (621198d) to head (454217b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1389   +/-   ##
=======================================
  Coverage   79.87%   79.87%           
=======================================
  Files         153      153           
  Lines        7060     7060           
  Branches     1548     1548           
=======================================
  Hits         5639     5639           
  Misses        781      781           
  Partials      640      640           

☔ View full report in Codecov by Sentry.
📢 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.

@harshithRai harshithRai marked this pull request as ready for review May 18, 2026 13:24
@harshithRai harshithRai requested a review from a team as a code owner May 18, 2026 13:24
@harshithRai harshithRai marked this pull request as draft May 19, 2026 07:56
@harshithRai harshithRai marked this pull request as ready for review May 19, 2026 09:16
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.

Social Connections not deleting on import with AUTH0_ALLOW_DELETE=true

2 participants