Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Title bug-report history rows by what was reported (PRD-8220) (#3727)
Andrew Mikofalvy04caaef985f3
diff --git a/.changeset/bug-report-history-titles.md b/.changeset/bug-report-history-titles.mdnew file mode 100644index 000000000..cc2a42d8b--- /dev/null+++ b/.changeset/bug-report-history-titles.md@@ -0,0 +1,11 @@+---+"@inkeep/open-knowledge": minor+---++Title bug-report history rows by what was reported.++A history row used to say what state its send was in, never what the report was about. Two reports filed the same afternoon rendered as two identical cards separated only by a timestamp. Rows are now titled by the first useful line of the note that went with the report, with the send-state badge kept on that same line and the bundle level, timestamp, size, reference and failure reason collapsed into one secondary line beneath it. The rows are also a real list now, so a screen reader announces one item per report and reads each row's title first.++Retrying a report from history now includes your note. Earlier retries silently dropped it, so a resend reached us with the reporter's own words missing, and the email draft it falls back to named the file to attach but not what had gone wrong. Both now carry the note the original send did.++Making that work meant saving the note locally for the first time: a redacted copy is written alongside the report when the bundle is created, so it survives the send that deletes the bundle. Reports generated before this update have no saved note, so they fall back to a project-based title, or to "Untitled report" when the report is not tied to a project (a system-wide report, or one made with `ok bug-report`).diff --git a/docs/content/reference/what-open-knowledge-writes.mdx b/docs/content/reference/what-open-knowledge-writes.mdxindex 16b69fda6..c1ddc09cb 100644--- a/docs/content/reference/what-open-knowledge-writes.mdx+++ b/docs/content/reference/what-open-knowledge-writes.mdx@@ -137,7 +137,7 @@ On each launch and project open, the app also runs **repair sweeps**: it rewrite| `~/.ok/stats.jsonl` | Local "open with AI" handoff stats — local-only, no phone-home | No || `~/.ok/themes/` | Your saved color themes from the [Themes plugin](../plugins/themes.mdx), one Tinted Theming base16 YAML file per theme, written when you create or edit a theme | No || `~/.ok/mcp-status.json` | First-launch MCP consent record | No |-| `~/.ok/logs/`, `~/.ok/bug-reports/` | Desktop and CLI logs, and bug-report bundles from `ok bug-report` and the app's **Help → Report a bug…** dialog (`ok diagnose bundle` writes into the project, under `.ok/local/diagnostics/`) | No |+| `~/.ok/logs/`, `~/.ok/bug-reports/` | Desktop and CLI logs, and bug-report bundles from `ok bug-report` and the app's **Help → Report a bug…** dialog (`ok diagnose bundle` writes into the project, under `.ok/local/diagnostics/`). Each report from the dialog also gets a small YAML record holding its send state and a secret-redacted copy of the note you wrote, so report history can still show what a report was about. The zip is deleted once the report is sent; the record is kept, and both go when you delete the report from report history | No || `~/.ok/bin/`, `~/.ok/env.sh` | `PATH` shim (see [Shell and `PATH`](#shell-and-path) above) | No |**Auth tokens** (for GitHub sync, sharing, and cloning) are stored in your OS credential store under the service name `open-knowledge` — the **Keychain** on macOS, **Credential Manager** on Windows, and the Secret Service keyring (libsecret) on Linux. The `~/.ok/auth.yml` file is only a fallback for headless environments where the credential store isn't reachable; when it becomes available, the token is migrated into it and the file copy is removed.@@ -263,7 +263,7 @@ Disable all three with `OK_RECLAIM_DISABLE=1`.| `~/.ok/stats.jsonl` | Local "open with AI" handoff stats — local-only, no phone-home | No || `~/.ok/themes/` | Your saved color themes from the [Themes plugin](../plugins/themes.mdx), one Tinted Theming base16 YAML file per theme, written when you create or edit a theme | No || `~/.ok/logs/` | CLI logs (`cli.<date>.log`), size- and age-capped | No |-| `~/.ok/bug-reports/` | Bug-report bundles from `ok bug-report` — the desktop app's **Help → Report a bug…** dialog writes here too (`ok diagnose bundle` writes into the project, under `.ok/local/diagnostics/`) | No |+| `~/.ok/bug-reports/` | Bug-report bundles from `ok bug-report` — the desktop app's **Help → Report a bug…** dialog writes here too (`ok diagnose bundle` writes into the project, under `.ok/local/diagnostics/`). A report filed from the dialog also leaves a small YAML record beside its bundle, holding the report's send state and a secret-redacted copy of the note you wrote so report history can name it. That record outlives the bundle: the zip is deleted once the report is sent, and the record is kept until you delete the report from report history | No |**Auth tokens** (for GitHub sync, sharing, and cloning) are stored in your operating system's secure credential store when one is available — the macOS **Keychain** (service `open-knowledge`), or the platform equivalent (Windows Credential Manager, Linux Secret Service) — falling back to a `0600` `~/.ok/auth.yml` file on headless systems (a Linux server, CI) where none is reachable.diff --git a/packages/app/src/components/BugReportHistory.dom.test.tsx b/packages/app/src/components/BugReportHistory.dom.test.tsxindex 5cc14520b..635b58a66 100644--- a/packages/app/src/components/BugReportHistory.dom.test.tsx+++ b/packages/app/src/components/BugReportHistory.dom.test.tsx@@ -239,6 +239,9 @@ describe('BugReportHistoryList', () => {render(<BugReportHistoryList />);expect(await screen.findByText('Unknown')).toBeDefined();+ // A sidecar that parsed but carries a state this build does not recognize+ // still has a real project on it, so the fallback must not give up on it.+ expect(screen.getByText('Report from demo')).toBeDefined();});test('Retry resends the existing bundle with reconstructed send metadata', async () => {@@ -482,6 +485,232 @@ describe('BugReportHistoryList', () => {});});+describe('report row titles', () => {+ test('a row carrying a note is titled by the note first useful line', async () => {+ installBridge({+ reports: [+ makeRow({+ id: 'n1-bugreport.zip',+ note: 'The editor froze after I pasted a large table\nSteps: paste, wait',+ }),+ ],+ });++ render(<BugReportHistoryList />);++ expect(await screen.findByText('The editor froze after I pasted a large table')).toBeDefined();+ expect(screen.queryByText(/Steps: paste, wait/)).toBeNull();+ });++ test('a titled row still drafts support mail with a title-free subject', async () => {+ const log = installBridge({+ reports: [+ makeRow({+ id: 'n2-bugreport.zip',+ note: 'Autosave stopped writing to disk',+ state: 'sent',+ reference: 'OK-54',+ zipDeleted: true,+ zipExists: false,+ retryable: false,+ }),+ ],+ });++ render(<BugReportHistoryList />);+ expect(await screen.findByText('Autosave stopped writing to disk')).toBeDefined();++ await userEvent.click(await screen.findByLabelText('Email support about this report'));++ // The reference is the correlation key and support already holds the bundle,+ // whose note.txt carries the note in full. A title in the subject would add+ // length without adding anything the recipient lacks.+ expect(log.opened).toEqual(['mailto:[email protected]?subject=Bug%20report%20OK-54']);+ });+});++describe('report row list semantics', () => {+ test('the reports render as a list, each item leading with its title', async () => {+ installBridge({+ reports: [+ makeRow({ id: 's1-bugreport.zip', note: 'Sync hangs on a large vault' }),+ makeRow({ id: 's2-bugreport.zip', note: 'Paste of a wide table locks the editor' }),+ ],+ });++ render(<BugReportHistoryList />);++ const items = await screen.findAllByRole('listitem');+ expect(items).toHaveLength(2);+ // The title has to come first inside the item: a screen reader walking the+ // list reads the row's own content in DOM order.+ expect(items[0]?.textContent?.startsWith('Sync hangs on a large vault')).toBe(true);+ expect(items[1]?.textContent?.startsWith('Paste of a wide table locks the editor')).toBe(true);+ });+});++describe('report row title fallbacks', () => {+ test('a note-less row from a project is titled by the project', async () => {+ installBridge({ reports: [makeRow({ id: 'f1-bugreport.zip' })] });++ render(<BugReportHistoryList />);++ expect(await screen.findByText('Report from demo')).toBeDefined();+ });++ test('a row with no project and no note is untitled, before and after a retry synthesizes a sidecar', async () => {+ // An `ok bug-report` bundle: no sidecar, so main reports an unknown level+ // and a system-wide claim nobody actually made.+ installBridge({+ reports: [+ makeRow({+ id: 'f2-bugreport.zip',+ projectSlug: null,+ systemWide: true,+ bundleLevel: 'unknown',+ }),+ ],+ });++ const { unmount } = render(<BugReportHistoryList />);+ expect(await screen.findByText('Untitled report')).toBeDefined();+ unmount();++ // After one Retry, main has written a stand-in sidecar asserting a standard+ // level and a system-wide report. Nothing on the row got truer, so the+ // title must not start claiming more than it did a moment ago.+ installBridge({+ reports: [+ makeRow({+ id: 'f2-bugreport.zip',+ state: 'sent',+ reference: 'OK-12',+ projectSlug: null,+ systemWide: true,+ bundleLevel: 'standard',+ retryable: false,+ }),+ ],+ });++ render(<BugReportHistoryList />);+ expect(await screen.findByText('Untitled report')).toBeDefined();+ });++ test('a project slug outranks a system-wide claim on the same row', async () => {+ // `toListRow` reads `systemWide` and `projectSlug` off independently+ // optional fields of a loose on-disk schema, so a partially written or+ // hand-edited sidecar can assert both. Only the slug requires a project to+ // have actually been recorded, which is why it is the one the title trusts.+ installBridge({+ reports: [makeRow({ id: 'f6-bugreport.zip', projectSlug: 'demo', systemWide: true })],+ });++ render(<BugReportHistoryList />);++ expect(await screen.findByText('Report from demo')).toBeDefined();+ });++ test('a row whose send is in flight is still titled by its own note', async () => {+ installBridge({+ reports: [+ makeRow({+ id: 'f3-bugreport.zip',+ state: 'uploading',+ note: 'Search returns nothing after a rename',+ retryable: false,+ }),+ ],+ });++ render(<BugReportHistoryList />);++ // The badge carries the send state; the title carries the incident.+ expect(await screen.findByText('Search returns nothing after a rename')).toBeDefined();+ expect(screen.getByText('Sending')).toBeDefined();+ });++ test('the title exposes its full string as a tooltip and resolves its own direction', async () => {+ const note =+ 'The editor froze after I pasted a large table and stayed frozen for about thirty seconds';+ installBridge({ reports: [makeRow({ id: 'f4-bugreport.zip', note })] });++ render(<BugReportHistoryList />);++ // A title too long for the row truncates in CSS, so the tooltip is the only+ // way the rest of it stays reachable. `dir="auto"` has to sit on the element+ // that truncates: the ellipsis follows the containing block's direction, so+ // without it a right-to-left note loses its opening words instead of its+ // closing ones.+ const title = await screen.findByText(note);+ expect(title.getAttribute('title')).toBe(note);+ expect(title.getAttribute('dir')).toBe('auto');+ });++ test('a fallback title carries a tooltip too', async () => {+ installBridge({ reports: [makeRow({ id: 'f5-bugreport.zip' })] });++ render(<BugReportHistoryList />);++ expect((await screen.findByText('Report from demo')).getAttribute('title')).toBe(+ 'Report from demo',+ );+ });+});++describe('report row metadata line', () => {+ test('a sent row with a reference still shows its bundle size', async () => {+ installBridge({+ reports: [+ makeRow({+ id: 'm1-bugreport.zip',+ state: 'sent',+ reference: 'OK-42',+ zipDeleted: true,+ zipExists: false,+ retryable: false,+ }),+ ],+ });++ render(<BugReportHistoryList />);++ // Size used to be the fallback arm of a mutually exclusive ternary, so a row+ // that had a reference to show never showed how big its bundle was.+ expect(await screen.findByText('4 KB')).toBeDefined();+ expect(screen.getByText('OK-42')).toBeDefined();+ });++ test('an upload-failed row shows its size alongside the failure reason', async () => {+ installBridge({+ reports: [+ makeRow({+ id: 'm2-bugreport.zip',+ state: 'upload-failed',+ lastError: { reason: 'complete-rejected: 503', at: 'x' },+ }),+ ],+ });++ render(<BugReportHistoryList />);++ expect(await screen.findByText('4 KB')).toBeDefined();+ expect(screen.getByText('complete-rejected: 503')).toBeDefined();+ });++ test('a row with no bundle size on record shows no size segment', async () => {+ installBridge({+ reports: [makeRow({ id: 'm3-bugreport.zip', zipBytes: 0, zipExists: false })],+ });++ render(<BugReportHistoryList />);++ // `0 B` would be a claim about a file nobody has.+ await screen.findByText('Report from demo');+ expect(screen.queryByText('0 B')).toBeNull();+ });+});+describe('BugReportPreviousReports', () => {test('renders nothing when there is no history to disclose', async () => {const log = installBridge({ reports: [] });@@ -535,6 +764,21 @@ describe('BugReportPreviousReports', () => {expect(log.opened).toEqual(['mailto:[email protected]?subject=Bug%20report%20OK-31']);});+ test('the disclosure renders the same titled list rows as the standalone pane', async () => {+ installBridge({+ reports: [makeRow({ id: 'p1-bugreport.zip', note: 'Search returns stale results' })],+ });++ render(<BugReportPreviousReports />);+ await userEvent.click(await screen.findByRole('button', { name: /Previous reports/ }));++ // The two mounts share one row component and differ only in available+ // width, so the disclosure gets the list semantics and the title ordering.+ const items = await screen.findAllByRole('listitem');+ expect(items).toHaveLength(1);+ expect(items[0]?.textContent?.startsWith('Search returns stale results')).toBe(true);+ });+test('renders nothing when the bridge is absent', async () => {clearBridge();const { container } = render(<BugReportPreviousReports />);diff --git a/packages/app/src/components/BugReportHistory.tsx b/packages/app/src/components/BugReportHistory.tsxindex 1072c81bc..911d69aa4 100644--- a/packages/app/src/components/BugReportHistory.tsx+++ b/packages/app/src/components/BugReportHistory.tsx@@ -9,6 +9,15 @@* inside the Report Bug dialog's compose step; renders nothing until there* is at least one prior report, so it never clutters the compose flow.*+ * A row is titled by the first useful line of the note that accompanied the+ * report — the composed note, so a crash report filed with an empty box titles+ * from its crash context rather than from nothing — falling back to the+ * report's project and then to an untitled label. Reports generated before the+ * sidecar started carrying a note have none to title them. For one already+ * sent that is permanent, since retention unlinked the zip holding the only+ * other copy; an unsent one still has its `note.txt` on disk, but nothing reads+ * a zip on the list path.+ ** State is shown as an inline status badge (modeless — no nested dialogs), and* per-row actions are Retry (hand the existing bundle to the background send* manager without regenerating), a support follow-up on a sent report that has@@ -26,7 +35,7 @@ import { Button } from '@/components/ui/button';import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';import { Spinner } from '@/components/ui/spinner';import { bugReportSendManager } from '@/lib/bug-report-send-manager';-import { formatBundleSize, supportMailtoUrl } from '@/lib/bug-report-support';+import { bugReportNoteTitle, formatBundleSize, supportMailtoUrl } from '@/lib/bug-report-support';import { revealInFileManagerLabel } from '@/lib/platform-labels';type PendingAction = 'retrying' | 'deleting';@@ -219,6 +228,13 @@ function ReportRow({}) {const { t, i18n } = useLingui();const busy = pending !== undefined;+ // `projectSlug` is the only identity on the row a synthesized sidecar cannot+ // forge: `systemWide`, `bundleLevel` and `degraded` all take invented values+ // once a retry writes a stand-in record, so a title built on any of them+ // turns into a confident false claim after one press of Retry.+ const title =+ bugReportNoteTitle(row.note) ??+ (row.projectSlug !== null ? t`Report from ${row.projectSlug}` : t`Untitled report`);const when =row.createdAt === ''? t`Unknown date`@@ -232,24 +248,51 @@ function ReportRow({timeStyle: 'short',}).format(new Date(row.createdAt));return (- <div className="flex items-start gap-2.5 rounded-md border px-3 py-2.5">+ <li className="flex items-start gap-2.5 rounded-md border px-3 py-2.5"><div className="min-w-0 flex-1 space-y-1">- <div className="flex flex-wrap items-center gap-1.5">+ <div className="flex items-center gap-2">+ {/* `dir="auto"` on the truncating element itself, not on a nested+ `<bdi>`: the ellipsis follows the containing block's direction, so+ an Arabic note under an English interface would otherwise lose its+ opening words rather than its closing ones. `min-w-0 flex-1` is+ what lets the flex item shrink far enough for it to appear at all. */}+ <p dir="auto" className="min-w-0 flex-1 truncate text-1sm" title={title}>+ {title}+ </p><StateBadge state={row.state} />- {row.bundleLevel !== 'unknown' ? <Badge variant="gray">{row.bundleLevel}</Badge> : null}- <span className="truncate text-1sm text-muted-foreground">{when}</span></div>- <p className="text-xs text-muted-foreground">+ {/* Each datum is its own text node, with the separators held apart as+ their own hidden spans. Folding them into one message instead would+ need a msgid per reachable combination of level, size, state and+ error, and would read a bare middle dot out to a screen reader+ between every field. */}+ <div className="flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground">+ {row.bundleLevel !== 'unknown' ? <Badge variant="gray">{row.bundleLevel}</Badge> : null}+ <span className="whitespace-nowrap">{when}</span>+ {/* Zero means neither a zip nor a recorded figure, so `0 B` would be a+ claim about a file nobody has. */}+ {row.zipBytes > 0 ? (+ <>+ <span aria-hidden>·</span>+ <span className="whitespace-nowrap">{formatBundleSize(row.zipBytes)}</span>+ </>+ ) : null}{row.state === 'sent' && row.reference !== undefined ? (- <Trans>- Reference <span className="font-mono text-foreground">{row.reference}</span>- </Trans>+ <>+ <span aria-hidden>·</span>+ <span>+ <Trans>+ Reference <span className="font-mono text-foreground">{row.reference}</span>+ </Trans>+ </span>+ </>) : row.state === 'upload-failed' && row.lastError !== undefined ? (- <span className="text-destructive">{row.lastError.reason}</span>- ) : (- <span>{formatBundleSize(row.zipBytes)}</span>- )}- </p>+ <>+ <span aria-hidden>·</span>+ <span className="text-destructive">{row.lastError.reason}</span>+ </>+ ) : null}+ </div></div><div className="flex shrink-0 items-center gap-1">{row.retryable ? (@@ -300,7 +343,7 @@ function ReportRow({)}</Button></div>- </div>+ </li>);}@@ -313,7 +356,7 @@ function ReportRows({contactSupport,}: ReturnType<typeof useReportHistory>) {return (- <div className="flex flex-col gap-2">+ <ul className="flex flex-col gap-2">{reports.map((row) => (<ReportRowkey={row.id}@@ -325,7 +368,7 @@ function ReportRows({onDelete={remove}/>))}- </div>+ </ul>);}diff --git a/packages/app/src/components/ReportBugDialogBody.tsx b/packages/app/src/components/ReportBugDialogBody.tsxindex 7b55ba02e..65d7cf411 100644--- a/packages/app/src/components/ReportBugDialogBody.tsx+++ b/packages/app/src/components/ReportBugDialogBody.tsx@@ -75,6 +75,12 @@ interface CreatedReport {* Crash details ride inside the note string so they reach the bundle's note* file, the upload metadata, and the mailto fallback body through the existing* IPC contract. Team-facing diagnostic text, deliberately not localized.+ *+ * Line one is no longer team-facing only: it is what the reporter reads back as+ * their own history row title, and what the intake names the ticket. Context+ * lines are appended rather than prepended so a typed note keeps that line, and+ * any originator that leads with context owes a first line naming the incident+ * rather than the machine that reported it.*/function composeNote(userNote: string, contextLines: string[] | undefined): string | undefined {const trimmed = userNote.trim();diff --git a/packages/app/src/lib/bug-report-send-manager.test.ts b/packages/app/src/lib/bug-report-send-manager.test.tsindex afebf75eb..3ae845ffe 100644--- a/packages/app/src/lib/bug-report-send-manager.test.ts+++ b/packages/app/src/lib/bug-report-send-manager.test.ts@@ -158,7 +158,7 @@ describe('bug-report send manager', () => {await stub.settle(FAILED_RESULT);});- test('a history row sends without a note and with a readable bundle level', async () => {+ test('a history row with no note sends no note key, and a readable bundle level', async () => {const stub = createDeferredBridge();const manager = createBugReportSendManager(() => stub.bridge);@@ -169,6 +169,31 @@ describe('bug-report send manager', () => {zipPath: ZIP_PATH,metadata: { level: 'standard', systemWide: true, projectSlug: null },});+ // `toEqual` treats an explicit `note: undefined` as absent, so the key+ // itself is asserted separately: a row with no note must not send a+ // synthesized stand-in, and must not send an empty slot either.+ expect(stub.calls[0]?.metadata).not.toHaveProperty('note');+ await stub.settle(FAILED_RESULT);+ });++ test('a history retry resends the note persisted with the report', async () => {+ const stub = createDeferredBridge();+ const manager = createBugReportSendManager(() => stub.bridge);++ manager.startBugReportSend({+ kind: 'history-row',+ row: historyRow({ note: 'the editor froze after I pasted a large table' }),+ });++ expect(stub.calls[0]).toEqual({+ zipPath: ZIP_PATH,+ metadata: {+ level: 'standard',+ systemWide: true,+ projectSlug: null,+ note: 'the editor froze after I pasted a large table',+ },+ });await stub.settle(FAILED_RESULT);});diff --git a/packages/app/src/lib/bug-report-send-manager.ts b/packages/app/src/lib/bug-report-send-manager.tsindex 74dae4c06..c2103d122 100644--- a/packages/app/src/lib/bug-report-send-manager.ts+++ b/packages/app/src/lib/bug-report-send-manager.ts@@ -98,7 +98,9 @@ export interface CreatedBugReport {/*** The two surfaces that start a send hold different things. The dialog holds a* freshly created bundle plus the note it composed; history holds a persisted- * row with no note and a bundle level that may be unreadable.+ * row whose note is the sidecar's copy of that same text — absent for reports+ * generated before it was persisted — and a bundle level that may be+ * unreadable.*/export type BugReportSendRequest =| {@@ -153,6 +155,10 @@ function toSendInput(request: BugReportSendRequest): SendInput {level: row.bundleLevel === 'unknown' ? 'standard' : row.bundleLevel,systemWide: row.systemWide,projectSlug: row.projectSlug,+ // The sidecar's copy, so a retry puts the same words on the wire the+ // original send did. Absence is data: a pre-change row or a CLI bundle+ // has no note and retries without one rather than with a stand-in.+ ...(row.note !== undefined ? { note: row.note } : {}),},};}diff --git a/packages/app/src/lib/bug-report-support.test.ts b/packages/app/src/lib/bug-report-support.test.tsindex 29ad1c7c8..2da3fd69b 100644--- a/packages/app/src/lib/bug-report-support.test.ts+++ b/packages/app/src/lib/bug-report-support.test.ts@@ -1,5 +1,5 @@/**- * Unit tests for the two pure helpers in the shared bug-report module.+ * Unit tests for the pure helpers in the shared bug-report module.** `zipBasename` is the load-bearing one: the renderer keys a send operation by* it, and Electron main independently keys the same report by `path.basename`@@ -7,8 +7,9 @@* for a renderer operation to name the report main is actually sending.*/+import { isBlankNoteContent } from '@inkeep/open-knowledge-core';import { describe, expect, test } from 'vitest';-import { supportMailtoUrl, zipBasename } from './bug-report-support.ts';+import { bugReportNoteTitle, supportMailtoUrl, zipBasename } from './bug-report-support.ts';describe('zipBasename', () => {test('reduces a posix path to the filename', () => {@@ -35,3 +36,208 @@ describe('supportMailtoUrl', () => {);});});++/**+ * One corpus, two jobs: each row is its own named derivation case, and the+ * idempotence test replays the whole set. A case added here is covered by both.+ */+const NOTE_TITLE_CASES: ReadonlyArray<{+ name: string;+ note: string | undefined;+ title: string | undefined;+}> = [+ {+ name: 'titles a single-line note with the line itself',+ note: 'The editor froze after I pasted a large table',+ title: 'The editor froze after I pasted a large table',+ },+ {+ name: 'titles a multi-line note with its first line',+ note: 'Sync hangs on large vaults\nSteps to reproduce:\n1. Open the vault',+ title: 'Sync hangs on large vaults',+ },+ {+ name: 'skips leading blank lines',+ note: '\n\n \nSync hangs on large vaults',+ title: 'Sync hangs on large vaults',+ },+ {+ name: 'treats a lone carriage return as a line break',+ note: 'Sync hangs on large vaults\rSteps to reproduce:',+ title: 'Sync hangs on large vaults',+ },+ {+ name: 'treats a CRLF pair as one line break',+ note: 'Sync hangs on large vaults\r\nSteps to reproduce:',+ title: 'Sync hangs on large vaults',+ },+ {+ name: 'leaves no trailing space when the cut lands on one',+ note: `${'w'.repeat(199)} tail`,+ title: 'w'.repeat(199),+ },+ {+ name: 'leaves a title of exactly the ceiling untouched',+ note: 'z'.repeat(200),+ title: 'z'.repeat(200),+ },+ {+ name: 'cuts a title one over the ceiling to exactly the ceiling',+ note: 'z'.repeat(201),+ title: 'z'.repeat(200),+ },+ {+ name: 'caps a very long first line at the title ceiling',+ note: `${'x'.repeat(250)} tail`,+ title: 'x'.repeat(200),+ },+ {+ name: 'caps without leaving half an astral character at the cut',+ note: `${'y'.repeat(199)}\u{1F600} tail`,+ title: 'y'.repeat(199),+ },+ {+ name: 'keeps a bullet marker, which introduces one step rather than wrapping the line',+ note: '- app freezes on save\n- then the window goes white',+ title: '- app freezes on save',+ },+ {+ name: 'keeps a numbered-list marker for the same reason',+ note: '1. open the vault\n2. paste a wide table',+ title: '1. open the vault',+ },+ {+ name: 'strips an ATX marker indented within the three spaces CommonMark allows',+ note: ' # Sync hangs on large vaults',+ title: 'Sync hangs on large vaults',+ },+ {+ name: 'strips a block-quote marker the reporter indented',+ note: ' > ENOENT opening the vault',+ title: 'ENOENT opening the vault',+ },+ {+ name: 'strips an ATX marker the reporter opened with a tab',+ note: '\t# The editor froze',+ title: 'The editor froze',+ },+ {+ name: 'leaves no double space when an invisible sat between two spaces',+ note: 'sync \u200B hangs on large vaults',+ title: 'sync hangs on large vaults',+ },+ {+ name: 'strips a marker hidden behind a leading zero-width character',+ note: '\u200B# The editor froze',+ title: 'The editor froze',+ },+ {+ name: 'drops a bidi override rather than letting it reorder the title',+ note: '\u202ESync hangs on large vaults',+ title: 'Sync hangs on large vaults',+ },+ {+ name: 'falls through a line of only zero-width characters',+ note: '\u200B\uFEFF\nThe editor froze',+ title: 'The editor froze',+ },+ {+ name: 'has no title when every line is invisible',+ note: '\u200B\n\u202E',+ title: undefined,+ },+ {+ name: 'maps a control character to a space instead of joining the words',+ note: 'editor\u0000froze',+ title: 'editor froze',+ },+ {+ name: 'maps an embedded tab to a space instead of joining the words',+ note: 'editor\tfroze',+ title: 'editor froze',+ },+ {+ name: 'collapses non-breaking spaces and runs of spaces',+ note: 'Sync\u00A0\u00A0hangs on large vaults',+ title: 'Sync hangs on large vaults',+ },+ { name: 'strips a level-1 ATX marker', note: '# The editor froze', title: 'The editor froze' },+ { name: 'strips a level-2 ATX marker', note: '## The editor froze', title: 'The editor froze' },+ { name: 'strips a level-3 ATX marker', note: '### The editor froze', title: 'The editor froze' },+ { name: 'strips a level-4 ATX marker', note: '#### The editor froze', title: 'The editor froze' },+ {+ name: 'strips a level-5 ATX marker',+ note: '##### The editor froze',+ title: 'The editor froze',+ },+ {+ name: 'strips a level-6 ATX marker',+ note: '###### The editor froze',+ title: 'The editor froze',+ },+ {+ name: 'leaves a seven-hash line alone, since CommonMark reads no heading there',+ note: '####### The editor froze',+ title: '####### The editor froze',+ },+ {+ name: 'leaves a hashtag alone, since no whitespace follows the hash',+ note: '#regression in the editor',+ title: '#regression in the editor',+ },+ {+ name: 'strips a blockquote marker',+ note: '> ENOENT opening the vault',+ title: 'ENOENT opening the vault',+ },+ { name: 'strips stacked markers in a single call', note: '## # Hello', title: 'Hello' },+ {+ name: 'falls through to the next line when the first is a bare marker',+ note: '#\nThe editor froze',+ title: 'The editor froze',+ },+ {+ name: 'yields no title when every line normalizes to nothing',+ note: '#\n>\n \n',+ title: undefined,+ },+ { name: 'yields no title for an empty note', note: '', title: undefined },+ { name: 'yields no title for an absent note', note: undefined, title: undefined },+];++describe('bugReportNoteTitle', () => {+ test.each(NOTE_TITLE_CASES)('$name', ({ note, title }) => {+ expect(bugReportNoteTitle(note)).toBe(title);+ });++ test('yields no title when the sidecar handed back a non-string', () => {+ expect(bugReportNoteTitle(42 as unknown as string)).toBeUndefined();+ });++ test('is idempotent, so re-deriving a row title cannot shift it', () => {+ for (const { note } of NOTE_TITLE_CASES) {+ const once = bugReportNoteTitle(note);+ expect(bugReportNoteTitle(once)).toBe(once);+ }+ });+});++describe('main and the renderer agree on what does not count', () => {+ // The two processes decide this separately: main asks whether a note is worth+ // persisting, the renderer whether one yields a title. A character either+ // side stopped recognizing would leave a sidecar claiming a note the row+ // refuses to title, and a retry would put it on the wire as the reporter's+ // words. Boundaries included deliberately — the ends of a range are what a+ // careless narrowing drops first.+ test.each([+ ['\u0000', 'NUL'],+ ['\u001F', 'C0 upper boundary'],+ ['\u007F', 'DEL'],+ ['\u200B', 'zero-width space'],+ ['\uFEFF', 'BOM'],+ ['\u202E', 'right-to-left override'],+ ])('a note of only %j (%s) is blank to main and titleless to the renderer', (ch) => {+ expect(isBlankNoteContent(ch)).toBe(true);+ expect(bugReportNoteTitle(ch)).toBeUndefined();+ });+});diff --git a/packages/app/src/lib/bug-report-support.ts b/packages/app/src/lib/bug-report-support.tsindex da2b62e97..1dc5ffc76 100644--- a/packages/app/src/lib/bug-report-support.ts+++ b/packages/app/src/lib/bug-report-support.ts@@ -2,8 +2,8 @@* Bug-report primitives shared across the reporting surfaces — the compose* dialog, the background send manager, its toast, and the history rows.*- * Two concerns live here because both outlived the dialog that once owned- * them privately:+ * These live here because each outlived the dialog that once owned them+ * privately:** - The support-email address. `[email protected]` is the fallback transport* whenever the intake endpoint is absent or the upload fails, and the@@ -15,8 +15,16 @@* the renderer's operation to a report main has never heard of.* - `formatBundleSize`. Every surface shows the bundle's on-disk size, so* all of them have to round it the same way.+ * - `bugReportNoteTitle`. The note-to-row-title derivation, kept beside the+ * other display helpers because the renderer is its only caller.*/+import {+ clampToCodeUnits,+ mapControlCharactersToSpace,+ stripInvisibleCharacters,+} from '@inkeep/open-knowledge-core';+const SUPPORT_EMAIL = '[email protected]';/** Bare mailto with a prefilled subject — used where a report already has a@@ -40,3 +48,77 @@ export function formatBundleSize(bytes: number): string {if (bytes >= 1024) return `${Math.max(1, Math.round(bytes / 1024))} KB`;return `${bytes} B`;}++/**+ * Ceiling on the derived title, in UTF-16 code units.+ *+ * The row truncates visually with CSS, so this is not what keeps the line from+ * overflowing. It bounds the OTHER consumer: the same string goes into the+ * `title` attribute, the mechanism by which the full title is meant to stay+ * reachable, and a native tooltip has no guaranteed capacity, no scrolling and+ * no selection. Past a couple of hundred characters that promise is empty, and+ * an uncapped note would put up to 32,768 code units into a DOM attribute on+ * every row. Sits between the repo's peers: `deriveThreadTitle` caps at 48, the+ * link-preview excerpt at 240.+ */+const MAX_TITLE_LENGTH = 200;++/** Anchored on whitespace-or-end, which is what leaves `#hashtag` and a run of+ * seven hashes alone: CommonMark reads a heading in neither. The line is+ * trimmed before this runs, so the anchor does not need to tolerate the up-to+ * three leading spaces CommonMark permits ahead of a marker.+ *+ * List markers are deliberately absent, which is where this diverges from+ * `deriveThreadTitle`'s wider lead pattern. A heading or quote marker is+ * punctuation wrapping the whole line, so removing it leaves the sentence+ * intact; a bullet or number introduces one step of several, and stripping it+ * promotes a mid-thought fragment over the line the reporter actually led+ * with. Keeping the bullet reads as a list, which is what it is. */+const BLOCK_MARKER = /^(?:#{1,6}|>)(?:[ \t]+|$)/;++/**+ * The reporter's note reduced to the one line a history row can show.+ *+ * The renderer is deliberately the only caller. Main persists the note whole+ * and never needs its first line, since the intake derives its own ticket title+ * service-side.+ *+ * The runtime type check is not redundant with the signature. `OkBugReportListRow`+ * is a type-only contract across the Electron IPC hop: the invoker casts main's+ * reply rather than validating it, so a version-skewed main, a hand-edited+ * sidecar, or a partially written file arrives as whatever it happens to be.+ * Nothing here paints a string it did not normalize.+ *+ * Invisible characters come out, then whitespace collapses, then the line+ * trims — all BEFORE the marker strip, never after. The marker alternation is anchored+ * flush-left, so anything still sitting ahead of a `#` hides it: an indent, a+ * tab the control pass turned into a space, or a zero-width character, which is+ * neither whitespace nor trimmable and would leave the row painting the `# Foo`+ * the strip exists to prevent. Normalizing first also keeps the function+ * idempotent, since a second pass would otherwise see the now-flush-left marker+ * and strip what the first pass left behind.+ *+ * The strip itself runs to a fixed point rather than once, so `## # Hello`+ * titles as `Hello`.+ *+ * The length cap applies last and does not cost idempotence: it is a function+ * of its input, and the cut is trimmed on the right, so an already-capped title+ * re-derives to itself.+ */+export function bugReportNoteTitle(note: string | undefined): string | undefined {+ if (typeof note !== 'string') return undefined;+ for (const line of note.split(/\r\n|\r|\n/)) {+ let normalized = mapControlCharactersToSpace(line);+ // Invisibles come out BEFORE the collapse, not after: removing one from+ // between two spaces would otherwise leave the double space behind, and a+ // second pass would collapse it — costing the idempotence asserted below.+ normalized = stripInvisibleCharacters(normalized).replace(/\s+/g, ' ').trim();+ while (BLOCK_MARKER.test(normalized)) {+ normalized = normalized.replace(BLOCK_MARKER, '').trim();+ }+ // trimEnd AFTER the clamp, not just before it: a cut landing on a space+ // would otherwise leave one trailing, and a second pass would remove it.+ if (normalized !== '') return clampToCodeUnits(normalized, MAX_TITLE_LENGTH).trimEnd();+ }+ return undefined;+}diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.jsonindex cae89e65d..c7caea6a5 100644--- a/packages/app/src/locales/ar/messages.json+++ b/packages/app/src/locales/ar/messages.json@@ -329,6 +329,7 @@"3SWNP8": ["الجهد الافتراضي للنموذج"],"3SZrdj": ["التحقق من التحديثات…"],"3TSz9S": ["تصغير"],+ "3Uuuft": ["تقرير من ", ["0"]],"3UzaS-": ["شجرة عمل مرتبطة بهذا المستودع"],"3V94ia": ["تعذّر إرسال تعليقاتك — مساحة العمل غير جاهزة."],"3VbwPp": ["فتح ", ["keyName"], " في المتصفح"],@@ -2197,6 +2198,7 @@"PWqtgd": ["جارٍ تحميل المحادثة"],"PXaT32": ["أعاد الخادم استجابة وجهات المهارات غير مكتملة."],"PYmp-0": ["استيراد كقالب"],+ "PZKdTd": ["تقرير بلا عنوان"],"PZn2LP": ["الاحتفاظ بالمصدر"],"PZt2Ds": ["انتهى الاستنساخ بشكل غير متوقع."],"PZtgO0": ["يجري فتح شجرة العمل"],diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.poindex 3cf11a76f..11f3ed4b8 100644--- a/packages/app/src/locales/ar/messages.po+++ b/packages/app/src/locales/ar/messages.po@@ -10621,6 +10621,11 @@ msgstr "الإبلاغ عن علة"msgid "Report a bug…"msgstr "الإبلاغ عن علة…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "تقرير من {0}"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13878,6 +13883,10 @@ msgstr "تعذّر حل الملف {identity}. انتقل إلى المرجع."msgid "Unresolvable image {identity}. Go to reference."msgstr "تعذّر حل الصورة {identity}. انتقل إلى المرجع."+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "تقرير بلا عنوان"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "محدَّث"diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.jsonindex cbdc2ccf2..4537f3018 100644--- a/packages/app/src/locales/bn/messages.json+++ b/packages/app/src/locales/bn/messages.json@@ -288,6 +288,7 @@"3SWNP8": ["মডেলের ডিফল্ট প্রচেষ্টা"],"3SZrdj": ["হালনাগাদ দেখুন…"],"3TSz9S": ["ছোট করুন"],+ "3Uuuft": [["0"], " থেকে রিপোর্ট"],"3UzaS-": ["এই রিপোজিটরির একটি লিংকড ওয়ার্কট্রি"],"3V94ia": ["আপনার মন্তব্য পাঠানো যায়নি — ওয়ার্কস্পেস প্রস্তুত নয়।"],"3VbwPp": [["keyName"], " ব্রাউজারে খুলুন"],@@ -1870,6 +1871,7 @@"PWqtgd": ["চ্যাট লোড হচ্ছে"],"PXaT32": ["সার্ভার একটি অসম্পূর্ণ স্কিল-টার্গেট প্রতিক্রিয়া ফেরত দিয়েছে।"],"PYmp-0": ["টেমপ্লেট হিসেবে আমদানি করুন"],+ "PZKdTd": ["শিরোনামহীন রিপোর্ট"],"PZn2LP": ["উৎস রাখুন"],"PZt2Ds": ["ক্লোন অপ্রত্যাশিতভাবে শেষ হয়েছে।"],"PZtgO0": ["ওয়ার্কট্রি খোলা হচ্ছে"],diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.poindex bc6ed895d..96762d272 100644--- a/packages/app/src/locales/bn/messages.po+++ b/packages/app/src/locales/bn/messages.po@@ -10617,6 +10617,11 @@ msgstr "একটি বাগ জানান"msgid "Report a bug…"msgstr "একটি বাগ জানান…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "{0} থেকে রিপোর্ট"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13874,6 +13879,10 @@ msgstr "সমাধান করা যায় না এমন ফাইলmsgid "Unresolvable image {identity}. Go to reference."msgstr "সমাধান করা যায় না এমন ছবি {identity}। রেফারেন্সে যান।"+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "শিরোনামহীন রিপোর্ট"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "হালনাগাদ"diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.jsonindex 747ca1a8c..a2d8c30ef 100644--- a/packages/app/src/locales/en/messages.json+++ b/packages/app/src/locales/en/messages.json@@ -293,6 +293,7 @@"3SWNP8": ["Model's default effort"],"3SZrdj": ["Check for updates…"],"3TSz9S": ["Minimize"],+ "3Uuuft": ["Report from ", ["0"]],"3UzaS-": ["A linked worktree of this repository"],"3V94ia": ["Couldn't send your comments — the workspace isn't ready."],"3VbwPp": ["Open ", ["keyName"], " in browser"],@@ -1922,6 +1923,7 @@"PWqtgd": ["Loading the chat"],"PXaT32": ["Server returned an incomplete skill-targets response."],"PYmp-0": ["Import as template"],+ "PZKdTd": ["Untitled report"],"PZn2LP": ["Keep source"],"PZt2Ds": ["Clone ended unexpectedly."],"PZtgO0": ["Opening worktree"],diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.poindex 61b475955..5f0011d51 100644--- a/packages/app/src/locales/en/messages.po+++ b/packages/app/src/locales/en/messages.po@@ -10621,6 +10621,11 @@ msgstr "Report a bug"msgid "Report a bug…"msgstr "Report a bug…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "Report from {0}"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13878,6 +13883,10 @@ msgstr "Unresolvable file {identity}. Go to reference."msgid "Unresolvable image {identity}. Go to reference."msgstr "Unresolvable image {identity}. Go to reference."+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "Untitled report"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "Up to date"diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.jsonindex 040ca965c..8a57973fa 100644--- a/packages/app/src/locales/es/messages.json+++ b/packages/app/src/locales/es/messages.json@@ -334,6 +334,7 @@"3SWNP8": ["Esfuerzo predeterminado del modelo"],"3SZrdj": ["Buscar actualizaciones…"],"3TSz9S": ["Minimizar"],+ "3Uuuft": ["Informe de ", ["0"]],"3UzaS-": ["Un worktree vinculado de este repositorio"],"3V94ia": ["No se pudieron enviar tus comentarios: el espacio de trabajo no está listo."],"3VbwPp": ["Abrir ", ["keyName"], " en el navegador"],@@ -2220,6 +2221,7 @@"PWqtgd": ["Cargando el chat"],"PXaT32": ["El servidor devolvió una respuesta de destinos de habilidades incompleta."],"PYmp-0": ["Importar como plantilla"],+ "PZKdTd": ["Informe sin título"],"PZn2LP": ["Conservar el origen"],"PZt2Ds": ["La clonación terminó de forma inesperada."],"PZtgO0": ["Abriendo el worktree"],diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.poindex 085694483..66a5bc0e1 100644--- a/packages/app/src/locales/es/messages.po+++ b/packages/app/src/locales/es/messages.po@@ -10621,6 +10621,11 @@ msgstr "Informar de un error"msgid "Report a bug…"msgstr "Informar de un error…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "Informe de {0}"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13878,6 +13883,10 @@ msgstr "No se puede resolver el archivo {identity}. Ir a la referencia."msgid "Unresolvable image {identity}. Go to reference."msgstr "No se puede resolver la imagen {identity}. Ir a la referencia."+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "Informe sin título"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "Al día"diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.jsonindex 692d257c0..c75d4cf89 100644--- a/packages/app/src/locales/fr/messages.json+++ b/packages/app/src/locales/fr/messages.json@@ -346,6 +346,7 @@"3SWNP8": ["Effort par défaut du modèle"],"3SZrdj": ["Rechercher les mises à jour…"],"3TSz9S": ["Réduire"],+ "3Uuuft": ["Rapport de ", ["0"]],"3UzaS-": ["Un worktree lié à ce dépôt"],"3V94ia": ["Impossible d'envoyer vos commentaires — l'espace de travail n'est pas prêt."],"3VbwPp": ["Ouvrir ", ["keyName"], " dans le navigateur"],@@ -2247,6 +2248,7 @@"PWqtgd": ["Chargement du chat"],"PXaT32": ["Le serveur a renvoyé une réponse de cibles de compétences incomplète."],"PYmp-0": ["Importer comme modèle"],+ "PZKdTd": ["Rapport sans titre"],"PZn2LP": ["Conserver la source"],"PZt2Ds": ["Le clonage s'est terminé de façon inattendue."],"PZtgO0": ["Ouverture du worktree"],diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.poindex aa65bfea5..d2041160b 100644--- a/packages/app/src/locales/fr/messages.po+++ b/packages/app/src/locales/fr/messages.po@@ -10621,6 +10621,11 @@ msgstr "Signaler un bug"msgid "Report a bug…"msgstr "Signaler un bug…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "Rapport de {0}"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13878,6 +13883,10 @@ msgstr "Fichier {identity} impossible à résoudre. Accéder à la référence."msgid "Unresolvable image {identity}. Go to reference."msgstr "Image {identity} impossible à résoudre. Accéder à la référence."+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "Rapport sans titre"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "À jour"diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.jsonindex 36f99197f..80ddb0c6c 100644--- a/packages/app/src/locales/hi/messages.json+++ b/packages/app/src/locales/hi/messages.json@@ -288,6 +288,7 @@"3SWNP8": ["मॉडल का डिफ़ॉल्ट प्रयास स्तर"],"3SZrdj": ["अपडेट देखें…"],"3TSz9S": ["छोटा करें"],+ "3Uuuft": [["0"], " से रिपोर्ट"],"3UzaS-": ["इस रिपॉज़िटरी की एक लिंक्ड वर्कट्री"],"3V94ia": ["आपकी टिप्पणियाँ नहीं भेजी जा सकीं — कार्यक्षेत्र तैयार नहीं है।"],"3VbwPp": [["keyName"], " को ब्राउज़र में खोलें"],@@ -1871,6 +1872,7 @@"PWqtgd": ["चैट लोड हो रही है"],"PXaT32": ["सर्वर ने अधूरी स्किल-टारगेट प्रतिक्रिया लौटाई।"],"PYmp-0": ["टेम्पलेट के रूप में आयात करें"],+ "PZKdTd": ["बिना शीर्षक रिपोर्ट"],"PZn2LP": ["स्रोत रखें"],"PZt2Ds": ["क्लोन अप्रत्याशित रूप से समाप्त हो गया।"],"PZtgO0": ["वर्कट्री खोला जा रहा है"],diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.poindex 2740b69bd..3238c2372 100644--- a/packages/app/src/locales/hi/messages.po+++ b/packages/app/src/locales/hi/messages.po@@ -10617,6 +10617,11 @@ msgstr "बग की रिपोर्ट करें"msgid "Report a bug…"msgstr "बग की रिपोर्ट करें…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "{0} से रिपोर्ट"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13874,6 +13879,10 @@ msgstr "हल न की जा सकने वाली फ़ाइल {idenmsgid "Unresolvable image {identity}. Go to reference."msgstr "हल न की जा सकने वाला चित्र {identity}। संदर्भ पर जाएँ।"+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "बिना शीर्षक रिपोर्ट"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "अद्यतित"diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.jsonindex 5db009932..b96421db4 100644--- a/packages/app/src/locales/id/messages.json+++ b/packages/app/src/locales/id/messages.json@@ -294,6 +294,7 @@"3SWNP8": ["Upaya bawaan model"],"3SZrdj": ["Periksa pembaruan…"],"3TSz9S": ["Perkecil"],+ "3Uuuft": ["Laporan dari ", ["0"]],"3UzaS-": ["Worktree tertaut dari repositori ini"],"3V94ia": ["Komentar Anda tidak bisa dikirim — ruang kerjanya belum siap."],"3VbwPp": ["Buka ", ["keyName"], " di peramban"],@@ -1932,6 +1933,7 @@"PWqtgd": ["Memuat obrolan"],"PXaT32": ["Server mengembalikan respons target skill yang tidak lengkap."],"PYmp-0": ["Impor sebagai templat"],+ "PZKdTd": ["Laporan tanpa judul"],"PZn2LP": ["Simpan sumbernya"],"PZt2Ds": ["Kloning berakhir secara tidak terduga."],"PZtgO0": ["Membuka worktree"],diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.poindex ed8aa8965..3c622cadc 100644--- a/packages/app/src/locales/id/messages.po+++ b/packages/app/src/locales/id/messages.po@@ -10617,6 +10617,11 @@ msgstr "Laporkan bug"msgid "Report a bug…"msgstr "Laporkan bug…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "Laporan dari {0}"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13874,6 +13879,10 @@ msgstr "File {identity} tidak dapat ditentukan. Buka referensi."msgid "Unresolvable image {identity}. Go to reference."msgstr "Gambar {identity} tidak dapat ditentukan. Buka referensi."+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "Laporan tanpa judul"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "Sudah mutakhir"diff --git a/packages/app/src/locales/ko/messages.json b/packages/app/src/locales/ko/messages.jsonindex 55c278cbe..0ce1a911e 100644--- a/packages/app/src/locales/ko/messages.json+++ b/packages/app/src/locales/ko/messages.json@@ -281,6 +281,7 @@"3SWNP8": ["모델 기본 작업 수준"],"3SZrdj": ["업데이트 확인…"],"3TSz9S": ["최소화"],+ "3Uuuft": [["0"], "의 보고서"],"3UzaS-": ["이 리포지토리의 연결된 워크트리"],"3V94ia": ["댓글 전송에 실패했습니다. 워크스페이스 준비 전입니다."],"3VbwPp": ["브라우저에서 ", ["keyName"], " 열기"],@@ -1859,6 +1860,7 @@"PWqtgd": ["채팅 불러오는 중"],"PXaT32": ["서버에서 불완전한 스킬 대상 응답을 반환했습니다."],"PYmp-0": ["템플릿으로 가져오기"],+ "PZKdTd": ["제목 없는 보고서"],"PZn2LP": ["소스 유지"],"PZt2Ds": ["클론이 예기치 않게 종료되었습니다."],"PZtgO0": ["워크트리 여는 중"],diff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.poindex 28e8bec0c..616530909 100644--- a/packages/app/src/locales/ko/messages.po+++ b/packages/app/src/locales/ko/messages.po@@ -10621,6 +10621,11 @@ msgstr "버그 신고"msgid "Report a bug…"msgstr "버그 신고…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "{0}의 보고서"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13878,6 +13883,10 @@ msgstr "해결할 수 없는 파일 {identity}. 참조로 이동합니다."msgid "Unresolvable image {identity}. Go to reference."msgstr "해결할 수 없는 이미지 {identity}. 참조로 이동합니다."+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "제목 없는 보고서"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "최신 상태"diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.jsonindex 9c7b61d70..60de22ef7 100644--- a/packages/app/src/locales/pseudo/messages.json+++ b/packages/app/src/locales/pseudo/messages.json@@ -293,6 +293,7 @@"3SWNP8": ["Ḿōďēĺ'ś ďēƒàũĺţ ēƒƒōŕţ"],"3SZrdj": ["Ćĥēćķ ƒōŕ ũƥďàţēś…"],"3TSz9S": ["Ḿĩńĩḿĩźē"],+ "3Uuuft": ["Ŕēƥōŕţ ƒŕōḿ ", ["0"]],"3UzaS-": ["À ĺĩńķēď ŵōŕķţŕēē ōƒ ţĥĩś ŕēƥōśĩţōŕŷ"],"3V94ia": ["Ćōũĺďń'ţ śēńď ŷōũŕ ćōḿḿēńţś — ţĥē ŵōŕķśƥàćē ĩśń'ţ ŕēàďŷ."],"3VbwPp": ["Ōƥēń ", ["keyName"], " ĩń ƀŕōŵśēŕ"],@@ -1922,6 +1923,7 @@"PWqtgd": ["Ĺōàďĩńĝ ţĥē ćĥàţ"],"PXaT32": ["Śēŕvēŕ ŕēţũŕńēď àń ĩńćōḿƥĺēţē śķĩĺĺ-ţàŕĝēţś ŕēśƥōńśē."],"PYmp-0": ["Ĩḿƥōŕţ àś ţēḿƥĺàţē"],+ "PZKdTd": ["Ũńţĩţĺēď ŕēƥōŕţ"],"PZn2LP": ["Ķēēƥ śōũŕćē"],"PZt2Ds": ["Ćĺōńē ēńďēď ũńēxƥēćţēďĺŷ."],"PZtgO0": ["Ōƥēńĩńĝ ŵōŕķţŕēē"],diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.poindex 214993184..5391f2fe6 100644--- a/packages/app/src/locales/pseudo/messages.po+++ b/packages/app/src/locales/pseudo/messages.po@@ -10617,6 +10617,11 @@ msgstr ""msgid "Report a bug…"msgstr ""+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr ""+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13874,6 +13879,10 @@ msgstr ""msgid "Unresolvable image {identity}. Go to reference."msgstr ""+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr ""+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr ""diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.jsonindex 0757870b2..bb6a3d025 100644--- a/packages/app/src/locales/pt-BR/messages.json+++ b/packages/app/src/locales/pt-BR/messages.json@@ -330,6 +330,7 @@"3SWNP8": ["Esforço padrão do modelo"],"3SZrdj": ["Buscar atualizações…"],"3TSz9S": ["Minimizar"],+ "3Uuuft": ["Relatório de ", ["0"]],"3UzaS-": ["Um worktree vinculado deste repositório"],"3V94ia": ["Não deu para enviar seus comentários — o espaço de trabalho não está pronto."],"3VbwPp": ["Abrir ", ["keyName"], " no navegador"],@@ -2188,6 +2189,7 @@"PWqtgd": ["Carregando o chat"],"PXaT32": ["O servidor retornou uma resposta de destinos de habilidades incompleta."],"PYmp-0": ["Importar como modelo"],+ "PZKdTd": ["Relatório sem título"],"PZn2LP": ["Manter a fonte"],"PZt2Ds": ["A clonagem terminou de forma inesperada."],"PZtgO0": ["Abrindo o worktree"],diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.poindex 225e4a97f..13ba330d2 100644--- a/packages/app/src/locales/pt-BR/messages.po+++ b/packages/app/src/locales/pt-BR/messages.po@@ -10617,6 +10617,11 @@ msgstr "Relatar um erro"msgid "Report a bug…"msgstr "Relatar um erro…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "Relatório de {0}"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13874,6 +13879,10 @@ msgstr "Não foi possível resolver o arquivo {identity}. Ir para a referência.msgid "Unresolvable image {identity}. Go to reference."msgstr "Não foi possível resolver a imagem {identity}. Ir para a referência."+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "Relatório sem título"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "Atualizado"diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.jsonindex d9568f31e..67738efff 100644--- a/packages/app/src/locales/ur/messages.json+++ b/packages/app/src/locales/ur/messages.json@@ -294,6 +294,7 @@"3SWNP8": ["ماڈل کی ڈیفالٹ کوشش"],"3SZrdj": ["اپ ڈیٹس دیکھیں…"],"3TSz9S": ["چھوٹا کریں"],+ "3Uuuft": [["0"], " سے رپورٹ"],"3UzaS-": ["اس ریپازٹری کا ایک منسلک ورک ٹری"],"3V94ia": ["آپ کے تبصرے نہیں بھیجے جا سکے — ورک اسپیس تیار نہیں ہے۔"],"3VbwPp": [["keyName"], " براؤزر میں کھولیں"],@@ -1966,6 +1967,7 @@"PWqtgd": ["چیٹ لوڈ ہو رہی ہے"],"PXaT32": ["سرور نے نامکمل اسکل ٹارگٹس جواب لوٹایا۔"],"PYmp-0": ["ٹیمپلیٹ کے طور پر درآمد کریں"],+ "PZKdTd": ["بلا عنوان رپورٹ"],"PZn2LP": ["ماخذ رکھیں"],"PZt2Ds": ["کلون غیر متوقع طور پر ختم ہو گیا۔"],"PZtgO0": ["ورک ٹری کھولا جا رہا ہے"],diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.poindex 6d296f22a..acead80d9 100644--- a/packages/app/src/locales/ur/messages.po+++ b/packages/app/src/locales/ur/messages.po@@ -10621,6 +10621,11 @@ msgstr "بگ رپورٹ کریں"msgid "Report a bug…"msgstr "بگ رپورٹ کریں…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "{0} سے رپورٹ"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13878,6 +13883,10 @@ msgstr "ناقابلِ حل فائل {identity}۔ حوالہ پر جائیں۔"msgid "Unresolvable image {identity}. Go to reference."msgstr "ناقابلِ حل تصویر {identity}۔ حوالہ پر جائیں۔"+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "بلا عنوان رپورٹ"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "تازہ ترین"diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.jsonindex e66ea36be..683894614 100644--- a/packages/app/src/locales/zh-Hans/messages.json+++ b/packages/app/src/locales/zh-Hans/messages.json@@ -263,6 +263,7 @@"3SWNP8": ["模型默认的推理强度"],"3SZrdj": ["检查更新…"],"3TSz9S": ["最小化"],+ "3Uuuft": ["来自 ", ["0"], " 的报告"],"3UzaS-": ["此仓库的一个链接 worktree"],"3V94ia": ["无法发送你的评论——工作区尚未就绪。"],"3VbwPp": ["在浏览器中打开 ", ["keyName"]],@@ -1698,6 +1699,7 @@"PWqtgd": ["正在加载对话"],"PXaT32": ["服务器返回的技能目标响应不完整。"],"PYmp-0": ["作为模板导入"],+ "PZKdTd": ["未命名报告"],"PZn2LP": ["保留来源"],"PZt2Ds": ["克隆意外结束。"],"PZtgO0": ["正在打开 worktree"],diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.poindex dae80a1c8..0be967a79 100644--- a/packages/app/src/locales/zh-Hans/messages.po+++ b/packages/app/src/locales/zh-Hans/messages.po@@ -10621,6 +10621,11 @@ msgstr "报告问题"msgid "Report a bug…"msgstr "报告问题…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "来自 {0} 的报告"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13878,6 +13883,10 @@ msgstr "无法解析文件 {identity}。转到引用位置。"msgid "Unresolvable image {identity}. Go to reference."msgstr "无法解析图片 {identity}。转到引用位置。"+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "未命名报告"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "已是最新"diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.jsonindex 4101461d2..447d5bd7e 100644--- a/packages/app/src/locales/zh-Hant/messages.json+++ b/packages/app/src/locales/zh-Hant/messages.json@@ -267,6 +267,7 @@"3SWNP8": ["模型預設的推理強度"],"3SZrdj": ["檢查更新…"],"3TSz9S": ["最小化"],+ "3Uuuft": ["來自 ", ["0"], " 的回報"],"3UzaS-": ["此儲存庫的一個連結 worktree"],"3V94ia": ["無法傳送你的註解——工作區還沒準備好。"],"3VbwPp": ["在瀏覽器中開啟 ", ["keyName"]],@@ -1724,6 +1725,7 @@"PWqtgd": ["正在載入對話"],"PXaT32": ["伺服器回傳的技能目標回應不完整。"],"PYmp-0": ["當成範本匯入"],+ "PZKdTd": ["未命名回報"],"PZn2LP": ["保留來源"],"PZt2Ds": ["複製意外結束。"],"PZtgO0": ["正在開啟 worktree"],diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.poindex 0195ecc90..9daf83ec7 100644--- a/packages/app/src/locales/zh-Hant/messages.po+++ b/packages/app/src/locales/zh-Hant/messages.po@@ -10621,6 +10621,11 @@ msgstr "回報問題"msgid "Report a bug…"msgstr "回報問題…"+#. placeholder {0}: row.projectSlug+#: src/components/BugReportHistory.tsx+msgid "Report from {0}"+msgstr "來自 {0} 的回報"+#: src/components/AppErrorBoundary.tsx#: src/components/DocumentErrorBoundary.tsxmsgid "Report this error"@@ -13878,6 +13883,10 @@ msgstr "無法解析檔案 {identity}。前往引用位置。"msgid "Unresolvable image {identity}. Go to reference."msgstr "無法解析圖片 {identity}。前往引用位置。"+#: src/components/BugReportHistory.tsx+msgid "Untitled report"+msgstr "未命名回報"+#: src/components/SyncStatusBadge.tsxmsgid "Up to date"msgstr "已是最新"diff --git a/packages/core/src/bug-report-sidecar/note-content.ts b/packages/core/src/bug-report-sidecar/note-content.tsnew file mode 100644index 000000000..b164a0a10--- /dev/null+++ b/packages/core/src/bug-report-sidecar/note-content.ts@@ -0,0 +1,80 @@+/**+ * What counts as content in a reporter's bug-report note.+ *+ * Two processes answer this independently and must not drift: Electron main+ * decides whether a note is worth persisting at all, and the renderer decides+ * whether one yields a row title. When they disagree, the sidecar holds a note+ * the row refuses to title and a later retry puts it on the wire as the+ * reporter's words.+ *+ * They share the primitives rather than one predicate, because they need+ * different things from the same rule: main needs the yes-or-no+ * (`isBlankNoteContent`), while the renderer needs the normalized string it is+ * about to paint (`stripInvisibleCharacters`, `clampToCodeUnits`). What must+ * stay identical is the notion of a character that does not count, which lives+ * here once.+ */++/**+ * Zero-width and bidi-control characters: present in a string, absent from the+ * screen. `String.prototype.trim` does not remove them, so a note made only of+ * these is neither empty nor visible.+ */+const INVISIBLE_CHARACTERS = /[\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF]/g;++/**+ * The value with every invisible character removed.+ *+ * A reader normalizes with this before deciding anything positional. A leading+ * zero-width space is not whitespace and does not trim, so a title derivation+ * that only trims would fail to see a `#` sitting one invisible character in+ * and would paint the marker the strip exists to remove.+ */+export function stripInvisibleCharacters(value: string): string {+ return value.replace(INVISIBLE_CHARACTERS, '');+}++/**+ * `value` with every ASCII control character mapped to a single space.+ *+ * Mapped, never deleted: a tab is a control character, and deleting it joins+ * the words either side of it. A NUL is the sharper case — invisible on screen+ * but enough to break exact text matching downstream, and the value comes off+ * disk from an open format, so its cleanliness cannot be assumed.+ */+export function mapControlCharactersToSpace(value: string): string {+ // biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the point; this is the one place that decides what a control character is.+ return value.replace(/[\u0000-\u001F\u007F]/g, ' ');+}++/**+ * True when the value has no character a reader could actually see.+ *+ * Control characters count as invisible here even though they are not in the+ * zero-width set, because the renderer maps them to spaces before deciding a+ * line is empty. Leaving them out would put the two processes back in+ * disagreement over a note of nothing but C0 controls.+ */+export function isBlankNoteContent(value: string): boolean {+ return mapControlCharactersToSpace(stripInvisibleCharacters(value)).trim() === '';+}++/**+ * `value` cut to at most `maxCodeUnits`, never leaving half an astral+ * character behind.+ *+ * Counts UTF-16 code units because that is what `String.prototype.length`+ * reports, and every ceiling in this feature is expressed in the same unit.+ * Slicing by code points instead would satisfy the eye and break the ceiling: a+ * cap of N code points can be 2N code units, which a length check downstream+ * would reject. A bare slice can land between the halves of a surrogate pair,+ * storing a lone surrogate that YAML round-trips happily and a renderer paints+ * as a replacement character, so drop a trailing high surrogate when the cut+ * lands on one.+ */+export function clampToCodeUnits(value: string, maxCodeUnits: number): string {+ if (value.length <= maxCodeUnits) return value;+ const clamped = value.slice(0, maxCodeUnits);+ const lastUnit = clamped.charCodeAt(clamped.length - 1);+ return lastUnit >= 0xd800 && lastUnit <= 0xdbff ? clamped.slice(0, -1) : clamped;+}diff --git a/packages/core/src/bug-report-sidecar/schema.ts b/packages/core/src/bug-report-sidecar/schema.tsindex b3c4789fc..b66fe9b8e 100644--- a/packages/core/src/bug-report-sidecar/schema.ts+++ b/packages/core/src/bug-report-sidecar/schema.ts@@ -165,7 +165,7 @@ export const ReportSidecarSchema = z.looseObject({lastError: LastErrorSchema.optional(),/** Bounded attempt history (capped by the writer). */attempts: z.array(AttemptSchema).optional(),- /** Short redacted note carried for list context. */+ /** Redacted note carried for list context. */note: z.string().optional(),});diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 0b586d5ef..25ed48fc5 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -1,6 +1,13 @@// Bug-report sidecar — the durable per-report YAML record backing the retry// list. Schema + open-state normalization; the writer/reader/retention live in// desktop main.++export {+ clampToCodeUnits,+ isBlankNoteContent,+ mapControlCharactersToSpace,+ stripInvisibleCharacters,+} from './bug-report-sidecar/note-content.ts';export {isKnownReportSidecarState,isReportIdShape,diff --git a/packages/core/src/logger-types.ts b/packages/core/src/logger-types.tsindex 7a0a5e8cd..2c65c082f 100644--- a/packages/core/src/logger-types.ts+++ b/packages/core/src/logger-types.ts@@ -270,6 +270,14 @@ export interface OkBugReportListRow {/** State-coupled: present only when `state === 'upload-failed'`. */lastError?: { reason: string; at: string };attemptsCount: number;+ /**+ * The sidecar's scrubbed copy of the reporter's composed note, whole rather+ * than an excerpt: the renderer derives the row title from its first useful+ * line, and a history retry resends it as `metadata.note`. Absent whenever+ * the reporter wrote nothing and no crash context was appended, which is the+ * common case, and also for CLI bundles, unreadable sidecars, and reports+ * generated before the note was persisted.+ */note?: string;/** Main-derived absolute zip path; re-validated for containment on use. */zipPath: string;diff --git a/packages/desktop/src/main/bug-report-sidecar.test.ts b/packages/desktop/src/main/bug-report-sidecar.test.tsindex 30f811e10..1f71c4dcc 100644--- a/packages/desktop/src/main/bug-report-sidecar.test.ts+++ b/packages/desktop/src/main/bug-report-sidecar.test.ts@@ -141,6 +141,45 @@ describe('writeReportSidecar / readReportSidecar', () => {const dir = makeTmpDir();expect(await readReportSidecar(sidecarPathForId(dir, rid(1)))).toBeNull();});++ test('recordGenerated persists the note it was handed', async () => {+ const dir = makeTmpDir();+ const id = rid(1);+ seedZip(dir, id);+ const store = createBugReportSidecarStore({ dir });++ await store.recordGenerated({+ zipPath: zipPathForId(dir, id),+ zipBytes: 128,+ level: 'standard',+ systemWide: false,+ projectSlug: 'demo',+ note: 'sync hung on a large repo',+ });++ expect((await readReportSidecar(sidecarPathForId(dir, id)))?.note).toBe(+ 'sync hung on a large repo',+ );+ });++ test('recordGenerated without a note writes no note key at all', async () => {+ const dir = makeTmpDir();+ const id = rid(1);+ seedZip(dir, id);+ const store = createBugReportSidecarStore({ dir });++ await store.recordGenerated({+ zipPath: zipPathForId(dir, id),+ zipBytes: 128,+ level: 'standard',+ systemWide: false,+ projectSlug: 'demo',+ });++ const sidecar = await readReportSidecar(sidecarPathForId(dir, id));+ expect(sidecar).not.toBeNull();+ expect(sidecar && 'note' in sidecar).toBe(false);+ });});describe('listReports — states and ordering', () => {@@ -176,6 +215,19 @@ describe('listReports — states and ordering', () => {expect(failed?.retryable).toBe(true);expect(failed?.lastError?.reason).toBe('offline');});++ test('a row carries the sidecar note, and omits it when the sidecar has none', async () => {+ const dir = makeTmpDir();+ await seedReport(dir, 1, { note: 'the editor froze after a paste' });+ await seedReport(dir, 2);++ const result = await listReports(dir);+ if (!result.ok) throw new Error(`expected ok, got ${result.reason}`);++ const [withoutNote, withNote] = result.reports;+ expect(withNote?.note).toBe('the editor froze after a paste');+ expect(withoutNote && 'note' in withoutNote).toBe(false);+ });});describe('listReports — forgiving reads (FR9)', () => {@@ -280,9 +332,31 @@ describe('send hooks — state transitions and in-flight lock', () => {expect(await store.sendHooks.onSendStart(id)).toEqual({ proceed: false });});+ test('a synthesized sidecar claims no project, so the row can never be titled by one', async () => {+ const dir = makeTmpDir();+ const id = rid(1);+ // A sidecar-less bundle, as the CLI writes: the first retry synthesizes a+ // record for it. That record asserts a bundle level and a system-wide flag+ // nobody supplied, which is why the row title may lean on neither. The slug+ // is the one identity signal synthesis cannot invent, and it must stay null+ // or an untitled report starts claiming a project it never came from.+ seedZip(dir, id);+ const store = createBugReportSidecarStore({ dir });++ expect(await store.sendHooks.onSendStart(id)).toEqual({ proceed: true });++ const synthesized = await readReportSidecar(sidecarPathForId(dir, id));+ expect(synthesized).not.toBeNull();+ expect(synthesized?.projectSlug ?? null).toBeNull();+ expect(synthesized && 'note' in synthesized).toBe(false);+ });+test('a sent result records the reference, appends an attempt, and reclaims the zip', async () => {const dir = makeTmpDir();- const id = await seedReport(dir, 1, { state: 'generated' });+ const id = await seedReport(dir, 1, {+ state: 'generated',+ note: 'the editor froze after a paste',+ });const store = createBugReportSidecarStore({ dir });await store.sendHooks.onSendStart(id);@@ -293,6 +367,7 @@ describe('send hooks — state transitions and in-flight lock', () => {expect(sidecar?.reference).toBe('OK-777');expect(sidecar?.zipDeleted).toBe(true);expect(sidecar?.attempts?.at(-1)).toMatchObject({ transport: 'upload', outcome: 'success' });+ expect(sidecar?.note).toBe('the editor froze after a paste');// The confirmed-sent zip is reclaimed, its tombstone sidecar kept.expect(existsSync(zipPathForId(dir, id))).toBe(false);expect(existsSync(sidecarPathForId(dir, id))).toBe(true);@@ -302,7 +377,10 @@ describe('send hooks — state transitions and in-flight lock', () => {test('an upload-failed result records the reason and stays retryable', async () => {const dir = makeTmpDir();- const id = await seedReport(dir, 1, { state: 'generated' });+ const id = await seedReport(dir, 1, {+ state: 'generated',+ note: 'the editor froze after a paste',+ });const store = createBugReportSidecarStore({ dir });await store.sendHooks.onSendStart(id);@@ -315,12 +393,16 @@ describe('send hooks — state transitions and in-flight lock', () => {expect(sidecar?.state).toBe('upload-failed');expect(sidecar?.lastError?.reason).toBe('complete-rejected: 503');expect(sidecar?.attempts?.at(-1)).toMatchObject({ transport: 'upload', outcome: 'failed' });+ expect(sidecar?.note).toBe('the editor froze after a paste');expect(existsSync(zipPathForId(dir, id))).toBe(true);});test('an email-drafted result records the email transport without touching the zip', async () => {const dir = makeTmpDir();- const id = await seedReport(dir, 1, { state: 'generated' });+ const id = await seedReport(dir, 1, {+ state: 'generated',+ note: 'the editor froze after a paste',+ });const store = createBugReportSidecarStore({ dir });await store.sendHooks.onSendResult(id, { kind: 'email-drafted' });@@ -328,6 +410,7 @@ describe('send hooks — state transitions and in-flight lock', () => {const sidecar = await readReportSidecar(sidecarPathForId(dir, id));expect(sidecar?.state).toBe('email-drafted');expect(sidecar?.attempts?.at(-1)).toMatchObject({ transport: 'email' });+ expect(sidecar?.note).toBe('the editor froze after a paste');expect(existsSync(zipPathForId(dir, id))).toBe(true);});});@@ -343,6 +426,21 @@ describe('runRetentionSweep', () => {expect((await readReportSidecar(sidecarPathForId(dir, id)))?.zipDeleted).toBe(true);});+ test('the tombstone write keeps the note after the zip is reclaimed', async () => {+ const dir = makeTmpDir();+ const note = 'the editor froze after I pasted a large table';+ const id = await seedReport(dir, 1, { state: 'sent', reference: 'OK-1', note });++ await runRetentionSweep(dir, createInFlightRegistry());++ // The zip that held the reporter's words is gone, so the sidecar is now the+ // only local copy. A tombstone that dropped it would leave the row that+ // most needs a title permanently unable to have one.+ const sidecar = await readReportSidecar(sidecarPathForId(dir, id));+ expect(sidecar?.zipDeleted).toBe(true);+ expect(sidecar?.note).toBe(note);+ });+test('evicts the oldest unsent over the count cap but never the newest', async () => {const dir = makeTmpDir();const total = MAX_UNSENT_REPORT_COUNT + 2;@@ -490,7 +588,10 @@ describe('runRetentionSweep', () => {describe('reconcileStaleUploading', () => {test('demotes a stale uploading sidecar to upload-failed at boot', async () => {const dir = makeTmpDir();- const staleId = await seedReport(dir, 1, { state: 'uploading' });+ const staleId = await seedReport(dir, 1, {+ state: 'uploading',+ note: 'the editor froze after a paste',+ });const okId = await seedReport(dir, 2, { state: 'generated' });const reconciled = await reconcileStaleUploading(dir);@@ -499,6 +600,7 @@ describe('reconcileStaleUploading', () => {const stale = await readReportSidecar(sidecarPathForId(dir, staleId));expect(stale?.state).toBe('upload-failed');expect(stale?.lastError?.reason).toBe('interrupted-by-restart');+ expect(stale?.note).toBe('the editor froze after a paste');// A non-uploading sidecar is untouched.expect((await readReportSidecar(sidecarPathForId(dir, okId)))?.state).toBe('generated');});diff --git a/packages/desktop/src/main/bug-report-sidecar.ts b/packages/desktop/src/main/bug-report-sidecar.tsindex fa6ce00c8..6e83383d9 100644--- a/packages/desktop/src/main/bug-report-sidecar.ts+++ b/packages/desktop/src/main/bug-report-sidecar.ts@@ -214,6 +214,7 @@ function toListRow(dir: string, scanned: ScannedReport): OkBugReportListRow {projectSlug,...(s?.reference !== undefined ? { reference: s.reference } : {}),...(s?.lastError !== undefined ? { lastError: s.lastError } : {}),+ ...(s?.note !== undefined ? { note: s.note } : {}),attemptsCount: s?.attempts?.length ?? 0,zipPath: zipPathForId(dir, scanned.id),retryable: scanned.zipExists && state !== 'sent' && state !== 'uploading',@@ -577,6 +578,7 @@ export function createBugReportSidecarStore(opts: {state: 'generated',systemWide: meta.systemWide,projectSlug: meta.projectSlug,+ ...(meta.note !== undefined ? { note: meta.note } : {}),};try {await writeReportSidecar(dir, sidecar);diff --git a/packages/desktop/src/main/ipc/bug-report.test.ts b/packages/desktop/src/main/ipc/bug-report.test.tsindex cec4502ec..f8fb9766a 100644--- a/packages/desktop/src/main/ipc/bug-report.test.ts+++ b/packages/desktop/src/main/ipc/bug-report.test.ts@@ -2614,6 +2614,233 @@ describe('bug-report sidecar wiring — create writes the record, send tracks stexpect(sidecar?.zipBytes).toBe(result.zipSizeBytes);});+ test('a create with a note persists that note in the sidecar', async () => {+ const { dir, createDeps } = makeSidecarRig();++ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note: 'The editor froze after I pasted a large table',+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar?.note).toBe('The editor froze after I pasted a large table');+ });++ test('a multi-line note is persisted whole, matching the copy inside the zip', async () => {+ const { dir, createDeps, zipPath } = makeSidecarRig();+ const note = 'Sync hung on a large repo\n\nSteps:\n1. open the project\n2. wait';++ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note,+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar?.note).toBe(note);+ expect(readZipEntry(zipPath, 'note.txt')).toContain(note);+ });++ test('a create with no note writes a sidecar carrying no note key', async () => {+ const { dir, createDeps } = makeSidecarRig();++ const result = await handleBugReportCreate(createDeps, { kind: 'create', level: 'standard' });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar).not.toBeNull();+ expect(sidecar && 'note' in sidecar).toBe(false);+ });++ test('an empty note is stored as no note rather than an empty one', async () => {+ const { dir, createDeps } = makeSidecarRig();++ // The compose dialog collapses an untouched textarea to `undefined`, but+ // the IPC boundary accepts `''` from any renderer, and an empty stored note+ // would read as "has a note" to the list.+ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note: '',+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar).not.toBeNull();+ expect(sidecar && 'note' in sidecar).toBe(false);+ });++ test('a sidecar-persist failure never turns a successful create into a failure', async () => {+ const { dir, createDeps } = makeSidecarRig();++ // Every other test in this block passes the real recordGenerated, which+ // swallows its own write errors, so nothing otherwise enters the guard that+ // exists for this case: the zip is already on disk, and reporting the+ // create as failed would send the user back to make a duplicate.+ const result = await handleBugReportCreate(+ { ...createDeps, onReportGenerated: () => Promise.reject(new Error('disk full')) },+ { kind: 'create', level: 'standard', note: 'the editor froze' },+ );++ expect(result.ok).toBe(true);+ // No sidecar landed, and that is the accepted cost — the report itself did.+ expect(await readReportSidecar(sidecarPathForId(dir, REPORT_ID))).toBeNull();+ });++ test('a whitespace-only note is stored as no note', async () => {+ const { dir, createDeps } = makeSidecarRig();++ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note: ' \n\t ',+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ // The row would title itself by the fallback either way, but a stored blank+ // still reads as "has a note", so a retry would send whitespace to the+ // intake as the reporter's own words.+ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar).not.toBeNull();+ expect(sidecar && 'note' in sidecar).toBe(false);+ });++ test('a note of only control characters is stored as no note', async () => {+ const { dir, createDeps } = makeSidecarRig();++ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note: '\u0001\u0002\u0007',+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ // The renderer maps a control character to a space before deciding a line+ // is empty, so it derives no title from this. If the writer disagreed and+ // stored it, the row would fall back while the sidecar claimed a note and+ // a retry would put the controls on the wire.+ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar).not.toBeNull();+ expect(sidecar && 'note' in sidecar).toBe(false);+ });++ test('a note of only invisible characters is stored as no note', async () => {+ const { dir, createDeps } = makeSidecarRig();++ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note: '\u200B\uFEFF\u202E',+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ // trim() does not see zero-width or bidi-control characters, so this is the+ // case that made the writer and the renderer disagree: the row derived no+ // title while the sidecar still claimed to hold a note, and a retry put it+ // on the wire as the reporter's words.+ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar).not.toBeNull();+ expect(sidecar && 'note' in sidecar).toBe(false);+ });++ test('a clamp landing on a complete astral pair keeps the pair whole', async () => {+ const { dir, createDeps } = makeSidecarRig();+ // Mirror of the orphaned-high-surrogate case: sized so the emoji ends+ // exactly ON the cut rather than straddling it, which leaves a LOW+ // surrogate as the final code unit. Widening the guard past 0xdbff would+ // amputate this complete pair.+ const filler = 'x'.repeat(32_768 - '://[REDACTED]@'.length - 2);+ const note = `://a:b@${filler}\u{1F600}${'y'.repeat(7)}`;+ expect(note.length).toBe(32_768);++ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note,+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ const stored = (await readReportSidecar(sidecarPathForId(dir, REPORT_ID)))?.note;+ expect(stored?.length).toBe(32_768);+ expect(stored?.endsWith('\u{1F600}')).toBe(true);+ });++ test('a secret typed into the note is redacted in the persisted sidecar', async () => {+ const { dir, createDeps } = makeSidecarRig();+ const secret = 'sk-ant-api03-abcdefghijklmnopqrstuvwx';++ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note: `auth broke with ${secret} in the header`,+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar?.note).toBe('auth broke with [REDACTED-ANTHROPIC] in the header');+ // Nothing on the durable path may carry the raw secret, YAML included.+ const raw = readFileSync(sidecarPathForId(dir, REPORT_ID), 'utf-8');+ expect(raw).not.toContain(secret);+ });++ test('a note that redaction lengthens but keeps under the ceiling is stored in full', async () => {+ const { dir, createDeps } = makeSidecarRig();+ // `://a:b@` expands to `://[REDACTED]@`, so the stored copy is LONGER than+ // what create accepted — proof the clamp does not fire early.+ const note = `db at postgres://a:b@localhost timed out`;++ const result = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note,+ });+ if (!result.ok) throw new Error(`expected ok, got: ${result.error}`);++ const sidecar = await readReportSidecar(sidecarPathForId(dir, REPORT_ID));+ expect(sidecar?.note).toBe('db at postgres://[REDACTED]@localhost timed out');+ expect(sidecar?.note?.length).toBeGreaterThan(note.length);+ });++ test('a ceiling-length note that redaction lengthens stays sendable on a later retry', async () => {+ const { dir, store, createDeps, zipPath } = makeSidecarRig();+ // Sized so the scrub pushes the note past the ceiling and the cut lands+ // between the halves of an astral character: the credential grows by seven+ // code units, and the emoji straddles index MAX_NOTE_LENGTH - 1.+ const filler = 'x'.repeat(32_768 - '://a:b@'.length - 2 - 6);+ const note = `://a:b@${filler}\u{1F600}${'y'.repeat(6)}`;+ // Exactly at the ceiling create enforces, so create still accepts it.+ expect(note.length).toBe(32_768);++ const created = await handleBugReportCreate(createDeps, {+ kind: 'create',+ level: 'standard',+ note,+ });+ if (!created.ok) throw new Error(`expected ok, got: ${created.error}`);++ // Clamped at the ceiling with the orphaned high surrogate dropped, so the+ // stored copy ends on the filler rather than half an emoji.+ const stored = (await readReportSidecar(sidecarPathForId(dir, REPORT_ID)))?.note;+ expect(stored).toBe(`://[REDACTED]@${filler}`);++ // The property that matters: send re-validates the note against the same+ // ceiling, so an over-long stored copy would make every retry unsendable.+ const stub = await startIntakeStub();+ const sent = await handleBugReportSend(+ { ...makeSendDeps(stub.url, dir), sidecar: store.sendHooks },+ {+ kind: 'send',+ zipPath,+ metadata: { ...SEND_METADATA, note: stored },+ },+ );++ expect(sent).toEqual({ ok: true, reference: 'OK-1042' });+ });+test('a successful send flips the sidecar to sent + reference and reclaims the zip', async () => {const { dir, store, createDeps, zipPath } = makeSidecarRig();await handleBugReportCreate(createDeps, { kind: 'create', level: 'standard' });diff --git a/packages/desktop/src/main/ipc/bug-report.ts b/packages/desktop/src/main/ipc/bug-report.tsindex fbdba078e..96aecf581 100644--- a/packages/desktop/src/main/ipc/bug-report.ts+++ b/packages/desktop/src/main/ipc/bug-report.ts@@ -29,6 +29,8 @@ import {} from '@inkeep/open-knowledge';import {BUG_REPORT_SCREENSHOT_ZIP_NAME,+ clampToCodeUnits,+ isBlankNoteContent,isReportIdShape,type OkBugReportCrashAckResult,type OkBugReportCrashDumpAvailability,@@ -216,6 +218,29 @@ function isValidNote(note: unknown): boolean {return note === undefined || (typeof note === 'string' && note.length <= MAX_NOTE_LENGTH);}+/**+ * Post-scrub copy of the create request's note for the durable sidecar record.+ *+ * Scrub before clamp, never the reverse: redaction can lengthen text (a URL+ * credential expands to `://[REDACTED]@`), so a note that arrived at the+ * ceiling can leave the scrub over it. The ceiling bites on the way back out+ * too — `isSendRequest` re-runs {@link isValidNote} on a retry's metadata — so+ * an unclamped copy would make every future retry of that report fail send+ * validation. Clamping by UTF-16 code units matches what that check counts,+ * and a cut landing between a surrogate pair drops the orphaned high half+ * rather than storing a lone surrogate that renders as a replacement glyph.+ */+function scrubNoteForSidecar(note: string | undefined): string | undefined {+ // Nothing visible counts as absent, using the same predicate the renderer+ // titles rows with. The row would fall back correctly either way, but a+ // stored blank is still a note as far as the row is concerned, so a later+ // retry would put meaningless whitespace on the wire as the reporter's+ // words. Whitespace alone is not the whole test: trim does not see+ // zero-width or bidi-control characters.+ if (note === undefined || isBlankNoteContent(note)) return undefined;+ return clampToCodeUnits(redactContent(note).redacted, MAX_NOTE_LENGTH);+}+/*** `createHandler` casts renderer args without runtime enforcement, so the* payload is re-validated here before any filesystem work.@@ -475,13 +500,22 @@ export async function handleBugReportCreate(// and the call is guarded, so create still succeeds if the sidecar can't be// written.if (deps.onReportGenerated) {- await deps- .onReportGenerated({- zipPath,- zipBytes: zipSizeBytes,- level: request.level,- systemWide: summary.systemWide,- projectSlug: summary.projectSlug,+ const persist = deps.onReportGenerated;+ // The scrub runs INSIDE the guarded chain, not ahead of it. Called+ // outside, a throw would escape to the handler's own catch and report the+ // create as failed to someone whose zip is already on disk, which is the+ // one outcome the guard exists to prevent.+ await Promise.resolve()+ .then(() => {+ const sidecarNote = scrubNoteForSidecar(request.note);+ return persist({+ zipPath,+ zipBytes: zipSizeBytes,+ level: request.level,+ systemWide: summary.systemWide,+ projectSlug: summary.projectSlug,+ ...(sidecarNote !== undefined ? { note: sidecarNote } : {}),+ });}).catch((err: unknown) => {deps.logger?.warn(@@ -846,6 +880,12 @@ export interface GeneratedReportMeta {level: ReportBundleLevel;systemWide: boolean;projectSlug: string | null;+ /**+ * The reporter's composed note, already scrubbed and clamped for durable+ * storage — unlike the create request's raw note, which the bundle collector+ * scrubs on its own way into the zip.+ */+ note?: string;}/**@@ -1492,8 +1532,9 @@ export async function handleBugReportSend(};}// The compose UI promises automatic secret redaction. The note inside the- // zip is scrubbed by the bundle collector; these are the two copies that- // travel OUTSIDE the zip (upload metadata JSON, mailto body), so they get+ // zip is scrubbed by the bundle collector; these are two of the three copies+ // that travel OUTSIDE the zip (upload metadata JSON, mailto body — the third+ // is the sidecar record, scrubbed at generation time), so they get// the same scrub. Only the note — the zipPath line must stay verbatim so// the user can find the file to attach.const scrubbedNote =