Skip to content

feat: Dry-Run (GA)#1336

Open
kushalshit27 wants to merge 4 commits intomasterfrom
dry-run-ga
Open

feat: Dry-Run (GA)#1336
kushalshit27 wants to merge 4 commits intomasterfrom
dry-run-ga

Conversation

@kushalshit27
Copy link
Copy Markdown
Contributor

@kushalshit27 kushalshit27 commented Mar 25, 2026

🔧 Changes

Add support for a comprehensive dry-run mode that allows users to preview all potential changes to their Auth0 tenant without applying them. This feature includes:

  • New CLI Flags:

    • --dry-run (or --dry-run=preview): Show proposed changes and exit without applying (non-interactive, safe for CI)
    • --dry-run --interactive: Show proposed changes with interactive menu (apply / export / exit)
    • --dry-run --apply: Show proposed changes and automatically apply without prompting
  • Configuration & Environment Variables:

    • AUTH0_DRY_RUN: Enable dry-run mode (true / 'preview')
    • AUTH0_DRY_RUN_INTERACTIVE: Enable interactive menu (when using Node module)
    • AUTH0_DRY_RUN_APPLY: Auto-apply after preview (when using Node module)

Examples

CLI: Preview-Only (Non-Interactive, Safe for CI)

a0deploy import -c config.json -i ./tenant.yaml --dry-run

Output shows the proposed changes in a table format, then exits without applying anything.

CLI: Show Plan and Auto-Apply (CI Deployment)

a0deploy import -c config.json -i ./tenant.yaml --dry-run --apply

Shows the proposed changes, then automatically proceeds to apply them without prompting.

CLI: Interactive Review (Manual Deployments)

a0deploy import -c config.json -i ./tenant.yaml --dry-run --interactive

Shows the proposed changes with an interactive menu:

◆ What would you like to do?
│ ○ Apply changes
│ ○ Export changes in a file (No Apply)
│ ○ Exit
└

Node Module: Dry-Run with Interactive Menu

import { deploy } from 'auth0-deploy-cli';

deploy({
  input_file: './local/tenant.yaml',
  config: {
    AUTH0_DOMAIN: process.env.AUTH0_DOMAIN,
    AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
    AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
    AUTH0_DRY_RUN: true,
    AUTH0_DRY_RUN_INTERACTIVE: true,
  },
})
  .then(() => console.log('Dry run completed'))
  .catch((err) => console.log('Error:', err));

Node Module: Preview and Auto-Apply

deploy({
  input_file: './local/tenant.yaml',
  config: {
    AUTH0_DOMAIN: process.env.AUTH0_DOMAIN,
    AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
    AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
    AUTH0_DRY_RUN: true,
    AUTH0_DRY_RUN_APPLY: true,
  },
})
  .then(() => console.log('Deployment completed'))
  .catch((err) => console.log('Error:', err));

📚 References

🔬 Testing

Dry-run Testing:

  • CLI: a0deploy import -c config.json -i tenant.yaml --dry-run (preview mode)
  • CLI: a0deploy import -c config.json -i tenant.yaml --dry-run --interactive (interactive mode)
  • CLI: a0deploy import -c config.json -i tenant.yaml --dry-run --apply (auto-apply mode)

Note: Full end-to-end testing with a live Auth0 tenant would be valuable in addition to unit tests, particularly to verify the accuracy of the proposed changes and the behavior of the interactive menu.

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

feat: enhance dry-run functionality and documentation

feat: enhance dry-run functionality and documentation

feat: enhance dry-run functionality and documentation

feat: enhance dry-run functionality for tenant assets

feat: enhance dry-run functionality and tests

feat: improve precision in hoursToMinutes function

- src/sessionDurationsToMinutes.ts: update return value to include 4 decimal places

feat: update dependencies in package.json
- package.json: upgrade @clack/prompts to 1.1.0
- package.json: upgrade chalk to 5.6.2
- package.json: add @types/chai to devDependencies

feat: enhance dry-run functionality in userAttributeProfiles handler and tests
- src/tools/auth0/handlers/default.ts: add 'riskAssessment' type to settings
- src/tools/auth0/handlers/userAttributeProfiles.ts: implement dry run check for changes
- test/tools/auth0/handlers/userAttributeProfiles.tests.js: add test for dry run short-circuit behavior

feat: enhance dry-run functionality and tests

feat: enhance dry-run functionality and tests
- src/tools/calculateChanges.ts: add normalizeArrayValues function to handle array normalization
- src/tools/calculateChanges.ts: update getObjectDifferences to use normalized arrays for comparison
- test/tools/calculateChanges.test.ts: add tests to validate dry-run comparisons ignoring array order
- test/tools/calculateChanges.test.ts: add tests for real differences after normalizing array order

feat: enhance dry-run functionality and tests
- src/tools/calculateChanges.ts: add normalizeArrayValues function to handle array normalization
- src/tools/calculateChanges.ts: update getObjectDifferences to use normalized arrays for comparison
- test/tools/calculateChanges.test.ts: add tests to validate dry-run comparisons ignoring array order
- test/tools/calculateChanges.test.ts: add tests for real differences after normalizing array order

fix(src/tools/calculateChanges.ts): update regex for array path matching to improve log clarity

refactor: add dry-run change calculation utilities

feat: Enhance APIHandler and Auth0 logging
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 73.83721% with 180 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.80%. Comparing base (07e8731) to head (2c711c0).

Files with missing lines Patch % Lines
src/tools/calculateDryRunChanges.ts 88.67% 9 Missing and 20 partials ⚠️
src/tools/auth0/index.ts 76.72% 19 Missing and 8 partials ⚠️
src/tools/auth0/handlers/actions.ts 50.00% 4 Missing and 4 partials ⚠️
src/tools/calculateChanges.ts 46.15% 3 Missing and 4 partials ⚠️
src/tools/auth0/handlers/default.ts 78.57% 2 Missing and 4 partials ⚠️
src/tools/auth0/handlers/tenant.ts 73.91% 4 Missing and 2 partials ⚠️
src/tools/deploy.ts 64.70% 1 Missing and 5 partials ⚠️
src/tools/auth0/handlers/attackProtection.ts 20.00% 3 Missing and 1 partial ⚠️
src/tools/auth0/handlers/branding.ts 20.00% 3 Missing and 1 partial ⚠️
src/tools/auth0/handlers/databases.ts 69.23% 2 Missing and 2 partials ⚠️
... and 25 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1336      +/-   ##
==========================================
- Coverage   80.18%   79.80%   -0.38%     
==========================================
  Files         152      153       +1     
  Lines        6101     6729     +628     
  Branches     1247     1433     +186     
==========================================
+ Hits         4892     5370     +478     
- Misses        693      763      +70     
- Partials      516      596      +80     

☔ 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.

@kushalshit27 kushalshit27 changed the title feat: Dry-Run - GA feat: Dry-Run (GA) Mar 25, 2026
@kushalshit27 kushalshit27 marked this pull request as ready for review March 26, 2026 04:16
@kushalshit27 kushalshit27 requested a review from a team as a code owner March 26, 2026 04: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.

2 participants