Skip to content

fix(editor): explain refused Markdown document indexes once - #25660

Open
nwparker wants to merge 1 commit into
nwparker/editor-markdown-document-retentionfrom
nwparker/editor-markdown-capacity-notice
Open

nwparker wants to merge 1 commit into
nwparker/editor-markdown-document-retentionfrom
nwparker/editor-markdown-capacity-notice

Conversation

@nwparker

@nwparker nwparker commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​290 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​290
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​51 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​49

ELI5

When a workspace exceeds the existing Markdown document-listing limit, link completion returns no candidates. The editor now explains why with one notice instead of failing silently. Editing and Save continue to work.

What Changed

Reuse the existing capacity error code, error-message extractor, and Sonner notice. Electron sends a named error as text and drops its custom code, so the extractor also recognizes that exact named-error wrapper. Runtime errors retain their existing checked code path. Other listing failures receive no new capacity notice. The shared extractor also removes named-error prefixes from IPC wrappers for its other callers, so they display the underlying message.

Only the latest request for the committed workspace can show the notice. Repeated failed refreshes do not repeat it; an admitted refresh or committed workspace change permits a later capacity notice. Split panes use the same notice ID. No budget, execution owner, cache, RPC field, or library changes.

Five production paths: 51 additions / 2 deletions, net 49 lines (43 code and 6 locale lines). Two test files add 290 lines. Stacked on #25631 for its existing current-workspace request guards; #25648 is the separate local producer limit tested in the combined app.

Why

Reuse the error emitted by the existing listing budget rather than add another error category or accept a partial index. Exact Electron 43.7.5 dispatch calls error.toString(), and the renderer creates a new Error. The real app check confirms the class-prefixed text and absent code; synthetic runtime-code tests alone would miss that boundary.

The existing committed-request guards also protect stale Save refreshes. Their lifecycle follows React Suspense caveats and the locally checked React 19.2.8 source: hiding layout effects does not make a current request stale. No library internals are overridden.

Linked Issue

Related capacity/freeze investigations: #10990 and #10179. Keep them open: the remote provider's full traversal, native IME, and unrelated freezes are outside this notice change. Credit @nw and @neil for the investigations informing the existing listing limits; no contributor implementation is copied here.

Visual Proof

Before: no explanation after capacity refusal After: one useful notice
Before: capacity failure leaves no link explanation After: capacity notice while editing remains available

The before capture uses the bounded producer at 36c267e8e917 with its unchanged silent renderer. The after capture uses the combined build at 631c10e6a658, whose two notice implementation files are byte-identical to this PR's 85b73f872cb0 head. Both invoke the real local listing IPC over 20,001 owned Markdown files in a registered non-Git folder project. These are separate hidden Linux apps on Xvfb, not a single-change before/after build pair.

Testing

  • 55 focused tests in 5 suites: exact Electron/runtime error shapes; ordinary errors; repeat refreshes; successful and failed Save; superseded requests; owner changes; unmount; Suspense; discarded renders; Strict Mode; split-pane notice IDs.
  • Full macOS node/web/CLI typechecks, full lint, changed-code quality, and standalone React Doctor 0.9.14 pass at this exact head.
  • Fresh macOS and Linux combined Electron builds and typechecks pass. The exact combined freeze passes 4,061 tests on macOS and 4,062 on Linux in 456 suites, with existing skips stated in the review packet. It also passes 28 hidden integration checks on each OS in 17 specs.
  • Actual Linux Electron 43.7.5 IPC returns the named capacity error without its code. The real Rich Editor shows one notice; five actual Ctrl+S saves during refusal persist correctly without duplicate notices. Removing the owned excess files and saving admits the two-file index; restoring excess files and saving shows one later notice. All eight phases preserve the active workspace/file owner and saved bytes. Windows remain hidden; apps and owned fixtures are cleaned; no renderer errors.

Run ORCA_BACKGROUND_LAUNCH=1 pnpm test src/renderer/src/components/editor/rich-markdown-ipc-error-message.test.ts src/renderer/src/components/editor/useMarkdownDocuments.capacity-notice.test.tsx src/renderer/src/components/editor/useMarkdownDocuments.navigation.test.ts src/renderer/src/components/editor/useMarkdownDocuments.test.ts src/shared/markdown-document-listing-limits.test.ts.

Review

Independent source review found no introduced blocker. Risk is low for the notice scope. Actual product sources, Electron serialization, React request lifetimes, stale-owner controls, save recovery, and existing runtime error handling were checked.

The notice does not make the remote provider's traversal bounded. The existing limit estimates retained objects rather than guarantee an RSS ceiling. Native Windows, physical mobile, live SSH execution UI, and group-backed folder document indexes were not exercised by this notice check; the real non-Git folder-project catalog and local execution owner were asserted.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer source is copied.

Notes

Users receive one error notice when the entire index is refused. Link candidates remain unavailable until a successful refresh; this change does not reduce that existing trade-off. Dismissing the notice does not rearm it until an admitted refresh or committed workspace change. Ordinary permission, disconnect, and differently coded errors receive no new capacity notice. English and Chinese translations are included.

Checklist

  • Small production change; tests and stacked dependencies counted separately.
  • Before/after behavior, mechanism, and approach explained.
  • Real IPC, rendered Save/recovery, and hidden-window scope verified.
  • Source, correctness, stale requests, and notice deduplication independently reviewed.
  • Cross-platform, folder-project, and SSH limits stated.
  • Relevant tests, typechecks, lint, quality checks, and fresh composed builds pass.

@nwparker
nwparker requested a review from brennanb2025 as a code owner October 5, 2026 18:58

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Capacity notice — useMarkdownDocuments shows one Sonner notice when a Markdown document listing is refused for capacity, deduped per committed workspace and rearmed only by a successful refresh or a documentRequestKey change.
  • Error classification — new isMarkdownDocumentCapacityError recognizes the local code shape, the Electron IPC wrapper, and the paired runtime_error shape; extractIpcErrorMessage now strips class-name prefixes.
  • i18n / shared constant — editor.markdownLinks.capacity added to en and zh (other locales fall back to the translate default), and MARKDOWN_DOCUMENT_LISTING_ERROR_MESSAGE is exported.
  • Tests — unit coverage for the classification shapes plus a hook-level suite for the notice lifecycle (repeat saves, rearm, superseded/unmount/owner-change, Suspense, StrictMode, split panes).

ℹ️ Remote capacity errors classify by message, not the machine code

For paired/remote hosts, mapRuntimeError flattens MarkdownDocumentListingCapacityError to runtime_error because markdown_document_listing_capacity is not in STRUCTURED_RUNTIME_PASSTHROUGH_CODES, so the remote notice is matched by exact equality with MARKDOWN_DOCUMENT_LISTING_ERROR_MESSAGE. The tests pin that shape and it works today, but the remote notice would silently stop firing if that message string is ever edited while the code token is not. No change needed for this PR — noting the coupling for future edits.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant