Page MenuHomePhabricator

[Identity] Refactor existing onetime key logic to use new tables
AbandonedPublicDraft

Authored by jon on Jul 31 2023, 7:05 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 9:20 PM
Unknown Object (File)
Sun, Nov 24, 6:24 PM
Unknown Object (File)
Sat, Nov 23, 2:38 PM
Unknown Object (File)
Sat, Nov 23, 12:55 PM
Unknown Object (File)
Sat, Nov 2, 11:58 PM
Unknown Object (File)
Sat, Nov 2, 11:34 PM
Unknown Object (File)
Oct 27 2024, 3:42 PM
Unknown Object (File)
Oct 17 2024, 2:39 AM
Subscribers

Details

Reviewers
bartek
varun
Summary

Move old writes of onetime-keys to the new tables.

https://linear.app/comm/issue/ENG-4534/

Depends on D8642

Test Plan
  • Start identity service and localstack
  • Run ./services/terraform/dev/run.sh
cd services/commtest
cargo test --test identity_onetime_key_tests

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.Jul 31 2023, 7:35 AM
Harbormaster failed remote builds in B21370: Diff 29274!
services/identity/src/client_service.rs
794

This is no longer needed since user_id was previously needed to find the user in identity-users table, but the onetime keys tables only care about device id.

services/identity/src/constants.rs
91–99

these should be in the previous diff

services/identity/src/database.rs
28

chose to combine one-time to onetime because this was the existing standard

298–299

for consistency

328–336

this is a bit awkward, but create_device_info takes the entire object.

344–374

This is a bit awkward, where we can't write the one time keys in the same call. However, refactoring the user write to be included in the batch_write will require us to remove all mentions of the expression-related logic (E.g. set_expression_attribute_names and set_expression_attribute_values).

But, overall, the code is reading as "If I successfully create this user, please add these onetime keys as well"; which I think is fine.

359

This clone probably isn't required

services/identity/src/ddb_utils.rs
1–10

decided to create a new file, database.rs is already massive.

19–21

This is a bit repetitive, but WriteRequest also supports deletes, so seems to be the canonical way to describe "Create a WriteRequest which contains a put action".

Squashed this into D8675 to avoid some conflicts with refactoring