Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[claude] Sync: duplicated ClientId causes silent, permanent divergence — add detection and reconciliation

未关闭
#79 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
技术栈
csharp, sqlite

调研方向

先阅读 SyncState 和 QueryHelpers.GetMissingCommits,以了解基于时间戳的交换机制,然后跟踪 AddRangeFromSync 和 SnapshotWorker,分析其在报告的故障中的执行过程。该 issue 提议检测并协调重复的 ClientIds,但没有确定修复策略;完成条件是确定一种达成共识的行为,能够检测分歧并防止提交滞留导致的故障。

由索引模型根据 Issue 内容生成。

描述

Data bug

[Claude-drafted]

Sync exchanges commits purely on (ClientId → latest commit timestamp) (SyncState, QueryHelpers.GetMissingCommits). This assumes each ClientId is a single writer with append-only history. If two replicas ever write under the same ClientId (copied SQLite file, restored device backup), their histories fork and commits are permanently stranded in both directions — each side believes the other already has everything below its head. Nothing detects this: commit hashes never cross the wire ([JsonIgnore]), hash only id + parentHash, and are rewritten locally.

Repro: copy a project DB to a second client, edit + sync on both. The project eventually becomes unsyncable: an edit arrives for an entity whose creating commit is stranded, and SnapshotWorker throws on every subsequent sync.

Proposal (layered):

  1. Tripwire: in AddRangeFromSync, receiving a commit authored by the local ClientId that isn't already in the local DB proves the ID is duplicated → surface loudly; the app should switch to a fresh ClientId so the fork stops growing.
  2. Detect: extend SyncState entries with a commit count + order-independent digest of that client's commit IDs, compared over the shared range (≤ the lower head). Mismatch ⇒ divergence, even when heads differ. Must stay compatible with timestamp-only clients.
  3. Repair: on divergence for a ClientId, exchange that client's full commit-ID list, diff, send missing commits both ways. AddRangeFromSync already handles past-insertion (dedup, hash rewrite, snapshot replay), so the merge converges. Open question: auto-repair with loud logging vs. requiring user attention.

Prevention (keeping writer identity out of the copyable DB) is the app's job: sillsdev/languageforge-lexbox#2431.

主要语言
C#
星标
14
派生
4
平均合并
2 天 18 小时
30 天内合并 PR
6

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sillsdev/harmony 的其他 Issue

查看 sillsdev/harmony 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。