Repository navigation
feat(inboxes): filter thread list by folders, labels and read, add thread search - #1142
Conversation
commit: |
There was a problem hiding this comment.
cubic analysis
2 issues found across 10 files
Confidence score: 4/5
threads.tsadds a search operation that may require a permission existing production API keys lack, causing requests to fail. Confirm the required permission is available to those keys and documented.build-inbox-cursor-query.tsturns emptylabelsorfoldersarrays into empty-valued query params, which the API may parse as an empty filter entry. Omit these params when the arrays are empty.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/inboxes/build-inbox-cursor-query.ts">
<violation number="1" location="src/inboxes/build-inbox-cursor-query.ts:19">
P3: An empty array joins to an empty string, so `labels: []` or `folders: []` now emits an empty-valued param (`?labels=`), and the API's `splitCommaList('')` produces an empty entry instead of seeing no filter. The previous `label` handling appended nothing for an empty array. Skip arrays with no items along with `undefined`.</violation>
</file>
<file name="src/inboxes/threads/threads.ts">
<violation number="1" location="src/inboxes/threads/threads.ts:50">
P2: Custom agent: **API Key Permission Check SDK Methods**
Confirm that production API keys used by this SDK have the permission required for the new `/inboxes/:inboxId/threads/search` operation. Resend documents broader access for non-send routes, so existing restricted keys could otherwise fail when consumers call `threads.search`.</violation>
</file>
Linked issue analysis
Linked issue: MES-2207: update the Node SDK inbox preview with the thread list filters and search
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Use folders, labels, and read for thread list filters | ListInboxThreadsOptions exposes these filters, and the tests verify comma-separated arrays and false read values. |
| ✅ | Include folder on each inbox thread | InboxThread now includes folder, and the list and search fixtures provide it. |
| ✅ | Add search with the specified filters and date options | threads.search calls the search path and maps query, list filters, address filters, attachment, and dates. |
| ✅ | Return matched email IDs and search highlights | Search results extend InboxThread with matched_email_id and typed highlights, including the tested subject fragment. |
| ✅ | Serialize search parameters in the API's expected format | The query builder comma-joins arrays, preserves false values, and tests verify the search parameter names. |
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
cubic analysis
No issues found across 10 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Linked issue analysis
Linked issue: MES-2207: update the Node SDK inbox preview with the thread list filters and search
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Use folders, labels, and read for thread list filters | ListInboxThreadsOptions exposes these filters, and the tests verify comma-separated arrays and false read values. |
| ✅ | Include folder on each inbox thread | InboxThread now includes folder, and the list and search fixtures provide it. |
| ✅ | Add search with the specified filters and date options | threads.search calls the search path and maps query, list filters, address filters, attachment, and dates. |
| ✅ | Return matched email IDs and search highlights | Search results extend InboxThread with matched_email_id and typed highlights, including the tested subject fragment. |
| ✅ | Serialize search parameters in the API's expected format | The query builder comma-joins arrays, preserves false values, and tests verify the search parameter names. |
Requires human review: Breaks the preview threads.list public options (folder/query/label -> folders/labels/read) and adds a new threads.search method; the SDK contract change is the decisive factor.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Breaks the preview threads.list options (folder/query/label replaced by folders/labels/read) and adds a new public threads.search method; accepting that SDK contract change requires human sign-off.
View guided diff | Re-trigger cubic
the inbox preview's
threads.liststill sendsfolder,queryandlabel, which the public API stopped reading in resend-monorepo#11702. sothreads.list({ inboxId, folder: 'archive' })gets the inbox folder back, with no error. there's also no method forGET /inboxes/:inbox_id/threads/search.MES-2207
what changed
threads.listdropsfolder,queryandlabeland takesfolders,labels(label IDs) andread.threads.searchtakes the list filters plusquery,from/to/cc/bcc,hasAttachmentandstartDate/endDate. each result is a thread plusmatched_email_idandhighlights(fragments with the matches wrapped in**).InboxThreadgetsfolder, which the API already returns.folders=inbox,archive), which is how the API parses them (z.string().transform(splitCommaList)inthread-filters.ts). the old repeatedlabel=keys fail validation there.buildInboxCursorUrlbuilds the query from the keys it gets instead of a fixed list, so list and search share it.drafts.listsends the same params as before.release
breaking for preview users who pass
folder,queryorlabel. after merge, bump to6.32.1-preview-inboxes.5and push the tag to publish under thepreview-inboxesdist-tag.Summary by cubic
Updates the inbox preview thread list filters to match the public API and adds thread search.
threads.listnow takesfolders,labels, andreadinstead of the ignoredfolder,query, andlabelparams, andInboxThreadnow includesfolder. A newthreads.searchmethod hitsGET /inboxes/:inbox_id/threads/searchwith the list filters plus query, sender/recipient, attachment, and date options; each result includesmatched_email_idandhighlights. Array options are sent comma-separated, matching API parsing, and the shared query builder now serializes params generically from the given options.Breaking changes
folder,query, orlabeltothreads.listmust switch to the new filter names.6.32.1-preview-inboxes.5and publish under thepreview-inboxesdist-tag.Written for commit b76fe42. Summary will update on new commits.