Skip to content

feat: surface config warnings (hostname mismatch, source errors)#85

Merged
clavery merged 2 commits intomainfrom
feature/alert-on-hostname-mismatch
Jan 29, 2026
Merged

feat: surface config warnings (hostname mismatch, source errors)#85
clavery merged 2 commits intomainfrom
feature/alert-on-hostname-mismatch

Conversation

@clavery
Copy link
Copy Markdown
Collaborator

@clavery clavery commented Jan 27, 2026

Summary

Config warnings are now surfaced to users instead of being silently swallowed at trace level:

  • Hostname mismatch: When CLI --server flag differs from dw.json hostname, users see a warning explaining that config file values are being ignored; this applies to all config sources that may supply server values along with credentials
  • Source errors: When a config source throws (e.g., malformed dw.json), users see a warning about the parse failure

Previously these warnings were only visible with trace-level logging. Now users can identify configuration problems or "gotchas" without blocking execution.

Thanks to @SGD1953 for the idea!

Changes

  • SDK sources: Re-throw errors after logging at trace level (dw-json.ts, mobify-source.ts, package-json-source.ts)
  • SDK resolver: Catch source errors and create SOURCE_ERROR warnings
  • CLI config: Log all config warnings at warn level (not trace) - this surfaces both HOSTNAME_MISMATCH and SOURCE_ERROR
  • Docs: Added error handling section to extending.md

Test plan

  • Unit tests added for SOURCE_ERROR warning behavior
  • Existing tests updated to reflect new behavior
  • Manual test: Create malformed dw.json and run b2c setup config - should see warning about parse failure
  • Manual test: Run with hostname mismatch (b2c code deploy --server different.host.com with different hostname in dw.json) - should see warning about hostname mismatch

closes #84

Config sources that encounter errors (e.g., malformed JSON) now:
- Re-throw after logging at trace level
- Get caught by resolver which creates SOURCE_ERROR warning
- Warnings are logged at warn level in CLI

This helps users identify configuration problems without blocking
execution.
Matches CLI flag name (--server) for clarity.
@clavery clavery requested a review from yhsieh1 January 27, 2026 20:41
@clavery clavery merged commit 6b89ed6 into main Jan 29, 2026
3 checks passed
@clavery clavery deleted the feature/alert-on-hostname-mismatch branch February 8, 2026 20:04
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.

Hostname mismatch protection should WARN

1 participant