feat: wire up --profile-image and --metadata flags on conversations join#17
feat: wire up --profile-image and --metadata flags on conversations join#17
Conversation
The join request protocol already supported imageURL and metadata fields but they were not exposed via CLI flags. Now when joining a conversation: - --profile-image <url>: sends image URL in the JoinRequest and encrypts/ uploads it as a ProfileUpdate after joining - --metadata key=value: sends metadata in the JoinRequest and includes typed metadata in the ProfileUpdate (auto-typed: bool/number/string). Repeatable for multiple fields. Both fields are included in the JoinRequest DM (so the creator can see who's requesting to join) and in the post-join ProfileUpdate message (the authoritative profile source for the group). Bumps version to 0.5.2.
| const uploadProvider = getUploadProvider(config); | ||
| if (uploadProvider) { | ||
| // Get or generate the group's image encryption key | ||
| await conv.sync(); |
There was a problem hiding this comment.
🟢 Low conversations/join.ts:329
When multiple clients join simultaneously with --profile-image, each independently checks for the group image encryption key and may generate a new one, causing the last writer to overwrite earlier keys. The clients whose keys were overwritten cannot decrypt their own images because they were encrypted with a key that no longer exists. This contradicts the stated intent in lines 305-308 of avoiding read-modify-write races. Consider adding atomic key generation or recovering the existing key from the updated appData after another client writes it.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file src/commands/conversations/join.ts around line 329:
When multiple clients join simultaneously with `--profile-image`, each independently checks for the group image encryption key and may generate a new one, causing the last writer to overwrite earlier keys. The clients whose keys were overwritten cannot decrypt their own images because they were encrypted with a key that no longer exists. This contradicts the stated intent in lines 305-308 of avoiding read-modify-write races. Consider adding atomic key generation or recovering the existing key from the updated appData after another client writes it.
Evidence trail:
src/commands/conversations/join.ts lines 305-308 (comment about avoiding read-modify-write race), lines 329-339 (the read-modify-write pattern for imageEncryptionKey: sync at 329, read appData at 330-331, check key at 332, generate and write at 334-337), lines 340-350 (encrypt image with the generated key)
ApprovabilityVerdict: Needs human review This PR introduces new --profile-image and --metadata flags with substantial new logic including metadata auto-typing, image encryption, and upload integration. The new capability and complexity of the encryption/upload workflow warrants human review. You can customize Macroscope's approvability policy. Learn more. |
Summary
The join request protocol already supported
imageURLandmetadatafields inJoinRequestContent, but they were not exposed via CLI flags. This wires them up.New flags on
convos conversations join--profile-image <url>--metadata <key=value>true/false→ bool, numeric → number, else stringHow it works
Both fields flow through two stages:
Examples
Image encryption
When
--profile-imageis provided and the join is accepted, the image is:EncryptedProfileImageRefin the ProfileUpdateIf no upload provider is configured, a warning is shown and the image is skipped (non-fatal).
Version
Bumped to 0.5.2. All 226 tests pass.
Note
Wire up
--profile-imageand--metadataflags onconversations join--profile-image <url>and--metadata <key=value>(repeatable) flags to theconversations joincommand in join.ts.profile.imageURLand a typedmetadatamap when the flags are provided; values are auto-typed to bool, number, or string.ProfileUpdatewith name, metadata, and an optionally encrypted/uploaded profile image using a per-conversationimageEncryptionKeystored in conversationappData.--no-waitand final success paths includesprofileImageandmetadatafields when provided.📊 Macroscope summarized 39dc48b. 1 file reviewed, 2 issues evaluated, 0 issues filtered, 1 comment posted
🗂️ Filtered Issues