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
Unknown Object (File)
Wed, Nov 13, 1:42 PM
Unknown Object (File)
Wed, Nov 13, 1:42 PM
Unknown Object (File)
Wed, Nov 13, 1:42 PM
Unknown Object (File)
Wed, Nov 13, 1:42 PM
Unknown Object (File)
Wed, Nov 13, 1:42 PM
Unknown Object (File)
Wed, Nov 13, 12:44 AM
Unknown Object (File)
Tue, Nov 12, 10:22 PM
Unknown Object (File)
Sun, Oct 27, 10:50 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 ↗(On Diff #36880)

Unsure if this should be an invariant

216 ↗(On Diff #36880)

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 ↗(On Diff #36880)

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

192 ↗(On Diff #36880)

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 ↗(On Diff #36880)

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

215–218 ↗(On Diff #36880)

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 ↗(On Diff #36880)

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