Page MenuHomePhabricator

[identity] don't let linkFarcasterAccount overwrite existing fid for user
ClosedPublic

Authored by varun on Mar 27 2024, 1:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 11:13 AM
Unknown Object (File)
Fri, Apr 12, 1:29 AM
Unknown Object (File)
Fri, Apr 12, 1:29 AM
Unknown Object (File)
Fri, Apr 12, 1:29 AM
Unknown Object (File)
Fri, Apr 12, 1:29 AM
Unknown Object (File)
Tue, Apr 9, 2:56 AM
Unknown Object (File)
Tue, Apr 2, 3:58 PM
Unknown Object (File)
Tue, Apr 2, 2:16 PM
Subscribers

Details

Summary
Test Plan

tried calling linkFarcasterAccount multiple times. attempts with the same FID succeeded but attempts with a different FID failed.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

varun requested review of this revision.Mar 27 2024, 1:40 PM
This comment was removed by ashoat.
bartek added inline comments.
services/identity/src/database/farcaster.rs
68–72 ↗(On Diff #38389)

You don't have to provide the same value twice

88 ↗(On Diff #38389)

Does UpdateExpression if_not_exists fail the operation if given value already exists? The docs don't say this explicitly, but I guess

  • if_not_exists (path, value)

If the item does not contain an attribute at the specified path, if_not_exists evaluates to value; otherwise, it evaluates to path.

means that if the ID already exists, the expression evaluates to SET farcasterID = farcasterID so it's a no-op.

According to your test plan, it succeeds so it's alright

This revision is now accepted and ready to land.Mar 27 2024, 11:20 PM
services/identity/src/database/farcaster.rs
88 ↗(On Diff #38389)

yeah i checked and it succeeds so assuming DDB treats it as a no-op