Android: surface snapshot metadata validation errors instead of generic Snapshot refresh failed

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
56/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
android, ocaml

调研方向

Read shared/src/logseq/core/snapshot_download.ml at the metadata resolver and trace where its validation error reaches Android's sync status and Check log. Reproduce the missing- t metadata response described in the issue and confirm the specific reason is surfaced without exposing credentials or payloads; the existing upstream server includes t, so use the stated older-server case when checking the failure path.

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

描述

Summary

Please preserve the underlying snapshot metadata validation reason in Android's sync status / Check log. A deterministic bootstrap contract mismatch currently appears only as Sync failed / Snapshot refresh failed, with repeated download-start events and no actionable reason visible to the user.

Scope: the missing field in this reproduction comes from an intentionally old, locally patched self-hosted server. This is not a claim that the current upstream server still omits the field: the current handler and the current upstream container image include it. Strict cursor validation should remain enabled.

Installed app

  • Pixel Fold, native Android app com.logseq.logseq
  • Version 2.0.2, versionCode 1701
  • Settings revision cbff0ec5, resolved to cbff0ec53026e139aa8bd2ac5f381b16481086ff (Add Android account deletion and privacy links)
  • Existing E2EE cloud graph accessed through a self-hosted HTTPS graph server
  • Old server source revision abdf4775a3ad99e526abebca6042deecb541f017, with a separate local transaction-handling patch

Reproduction

  1. Configure an older self-hosted server whose successful /sync/<graph-id>/snapshot/download JSON has this shape:

    {"ok":true,"key":"stream/<graph-id>.snapshot","url":"https://<sync-origin>/sync/<graph-id>/snapshot/stream"}
    
  2. On the installed native build, select a graph requiring initial snapshot bootstrap (cursor=-1).

  3. Open Sync status, tap Sync now, and wait at least 35 seconds.

  4. Inspect Sync status and Settings → Check log.

The observed UI remains:

Status: Sync failed
Connection: Disconnected
Local changes: Not saved
Remote tx: Unavailable

Check log's Last error is Snapshot refresh failed. PID-scoped Android logs show GraphLifecycle: snapshot.download.start repeatedly, approximately 30 seconds apart, without the specific metadata validation reason. This failure was reproduced by an ADB UI script which taps Sync now, waits 35 seconds, and exits 1 for the failed/disconnected state. No app data was cleared.

Source-matched cause and expected diagnostics

The exact installed resolver requires t to be an integer >= 0 and otherwise returns Snapshot cursor metadata is invalid before returning a stream download plan:

https://github.com/logseq/mobile/blob/cbff0ec53026e139aa8bd2ac5f381b16481086ff/shared/src/logseq/core/snapshot_download.ml

The production metadata response was independently authenticated and checked: HTTP 200, fields ok, key, url, no t. Successful HTTP and a working stream are not sufficient to satisfy the native metadata contract.

Please expose that specific reason, ideally with a message indicating an incompatible/older sync server, rather than only Snapshot refresh failed. This would distinguish a protocol contract mismatch from timeouts, authentication, E2EE, and import failures without exposing payloads or credentials.

Current upstream status / limits

The current upstream Logseq handler returns :t (t-now self). A read-only metadata probe against an isolated copy of the graph running ghcr.io/yshalsager/logseq-selfhost-sync:latest passes the installed native metadata contract and returns the actual current cursor.

That probe verifies metadata only. It does not establish Android stream import/decryption success. No graph contents, credentials, key material, private hostnames, raw UI XML, or raw Android logs are attached.

主要语言
OCaml
星标
9
派生
2
平均合并
2 小时 26 分钟
30 天内合并 PR
116

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

logseq/mobile 的其他 Issue

查看 logseq/mobile 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

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