refactor(desktop): classify electron exports#10266
Electron modules had 15 unclassified runtime exports. This marks ten canonical Effect service constructors as intentional public APIs, narrows four protocol implementation exports, and removes one unused safe-storage predicate without changing the exported error schema.
This is layer 2 of 5 in the desktop Knip cleanup stack.
Verification after the full stack: desktop typecheck; desktop Knip export audit; 831 desktop tests; changed-file lint and format checks. The native libsecret test cannot start on this machine because the system libsecret-1 development package is unavailable.
Model: gpt-6 astra. Harness: Codex in T3 Code.
Note
Make electron helper functions and constants private across desktop modules
- Changes
PRODUCTION_SCHEME,DEVELOPMENT_SCHEME,getDesktopOrigin, andregisterDesktopSchemePrivilegesSyncin ElectronProtocol.ts from named exports to module-private bindings. - Removes the
isElectronSafeStorageErrornamed export from ElectronSafeStorage.ts. - Adds public API documentation comments to the
makeservice construction export across all electron service modules. - Behavioral Change:
isElectronSafeStorageError, the protocol scheme constants,getDesktopOrigin, andregisterDesktopSchemePrivilegesSyncare no longer importable from their modules; any out-of-tree consumers must update.
Macroscope summarized bf20c62.
Summary by CodeRabbit
- Documentation
- Added public API documentation for desktop service construction APIs.
- Clarified canonical entry points for Electron services.
- Refactor
- Restricted visibility of internal desktop protocol helpers and constants.
- Removed an internal safe-storage error predicate from the public API.
Approvability
Verdict: Approved at eca58d0
Macroscope's review found this PR approvable β This is a narrowly scoped Electron export cleanup: service construction remains intact, internal protocol helpers are no longer exported, and an unused safe-storage guard is removed. The diff does not change request-path behavior, product defaults, schemas, or production workflows.
No code changes detected at bf20c62. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
Thread transfer impact
β Thread transfer remains within every enforced ceiling.
βΉοΈ No successful
mainbaseline artifact is available yet. This run establishes the initial measurement.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | β | 13.6 KiB | β | 15.1 KiB | β |
| Codex | Thread snapshot wire | β | 7.0 KiB | β | 7.3 KiB | β |
| Codex | Live turn WebSocket wire | β | 6.6 KiB | β | 7.8 KiB | β |
| Codex | Live turn WebSocket decoded | β | 57.1 KiB | β | 66.4 KiB | β |
| Codex | Live turn messages | β | 10 | β | 21 | β |
| Claude | Total thread wire | β | 13.5 KiB | β | 15.1 KiB | β |
| Claude | Thread snapshot wire | β | 7.0 KiB | β | 7.3 KiB | β |
| Claude | Live turn WebSocket wire | β | 6.5 KiB | β | 7.8 KiB | β |
| Claude | Live turn WebSocket decoded | β | 57.8 KiB | β | 66.4 KiB | β |
| Claude | Live turn messages | β | 8 | β | 21 | β |
Baseline: unavailable Β· PR result: bf20c62 Β· Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 113.9 KiB
- Claude decoded thread snapshot: 114.6 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
The same change (export const make β const make) is applied in nine other service modules in this PR: ElectronDialog.ts, ElectronMenu.ts, ElectronPowerMonitor.ts, ElectronProtocol.ts, ElectronSafeStorage.ts, ElectronShell.ts, ElectronTheme.ts, ElectronUpdater.ts, ElectronWindow.ts. The inline note below applies to each of them. The other unexports in this PR (DESKTOP_PRODUCTION_SCHEME, DESKTOP_DEVELOPMENT_SCHEME, getDesktopOrigin, registerDesktopSchemePrivilegesSync) are module-local pure helpers, not part of a service's public shape, so narrowing those looks correct.
Posted via Macroscope β Effect Service Conventions
| β¦ | β¦ | @@ -98,7 +98,7 @@ const addScopedAppListener = <Args extends ReadonlyArray<unknown>>( | |
| 99 | 99 | ).pipe(Effect.asVoid); | |
| 100 | 100 | ||
| 101 | - | export const make = ElectronApp.of({ | |
| 101 | + | const make = ElectronApp.of({ | |
electron/ElectronApp.ts:101
make is part of the canonical public shape of a service module that owns construction (Foo.Foo, Foo.make, Foo.layer), so consider keeping it exported even though only the local layer consumes it today β that is what packages/client-runtime/src/connection/driver.ts does, where the unused-export lint is silenced with a tag comment (/** @public Service construction is part of the canonical Effect module API. */) rather than by dropping export.
| 1 | export const make = ElectronApp.of({ |
No longer relevant as of eca58d022256cf5584ba343ff8925a02aecc00bb
Added 1 commit
- refactor(desktop): keep electron helpers privatebf20c62
No actionable comments were generated in the recent review. π
βΉοΈ Recent review info
βοΈ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Team
Run ID: a750c205-3c45-4e63-bc05-f571da6a19aa
π₯ Commits
Reviewing files that changed from the base of the PR and between fe8fffac36e33a6872351f261b8d21745b409df2 and bf20c623db759b3d1f960d3250dacadb6cf348cf.
π Files selected for processing (10)
apps/desktop/src/electron/ElectronApp.tsapps/desktop/src/electron/ElectronDialog.tsapps/desktop/src/electron/ElectronMenu.tsapps/desktop/src/electron/ElectronPowerMonitor.tsapps/desktop/src/electron/ElectronProtocol.tsapps/desktop/src/electron/ElectronSafeStorage.tsapps/desktop/src/electron/ElectronShell.tsapps/desktop/src/electron/ElectronTheme.tsapps/desktop/src/electron/ElectronUpdater.tsapps/desktop/src/electron/ElectronWindow.ts
Included review availability: 7 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.
π Walkthrough
Walkthrough
The change documents Electron service constructors as public Effect APIs. It also makes selected protocol helpers module-private and removes the exported safe-storage error predicate.
Changes
Electron API surface cleanup
| Layer / File(s) | Summary |
|---|---|
Document Electron service constructors apps/desktop/src/electron/ElectronApp.ts, ElectronDialog.ts, ElectronMenu.ts, ElectronPowerMonitor.ts, ElectronProtocol.ts, ElectronSafeStorage.ts, ElectronShell.ts, ElectronTheme.ts, ElectronUpdater.ts, ElectronWindow.ts | Public API documentation comments were added to the Electron service constructors. |
Restrict internal Electron helpers apps/desktop/src/electron/ElectronProtocol.ts, ElectronSafeStorage.ts | Selected Electron protocol declarations and isElectronSafeStorageError are no longer exported. |
Estimated code review effort: 1 (Trivial) | ~5 minutes
Merge Risk: βͺ Minimal Β· up to bf20c
This change clarifies the Electron service API surface and removes internal or unused exports. No current merge-readiness risk remains.
π₯ Pre-merge checks | β 4 | β 1
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 10 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
β Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Linked Issues check | β Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | β Passed | Check skipped because no linked issues were found for this pull request. |
| Title check | β Passed | The title clearly summarizes the main change: refactoring and classifying Electron exports. |
| Description check | β Passed | The description explains the export changes, rationale, scope, verification, and known test limitation. It does not use the template headings or checklist, but it is mostly complete and directly relatβ¦ |
- Fix all pre-merge checks with AI
β¨ Finishing Touches π‘ 1
π Generate docstrings π‘
- Create stacked PR
- Commit on current branch
π§ͺ Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
cleanup-desktop/electron-helpers
Comment @coderabbitai help to get the list of available commands.