Hostname/sync-folder: case-only legacy folder deletes the SAF mirror; device rename half-migrates; non-Latin names become 'unknown'
Maintainer thường phản hồi trong vòng 1 ngày
@TimeToBuildBob đang làm issue này rồi.
Từ ngày 24/11/2026.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start with the JVM repros: planFolderMigration and sanitizeDeviceHostname in the hostname and sync-folder code, plus SanitizedHostnameMigration.legacyHostnames, renameDir, SyncInterface.deleteStaleSafHostnameDirs and DatastoreStartup.rewriteBucketHostnames. Done means the case-only and non-Latin repros behave as described, and a rename moves existing buckets and the sync folder consistently. The issue asks for a decision on whether history should move, so confirm that with maintainers before coding.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Three hostname and sync-folder defects found in a review of master (aa9cea0). Each is confirmed by reading the code; the reproduction steps below name the pure functions involved. Fix order matters: fixing 3 changes existing hostnames, which runs into 2.
1. Case-only legacy folder: the SAF mirror of this device is deleted after every sync
Two independent reviewers reported this. Take a raw device name like PIXEL8 or Bob: the legacy folder is PIXEL8, and the sanitized hostname is pixel8.
SanitizedHostnameMigration.legacyHostnamesfilters with a case-sensitive compare (it != current), soPIXEL8counts as legacy.getExternalFilesDir()/syncsits on Android's case-insensitive emulated storage.planFolderMigrationplansRenameHostnameDir("PIXEL8", "pixel8").renameDirthen refuses, becauseFile("pixel8").exists()is the same directory. The migration is never marked done and re-runs on every sync.- aw-sync's writes to
pixel8/land in the existingPIXEL8/. The mirror copies them to SAFPIXEL8/<device_id>/. SyncInterface.deleteStaleSafHostnameDirsthen matches the legacy namePIXEL8and deletes<device_id>and the folder.
Result: after every successful sync, the Syncthing folder holds none of this device's data, and peers see it appear and disappear.
JVM repro of the planning step: planFolderMigration(setOf("PIXEL8"), mapOf("PIXEL8" to setOf("id")), "pixel8", listOf("PIXEL8"), "id") returns a rename onto the same directory. The refused rename and the deletion need a case-insensitive filesystem.
Likely fix: in the folder paths (planner and SAF cleanup) only, treat a legacy name that equals the current one ignoring case as the current folder. A case-only rename needs a two-step rename. The bucket-hostname rewrite in sqlite.db should stay case-sensitive.
2. Renaming the device leaves the existing buckets on the old hostname, and the rewrite never retries
Device Pixel 7 → hostname pixel_7. The user renames it to Erik's Pixel → erik_s_pixel.
DatastoreStartup.rewriteBucketHostnamesonly rewrites hostnames inlegacyHostnames(current, rawDeviceName, MODEL)=["Erik's Pixel", "Pixel 7", "Unknown", "unknown"]. These are raw names, so the stored sanitizedpixel_7never matches.- It updates 0 rows and, because of
updated >= 0, still storessanitizedHostnameMigratedTo = erik_s_pixel. It never retries. - Existing buckets keep
pixel_7, while/api/0/info, new buckets, the dashboard route/#/activity/erik_s_pixel/and the sync folder all use the new name. Thepixel_7/<id>/sync folder is never migrated either.
The previous sanitized hostname is already in that preference; it just isn't added to the candidates. Whether a rename should move history to the new name is a product decision, but the current half-moved state is a bug either way.
3. Device names without Latin letters become the unknown sentinel
deviceHostname() only falls back to Build.DEVICE when DEVICE_NAME is null. Names like 小米手机, Телефон or 📱 sanitize to unknown, the value the KDoc calls a terrible default. aw-sync then treats the device as having no provenance. Mixed names can also collide: Galaxy Пети and Galaxy Маши both become galaxy.
JVM repro: sanitizeDeviceHostname("小米手机") == "unknown". A fix should fall back to Build.DEVICE when the sanitized name is unknown.
- Ngôn ngữ chính
- Kotlin
- Star
- 289
- Fork
- 67
- Merge trung bình
- 8 ngày 52 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ActivityWatch/aw-android
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ActivityWatch/aw-android#383 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Web watcher: add support for Brave (`com.brave.browser` missing from KNOWN_BROWSER_PACKAGES)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ActivityWatch/aw-android#306 · 1 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AuthSettingsActivity crashes on launch (InflateException: Material attributes under AppCompat theme)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
ActivityWatch/aw-android#210 · 11 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Data-integrity review: browser visit lost on watcher destroy, export overwrite without truncate, notify drops startOfDay minutes (+2)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
ActivityWatch/aw-android#409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Follow-through: 4 untracked items deferred from merged PRs (widget fallback order, notify migration, test flake, rollout guard)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
ActivityWatch/aw-android#405 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ActivityWatch/aw-android
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
krelltunez/dayGLANCE#2445 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
EANs strippenĐang mởgood first issue prio:P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
haritpanchal/WakeGuard#16 ·
-
PathSegmentTemplateMatcher accepts conflicting captures for repeated variable namesCó thể đã có người làm @Christiansada đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
modelcontextprotocol/kotlin-sdk#1217 ·
Maintainer thường phản hồi trong vòng 3 ngày