AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
feat(desktop): open prefilled sync issue reports
tianma-if0ba754c0a6b6
diff --git a/apps/web/src/components/DesktopSyncIssuesDialog.tsx b/apps/web/src/components/DesktopSyncIssuesDialog.tsxindex bb8c23f0..c4bcf9d9 100644--- a/apps/web/src/components/DesktopSyncIssuesDialog.tsx+++ b/apps/web/src/components/DesktopSyncIssuesDialog.tsx@@ -1,12 +1,12 @@import { useCallback, useEffect, useMemo, useState } from "react";-import { AlertTriangle, ClipboardCopy, RefreshCw, RotateCcw, Trash2 } from "lucide-react";-import type { DesktopOutboxItem, Notebook } from "@edgeever/shared";+import { AlertTriangle, ExternalLink, RefreshCw, RotateCcw, Trash2 } from "lucide-react";+import { buildGitHubFeedbackUrl, type DesktopOutboxItem, type Notebook } from "@edgeever/shared";import { useTranslation } from "react-i18next";import { Button } from "@/components/ui/button";import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";import { AppConfirmDialog } from "@/components/dialogs/ConfirmDialogs";-import { copyTextToClipboard } from "@/lib/clipboard";+import { getWebSystemInfoItems } from "@/components/settings/SystemInfoCard";import {createDesktopSyncDiagnosticText,discardDesktopSyncIssue,@@ -37,7 +37,6 @@ export const DesktopSyncIssuesDialog = ({const [loading, setLoading] = useState(false);const [workingId, setWorkingId] = useState<number | null>(null);const [error, setError] = useState<string | null>(null);- const [copied, setCopied] = useState(false);const [recovering, setRecovering] = useState<DesktopOutboxItem | null>(null);const [discarding, setDiscarding] = useState<DesktopOutboxItem | null>(null);const [recoveryNotebookId, setRecoveryNotebookId] = useState("");@@ -47,6 +46,20 @@ export const DesktopSyncIssuesDialog = ({() => new Intl.DateTimeFormat(i18n.language, { dateStyle: "short", timeStyle: "medium" }),[i18n.language],);+ const reportIssueUrl = useMemo(() => buildGitHubFeedbackUrl({+ contentHeading: t("notebookPane.syncDetails.reportContentHeading"),+ contentPrompt: t("notebookPane.syncDetails.reportContentPrompt"),+ diagnostics: {+ heading: t("notebookPane.syncDetails.reportDiagnosticsHeading"),+ notice: t("notebookPane.syncDetails.reportDiagnosticsNotice"),+ text: createDesktopSyncDiagnosticText(items),+ },+ privacyNotice: t("feedback.privacyNotice"),+ systemInfo: getWebSystemInfoItems(t, i18n.language),+ systemInfoHeading: t("feedback.systemInfoHeading"),+ systemInfoNotice: t("feedback.systemInfoNotice"),+ titlePrefix: t("notebookPane.syncDetails.reportTitlePrefix"),+ }), [i18n.language, items, t]);const formatTime = (value: string | null | undefined) => {if (!value) return null;const time = new Date(value);@@ -157,17 +170,18 @@ export const DesktopSyncIssuesDialog = ({</div><DialogFooter className="gap-2 sm:justify-between">- <Button- variant="outline"- disabled={items.length === 0}- onClick={() => void copyTextToClipboard(createDesktopSyncDiagnosticText(items)).then((success) => {- if (!success) return;- setCopied(true);- window.setTimeout(() => setCopied(false), 1500);- })}- >- <ClipboardCopy className="mr-1.5 h-4 w-4" />- {copied ? t("common.copied") : t("notebookPane.syncDetails.copyDiagnostics")}+ <Button variant="outline" disabled={items.length === 0} asChild={items.length > 0}>+ {items.length > 0 ? (+ <a href={reportIssueUrl} target="_blank" rel="noopener noreferrer">+ <ExternalLink className="mr-1.5 h-4 w-4" />+ {t("notebookPane.syncDetails.reportIssue")}+ </a>+ ) : (+ <span>+ <ExternalLink className="mr-1.5 h-4 w-4" />+ {t("notebookPane.syncDetails.reportIssue")}+ </span>+ )}</Button><Button variant="outline" onClick={() => onOpenChange(false)}>{t("common.close")}</Button></DialogFooter>diff --git a/apps/web/src/lib/desktop-sync.test.mjs b/apps/web/src/lib/desktop-sync.test.mjsindex 3c0e3a68..fc6d3598 100644--- a/apps/web/src/lib/desktop-sync.test.mjs+++ b/apps/web/src/lib/desktop-sync.test.mjs@@ -145,12 +145,34 @@ describe("desktop sync failure handling", () => {}]);expect(diagnostic).toContain("memo_not_found");+ expect(diagnostic).toContain('"totalItemCount": 1');+ expect(diagnostic).not.toContain('"id": 7');expect(diagnostic).not.toContain("private-memo-id");expect(diagnostic).not.toContain("private note body");expect(diagnostic).not.toContain("memo_private123");expect(diagnostic).not.toContain("private.example.test");});+ test("bounds diagnostics for a prefilled GitHub Issue URL", () => {+ const items = Array.from({ length: 200 }, (_, id) => ({+ id,+ kind: "memo.update",+ entityId: `memo_private_${id}`,+ payload: { contentMarkdown: "private note body" },+ attemptCount: 99_999,+ version: 1,+ status: "error",+ lastError: "Temporary failure ".repeat(40),+ lastErrorCode: "network_error",+ retryable: true,+ }));+ const diagnostic = createDesktopSyncDiagnosticText(items);++ expect(diagnostic).toContain('"totalItemCount": 200');+ expect(diagnostic).toContain('"includedItemCount": 5');+ expect(encodeURIComponent(diagnostic).length).toBeLessThan(6_000);+ });+test("allows remote pulls while durable errors are handled separately", () => {expect(shouldPullDesktopChanges({ pending: 0, syncing: 0, error: 1, conflict: 1 }, true)).toBe(true);expect(shouldPullDesktopChanges({ pending: 1, syncing: 0, error: 0, conflict: 0 }, true)).toBe(false);diff --git a/apps/web/src/lib/desktop-sync.ts b/apps/web/src/lib/desktop-sync.tsindex 7192855a..5ed7005e 100644--- a/apps/web/src/lib/desktop-sync.ts+++ b/apps/web/src/lib/desktop-sync.ts@@ -624,7 +624,7 @@ export const recoverDesktopMemoUpdate = async (item: DesktopOutboxItem, notebookconst sanitizeDesktopSyncDiagnosticError = (value: string | null | undefined) => value? value- .slice(0, 500)+ .slice(0, 200).replace(/https?:\/\/[^\s)\]}]+/gi, "[redacted-url]").replace(/\b(?:memo|notebook|template|resource)_[A-Za-z0-9_-]+\b/g, "[redacted-id]").replace(/\/Users\/[^/\s]+/g, "/Users/[redacted]")@@ -633,8 +633,9 @@ const sanitizeDesktopSyncDiagnosticError = (value: string | null | undefined) =>export const createDesktopSyncDiagnosticText = (items: DesktopOutboxItem[]) => JSON.stringify({generatedAt: new Date().toISOString(),- items: items.map((item) => ({- id: item.id,+ totalItemCount: items.length,+ includedItemCount: Math.min(items.length, 5),+ items: items.slice(0, 5).map((item) => ({kind: item.kind,status: item.status,attemptCount: item.attemptCount,diff --git a/packages/shared/src/github-feedback.test.mjs b/packages/shared/src/github-feedback.test.mjsnew file mode 100644index 00000000..9e8330e9--- /dev/null+++ b/packages/shared/src/github-feedback.test.mjs@@ -0,0 +1,29 @@+import { describe, expect, test } from "bun:test";+import { buildGitHubFeedbackUrl } from "./github-feedback";++describe("GitHub feedback URL", () => {+ test("includes optional diagnostics before system information", () => {+ const url = new URL(buildGitHubFeedbackUrl({+ contentHeading: "What happened",+ contentPrompt: "Describe the problem.",+ diagnostics: {+ heading: "Diagnostics",+ notice: "Review before submitting.",+ text: JSON.stringify({ errorCode: "memo_not_found" }),+ },+ privacyNotice: "Public report.",+ systemInfo: [{ label: "Version", value: "v1.46.0" }],+ systemInfoHeading: "System information",+ systemInfoNotice: "Generated locally.",+ titlePrefix: "[Sync] ",+ }));++ expect(url.origin + url.pathname).toBe("https://github.com/tianma-if/edgeever/issues/new");+ expect(url.searchParams.get("title")).toBe("[Sync] ");+ const body = url.searchParams.get("body");+ expect(body).toContain("## Diagnostics");+ expect(body).toContain('"errorCode":"memo_not_found"');+ expect(body).toContain("- Version: v1.46.0");+ expect(body.indexOf("## Diagnostics")).toBeLessThan(body.indexOf("## System information"));+ });+});diff --git a/packages/shared/src/github-feedback.ts b/packages/shared/src/github-feedback.tsindex cd41d6b3..b13a1310 100644--- a/packages/shared/src/github-feedback.ts+++ b/packages/shared/src/github-feedback.ts@@ -8,6 +8,7 @@ export type GitHubFeedbackSystemInfoItem = {export const buildGitHubFeedbackUrl = ({contentHeading,contentPrompt,+ diagnostics,privacyNotice,systemInfo,systemInfoHeading,@@ -16,6 +17,11 @@ export const buildGitHubFeedbackUrl = ({}: {contentHeading: string;contentPrompt: string;+ diagnostics?: {+ heading: string;+ notice: string;+ text: string;+ };privacyNotice: string;systemInfo: GitHubFeedbackSystemInfoItem[];systemInfoHeading: string;@@ -27,6 +33,16 @@ export const buildGitHubFeedbackUrl = ({"",`<!-- ${contentPrompt} -->`,"",+ ...(diagnostics ? [+ `## ${diagnostics.heading}`,+ "",+ `<!-- ${diagnostics.notice} -->`,+ "",+ "```json",+ diagnostics.text,+ "```",+ "",+ ] : []),`## ${systemInfoHeading}`,"",`<!-- ${systemInfoNotice} -->`,diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 73e69480..f8b23123 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -170,7 +170,12 @@ export const enUS = {discard: "Discard local changes",discardTitle: "Discard these local changes?",discardDescription: "Content that has not been uploaded from this sync item will be permanently deleted. Other notes and cloud data are not affected.",- copyDiagnostics: "Copy redacted diagnostics",+ reportIssue: "Report issue",+ reportTitlePrefix: "[Sync] Desktop sync needs attention",+ reportContentHeading: "What happened",+ reportContentPrompt: "Describe what happened, what you expected, and any steps that may help reproduce the sync problem.",+ reportDiagnosticsHeading: "Automatically captured sync diagnostics",+ reportDiagnosticsNotice: "EdgeEver generated and redacted these diagnostics locally. Review them before submitting.",operations: {memo_create: "Create note",memo_update: "Update note",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex 8ba18c6b..2af3f20d 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -170,7 +170,12 @@ export const zhCN = {discard: "放弃本地修改",discardTitle: "放弃这项本地修改?",discardDescription: "该同步项中尚未上传的内容会被永久删除。其他笔记和云端数据不会受到影响。",- copyDiagnostics: "复制脱敏诊断",+ reportIssue: "反馈问题",+ reportTitlePrefix: "[同步] 桌面端同步需要处理",+ reportContentHeading: "问题描述",+ reportContentPrompt: "请补充问题现象、预期结果,以及可能有助于复现同步问题的操作步骤。",+ reportDiagnosticsHeading: "自动采集的同步诊断",+ reportDiagnosticsNotice: "以下诊断由 EdgeEver 在本地生成并脱敏,请在提交前检查。",operations: {memo_create: "新建笔记",memo_update: "更新笔记",