Skip to content

Orphaned apiApps wrappers fail the client dead-export guard on main (blocks any full-CI PR) #5848

Description

@atomantic

client/src/services/api.deadExports.test.js fails on current main:

AssertionError: caller-less wrappers:
services/apiApps.js:getPreferredSelfRestartOrigin
services/apiApps.js:pullAndUpdateApp: expected [ …(2) ] to deeply equal []

What happened

The apps repository-source work (merged at 2e996e4d2) moved RepositorySourcePanel.jsx onto the socket-driven useAppOperation hook. The panel no longer calls api.pullAndUpdateApp or api.getPreferredSelfRestartOrigin, but both wrappers — and the tests that mock them — were left in place. Grep confirms the only remaining references are test files:

  • client/src/services/apiApps.js:170 getPreferredSelfRestartOrigin
  • client/src/services/apiApps.js:177 pullAndUpdateApp
  • referenced only from client/src/services/apiApps.test.js and client/src/components/apps/tabs/RepositorySourcePanel.test.jsx (as vi.fn() mocks)

Why it matters

main's own CI has been green because the run planner picks affected tests; the failure only surfaces on a full client run. That means any PR that trips full mode is red through no fault of its own — it is currently blocking #5625, a server-only change that touches zero client files.

The RepositorySourcePanel.test.jsx mocks are also now vacuous: they stub two functions the component never calls, and expect(api.pullAndUpdateApp).not.toHaveBeenCalled() passes trivially.

Fix

Decide which of the two the panel was meant to keep:

  • If the update flow genuinely moved to sockets (most likely): delete both exports from apiApps.js, drop the getPreferredSelfRestartOrigin describe block in apiApps.test.js, and remove the two dead mocks plus the vacuous assertion from RepositorySourcePanel.test.jsx. Check whether the server's POST /apps/:id/update route still has any client caller before leaving it in place.
  • If the panel should still call them, wire the calls back and the dead-export guard goes green on its own.

Either way the guard test should be green on main before the next full-CI PR lands.

Acceptance criteria

  • cd client && npm run test:ci passes on main (full mode)
  • No test mocks an apiApps export the production tree no longer calls
  • POST /apps/:id/update either has a live client caller or is documented as server/API-only

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions