Skip to content

XS✔ ◾ Remove dead My Shaves portal IPC surface that leaked raw JSON (#454)#971

Open
tomek-i wants to merge 1 commit into
mainfrom
454-remove-dead-my-shaves-json-endpoint
Open

XS✔ ◾ Remove dead My Shaves portal IPC surface that leaked raw JSON (#454)#971
tomek-i wants to merge 1 commit into
mainfrom
454-remove-dead-my-shaves-json-endpoint

Conversation

@tomek-i

@tomek-i tomek-i commented Jul 20, 2026

Copy link
Copy Markdown
Member

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 main today:

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 — remove PORTAL_GET_MY_SHAVES channel constant
  • src/backend/ipc/portal-handlers.ts — remove the ipcMain.handle(PORTAL_GET_MY_SHAVES, ...) block and its now-unused https/GetMyShavesResponse imports
  • src/backend/preload.ts — remove the channel constant and portal.getMyShaves bridge binding
  • src/backend/types/index.ts, src/ui/src/types/index.ts — remove the now-unused ShaveItem/GetMyShavesResponse types
  • src/ui/src/services/ipc-client.ts — remove the portal.getMyShaves type declaration and its import

No 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 passed
  • npm --prefix src/ui install && npm --prefix src/ui test — 255/255 tests passed
  • npm run lint — clean (one pre-existing, unrelated info-level note in Cloud360LiveView.tsx, not touched by this change)
  • Repo-wide grep confirms zero remaining references to PORTAL_GET_MY_SHAVES, getMyShaves, GetMyShavesResponse, ShaveItem

Closes #454

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>
Copilot AI review requested due to automatic review settings July 20, 2026 01:13
@tomek-i tomek-i added the armada Eligible for the ARMADA fleet to pick up label Jul 20, 2026
@github-actions github-actions Bot changed the title Remove dead My Shaves portal IPC surface that leaked raw JSON (#454) XS✔ ◾ Remove dead My Shaves portal IPC surface that leaked raw JSON (#454) Jul 20, 2026

Copilot AI 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.

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_SHAVES IPC channel constant and end-to-end wiring (handler + preload bridge).
  • Removed the now-unused getMyShaves typing from the renderer IPC client surface.
  • Removed ShaveItem / GetMyShavesResponse types 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.

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

Labels

armada Eligible for the ARMADA fleet to pick up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

My Shave shows raw JSON payload on sign-in (desktop)

2 participants