Page MenuHomePhabricator

[lib] add prefix query support to context provider
ClosedPublic

Authored by will on Feb 8 2024, 11:23 AM.
Tags
None
Referenced Files
F2196171: D11000.id36879.diff
Fri, Jul 5, 11:58 AM
F2195687: D11000.diff
Fri, Jul 5, 11:01 AM
Unknown Object (File)
Thu, Jul 4, 8:31 AM
Unknown Object (File)
Wed, Jul 3, 10:42 PM
Unknown Object (File)
Wed, Jul 3, 4:42 PM
Unknown Object (File)
Wed, Jul 3, 1:43 AM
Unknown Object (File)
Sun, Jun 30, 7:54 AM
Unknown Object (File)
Wed, Jun 12, 6:58 AM
Subscribers

Details

Summary

This implements prefix query messaging on the identity search context handler.
sendPrefixQuery add a promise to an array and then returns the promise. It then sends a websocket search query with an id.
When either a Success or Error search response type is received, the context handler will either resolve or reject promises using the id in the search response.

Depends on D10973

Test Plan

flow and console logged search results on web

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 8 2024, 11:26 AM
Harbormaster failed remote builds in B26669: Diff 36879!
Harbormaster returned this revision to the author for changes because remote builds failed.Feb 8 2024, 11:37 AM
Harbormaster failed remote builds in B26670: Diff 36880!
will requested review of this revision.Feb 8 2024, 11:45 AM
lib/identity-search/identity-search-context.js
192

Unsure if this should be an invariant

216

I used the preexisting clientRequestVisualTimeout constant which is what we currently use in inflight-requests.js. However, given that search results should be returned immediately, I was considering creating a shorter timeout duration so that we might fallback to keyserver search quicker

will retitled this revision from [lib] add prefix query support to context handler to [lib] add prefix query support to context provider.Feb 8 2024, 11:59 AM
will marked an inline comment as not done.Feb 8 2024, 12:03 PM
ashoat requested changes to this revision.Feb 8 2024, 12:09 PM

Good work on matching the requests / responses!

Did you consider using InflightRequests directly? I'm guessing that some parts of it are too tightly coupled to the keyserver WebSocket client code?

lib/identity-search/identity-search-context.js
159

Should we add a log or something? This seems like it would be an unexpected thing

192

I would "DeMorgan's Law" this

RE the invariant, there's really no difference between an invariant and this code... it's a stylistic preference more than anything

211

Feels a bit weird that this line is inside this new Promise declaration. Can you move it out?

215–218

This function looks like it can be extracted to the top-level scope, which would avoid the need for it to be redefined on every invocation of sendPrefixQuery

217

Not clear why you're throwing an empty array. Can you throw a new Error instead?

This revision now requires changes to proceed.Feb 8 2024, 12:09 PM

Definitely looked onto using InflightRequests directly but seemed like a lot more work to decouple with keyserver code. It would require revamping a lot of my current solution which might not be worth the time required

Can you rebase on master to fix the CI issues?

This revision is now accepted and ready to land.Feb 12 2024, 6:02 AM