feat(shared): offline-tolerant sync.sh#43
Merged
Conversation
sync.sh now never blocks commits on network failure: - SYNC_OFFLINE=1 env var → skip entirely with warning, exit 0 - curl fetch failures → warn to stderr, skip that file, exit 0 - missing curl/jq → warn + exit 0 (local dev without deps still commits) - unknown language → warn + exit 0 (no more hard die) - committed files: write to .tmp first, atomically mv on success, preserving cached copy if fetch fails mid-run - --max-time 10 on every curl so a hung network doesn't stall the hook Committed files stay committed (release-please-config.json must live at repo root for release-please-action to read it in CI); cached files stay in .shared/ as before. Offline tolerance is purely about hook robustness — CI still re-fetches on every run so canonical drift is picked up. Consumers' pre-commit entry bootstrap will be updated in a follow-up to tolerate the initial curl (before .shared/sync.sh is cached).
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.
Summary
Why
Previous sync.sh used `set -euo pipefail` + `die()` on any curl failure, so an offline pre-commit run blocked the commit. Now: network down → warn + exit 0, committed files already in repo stay intact, cached files in `.shared/` stay as last-known-good.
Follow-up
Consumer repos' pre-commit `entry:` bootstrap (which curls sync.sh itself before it's cached) also needs offline-tolerance wrapping — separate PRs per consumer.
Test plan