Skip to content

fix: unknow type in sync - #8703

Merged
CurryYangxx merged 1 commit into
developfrom
fix/unknow-type-sync
Jun 19, 2025
Merged

fix: unknow type in sync#8703
CurryYangxx merged 1 commit into
developfrom
fix/unknow-type-sync

Conversation

@CurryYangxx

@CurryYangxx CurryYangxx commented May 12, 2025

Copy link
Copy Markdown
Member

Background

This is a fix for sync between different versions(The new version includes new DB model types to sync).
When testing the new Socket.io feature, if we push the new commit that includes the socket.io request. Then we use an older version and pull, there are some unexpected behaviors

  • git sync
    • Will recognize socket.io as websocket and can not select it.
  • cloud sync
    • Can not pull an unsynced workspace or new commit (Unknown database type causes js error)

This pr can fix the 2 issues above, but when we check the diff in the older version, the new type request was deleted.
Consider whether this can be fixed or the user can be better prompted

image

@CurryYangxx
CurryYangxx requested review from Copilot and gatzjames May 12, 2025 07:49

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 addresses sync issues when handling unknown model types between different versions. Key changes include:

  • Adding a type check before upserting documents in the backend project sync logic.
  • Enhancing the meta schema in the v5 import parser to ensure websocket request IDs follow the expected pattern.
  • Logging a warning and gracefully handling cases when a database collection is missing.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/insomnia/src/sync/vcs/pull-backend-project.ts Introduces a type guard on document upserts to prevent syncing issues.
packages/insomnia/src/common/import-v5-parser.ts Adds a schema validation to ensure websocket request IDs start with "ws-req".
packages/insomnia/src/common/database.ts Logs a warning and returns an empty result when the database collection is missing.
Comments suppressed due to low confidence (1)

packages/insomnia/src/sync/vcs/pull-backend-project.ts:60

  • [nitpick] Consider renaming 'allModelType' to 'allModelTypes' to more clearly indicate that it represents a collection of model types.
const allModelType = models.types();

Comment thread packages/insomnia/src/common/database.ts
@CurryYangxx CurryYangxx changed the title fix: unknow sync in sync fix: unknow type in sync May 26, 2025
@CurryYangxx
CurryYangxx force-pushed the fix/unknow-type-sync branch from 6e4f2a2 to e0924e1 Compare May 28, 2025 03:07
@CurryYangxx
CurryYangxx force-pushed the fix/unknow-type-sync branch from e0924e1 to a6018ee Compare June 19, 2025 06:04
@CurryYangxx
CurryYangxx enabled auto-merge (squash) June 19, 2025 06:09
@CurryYangxx
CurryYangxx merged commit ef5235a into develop Jun 19, 2025
@CurryYangxx
CurryYangxx deleted the fix/unknow-type-sync branch June 19, 2025 06:17
RoamingLost pushed a commit to RoamingLost/insomnia that referenced this pull request Aug 6, 2025
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.

3 participants