Skip to content

chore(console): remove legacy api.ts endpoints no longer served by the backend#285

Open
jeroenrinzema wants to merge 1 commit into
mainfrom
chore/remove-legacy-api-endpoints
Open

chore(console): remove legacy api.ts endpoints no longer served by the backend#285
jeroenrinzema wants to merge 1 commit into
mainfrom
chore/remove-legacy-api-endpoints

Conversation

@jeroenrinzema

Copy link
Copy Markdown
Contributor

Why

The management API is served only through the OpenAPI-generated router (mgmtoapi.HandlerWithOptions) with a request-validator middleware — anything not in resources.yml isn't routed. Auditing the legacy axios api.ts client against the spec surfaced a set of endpoints it still calls that have no matching spec path, so they 404 against the current backend. Per the decision that we won't support these going forward, this removes them and the now-orphaned UI that depended on them.

This is step 1 toward retiring api.ts entirely — it clears the dead/unsupported surface so the remaining migration of live endpoints onto the generated client is unblocked and cleaner.

Removed from api.ts (verified zero callers, not in spec)

Method(s) Legacy path
data.userPaths, data.rebuild data/paths/users, data/paths/sync
resources.* resources
tags.* tags, tags/used, tags/assign
lists.recount lists/{id}/recount
users.lists subjects/users/{id}/lists
organizations.members.* subjects/organizations/{id}/members
journeys.steps.searchUsers journeys/{id}/steps/{id}/users
journeys.entrances.* journeys/{id}/entrances, journeys/entrances/{id}
journeys.users.skipDelay / removeFromJourney …/steps/{id}/resume, …/step/{id}

UI removed (only reachable via the dead endpoints above)

  • EntranceDetails and JourneyUserEntrances pages + their two orphan routes (nothing linked to them).
  • JourneyStepUsers panel and the journey step-sidebar "view users" click-through. The step stats card is kept — it's just no longer a button (it previously navigated into the dead users panel).
  • The dead setViewUsersStep / onViewUsers plumbing threaded through the editor, canvas, sidebar, and node-action types.

Explicitly kept

  • journeys.users.getState — in the spec, used by the editor for step-completion indicators.
  • Path suggestions (projects.pathSuggestions) — still a needed feature; will move to the schema-based approach separately.
  • locales.getByKey — still in use by the template editor; handled in a later step.

Verification

  • tsc --noEmit clean
  • eslint clean (0 errors; remaining warnings are pre-existing prettier nits in untouched files)
  • Journey unit tests pass
  • Production build succeeds (bundle ~55 KB smaller)

…e backend

The management backend serves only what's in the OpenAPI spec (the oapi
router plus a request-validator middleware reject off-spec paths). Several
endpoints still called through the legacy axios `api.ts` client have no
matching spec path, so they 404 against the current backend. This removes
them and the now-orphaned UI that called them, as a first step toward
retiring `api.ts` entirely.

Removed from api.ts (no callers; not in spec):
- data.userPaths / data.rebuild  (data/paths/users, data/paths/sync)
- resources.*                     (resources)
- tags.*                          (tags, tags/used, tags/assign)
- lists.recount                   (lists/{id}/recount)
- users.lists                     (subjects/users/{id}/lists)
- organizations.members.*         (subjects/organizations/{id}/members)
- journeys.steps.searchUsers      (journeys/{id}/steps/{id}/users)
- journeys.entrances.*            (journeys/{id}/entrances, journeys/entrances/{id})
- journeys.users.skipDelay / removeFromJourney  (steps/{id}/resume, step/{id})

UI removed (reached only via the above, all backed by dead endpoints):
- EntranceDetails + JourneyUserEntrances pages and their orphan routes
- JourneyStepUsers panel and the step-sidebar "view users" click-through
  (the step stats card itself is kept, now non-interactive)

Kept: journeys.users.getState (in spec, used by the editor), path
suggestions, and locales.getByKey (still in use; to be migrated separately).

tsc + eslint clean, journey unit tests pass, production build succeeds.

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

Removes legacy console/src/api.ts client endpoints that no longer exist in the backend OpenAPI router, and deletes the now-orphaned UI/routes that depended on those endpoints (notably journey entrance/user-step views). This helps shrink the unsupported surface area of the legacy client as a first step toward retiring api.ts.

Changes:

  • Removed dead legacy api.ts methods (journey entrances/step users, org members, tags/resources, list recount, etc.) that are no longer served by the backend.
  • Removed unreachable journey UI pages/panels and their routing/plumbing (entrance details, journey user entrances, “view users” step panel).
  • Simplified journey editor/canvas/sidebar types and props by removing the onViewUsers / setViewUsersStep wiring.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
console/src/views/router.tsx Removes the now-dead journey entrances routes and corresponding component imports.
console/src/views/journey/JourneyUserEntrances.tsx Deletes orphaned page that queried removed journeys.entrances.search.
console/src/views/journey/JourneyStepUsers.tsx Deletes orphaned “users in step” dialog that depended on removed legacy endpoints.
console/src/views/journey/hooks/useJourneyPersistence.ts Removes setViewUsersStep action type from journey persistence actions.
console/src/views/journey/EntranceDetails.tsx Deletes orphaned entrance details page and its exported typeVariants.
console/src/views/journey/editor/JourneyEditor.utils.ts Removes setViewUsersStep from the stepsToNodes actions contract.
console/src/views/journey/editor/JourneyEditor.types.ts Removes setViewUsersStep from JourneyNodeData.
console/src/views/journey/editor/JourneyEditor.tsx Removes state/handlers/rendering for the deleted JourneyStepUsers dialog and sidebar plumbing.
console/src/views/journey/components/JourneyStepSidebar.tsx Removes the “view users” click-through behavior; keeps the stats card as non-interactive UI.
console/src/views/journey/components/JourneyCanvas.tsx Removes onViewUsers from the sidebar prop surface and call site.
console/src/api.ts Removes legacy endpoints/types that are no longer routed by the backend; simplifies organizations to the base entity path only.

💡 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants