Skip to content

feat(documents): open CSV and TSV files from the OS - #24756

Merged
nwparker merged 3 commits into
mainfrom
nwparker/sweep-23225-csv-os-open
Oct 3, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/sweep-23225-csv-os-open

Conversation

@nwparker

@nwparker nwparker commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Choose Orca in your file manager’s Open With menu for a CSV or TSV export, and see it as a table in the floating workspace.

What Changed

Before, Orca only registered Markdown files and ignored CSV/TSV paths supplied by the OS. This adds CSV/TSV to the same local document queue and file-tab opener, which already selects the table viewer. macOS uses Alternate, Linux adds the existing CSV/TSV MIME types, and Windows uses the existing additive Open With registration and uninstall mechanism. None changes the default app.

The renderer now leaves requests in that queue until saved tabs finish restoring. A hidden cold-start check exposed that restoration could erase a tab opened too early; I rebuilt the untouched baseline and reproduced that with Markdown before changing the timing. The 32-file queue limit, dedupe, existing file authorization, and Markdown-only discovery remain in place.

Why

The viewer already exists. Extending the shared entry point keeps startup and already-running behavior together, with the same file validation and limits, instead of introducing another CSV launch path or a default-handler takeover.

Linked Issue

Fixes #23225

Visual Proof

macOS, disposable profiles and files, rebuilt app, hidden renderer screenshots throughout. These prove delivery and rendered content; they do not prove native Finder/Explorer installation registration.

Before: launch with CSV opens no file After: one CSV tab in Table view, with actual cells
Before CSV After CSV

Already-running CSV and TSV delivery:

Warm CSV table

Warm TSV table

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Reproduce the acceptance checks with:

ORCA_BACKGROUND_LAUNCH=1 pnpm exec electron-vite build --mode e2e
ORCA_BACKGROUND_LAUNCH=1 SKIP_BUILD=1 pnpm run test:e2e tests/e2e/os-opened-documents.spec.ts --workers=1

All three Markdown/CSV/TSV cases pass on macOS with no project required. Each starts with real argv paths plus a file URL, then delivers warm second-instance and open-file events through Electron’s handlers. Assertions check actual table cells or Markdown headings, one tab per file, denied reads for an unsupported sibling file, and every native window hidden and unfocused.

Scoped regression checks cover Windows drive/UNC paths and file URLs, malformed and relative inputs, dedupe, queue overflow, missing files/directories, authorization, Markdown discovery, renderer bridge cleanup, and all three platforms’ additive association declarations. Current pnpm tc, formatting, changed-code-quality and localization checks pass. The preserved feature source has passed hidden cold/warm acceptance for Markdown, CSV and TSV on the preceding independently reviewed head. After bringing in the existing main fix for stale package-list contract checks (#24785), the current head 0bf39c52ed3005f325f75daf17534351e98b216d passes 194 scoped tests across 17 files, full production typecheck, formatting, changed-code-quality and localization checks. All 27 feature paths, all 26 content blobs, and the full feature diff are byte-for-byte identical to that reviewed head; original commits remain in history. Required CI on this exact published head passes: repository guards and final verify are SUCCESS. The changed E2E specs and both package jobs also pass; there are no pending or failed check contexts. This does not prove native file-manager registration. The prior Windows job timed out in an unchanged missing-hook test before packaging; a source-equivalent named-main control passed that case, and the new-head Windows job passes without a timeout or workflow workaround.

AI Disclosure

Review

Independent read-only review found no actionable issues on exact head bac18bd849fcf8d935db82cca991fd3d7b25ba5f against adf447d958b2e7eb9c85b0e9b12f634683c4ecbf. The reviewer passed 73 feature tests on the preceding head, confirmed those source changes are identical, and independently passed 36 localization tests plus the catalog verifier on this head. The prior local regression suite passed 131 tests across 15 files. The current main-integration head preserves the exact reviewed patch (SHA-256 6ab65d18ea3396d16fc25fc9c2d29966f785815bcd3555b149017ecdc8b0c8ce) against named main 5706d144b71fa09e23caf95c4f558901a45b9843; this is verified source equivalence to the genuine review, not a new independent review claim.

Automatic CodeRabbit review on the preceding b1a8c0cb3f60 head reported no actionable code findings. Its unrelated localization scope warning is addressed in this revision; the docstring coverage advisory is explained under the repository’s concise-comments rule. Pullfrog reviewed the preceding bac18bd feature head, all 27 files and both commits, and found no new issues. Its optional leftover localization-key observation is explicitly harmless under the verifier. Current-head required CI passes; the bot reviews themselves remain tied to the explicit earlier heads above.

Requested by @momokun7; this reuses the Markdown OS-open flow from #10138. I compared recent contributor PRs #19894 by @kbsali (CSV delimiters) and #21125 by @BearMett (editor restoration records): neither adds OS entry points. No contributor commits were taken over, so no co-author trailer is claimed.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied or translated.

Notes

Merge risk: document associations and startup delivery. Regression checks preserve the Windows daemon uninstall guard and existing handler registrations. This is local desktop behavior; remote execution and wire contracts are untouched, and files remain pinned to this machine even when another runtime is selected.

Negative user-facing tradeoff: OS files now wait for normal session restoration during cold start, so slow restoration can delay the tab. No new setting, default-app change, or file-access expansion is introduced.

Validation gaps: the optional standalone E2E typecheck encounters pre-existing conflicting Window.__paneManagers declarations; production pnpm tc and rendered E2E checks pass. Native Finder/Explorer registration, Windows installer execution, Linux desktop installation, and native file-manager actions were not exercised. Cross-platform path and declared packaging behavior are covered by automated contracts, not a native installation claim. CodeRabbit’s automatic review covers the preceding head; fresh current-head review is subject to the coordinator’s shared quota slot, with no autonomous retry requested.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, user-facing before/after, mechanism, and why over alternatives)
  • Before/after screenshots attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path impact considered
  • Required published-head PR Checks guard and final verify both succeed (exact head 0bf39c52ed3005f325f75daf17534351e98b216d; local checks pass)

