PROD-2203: Add --preflight (dry-run preview) mode to sync/push#168
Draft
5PK wants to merge 3 commits into
Draft
Conversation
Adds a preflight mode that runs the full source-pull, target-pull, dependency analysis and change detection a real sync would perform, then reports the creates/updates/skips/conflicts it WOULD produce — without writing anything to the target instance or mapping files. - New --preflight flag and --preflight-json (machine-readable output) - Central PreflightReport collector (src/lib/preflight) with table + JSON rendering; populated at each pusher's decision point (the only place that can observe skips/conflicts, which never reach the API) - All 7 pushers instrumented (galleries, assets, models, containers, content, templates, pages); gallery/asset silent target-changed fall-throughs now surfaced as conflicts - saveMappingFile hard-guarded under preflight; auto-publish suppressed - Exits non-zero when conflicts are detected (for CI gating) - Tests: report module + saveMappingFile guard Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The preflight conflict warning said a real sync would require --force, but the actual flag is --overwrite (as the per-item conflict details already state). Align the wording to avoid pointing users at a non-existent flag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Implements PROD-2203. Adds a preflight mode to the
sync/pushcommand that previews what a sync would do — before committing any changes to the target.Preflight runs the full source-pull, target-pull, dependency analysis and change detection that a real sync performs, then reports the creates / updates / skips / conflicts it would produce — without writing anything to the target instance or mapping files. This lets customers and support preview sensitive migrations safely.
Flags
--preflight— run the preview (no writes to target or mappings)--preflight-json— emit the report as machine-readable JSON instead of the human tableExits non-zero when conflicts are detected, so CI/scripts can gate a real sync on a clean preflight.
How it works
The key design point: skip and conflict decisions never reach the API (the sync decides "nothing to do" / "unsafe" and moves on), so a client-level interceptor can't observe them. Each pusher therefore records its already-computed decision at the decision point and skips the write.
PreflightReportcollector (src/lib/preflight/) — per-phase counts + table/JSON renderingsaveMappingFilehard-guarded under preflight (safety net); auto-publish suppressed--overwrite" fall-throughs (galleries/assets) are now surfaced as conflicts in the reportSample output
Testing
saveMappingFilepreflight guardtsc --noEmitclean;npm run buildpassesNotes for reviewers
--preflightrun against a throwaway target to eyeball report formatting (automated tests cover logic, not a live sync).🤖 Generated with Claude Code