Add "Sync with Door43" for shared/collaborative projects - #7669
Open
deferredreward wants to merge 5 commits into
Open
deferredreward wants to merge 5 commits into
deferredreward wants to merge 5 commits into
Conversation
Adds a per-project "Sync with Door43" menu action that pulls the latest from the project's Door43 repo, merges it with local checking work, and pushes the combined result back - enabling multiple people (or one person on multiple machines) to work on the same shared project. Strategy (data-level merge, not raw git merge): - fast path: if remote HEAD is already in local history, just push - otherwise clone the remote fresh, verify/migrate it, merge the local project into the clone (local check data kept, remote check data unioned in, remote alignments overlaid, manifest checkers/translators unioned, external verse edits recorded), keep the clone's git history so the merged commit fast-forwards, swap into place with a backup, then push to the origin owner's repo with the user's token - edge cases: offline / not logged in, no remote (offer upload), remote deleted (offer re-upload), push race (retry), permission denied (suggest collaborator access or own-copy upload) New: ProjectSyncActions, ProjectSyncHelpers, GitApi.pushRepo/ isCommitInHistory, Repo GIT_ERROR_PUSH_DENIED mapping, Sync menu item. Fixes #7667 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The mock defined writeJSONSync but not the lowercase writeJsonSync that copyAlignmentData (and other helpers) call, so those writes were silent no-ops under test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- resolve the sync promise on the invalid-token guard (was hanging) - treat an empty remote (no HEAD) as up to date -> fast push instead of a misleading import error - validate remote owner/name and the commit sha before passing them to git shell commands (prevents injection via a crafted git config) - reuse ProjectUploadActions.saveChangesInOldProjects instead of inlining; collapse the duplicated no-remote/remote-missing upload prompt into one helper - add syncProject flow tests (fast path, merge path, push race, no remote) and GitApi pushRepo error-path + isCommitInHistory guard tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The alignment-overlay assertion relied on the fs-extra test mock's writeJsonSync, which genMockFromModule stubs as a no-op unless overridden; the override behaved differently under CI's npm ci vs a local npm i, so the test passed locally but failed on CI. Revert the shared-mock writeJsonSync alias and instead spy on copyAlignmentData (whose remote-wins behavior is already covered in ProjectOverwriteHelpers.test.js), asserting mergeLocalIntoRemoteClone delegates to it with the correct directories and uses local .apps as the base. Co-Authored-By: Claude Fable 5 <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.
Fixes #7667
What
Adds a per-project Sync with Door43 action (in the project card menu, next to Upload) that pulls the latest changes from the project's Door43 repo, merges them with local checking work, and pushes the combined result back — enabling multiple people (or one person on multiple machines) to work on the same shared Door43 project. Today the only push-side action is Upload, a plain
git pushthat aborts on non-fast-forward with no way to reconcile.How
A raw git merge is not viable for tC data (thousands of timestamp-named JSON check-data files would conflict constantly with no resolution UI), so sync uses a data-level merge built on the existing project-overwrite machinery:
getRemoteRepoHead) and, if it is already an ancestor of local HEAD (newGitApi.isCommitInHistory), just push — no clone or merge. Cheap for the two-machines-one-user case.ProjectSyncHelpers.mergeLocalIntoRemoteClone): local check data is the base, remote-only check data is unioned in (timestamp filenames make file-level union safe), remote alignments are overlaid per verse (reusingcopyAlignmentData), manifest checkers/translators are unioned, and external verse edits are recorded with stale selections invalidated (reusingcreateVerseEditsForAllChangedVerses). For verse text, the Door43 copy wins — disclosed in the confirmation dialog..sync_backupfor failure recovery, then push to the origin owner's repo using the logged-in user's token (newGitApi.pushRepo) so collaborators can push to a shared repo.Edge cases handled: offline / not logged in (same guards as upload); project never uploaded (offer Upload); remote repo deleted (offer re-upload); push race — remote changed mid-sync (prompt to sync again); permission denied (new
GIT_ERROR_PUSH_DENIEDmapping → suggest collaborator access or an own-copy upload).Files
src/js/actions/ProjectSyncActions.js,src/js/helpers/ProjectSyncHelpers.jsGitApi.js:pushRepo(generalizespushNewRepoto any owner/name),isCommitInHistoryRepo.js:GIT_ERROR_PUSH_DENIED+ mapping inconvertGitErrorMessageProjectUploadActions.js: exportmakeSureProjectUnlockedProjectCardMenu/Menu.js+index.js); ~10 newprojects.*locale keys +buttons.upload_button(English only; other locales via Crowdin)Testing
ProjectSyncHelpers.test.js(6 tests: checkData union, alignment overlay,.gitpreserved, manifest union, no-remote-apps copy), newProjectSyncActions.test.js(guard cases), extendedGitApi.test.js(pushRepo,isCommitInHistory). Also added the missingfs.writeJsonSyncalias to the fs-extra test mock (it only hadwriteJSONSync, socopyAlignmentData's writes were silent no-ops under test). All touched suites pass (ProjectSyncHelpers, ProjectSyncActions, GitApi, Repo, ProjectUploadActions, ProjectCardMenu); eslint clean.🤖 Generated with Claude Code