Problem
`handleAppend` in `packages/imap/src/commands/extensions.ts` hardcodes `1` as the UIDVALIDITY value in the `APPENDUID` response code:
```typescript
// RFC 4315: APPENDUID response code
return [formatTagged(tag, "OK", `[APPENDUID 1 ${result.uid}] APPEND completed`)];
```
Per RFC 4315 Section 3, the `APPENDUID` response code is `APPENDUID `. The uidValidity must be the current mailbox UIDVALIDITY, not a constant. Clients correlate their local UID cache against the (uidValidity, uid) tuple -- if uidValidity changes and the client sees a stale `1`, it may believe its cache is still valid when it is not, or it may invalidate incorrectly when an unrelated mailbox swaps in.
Fix scope
- `handleAppend` needs access to the target mailbox's `uidValidity`. The mailbox adapter already returns `uidValidity` from `getFolderStats`; the APPEND handler should fetch it (or receive it as a parameter) before emitting the response.
- Update the response line to use the real uidValidity
- Add a test referencing RFC 4315 Section 3 that asserts APPENDUID uses the actual mailbox uidValidity across mailboxes with different UIDVALIDITY values.
Related
Problem
`handleAppend` in `packages/imap/src/commands/extensions.ts` hardcodes `1` as the UIDVALIDITY value in the `APPENDUID` response code:
```typescript
// RFC 4315: APPENDUID response code
return [formatTagged(tag, "OK", `[APPENDUID 1 ${result.uid}] APPEND completed`)];
```
Per RFC 4315 Section 3, the `APPENDUID` response code is `APPENDUID `. The uidValidity must be the current mailbox UIDVALIDITY, not a constant. Clients correlate their local UID cache against the (uidValidity, uid) tuple -- if uidValidity changes and the client sees a stale `1`, it may believe its cache is still valid when it is not, or it may invalidate incorrectly when an unrelated mailbox swaps in.
Fix scope
Related