PROD | filter out deleted clients from company member list - #1361
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
OUT-3930 | Filter out deleted /inactive users while creating grouped email notifications when task is assigned or any such thing.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Deployment failed with the following error: Learn More: https://vercel.link/multiple-function-regions |
Greptile SummaryThis PR filters out deleted clients from the result of
Confidence Score: 4/5The change is a minimal, targeted client-side filter with no side effects on other callers; the The fix is correct and well-scoped — deleted clients will no longer surface in the company member list, notification recipients, or task-sharing queries. The only open question is whether the hardcoded lowercase string 'deleted' matches every possible value the upstream Copilot API can return, since the schema accepts any string. src/utils/CopilotAPI.ts — specifically the Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller
participant CopilotAPI
participant CopilotSDK
Caller->>CopilotAPI: getCompanyClients(companyId)
CopilotAPI->>CopilotSDK: "listClients({ limit: 10000, companyId })"
CopilotSDK-->>CopilotAPI: ClientsResponse (includes deleted clients)
Note over CopilotAPI: filter(c => c.status !== 'deleted')
CopilotAPI-->>Caller: ClientResponse[] (deleted clients excluded)
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller
participant CopilotAPI
participant CopilotSDK
Caller->>CopilotAPI: getCompanyClients(companyId)
CopilotAPI->>CopilotSDK: "listClients({ limit: 10000, companyId })"
CopilotSDK-->>CopilotAPI: ClientsResponse (includes deleted clients)
Note over CopilotAPI: filter(c => c.status !== 'deleted')
CopilotAPI-->>Caller: ClientResponse[] (deleted clients excluded)
Reviews (1): Last reviewed commit: "Merge branch 'production' into main" | Re-trigger Greptile |
| console.info('CopilotAPI#_getCompanyClients', this.token) | ||
| return (await this.getClients({ limit: 10000, companyId })).data || [] | ||
| const clients = (await this.getClients({ limit: 10000, companyId })).data || [] | ||
| return clients.filter((c) => c.status !== 'deleted') |
There was a problem hiding this comment.
The
status field in ClientResponseSchema is typed as z.string() — a plain, unconstrained string. If the Copilot API ever returns a differently-cased value (e.g. 'Deleted') or a related variant (e.g. 'deactivated'), the filter will silently miss those clients. Consider narrowing the schema to a z.enum to make valid statuses explicit and catch unexpected values at parse time.
| return clients.filter((c) => c.status !== 'deleted') | |
| return clients.filter((c) => c.status?.toLowerCase() !== 'deleted') |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
No description provided.