XS✔ ◾ Remove dead My Shaves portal IPC surface that leaked raw JSON (#454)#971
Open
tomek-i wants to merge 1 commit into
Open
XS✔ ◾ Remove dead My Shaves portal IPC surface that leaked raw JSON (#454)#971tomek-i wants to merge 1 commit into
tomek-i wants to merge 1 commit into
Conversation
The `portal:get-my-shaves` handler fetched the portal's /me/shaves endpoint and returned the raw parsed response as-is. It was superseded by #830, which moved the "My Shaves" page onto the local-DB-backed shave.getAll() with a proper table/card UI, but the old handler, its preload binding, IPC channel, and response types were never removed. Nothing in the current UI calls it, so it was unreachable dead code — exactly the kind of "unfinished feature exposed" surface reported in #454 (an older build's "My Shaves" button rendered this raw JSON instead of a formatted view). Removing it closes the gap for good so it can't be wired up again by mistake. Closes #454 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes an unused (“dead”) Portal IPC endpoint (portal:get-my-shaves) and its related types/IPC surface to prevent any accidental re-exposure of an unformatted raw JSON payload to the UI. It aligns the codebase with the current implementation where “Shaves” are sourced from the local DB (shave.getAll()) rather than the Portal /me/shaves response.
Changes:
- Removed the
PORTAL_GET_MY_SHAVESIPC channel constant and end-to-end wiring (handler + preload bridge). - Removed the now-unused
getMyShavestyping from the renderer IPC client surface. - Removed
ShaveItem/GetMyShavesResponsetypes from both backend and UI type re-exports.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/backend/ipc/channels.ts | Removes the unused PORTAL_GET_MY_SHAVES channel constant. |
| src/backend/ipc/portal-handlers.ts | Deletes the unused IPC handler (and its imports) that returned raw /me/shaves JSON. |
| src/backend/preload.ts | Removes the preload bridge binding for portal.getMyShaves. |
| src/backend/types/index.ts | Removes unused ShaveItem / GetMyShavesResponse exports. |
| src/ui/src/types/index.ts | Removes unused ShaveItem / GetMyShavesResponse exports. |
| src/ui/src/services/ipc-client.ts | Removes the portal.getMyShaves declaration/import from the typed IPC client surface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After signing in and clicking "My Shave(s)" in an older Desktop build, users saw a raw JSON payload instead of a formatted UI (see attached screenshot/video on #454). Investigating on
maintoday:HomePage.tsx, routed at/) already renders a proper table/card UI, sourced from the local database viashave.getAll()— this was the fix delivered by PR XS⚠️ ◾ change My Shaves list to use local database #830 ("change My Shaves list to use local database").portal:get-my-shavesIPC handler that XS⚠️ ◾ change My Shaves list to use local database #830 replaced was never removed. It still exists end-to-end (IPC channel,ipcMain.handle, preload binding, andGetMyShavesResponse/ShaveItemtypes) and returns the raw parsed/me/shavesAPI response as-is, with no formatting.ipcClient.portal.getMyShaves()(confirmed via repo-wide search; its siblinggetMyProjectsis consumed byProjectsPage.tsx, for contrast). The screenshot on My Shave shows raw JSON payload on sign-in (desktop) #454 is from an older build (pre-L⚠️ ◾ 💄 UI overhaul of homepage, navigation and shaves page #815 top-nav layout) whose "My Shaves" button evidently called this raw endpoint directly.Since the handler is unreachable from any current UI action, the literal repro no longer happens on
main. But leaving unused code that dumps a raw API payload lying around is exactly the "unfinished feature exposed" risk the issue calls out — it could get wired back up by accident. This PR removes it entirely so that can't happen.Changes
src/backend/ipc/channels.ts— removePORTAL_GET_MY_SHAVESchannel constantsrc/backend/ipc/portal-handlers.ts— remove theipcMain.handle(PORTAL_GET_MY_SHAVES, ...)block and its now-unusedhttps/GetMyShavesResponseimportssrc/backend/preload.ts— remove the channel constant andportal.getMyShavesbridge bindingsrc/backend/types/index.ts,src/ui/src/types/index.ts— remove the now-unusedShaveItem/GetMyShavesResponsetypessrc/ui/src/services/ipc-client.ts— remove theportal.getMyShavestype declaration and its importNo behavior change to the real "My Shaves" page — it never used this handler.
Testing performed
npm run build— clean (tsc, no dangling references)npm rebuild better-sqlite3 --build-from-source && npx vitest run --reporter=verbose --exclude 'src/ui/**'— 691/691 tests passednpm --prefix src/ui install && npm --prefix src/ui test— 255/255 tests passednpm run lint— clean (one pre-existing, unrelated info-level note inCloud360LiveView.tsx, not touched by this change)PORTAL_GET_MY_SHAVES,getMyShaves,GetMyShavesResponse,ShaveItemCloses #454