refactor(desktop): classify preview exports#10268
Preview and browser-import modules had ten unclassified runtime exports. This marks three canonical Effect service constructors as intentional public APIs, narrows six local implementation values, and removes one unused PreviewManager predicate while retaining exported schemas and types.
This is layer 4 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.
Summary by CodeRabbit
Documentation
- Added documentation comments to public preview service constructors, improving API reference clarity.
Refactor
- Streamlined the preview module’s public API by keeping internal favicon, picture-in-picture, and error-handling helpers private.
- No user-facing functionality or behavior was changed.
Approvability
Verdict: Approved at 97ae73e
Macroscope's review found this PR approvable — The PR only narrows internal preview module exports and documents retained Effect service constructors; helper implementations, constants, defaults, and runtime behavior remain unchanged. No product defaults or static-analysis suppressions are introduced, and no repository consumers of the removed exports were found.
No code changes detected at 3dc5b7c. 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.5 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: 3dc5b7c · 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.
Added 1 commit
- refactor(desktop): keep preview helpers private3dc5b7c
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: 87e721e3-104c-4d41-a00d-07d569484ba2
📥 Commits
Reviewing files that changed from the base of the PR and between 4c6bb9a0b545be177647d1d38a9fbc98c797492b and 3dc5b7c12bb3aad2e0fd16114f9a51ab22a3058f.
📒 Files selected for processing (4)
apps/desktop/src/preview/BrowserImport/BrowserImport.tsapps/desktop/src/preview/BrowserSession.tsapps/desktop/src/preview/FaviconCapture.tsapps/desktop/src/preview/Manager.ts
Included review availability: 6 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 preview modules now document canonical service constructors and restrict internal constants, data builders, and error type guards to module scope.
Changes
Preview API surface cleanup
| Layer / File(s) | Summary |
|---|---|
Document public service constructors apps/desktop/src/preview/BrowserImport/BrowserImport.ts, apps/desktop/src/preview/BrowserSession.ts, apps/desktop/src/preview/Manager.ts | Public API comments identify the make service constructors as part of the canonical Effect module API. |
Restrict internal preview helpers apps/desktop/src/preview/FaviconCapture.ts, apps/desktop/src/preview/Manager.ts | The favicon URL limit, picture-in-picture data URL builder, and preview error type guards are no longer exported. |
Estimated code review effort: 1 (Trivial) | ~5 minutes
Merge Risk: ⚪ Minimal · up to 3dc5b
Desktop preview modules now clarify the public service constructors and keep internal helpers private without changing runtime behavior. No merge-blocking risk remains.
Suggested reviewers: chrisdeeming, stienswout
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4… |
| 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 identifies the main change: classifying preview exports in the desktop application. |
| Description check | ✅ Passed | The description explains the export classification changes, the cleanup context, verification steps, and the unavailable libsecret test. It does not use the template headings or checklist, but it cont… |
✨ Finishing Touches
📝 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/preview-helpers
Comment @coderabbitai help to get the list of available commands.