Expand description
braze-sync apply — push local intent to Braze.
v0.1.0 supports Catalog Schema only (field add / field delete). The other resource kinds emit a “not yet implemented” warning.
§Safety chain
Apply is the only command that mutates remote state, so it goes through a strict order of checks. Each check fails closed:
- Recompute the diff (= the apply plan) using the same code path as
the
super::diffcommand. They cannot disagree about what would be applied. - Print the plan. The header line goes to stderr so the JSON output on stdout stays parseable for CI consumers.
- If
summary.changed_count() == 0→ “No changes” → exit 0. - If
--confirmis not set → “DRY RUN” → exit 0. Zero write calls reach Braze in this branch. Verified by integration tests that mount amethod("POST")mock with.expect(0). - If
summary.destructive_count() > 0 && !args.allow_destructive→ returnError::DestructiveBlockedwhichcli::exit_code_formaps to exit code 6 per IMPLEMENTATION.md §7.1. - Pre-validate the plan against v0.1.0’s known unsupported operations (top-level catalog Added / Removed, field-level Modified). This runs before any API call so we can never leave Braze half-applied.
- Apply each change. The loop uses
?, so the first failure aborts the rest — partial-apply is bad-by-default. Each call is logged viatracing::info!with structured fields per §2.3 #4.