feat: rebuild user, org and project services#9917
Open
ZxBing0066 wants to merge 2 commits into
Open
Conversation
✅ Circular References ReportGenerated at: 2026-05-13T09:18:18.917Z Summary
Click to view all circular references in PR (19)Click to view all circular references in base branch (19)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Insomnia’s internal service layer for user session, organization, and project operations by introducing new service APIs (get, list, update, remove) and updating call sites across routes, UI helpers, main-process code, and tests to use the rebuilt services.
Changes:
- Replaced legacy service methods (
getOrCreate,getById,all,patch) with a simplified API (get,list,update,remove) across the app. - Added a new
services.organizationimplementation that fetches/sorts orgs via the cloud API and exposeslist()/get(). - Updated tests and main/renderer flows to align with the new service method names and signatures.
Reviewed changes
Copilot reviewed 66 out of 66 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/insomnia/src/utils/router.ts | Switches project/session lookups to services.project.get and services.userSession.get. |
| packages/insomnia/src/ui/vault-key.client.ts | Updates session writes to services.userSession.update and reads to get. |
| packages/insomnia/src/ui/organization-utils.ts | Uses services.organization.list() and removes local sortOrganizations usage. |
| packages/insomnia/src/ui/components/modals/tests/import-export.test.ts | Removes legacy services.project.all() setup call. |
| packages/insomnia/src/templating/utils.ts | Updates vault session fetch to services.userSession.get(). |
| packages/insomnia/src/routes/untracked-projects.tsx | Updates session fetch to services.userSession.get(). |
| packages/insomnia/src/routes/organization.tsx | Removes sortOrganizations import/usage; uses services.userSession.get(). |
| packages/insomnia/src/routes/organization.sync.tsx | Updates session fetch to services.userSession.get(). |
| packages/insomnia/src/routes/organization.sync-organizations-and-projects.tsx | Updates session fetch to services.userSession.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.new.tsx | Updates session fetch to services.userSession.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.update.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.new.tsx | Switches project/session lookups to get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.move.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.delete.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.tsx | Switches project/session lookups to get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.spec.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.spec.generate-request-collection.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.generate-request-collection.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mcp.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.sync-data.tsx | Switches project lookup to services.project.get() in loader/action. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.push.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.pull.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.fetch.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.create-snapshot.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.$requestId.grant-access.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.update.tsx | Switches project/session lookups to get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.move.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.move-workspace.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.list-workspaces.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.delete.tsx | Switches project/session lookups to get(). |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx | Switches project/session lookups to get(). |
| packages/insomnia/src/routes/organization.$organizationId.project._index.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/organization.$organizationId.permissions.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/organization.$organizationId.members.$userId.roles.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/organization.$organizationId.collaborators.invites.$invitationId.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/organization.$organizationId.collaborators.invites.$invitationId.reinvite.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/organization._index.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/import.resources.tsx | Switches project lookup to services.project.get(). |
| packages/insomnia/src/routes/git.all-connected-repos.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/git-credentials.$id.related-projects.tsx | Switches to services.project.list({ gitRepositoryIds }). |
| packages/insomnia/src/routes/commands.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/auth.validate-vault-key.tsx | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/routes/auth.update-vault-salt.tsx | Switches session lookup to get() and updates to new update() signature. |
| packages/insomnia/src/routes/auth.clear-vault-key.tsx | Switches session lookup to get() and updates to new update() signature. |
| packages/insomnia/src/routes/auth.authorize.tsx | Switches session lookup to get() and updates to new update() signature. |
| packages/insomnia/src/root.tsx | Switches session lookup to services.userSession.get() in loader and deeplink handling. |
| packages/insomnia/src/network/tests/network.test.ts | Removes legacy services.project.all() setup call. |
| packages/insomnia/src/main/git-service.ts | Switches project lookups to get() and project enumeration to list(). |
| packages/insomnia/src/main/cloud-sync/initialization.ts | Switches project/session lookups to get(). |
| packages/insomnia/src/main/analytics.ts | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/main/tests/sync-initialization.test.ts | Updates mocks to new services.project.get and services.userSession.get. |
| packages/insomnia/src/insomnia-data/node-src/services/user-session.ts | Replaces getOrCreate/patch/all with get/update(patch)/remove(). |
| packages/insomnia/src/insomnia-data/node-src/services/project.ts | Replaces getById/all/getAllByGitRepositoryIds with get/list and broadens update/remove inputs. |
| packages/insomnia/src/insomnia-data/node-src/services/organization.ts | Adds new org service with API fetch + sorting and list/get methods. |
| packages/insomnia/src/insomnia-data/node-src/services/index.ts | Registers new organization service in the service implementation map. |
| packages/insomnia/src/insomnia-data/tests/request.test.ts | Removes legacy services.project.all() setup call. |
| packages/insomnia/src/entry.main.ts | Switches scratchpad project lookup to services.project.get(). |
| packages/insomnia/src/common/organization-storage-rules.ts | Switches session lookup to services.userSession.get(). |
| packages/insomnia/src/common/import.ts | Switches project lookup to get() and project enumeration/filtering to list({ organizationId }). |
| packages/insomnia/src/common/tests/render.test.ts | Removes legacy services.project.all() setup call. |
| packages/insomnia/src/common/tests/har.test.ts | Replaces services.project.all() with services.project.list(). |
| packages/insomnia/src/account/session.ts | Switches session operations to get()/update(patch)/remove() and simplifies key destructuring. |
💡 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.
Rebuild services for user-session, organization and project.