@nwparker
nwparker requested a review from brennanb2025 as a code owner October 2, 2026 11:47
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 2ecb5cb7-cb3e-4503-8dc5-bcf044784d4f

📥 Commits

Reviewing files that changed from the base of the PR and between adf447d and b1a8c0c.

📒 Files selected for processing (27)
  • config/electron-builder.config.cjs
  • config/nsis/orca-installer-hooks.nsh
  • config/scripts/electron-builder-markdown-associations.test.mjs
  • src/main/index.ts
  • src/main/ipc/markdown-documents-ripgrep-real.test.ts
  • src/main/ipc/markdown-documents.ts
  • src/main/startup/main-process-ipc-bootstrap.ts
  • src/main/startup/main-process-state.ts
  • src/main/startup/main-window-controller.ts
  • src/main/startup/os-opened-document-arguments.test.ts
  • src/main/startup/os-opened-document-delivery.test.ts
  • src/main/startup/os-opened-document-resolution.test.ts
  • src/main/startup/os-opened-document-wiring.test.ts
  • src/main/startup/os-opened-documents.test.ts
  • src/main/startup/os-opened-documents.ts
  • src/main/startup/os-opened-markdown-files.test.ts
  • src/preload/api/ui-command-event-api.ts
  • src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts
  • src/renderer/src/hooks/ipc-events/os-markdown-file-open-bridge.test.ts
  • src/renderer/src/hooks/ipc-events/os-markdown-file-open-bridge.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/open-document-in-floating-workspace.test.ts
  • src/renderer/src/lib/open-document-in-floating-workspace.ts
  • src/shared/filesystem-entry-types.ts
  • tests/e2e/helpers/orca-restart.ts
  • tests/e2e/os-opened-documents.spec.ts
💤 Files with no reviewable changes (1)
  • src/main/startup/os-opened-markdown-files.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

OS-open handling now accepts Markdown, CSV, and TSV documents. The main process parses and resolves supported paths, then delivers resolved documents to the renderer, which opens them in the floating workspace after workspace-session readiness. macOS, Linux, and Windows installer associations now include CSV and TSV. Tests cover path handling, delivery, platform associations, and end-to-end OS-open flows.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to b1a8c

CSV and TSV OS-open support is ready for normal CI and platform validation; no established issue currently blocks merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b1a8c

The added formats retain the existing file checks, bounded queue, and local workspace opening behavior. Table cells are displayed as text rather than executed. No introduced security weakness was demonstrated, but native installation behavior and some caller-identity and recovery paths remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The added exposure is CSV/TSV content and paths supplied through desktop OS-open requests, within the filesystem authority of the running application. The inspected opening path does not delegate these documents to an active remote runtime.

Security Findings and Attack Paths

  • inferred — For the inspected attack path from an attacker-influenced CSV/TSV file to table display, file validation and authorization precede delivery, and cell content remains inert text. This evidence does not establish a content-execution vulnerability.

Trust Boundaries and Controls

  • observed — External-file authorization remains a main-process responsibility before document metadata crosses into the renderer. The pending-open handler consumes only the existing queue and accepts no path argument, but does not explicitly check caller identity. That omission already existed in the base implementation; application-wide sender enforcement remains unverified.

Resilience and Maintainability Implications

  • observed — The new readiness gate leaves requests in main-process ownership while saved workspace tabs restore, reducing premature consumption. Capture deduplication and restoration caps are preserved; restore itself does not deduplicate against newly pending paths, a pre-existing limitation rather than a newly introduced guarantee.

