aw-sync: 15 reproduced defects from a bug hunt (CLI list flags panic, interrupted sync leaves permanent gap, reconcile truncates edits, ...)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 15/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- cli, rust, sqlite
调研方向
This is a grab-bag of 17 independent defects, so pick one item rather than the list. Start by cloning the linked bughunt-2026-11-24-aw-sync-repros branch and running a single test, e.g. cargo test -p aw-sync --test bughunt_edge, then read the cited lines in aw-sync/src/sync.rs or main.rs. Done means that specific repro test goes green without breaking the rest of the aw-sync suite. Item 1 already has a suggested four-line fix at commit 7d09c72, which is the closest thing here to a startable entry point.
由索引模型根据 Issue 内容生成。
描述
A review pass over aw-sync on master ea6f09c found the defects below. Every one has a test that fails on master. The tests are on a branch that is not meant for merging: TimeToBuildBob:bughunt-2026-11-24-aw-sync-repros. Run one file with cargo test -p aw-sync --test bughunt_<file>. The security and edge tests that start a server expect target/debug/aw-server to be built.
Crash (fix ready)
- Every list-valued CLI flag panics. This covers
sync --buckets,sync --host,daemon --bucketsanddedupe --bucket(main.rs:89,112,123,178). The fields areOption<Vec<String>>withvalue_parser=parse_list, which already returns aVec, so clap panics on access withMismatch between definition and access of 'buckets'and the process exits with 101. As a result,--buckets/--hostfiltering can't be used at all, anddedupecan never delete anything, because deleting requires--bucket.- Fix and unit test (red on master, green with the fix):
7d09c72, a 4-line type change to the::std::vec::Vecopt-out. I can open it as a PR if wanted.
- Fix and unit test (red on master, green with the fix):
Data loss / wrong data
- An interrupted multi-page sync leaves a permanent gap.
sync_onewrites the newest page first (sync.rs:1186-1250) and resumes from the destination's newest event (sync.rs:1085). If a pass dies after page 1, every later pass resumes past the hole and reports "up to date". Ways that happens: SIGTERM (ctrlcis built withouttermination), an HTTP timeout, or Android killing the job. A peer can hit the same gap with no failure anywhere, by pulling a staging snapshot taken mid-push. Same root cause as #696, but a new trigger, and it hits push too; #789 only covers pull. Two independent reviewers found this one.- Tests:
bughunt_concurrency.rs::interrupted_multipage_push_leaves_permanent_gap(4999 vs 5003),peer_pull_of_mid_push_snapshot_permanently_misses_older_events, andbughunt_errors.rs::partial_multipage_write_permanently_loses_older_events(4999 vs 12000).
- Tests:
- Editing an event that straddles the 7-day reconcile lookback truncates it permanently.
get_eventsclips the event's start tolookback_start, so thetimestamp >= lookback_startguards (sync.rs:1004,1017) never exclude it. Both sides then match on the clipped identity, the clipped source copy is inserted, and the full destination row is deleted (sync.rs:1055-1059). Example: a 10-day AFK event loses 3 days and 1 hour.- Test:
bughunt_correctness.rs::reconcile_edit_of_event_straddling_lookback_start_truncates_it.
- Test:
- A changed zero-duration latest event is duplicated instead of replaced. When the destination's newest event has duration 0,
resume == its timestamp, so reconcile skips it on both sides (timestamp < resume). The incremental copy inserts the new version next to the stale one. The real trigger is a stopwatch timer that is synced while running and then stopped: the destination keeps a phantomrunning:truerow. This is plausibly where #717's duplicated running rows come from.- Tests:
stopped_stopwatch_leaves_phantom_running_row_on_dest,title_edit_of_zero_duration_latest_event_duplicates_it. Variant:stopped_overlapping_timer_is_truncated_on_dest, where a timer stopped while a second one runs is synced as 15 minutes instead of 25.
- Tests:
- One bucket with
hostname == "unknown"blocks every bucket from that peer on pull. The refusal atsync.rs:874sits insidecollect::<Result<…>>()?, before the per-bucket skip loop. A hostname that only sanitizes to unknown is skipped per bucket, as intended. Two reviewers found this one.- Tests:
bughunt_errors.rs::unknown_hostname_bucket_blocks_all_sibling_buckets_on_pull,bughunt_edge.rs::unknown_hostname_bucket_does_not_block_healthy_sibling_on_pull.
- Tests:
- A non-ASCII hostname is pushed as
"unknown"and then refused by every peer. The device-id substitution atsync.rs:867checks only the literal"unknown", before sanitizing (sync.rs:648,745). A bucket from hostкомпьютерtherefore lands in staging with hostnameunknown.- Test:
bughunt_edge.rs::non_ascii_hostname_survives_push_then_pull.
- Test:
- Two overlapping pull passes import the same events twice. The resume point is read and the events are written later with no lock in between, and aw-sync has no single-instance lock. Example: the daemon with
pull = trueplus a manualaw-sync sync.- Test:
bughunt_concurrency.rs::overlapping_pull_passes_duplicate_events(11 vs 7).
- Test:
- If every peer fails on pull, the device stops pushing its own data.
sync_runin Both mode returns before push (sync.rs:167-172,192-196), and so do plainsync(main.rs:373) and Android full sync (android.rs:350). One corrupt peer db is enough to stop publishing.- Repro: a garbage peer
sync.dbmakessync --mode bothexit 1 and leaves its own staging db at 0 buckets; removing that peer makes it stage normally.
- Repro: a garbage peer
dedupeflags distinct events as duplicates. Pages after the first useend = cut - 1ns, and the server clips each event ending after that bound (dedupe.rs:107). Two events with the same start and data but different durations, both crossing the cut, then compare equal. Deletion is currently blocked only by #1.- Test:
bughunt_edge.rs::dedupe_does_not_flag_distinct_durations_straddling_page_cut.
- Test:
Trust boundary: peers writing into a shared folder
- Push follows a symlink planted at its own staging path and migrates whatever sqlite file it points to.
setup_local_remote/local_staging_db_path(sync.rs:293-311) check withexists()and open read-write.staging.rsandlegacy_clean.rsboth guard against symlinks; this path doesn't. In the test, aplaces.sqlite-like file comes out with aw tables,user_version=6and WAL mode.- Test:
bughunt_security.rs::push_follows_planted_symlink_and_migrates_foreign_sqlite_db.
Not defects under the current trust model: aw-sync treats every participant in the sync folder as trusted, and anyone who can write that folder can already edit a peer'ssync.dbdirectly. These two are noted only because they show how an accident (two devices with the same or colliding hostname) turns into data loss. They belong to the device-identity work (#694, activitywatch#302), not this list:
- Test:
- A peer whose
$aw.sync.origin/hostname matches another device's writes into that device's…-synced-from-bucket (sync.rs:601-622). Edit reconcile can then delete the real rows, and a far-future event freezes the resume point. Tests:peer_spoofing_origin_*. - The "keep largest db per device_id" rule (
util.rs:620-631) lets any folder claiming a device_id shadow that device's real db. Test:foreign_folder_claiming_peer_device_id_shadows_real_peer.
Minor
- A per-bucket sync failure returns
Ok, so the peer is reported asimported,0 failed(sync.rs:908-930,511-514). Test:per_bucket_failure_is_invisible_in_ok_result. Its assertion is stricter than the fix needs: a fix that surfaces the failure as a report warning would still fail it. - Reconcile correctly deletes a pre-existing destination duplicate, but the "event count shrank" check (
sync.rs:1313) then fails the bucket, and for a peer with a single bucket, the whole pass. Test:reconcile_dedup_reports_bucket_failure. - A tie run longer than one page (5000 events at the same timestamp) loses its tail, and later passes add up to 5000 duplicates (
sync.rs:1237-1241). This is mostly a risk for buckets that are already corrupted. Tests:tie_run_larger_than_a_page_*. - A far-future event, for example from a clock that was briefly a year ahead, stops a bucket syncing until the wall clock catches up. This is the #696 family; the trigger is listed for completeness. Test:
future_dated_event_from_clock_skew_stalls_bucket. - Distinct devices whose names sanitize to the same string are merged into one bucket for host-less bucket ids such as
aw-watcher-android-test. For example,Galaxy МашиandGalaxy Петиboth becomegalaxy. Test:distinct_devices_with_colliding_sanitized_names_are_not_merged.
Suspicions that did not reproduce (left out): pull following symlinks (read-only), unvalidated --host path joins (local input only), and Syncthing .sync-conflict copies being picked by the largest-file rule (not tested).
An independent pass tried to refute each finding. It reclassified the two peer-spoofing items above as by-design, and every other item it checked held up.
- 主要语言
- Rust
- 星标
- 322
- 派生
- 107
- 平均合并
- 2 天 16 小时
- 30 天内合并 PR
- 25
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ActivityWatch/aw-server-rust 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
ActivityWatch/aw-server-rust#883 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
ActivityWatch/aw-server-rust#872 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
ActivityWatch/aw-server-rust#798 · 1 条评论 ·
维护者通常 1 天内回复
-
query: categorize rules can pin unbounded memory in the regex cache and run past query_timeout可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 22/100
ActivityWatch/aw-server-rust#893 · 1 条评论 ·
维护者通常 1 天内回复
-
aw-client CLI ignores aw-client.toml host/port可能已有人在做 @TimeToBuildBob 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
ActivityWatch/aw-server-rust#888 ·
维护者通常 1 天内回复
查看 ActivityWatch/aw-server-rust 的全部 Issue
相似的 Issue
-
renaming a provider to a taken name fails with a raw sql error可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area:storage kind:bug priority:p3 ready
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
XLSX files cannot be imported into Adobe InDesign due to missing AppVersion in extended properties未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
qingjian-team/qingjian#1181 ·
维护者通常 2 天内回复