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
F3480936: D11000.id37638.diff
Tue, Dec 17, 12:54 AM
F3480935: D11000.id37048.diff
Tue, Dec 17, 12:54 AM
F3480934: D11000.id36961.diff
Tue, Dec 17, 12:54 AM
F3480933: D11000.id36879.diff
Tue, Dec 17, 12:54 AM
F3480932: D11000.id36880.diff
Tue, Dec 17, 12:54 AM
F3480920: D11000.id.diff
Tue, Dec 17, 12:54 AM
F3480917: D11000.diff
Tue, Dec 17, 12:54 AM
Unknown Object (File)
Mon, Dec 16, 6:10 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
Lint Not Applicable
Unit
Tests Not Applicable

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