Hardening Proposals

  • proposed — Explicitly bind pending-open consumption and readiness signalling to the intended application renderer. This would strengthen the existing caller-identity assumption; it is not an observed PR-introduced vulnerability.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.84% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 23 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The description includes an actionable issue reference, “Fixes #23225,” and the linked objective matches the pull request scope.
Out of Scope Changes check ✅ Passed The changes support the stated CSV/TSV OS-open objective, including document generalization, platform associations, startup delivery, tests, and related localization updates. No clearly unrelated func…
Title check ✅ Passed The title clearly identifies the primary change: enabling CSV and TSV files to open from OS file associations.
Description check ✅ Passed The description is complete and follows the repository template. It covers the user impact, implementation, rationale, linked issue, visual proof, testing, review, risks, validation gaps, and checklis…
Full details: Docstring Coverage

Explanation

Docstring coverage is 36.84% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 23 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

nwparker commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the localization scope warning in bac18bd849fcf8d935db82cca991fd3d7b25ba5f: the unrelated subagents.unnamed entry and status ordering are restored to the base. The runtime catalog now changes only for the existing Markdown error entry that became required when the generalized document error removed its literal call-site reference. Localization catalog/runtime verification passes; its safety contract explicitly allows unchanged extra entries.

The docstring-coverage warning is advisory. AGENTS.md requires concise comments explaining non-obvious reasoning and prohibits explaining obvious code. I kept comments aligned with that rule. Scoped feature and localization regression checks pass (131 tests across 15 files), along with the full typecheck and changed-code-quality gate.

@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

  • Packaging associations: macOS fileAssociations now generates Markdown + CSV/TSV entries, all role: Editor / rank: Alternate; Linux mimeTypes add text/csv and text/tab-separated-values; Windows NSIS generalizes to ORCA_REGISTER_DOCUMENT_* with a new Orca.Tabular ProgID, staying purely additive (OpenWithProgids/SupportedTypes only) with a symmetric uninstall. win.fileAssociations remains absent, preserving the "never claim the default handler" invariant.
  • Main process: os-opened-markdown-files.ts becomes os-opened-documents.ts; isOsOpenedDocumentName() = Markdown ∪ .csv/.tsv (case-insensitive); documentPathsFromArguments, OsOpenedDocumentState, and resolveOsOpenedDocuments replace their Markdown-named counterparts. resolveOsOpenedDocuments re-validates through the same argument filter before stat/authorizeExternalPath, so the authorization contract is unchanged. Buffer cap (32), dedupe, and restore semantics are preserved. IPC channel names and the MarkdownDocument type alias are retained for compatibility.
  • Renderer: openDocumentInFloatingWorkspace (language already resolves .csv/.tsv to their table languages). The OS-open bridge now defers both listener attachment and the pending pull until workspaceSessionReady, closing a cold-start race where startup tab restoration erased an early-opened tab. workspaceSessionReady flips during reconnectPersistedTerminals, which runs after hydrateEditorSession, so the gate outlasts editor hydration as intended.
  • Tests: unit coverage is split cleanly across arguments/resolution/delivery/wiring/documents, and the new tests/e2e/os-opened-documents.spec.ts asserts real table cells / Markdown headings on cold and warm delivery, one tab per file, denial of an unsupported sibling, and hidden/unfocused windows.

Verification

  • 44 main-process unit tests and 42 renderer/i18n tests pass on this head.
  • verify:localization-extraction, verify:localization-catalog, and verify:localization-runtime-catalog all exit 0.
  • No dangling references to any removed symbol remain; only the generated config/scripts/ci-shard-timings.json still names the renamed test files, with no functional effect.

The one non-actionable observation: verify:localization-runtime-catalog reports the now-orphaned auto.hooks.ipc.events.os.markdown.file.open.bridge.1e9a1a63c4 entry as "no longer required (harmless; sync to drop)" — running pnpm run sync:localization-runtime-catalog would prune it, but the check explicitly tolerates it.

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

@nwparker

nwparker commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Final merge review at 0bf39c52ed3005f325f75daf17534351e98b216d: the complete changed source matches the independently reviewed commit, and the documented required repository checks pass: detect changes and check repository guards, verify.

Extend existing OS document associations and delivery to CSV/TSV, preserving restoration and authorization.

Merge risk and retained limits: Low–moderate: OS file associations/startup queue; cold-start files wait for workspace restoration.

Contributor authors and existing co-author credit will be preserved explicitly in the squash commit.

@nwparker
nwparker merged commit 130b2ef into main Oct 3, 2026
45 checks passed
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.

[Feature]: Open CSV files from the OS (Finder / Explorer), like Markdown in #10138

1 participant