PROD-2310: sync exits non-zero on failures and precondition aborts#182
Merged
Conversation
… and precondition aborts
The sync/push command handler ignored the { success } returned by
pushInstances, so a sync could exit 0 despite failed items, failed
auto-publish, or a hard-stop abort. Additionally, `success` was computed
before auto-publish ran, so auto-publish errors never fed the exit code.
- index.ts: sync/push handler now checks result.success and exits 1;
a failed precondition (validateCommand false, e.g. missing target
locale) exits 1 instead of returning silently; a thrown abort
(model-validation hard-stop) is caught and exits 1.
- push.ts: fold real auto-publish failures into the returned success via
new exported helper hasBlockingAutoPublishErrors (publish/fatal count;
mapping/refresh left for PROD-2311).
- push.test.ts: focused tests for hasBlockingAutoPublishErrors.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jules-exel
approved these changes
Jul 14, 2026
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.
Root cause
agility syncexited with code 0 even when work failed, so CI (which keys on exit code) could not detect problems. Two defects combined:push/synccommand handler inindex.tscalledpush.pushInstances()but discarded the returned{ success }entirely (unlike theworkflowscommand, which does check it). So even a computedsuccess === falsenever affected the exit code.successignored auto-publish errors. Inpush.ts,successwas computed before the auto-publish step ran, so auto-publish failures (e.g. 34 publish errors) never fed into it.validateCommand(e.g. a requested locale missing on the target) justreturned (exit 0); a model-validation hard-stop threw out ofpushInstanceswith no explicit exit handling.What now feeds the failure signal
totalFailed/totalSyncFailures) — already computed assyncSuccess, now actually honored by the entry point.successvia the new exported helperhasBlockingAutoPublishErrors. Real publish failures (type: "publish") and fatal auto-publish crashes (type: "fatal") fail the exit code.validateCommandreturning false now exits 1.Left for follow-up
Auto-publish
mapping/refresherrors are post-publish bookkeeping that PROD-2311 may reclassify, so they are intentionally NOT treated as hard failures here (documented in-code). If PROD-2311 confirms they are real failures, extendhasBlockingAutoPublishErrors.Notes
pushInstancesstill returns a result; the handler decides the exit. Noprocess.exit()added deep in push logic. Existing preflightprocess.exitCodebehavior is unchanged.npm run type-checkpasses. Added focused unit tests forhasBlockingAutoPublishErrors(suite not run per task scope).🤖 Generated with Claude Code