feat: configurable ignoreDryRunFields via AUTH0_IGNORE_DRY_RUN_FIELDS#1385
feat: configurable ignoreDryRunFields via AUTH0_IGNORE_DRY_RUN_FIELDS#1385dotjoshrc wants to merge 1 commit into
Conversation
309ee16 to
3a99d54
Compare
Adds a new optional config key, AUTH0_IGNORE_DRY_RUN_FIELDS, mapping handler type to an array of field paths to exclude from --dry-run diff comparisons. User-supplied fields are merged additively with each handler's built-in defaults, so users cannot accidentally drop curated defaults like emailProvider's smtp_pass / mandrill api_key or clientGrants' _clientName. Motivation: the Management API does not return secret values (client_secret on clients, options.client_secret on connections, action secrets[].value, emailProvider credentials.api_key for non-SMTP/Mandrill providers, etc.). The corresponding local YAML fields therefore always appear as differences in dry-run output, drowning out signal. This option lets a tenant config silence those known-noisy fields without forking the CLI. Implementation: the merge is computed lazily by a new getEffectiveIgnoreDryRunFields() method, called from calcChanges and dryRunChanges where ignoreDryRunFields is actually consumed. The constructor remains byte-identical to upstream, so handler construction has no new side effects and any unrelated tests that exercise handler construction continue to behave exactly as before. The change is fully backwards compatible: when the new key is absent, the method returns the handler's existing ignoreDryRunFields unchanged. Includes unit tests covering merge, dedupe, type-isolation, the no-config fallback, and the throwing-config-provider path. All existing tests continue to pass.
3a99d54 to
cc5d021
Compare
|
The Failure pattern (4 tests, identical across re-runs):
All four fail with the same nock mismatch — item.client_id !== currentClient…where Why this isn't from this PR:
What I'd suggest: treat the four failing tests as a pre-existing CI flake on the auth-client filter and re-run, or point me at the right place to look if there's something more I can do from this PR. Happy to debug further if you'd like. |
|
Thank you for submitting this PR! Your contribution is greatly appreciated. We'll review it shortly |
🔧 Changes
Adds
AUTH0_IGNORE_DRY_RUN_FIELDS, a new optional config key mapping handler type to an array of field paths to exclude from--dry-rundiff comparisons. User-supplied entries are merged additively with each handler's built-inignoreDryRunFieldsdefaults, so the curated defaults (smtp.credentials.smtp_pass,mandrill.credentials.api_key,_clientName, etc.) cannot be accidentally dropped.Motivation. The Management API does not echo secret values on read —
client_secreton clients,options.client_secreton connections, actionsecrets[].value, and the email provider'scredentials.api_keyfor non-SMTP/Mandrill providers (notably Mailgun). The corresponding local YAML fields therefore always surface as diffs in--dry-runoutput, drowning out signal on every run. Today the only knob is per-handler hardcoded arrays; the goal here is to let tenant configs silence the known-noisy fields for their setup without forking the CLI.Shape. New optional config key, identical in shape to
EXCLUDED_PROPS/INCLUDED_PROPS:{ "AUTH0_IGNORE_DRY_RUN_FIELDS": { "clients": ["client_secret"], "connections": ["options.client_secret"], "actions": ["secrets"], "emailProvider": ["credentials.api_key"] } }This only affects
--dry-runreporting; a real import still sends every local field to the API as before.Backwards compatibility. When the key is absent the handler behavior is byte-identical to today. The constructor read is wrapped in a
try/catchso handlers constructed against an uninitializedconfigFactory()(as some unit tests do) continue to work.Files touched.
src/types.ts,src/tools/auth0/handlers/default.ts,test/tools/auth0/handlers/default.tests.ts,docs/configuring-the-deploy-cli.md,CHANGELOG.md. 119 LOC.📚 References
N/A — no linked issue. Validated against a real tenant (Mailgun email provider, OIDC connection with
client_secret, action with fivesecrets[]entries) where it cleanly suppresses the previously-noisy diff lines.🔬 Testing
test/tools/auth0/handlers/default.tests.tscovering: (1) merge of user-configured fields with handler defaults, (2) dedupe of overlapping entries, (3) isolation across handler types, (4) fallback when the config provider returns undefined.npm test→ 1228 passing / 1 pending (unchanged from main).npm run lint,npm run format:check,npm run build,npx kacl lintall clean.Manual verification: ran
a0deploy import --dry-run --debug -c <stage.json> -i tenant.yamlagainst a real Auth0 tenant; before this change, every dry-run logged afound in 'localObj' but not in 'remoteObj'line formailgun.credentials.api_keyand each entry ofhandle-post-login.secrets. With the config set, those becomeIgnoring key … due to ignoreDryRunFields configurationdebug lines instead, and the noise disappears at non-debug levels.📝 Checklist