Repository navigation
fix(cli): make failed meta deps sync atomic and fail check on unloadable snapshot - #474
Merged
Merged
Conversation
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 Changed
meta deps syncbacks updeps.lock.jsonand the.metaobjects/deps/snapshot before writing. On any failure, including the full-collection load, it restores both, prints a rollback notice, and exits 1 with the load error. The per-dependency report prints only after the sync succeeds.meta deps checkloads the committed model once its hashes match. It exits 1 and reports the load error (text, orloadErrorin structured output) when the model does not load. It still never writes the lock or snapshot.docs/features/metadata-dependencies.mddescribes the atomic sync and the load step incheck.CHANGELOG.mdgets an [Unreleased] Fixed entry.Validation
Risk Assessment
✅ Low: The change is small and matches the intent: a failed sync restores the previous lock and snapshot and exits 1, and
meta deps checknow exits 1 when the model won't load. The backup covers everythingapplySyncwrites, and the two regression tests exercise the real command.Testing
I ran the real
metaCLI against a throwaway publisher and consumer project. A consumer file that clashes with the dependency makes sync fail, and every failure path left the previous state intact. The fullpackages/clisuite passes (1746 pass, 0 fail). An unscopedbun testoverserver/typescripttimed out at the 10-minute background limit, so I scoped the regression run to the package that changed. The baseline ts-fast and ts-unit run was already green.meta deps syncthenmeta deps checkboth exit 0 and write the lock and snapshotmeta deps checkon a loadable-hash but unloadable snapshot is not green (text and json)Evidence: Live CLI transcript (all six scenarios)
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
🔧 **Test** - 1 issue found → auto-fixed ✅
server/typescript/packages/cli/src/commands/deps.ts:75- Failed re-sync prints 'synced acme-common 1.0.0→1.1.0' before rolling back and exiting 1, so the output reports success for a sync that was reverted.scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsscripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains (baseline, passed)bun bin/meta.ts deps sync --format text --cwd <consumer> (happy path, exit 0)bun bin/meta.ts deps check --format text --cwd <consumer> (exit 0 when current)bun bin/meta.ts deps sync with clashing meta.clash.json on re-sync to v1.1.0 (exit 1, load error, lock+snapshot md5 unchanged)bun bin/meta.ts deps sync with clashing model on first sync (exit 1, no deps.lock.json, no .metaobjects/deps/)bun bin/meta.ts deps check with unloadable snapshot, hashes matching (text exit 1 'does not load'; json exit 1 with loadError)bun bin/meta.ts deps check after clash removed (exit 0)bun bin/meta.ts verify --templates load probe after restore (exit 0)bun test packages/cli/test/deps-sync.test.ts (13 pass, automated)bun test packages/cli (1746 pass, 0 fail, 3 skip, automated)🔧 Fix applied.
✅ Re-checked - no issues remain.
meta deps syncthenmeta deps checkboth exit 0 and write the lock and snapshotmeta deps checkon a loadable-hash but unloadable snapshot is not green (text and json)scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsRealmetaCLI (bun bin/meta.ts) against a disposable publisher/consumer project: clean sync + check, clashing re-sync, check on unloadable snapshot (text and json), clashing first sync, dry-run with clash, recovery after removing the clashbun test test/deps-sync.test.tsin packages/cli (13 pass)bun testfor the whole packages/cli suite (1746 pass, 3 skip, 0 fail)Baseline already green:scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.