Skip to content

Make sync an injectable SyncService - #149

Open
myieye wants to merge 2 commits into
mainfrom
crdt-sync-service
Open

myieye wants to merge 2 commits into
mainfrom
crdt-sync-service

Conversation

@myieye

@myieye myieye commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

[Claude, autonomous]

Turn the static SyncHelper into an injectable SyncService, so the logging follow-up can give it a logger and config. No behavior change.

  • Breaking: JsonSyncable is now internal. Create one with IJsonSyncableFactory.Create(dir) (registered by AddCrdtData), which returns an ISyncable; its constructor and FilenamePrefix/FilenameExtension constants are no longer public. Nothing in Lexbox uses them.
  • SyncWithResourceUpload moved over as is; it still has no callers.

🤖 Generated with Claude Code

@myieye
myieye added this pull request to stack #150 October 20, 2026 15:34
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d811b6eb-1767-4dd2-a97c-9562c684cd83
Commits

Reviewing files that changed from the base of the PR and between fa4034f and 5c51f12.

Files selected for processing: 2
  • src/SIL.Harmony/DataModel.cs
  • src/SIL.Harmony/SyncService.cs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Synchronization now uses an injected SyncService with configured serializer options. DataModel and the now-internal JsonSyncable delegate synchronization to that service. A new IJsonSyncableFactory creates JSON-backed syncables. Dependency registration and tests now use the factory.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related issues

Possibly related PRs

  • sillsdev/harmony#148 — This PR makes the synchronization implementation from PR #148 available through an injected SyncService.
  • sillsdev/harmony#152 — The SyncService commit cloning uses JSON deserialization, which the Commit and ServerCommit constructor changes in PR #152 affect.
Merge Risk: Minimal · up to 5c51f

No actionable runtime or repository compatibility failure was identified in the reviewed change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "Make sync an injectable SyncService" matches the main change: the static SyncHelper becomes an injectable SyncService class, and the DataModel and JsonSyncable sync methods delegate to it. …
Description check Passed The description states the goal (turning the static SyncHelper into an injectable SyncService for a later logging change) and lists the breaking change to JsonSyncable, its new factory IJsonSyncableFa…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Make sync an injectable SyncService" matches the main change: the static SyncHelper becomes an injectable SyncService class, and the DataModel and JsonSyncable sync methods delegate to it. It is short, specific, and describes the primary change from the developer's perspective.

Full details: Description check

Explanation

The description states the goal (turning the static SyncHelper into an injectable SyncService for a later logging change) and lists the breaking change to JsonSyncable, its new factory IJsonSyncableFactory, and the moved SyncWithResourceUpload. All of this matches the changeset.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@myieye myieye changed the title [claude] Make sync an injectable SyncService Make sync an injectable SyncService Oct 21, 2026
@myieye
myieye marked this pull request as ready for review October 21, 2026 07:34
@myieye
myieye requested a review from hahn-kev October 21, 2026 07:34
Base automatically changed from sync-apply-directions-independently to main October 26, 2026 09:40
myieye and others added 2 commits October 26, 2026 10:40
JsonSyncable is now created through a factory registered in
AddCrdtDataCore, so its constructor can take internal services. This
removes the public JsonSyncable type from the package; callers use
IJsonSyncableFactory.Create(dir), which returns an ISyncable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The static SyncHelper becomes SyncService, a singleton registered in
AddCrdtDataCore and injected into DataModel and JsonSyncable (via its
factory), so it can take a logger and config later. It takes the
serializer options in its constructor instead of per call. No
behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@myieye
myieye force-pushed the crdt-sync-service branch from 1298aeb to 5c51f12 Compare October 26, 2026 09:40
@myieye
myieye removed this pull request from stack #150 October 26, 2026 10:12
@myieye
myieye added this pull request to stack #158 October 26, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant