Skip to content

fix(updater): recover downloads and await native installer handoff - #82

Draft
Chouwzi wants to merge 3 commits into
mainfrom
hotfix/2.5.1-auto-update
Draft

Chouwzi wants to merge 3 commits into
mainfrom
hotfix/2.5.1-auto-update

Conversation

@Chouwzi

@Chouwzi Chouwzi commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Mục tiêu

Auto update ở 2.5.0 có thể hết thời gian trên mạng chậm, tải lại gói đã có và báo đã mở installer Android khi mới queue bridge. Hotfix giữ/khôi phục tải, chờ kết quả native thật và để người dùng tiếp tục dùng app tới khi chủ động cài.

Refs #80 (chỉ phần updater), #81 (tải/reuse; chưa sửa installer destination hoặc cam kết setup <30 s). Không đóng toàn bộ hai issue.

  • Probe HTTP nhỏ giọt thật: budget 120 ms trả sau 704 ms trước sửa, 126 ms sau sửa với tiến độ 9 KiB. read1 giúp kiểm tra deadline/progress giữa các lượt socket read.
  • Downloader: ngân sách hữu hạn 600 s, retry theo deadline, tiếp tục Range khi response bị ngắt; rehash/reuse gói hoàn chỉnh và .part đã đủ byte với 0 request mới.
  • Android: DownloadManager giữ job theo metadata chính xác qua process recreation; app detach khi đóng và cancel chỉ khi người dùng yêu cầu. Job cũ được nối lại sau discovery, không tự tạo lượt tải mới từ auto check.
  • Handoff: chỉ installer_opened là ack; permission-required và failure giữ đường phục hồi, cache được kiểm tra lại. Lỗi signer/package/version có thông báo phù hợp và đường xem bản phát hành chính thức.
  • UX: tiến độ/hủy/cài/thử lại có cả trong settings; tải xong không giành focus bằng dialog. Confirmation hỗ trợ Escape/focus restoration.
  • Metadata chuẩn bị 2.5.1 / Android 2005001; giữ trust/channel/identity, không publish/tag trong PR này.

Phân tích nguyên nhân, phép đo và giới hạn: docs/testing/auto-update-recovery.md.

Gitflow

  • hotfix/2.5.1-auto-update từ affected main 598a1fd -> main; cùng nhánh mở PR back-merge vào develop.
  • Hai hướng PR qua validator Gitflow.
  • PR back-merge: fix(updater): back-merge 2.5.1 recovery hotfix into develop #83.
  • Merge commit sau required checks và fresh CODEOWNER review; không squash/rebase.
  • Draft: còn nghiệm thu signed upgrade trên Android thật và Windows profile/VM riêng trước release.

Kiểm thử

Commit cuối 89c3b3d22963ff6bd8594230ca86130d59f81a0a: tất cả checks xanh (Python 3.12/3.13/3.14, lint, security core/Android/Windows, private diagnostics, dependency review, Gitflow, Android và iOS). Hai PR cùng head; working tree sạch.

  • Full Python: 1,671 passed / 25 skipped; Ruff toàn src tests scripts; YAML và diff whitespace hợp lệ.
  • Hồi quy positive download/verify/confirm, cache/complete-partial reuse, Range/truncation, expiry/cancel, permission retry và native acknowledgement.
  • Local browser harness dùng controls thật, dữ liệu synthetic: desktop/360 px, light/dark; nhập liệu khi tải; ready không mở modal; click cài -> confirmation, Escape -> focus về action.
  • Provider-live Windows EXE 48,817,112 B: download+hash 17.894 s, Authenticode/product identity 1.040 s; reuse 0.038 s với network call bị cấm. Không launch installer; một mẫu không phải speedup benchmark hoặc SLA setup.
  • Production Kotlin debug/release compile với SDK36. SDK35 trước đó không tương thích AndroidX Core 1.17.0 đã có; chỉ nâng compileSdk, không đổi min/target.
  • Native Linux CI: testDebugUnitTest PASS, gồm suite 14 ca DownloadManager/metadata/cache và positive installer handoff/permission retry. Fixture khởi tạo lifecycle FileProvider đúng như Android; giữ giới hạn Windows Robolectric nêu trong tài liệu. Run cuối.
  • Android signed APK thật: background/lock/process reclaim, quyền denied -> granted -> retry, system installer -> upgrade; Windows EXE/MSI upgrade/UAC/cancel/error.

Bảo mật và quyền riêng tư

  • Giữ HTTPS, SHA/size, signer pin, installed signer, package/version/channel và xác nhận cài đặt. Notification DownloadManager chỉ hiện khi đang tải, không mở APK chưa xác minh qua thông báo hoàn tất.
  • Không commit credential, customer data, package binaries hoặc raw logs/captures; native errors dùng reason/stage cố định.
  • Mọi wait của observer/bridge/network có giới hạn; shutdown ngừng observer, không xóa download do OS sở hữu.

Ảnh hưởng người dùng

Không migration dữ liệu/cài đặt. Nếu auto check tắt, dùng kiểm tra thủ công để discovery và nối lại job Android đang có. Tải đã xong vẫn cần xác minh và xác nhận cài; native handoff không đồng nghĩa người dùng đã hoàn tất upgrade.

Client 2.5.0 vẫn cần được kiểm tra từ binary đã cài. Nếu updater cũ không mở được installer, bootstrap bằng gói hotfix chính thức cùng signer để cài đè, không yêu cầu uninstall/reset. Chưa có thiết bị Android kết nối nên chưa xác định exception cụ thể trên máy báo lỗi. Rollback source qua PR được review; giữ dữ liệu và credentials phát hành.

This branch has not been deployed

No deployments
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