Repository navigation
Conversation
Tiny Code Reviewthe AI provider rate-limited the request This is advice, not a gate. Re-run with the |
unRekable
left a comment
There was a problem hiding this comment.
Code Review
🟡 1 finding (0 blocking).
The PR adds Signal username lookup: a username-shaped query goes to libsignal's username lookup, the resolved account id is stored as a person, and everything else (names, phone numbers, signal.me links) never reaches Signal. The username validator faithfully mirrors libsignal's hard rules (checked against libsignal's username.rs and constants.rs: charset, the 48-char cap, and the 01 valid / 042 leading-zero / 00 zero discriminator cases); the lookup is bounded by the wire's existing 45-second answer timeout on the adapter's own command thread, and the fault log goes through redact. One defect: the stored PersonRow leaves avatar unset, and upsert_people sets avatar = excluded.avatar unconditionally, so a lookup that resolves to someone already stored nulls their picture and overwrites their known name with the username until the next connection re-fetches them. Every other upsert in this adapter passes ctx.avatar_of for exactly this reason.
Residual risk
- Phone-number lookup, the other half of the PR title, is not implemented: a phone-shaped query only searches people already stored. The body says 'Phone lookup stays off', but the PR closes #730, which may name the whole feature.
- A lookup that fails (network error, Signal rate limit) is indistinguishable from 'no such username' in the window: Ok(_) => {} and the warn go nowhere the user sees, so an empty result can look like an answer.
- Every username-shaped SearchPeople is now one round trip to Signal on the serialized command thread, so a burst of searches queues behind sends for up to the 45-second answer bound.
- The validator hard-codes libsignal's current hard rules; libsignal is pinned at fixed commits so drift is slow, but if Signal relaxes its username shape, valid usernames would silently not be searched until this filter is updated.
| Ok(Some(aci)) if wire::is_aci(&aci) => { | ||
| account.live().names.entry(aci.clone()).or_insert_with(|| username.to_owned()); | ||
| let _ = account.ctx.people(&[PersonRow { | ||
| id: aci, |
There was a problem hiding this comment.
| id: aci, | |
| avatar: account.ctx.avatar_of(&aci), | |
| id: aci, |
ab06394 to
79e4209
Compare
What changed and why
A Signal people search that is a username (
name.42) asks Signal for that account and stores the person, so starting a chat opens a row titled with the username. A plain name, a phone number, and a username link are not sent to Signal.Tested with
cargo test -p chatd --no-default-features(a_username_lookup_opens_a_chat,a_username_shape_is_proven) andcargo clippy -p chatd --no-default-features --all-targets. Not tested: no live Signal, lab not run, no phone or CDSI lookup, no username links, no shell, and the signal-feature build was not compiled in this pass.Type
Platforms
Proof
Scenario: e2e/scenarios/signal-username
Lab run: not run
Compatibility
No protocol change. An older client still searches the people it already stored. This build adds one stored person when a username lookup succeeds.
Risk and rollback
A query that looks like a username is sent to Signal's username lookup. A wrong account id would open a chat with the wrong person. Revert this commit. Phone lookup stays off.
Release note
You can start a Signal chat by typing someone's username.
Closes #730