chore: upgrade comapeo dependencies#1797
Conversation
…pport new map server and map code in backend. Adds patches as needed.
|
| Name | Status | Previous | Current |
|---|---|---|---|
@augment-vir/common |
- | 26.4.0 | |
@comapeo/core |
5.5.0 | 6.0.2 | |
@comapeo/ipc |
6.0.2 | 7.0.0 | |
@comapeo/map-server |
- | 1.0.1 | |
@hyperswarm/secret-stream |
6.6.3 | 6.7.1 | |
bare-events |
2.4.2 | 2.8.2 | |
browser-or-node |
- | 2.1.1 | |
custom-error-creator |
- | 1.1.1 | |
eventemitter3 |
5.0.1 | 5.0.4 | |
events-universal |
- | 1.0.1 | |
expect-type |
- | 0.15.0 | |
itty-router |
- | 5.0.23 | |
p-mutex |
- | 0.1.0 | |
run-time-assertions |
- | 1.5.2 | |
secret-stream-http |
- | 1.0.1 | |
typebox |
- | 1.1.10 | |
typed-event-target |
- | 3.4.0 | |
undici |
6.19.8 | 6.24.1 | |
wsl-utils |
- | 0.1.0 |
yep! done in #1738 in anticipation of this breaking change :) |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
achou11
left a comment
There was a problem hiding this comment.
More of an initial review as I haven't had the capacity to look through some of the more complex pieces or test any of the changes on a device. Overall the changes are going in the right direction and they surfaced a couple of issues in other comapeo modules.
| "overrides": { | ||
| "@hyperswarm/secret-stream": "6.7.1" |
There was a problem hiding this comment.
@gmaclennan - is this override to pin to a specific version or to "upgrade" the versions used by transitive deps? just wondering if it's actually needed as opposed to updating the lockfile
| projectId: string; | ||
| }): ArchiveServerMemberInfo | undefined { | ||
| const {data: members} = useManyMembers({projectId}); | ||
| const {data: members} = useManyMembers({projectId, includeLeft: true}); |
There was a problem hiding this comment.
although the isActiveArchiveServerMember used below is doing the appropriate role-based filtering, seems like ideally this would only get active members.
| const {data: members} = useManyMembers({projectId, includeLeft: true}); | |
| const {data: members} = useManyMembers({projectId, includeLeft: false}); |
| /> | ||
| {error && | ||
| /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ | ||
| (error as any).code !== 'MAP_NOT_FOUND' && ( |
There was a problem hiding this comment.
Think you can use isHttpError from @comapeo/core-react to clean this up a bit:
| (error as any).code !== 'MAP_NOT_FOUND' && ( | |
| isHttpError(error) && error.code !== 'MAP_NOT_FOUND' && ( |
@gmaclennan - i thought we had some kind of error helper so that the error.code here would narrow to known maps-related error codes. Maybe I'm confusing things with core...
There was a problem hiding this comment.
I can clean up all the errors with subsequent map work in any case.
metro.config.js
Outdated
| sourceExts: [...config.resolver.sourceExts, 'svg'], | ||
| // Required for importing @comapeo/ipc and rpc-reflector without bundling the server/backend code also | ||
| unstable_enablePackageExports: true, | ||
| // @comapeo/core-react imports DEFAULT_MAP_ID from the @comapeo/map-server root, which pulls in |
There was a problem hiding this comment.
This issue should be fixed in @comapeo/core-react@11.0.1.
I think instead of updating the metro config here, it would make more sense to create a patch file for core-react to introduce the fix. That way when you eventually upgrade to that version of core-react, the only change needed is removing the patch.
jest.config.js
Outdated
| '^@comapeo/ipc$': '<rootDir>/node_modules/@comapeo/ipc/dist/index.js', | ||
| '^custom-error-creator$': | ||
| '<rootDir>/node_modules/custom-error-creator/index.js', | ||
| '^@comapeo/map-server$': |
There was a problem hiding this comment.
assuming a patch file is introduced to fix the offending import, i think this could be updated to only affect the subpath import i.e.
| '^@comapeo/map-server$': | |
| '^@comapeo/map-server/constants\.js$': |
…or. Adds a patch for comapeo-core-react.
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
There was a problem hiding this comment.
minor thing but looks like typebox version used has been updated. should just be a matter of updating the file name if you want the patch-package warning to go away:
Warning: patch-package detected a patch file version mismatch
Don't worry! This is probably fine. The patch was still applied
successfully. Here's the deets:
Patch file created for
typebox@1.0.81
applied to
typebox@1.1.10
At path
node_modules/typebox
This warning is just to give you a heads-up. There is a small chance of
breakage even though the patch was applied successfully. Make sure the package
still behaves like you expect (you wrote tests, right?) and then run
patch-package typebox
to update the version in the patch file name and make this warning go away.
---
patch-package finished with 1 warning(s).| role: {roleId}, | ||
| deviceType, | ||
| joinedAt: new Date().toISOString(), | ||
| }; | ||
| } as MemberApi.ActiveMemberInfo; |
There was a problem hiding this comment.
instead of the type cast, i would suggest just adding an expect-error comment for the offending field i.e.
function mockMember(
deviceId: string,
roleId: MemberApi.RoleId,
deviceType: 'mobile' | 'desktop' = 'mobile',
): MemberApi.ActiveMemberInfo {
return {
deviceId,
name: `Device ${deviceId}`,
role: {
// @ts-expect-error Sufficient for testing purposes
roleId,
},
deviceType,
joinedAt: new Date().toISOString(),
};
}…ping issue. Tightening return type of function. Fixes typebox patch version.
|
@achou11 I think I updated everything as you suggested. I did some manual testing with my two devices -- inviting to as well as adding and removing from projects, adding a server. Exchanging. Adding and removing background maps. As well as some basic stuff like creating a project, adding observations, recording audio, taking pictures. I was able to add a server and see it on the team screen but I am seemingly unable to remove it. I am just stuck in the loading space. I used this server: |
There was a problem hiding this comment.
Great job on this! Now on to the next upgrade 😂
Regarding the remote archive removal issue, I think it's related to a bug in core-react (see digidem/comapeo-core-react#171). Would you mind trying out the changes from the PR to see if it fixes the issue? Can do so by creating an updated patch file here or creating a tarball from that PR. If you go with the patch-file approach, make sure you update both the esm and cjs dist directories in core-react, just to make sure the patch actually makes it into the bundle.
I suspect that there may be a few issues that this bug causes related to doing write operations with members. If you can verify that the fix upstream works, you can include that as part of the patch file in this PR. Then when you upgrade to latest core-react the patch file can be removed.
Alternatively, if you don't anticipate too much time happening between now and the upgrade to latest comapeo deps, you can merge this PR and then introduce release with the fix(es) shortly after. What do you think?
|
@cimigree I took it upon myself to add a commit that updates the patch file with the suspected fix. Mind trying the flow with the remote archive removal and seeing if it's fixed by this? It seemed to fix the issue for me when I tried it locally. |
|
@achou11 Thanks for doing the patch but I still had the same issue. It loads endlessly and then when I force close and reopen, the remote archive is gone. Anything in particular I can log or do to troubleshoot? |
Hm not sure. That might be some unrelated issue. The issue I was seeing and addressing was the remote archive not disaplearing after removing succeeds. Thought the endless loading might be a related thing but maybe it's not? |
achou11
left a comment
There was a problem hiding this comment.
Approving this to unblock you on being able to do the next upgrade. This is under the assumptions that:
-
The CI failure is an unrelated flake and will eventually pass if tried enough.
-
The issue you mentioned around the archive server is either some kind of flaky behavior.
I could be wrong about both! You would know better.
Even if the mentioned issues are regressions, might be easier to address them as follow ups as opposed to endlessly updating patches in this PR. From what I can tell, the app code changes here seem solid so issues most likely require dep upgrades (as seen with the introduced patch file for core-react).
Suspecting this is the cause of the issue with removing a remote archive highlighted in digidem/comapeo-mobile#1797. Prior to this change, all of the write hooks related to the members API invalidate `['@comapeo', 'projects', someProjectId, 'members', { includeLeft: undefined }]`, which misses the cases where a read hook internally uses a query key where `includeLeft` is a boolean value e.g. `['@comapeo', 'projects', someProjectId, 'members', { includeLeft: true }]` or `['@comapeo', 'projects', someProjectId, 'members', { includeLeft: false }]`. The proposed fix is to omit the last key fragment when `includeLeft` is undefined or unspecified, so that the write hook invalidations match `['@comapeo', 'projects', someProjectId, 'members']`, which will cover all members-related reads.

closes #1783
Upgrade @comapeo/core to v6.0.2 and @comapeo/core-react to v10.0.1 and @comapeo-ipc to 7.0.0
Breaking change migrations:
Map server wiring:
Most of this code was written by Gregor in #1693 and ported over in here so that the map can load and new map files can be uploaded in the develop branch, and basically so it doesn't break!
Infrastructure: