Skip to content

fix(MULTIPLA-002-2): CU-86akbhhue name the fleet token and ticket messages query keys, drop dead _fetchPolicy - #343

Merged
michaelassraf merged 1 commit into
mainfrom
ai-fix/multipla-002-2-18ce84f8-c0694bf2
Sep 15, 2026
Merged

michaelassraf merged 1 commit into
mainfrom
ai-fix/multipla-002-2-18ce84f8-c0694bf2

Conversation

@flamingo

@flamingo flamingo Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Closes 46 review findings across 26 files.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟢 90 high Inline query key literal used for Fleet API token query instead of a named constant src/app/(app)/monitoring/hooks/use-live-campaign.ts:193
2 🔴 55 low — review closely Live campaign error message check treats string data.error as an object type check, contradicting the CampaignMessage type src/app/(app)/monitoring/hooks/use-live-campaign.ts:317
3 🔴 30 low — review closely Module-level mutable cache for 'All Hosts' label id is never invalidated or scoped per-session src/app/(app)/monitoring/hooks/use-live-campaign.ts:112
4 🔴 45 low — review closely Fleet dev bearer token appended to WebSocket URL as a query parameter src/app/(app)/monitoring/hooks/use-live-campaign.ts:381
5 🟡 70 medium WebSocket event handlers not explicitly removed before nulling/closing the socket in cleanup src/app/(app)/monitoring/hooks/use-live-campaign.ts:217
6 🔴 55 low — review closely Inline query key arrays in NATS reconnect invalidation, not sourced from a shared keys module src/app/(app)/mingo/hooks/use-mingo-realtime-subscription.ts:297
7 🔴 55 low — review closely Inline query key in mingo-dialog cache write during stream-state sync src/app/(app)/mingo/hooks/use-mingo-realtime-subscription.ts:246
8 🔴 45 low — review closely Stray positional-arg style guard missing for dispatch-level redelivery gate reset only on dialogId change src/app/(app)/mingo/hooks/use-mingo-realtime-subscription.ts:223
9 🔴 35 low — review closely Reconnect-count effect can miss a reconnection if it fires between renders src/app/(app)/mingo/hooks/use-mingo-realtime-subscription.ts:293
10 🔴 40 low — review closely deviceQueryKeys used for cache key instead of the mandated admin-query-keys module src/app/(app)/devices/hooks/use-device-details.ts:367
11 🟡 65 medium isPrivateIp() misclassifies public IPv4 addresses in 100.64.0.0/10 (CGNAT) and treats fe80/fc00 with dot-notation matching that never matches IPv6 src/app/(app)/devices/hooks/use-device-details.ts:113
12 🔴 25 low — review closely Invalid Fleet host ID logged with console.warn instead of using the app's toast/logging convention src/app/(app)/devices/hooks/use-device-details.ts:332
13 🔴 35 low — review closely Inline query key arrays used instead of named constants from admin-query-keys src/app/(app)/mingo/hooks/use-mingo-chat.ts:205
14 🔴 30 low — review closely console.error used for user-facing failure diagnostics instead of a structured logger src/app/(app)/mingo/hooks/use-mingo-chat.ts:209
15 🔴 55 low — review closely Inline query keys used instead of a shared admin-query-keys constant src/app/(app)/mingo/hooks/use-mingo-dialog-selection.ts:173
16 🔴 20 low — review closely Raw fetch-style POST /chat/graphql calls bypass react-relay, contradicting the Relay-only GraphQL data-fetching rule src/app/(app)/mingo/hooks/use-mingo-dialog-selection.ts:178
17 🔴 35 low — review closely Inline queryKey ['mingo-dialogs'] not sourced from admin-query-keys.ts src/app/(app)/mingo/hooks/use-mingo-dialog.ts:59
18 🔴 55 low — review closely useMingoDialog createDialog race: concurrent calls can silently return stale dialogId src/app/(app)/mingo/hooks/use-mingo-dialog.ts:106
19 🔴 50 low — review closely Inline queryKey for mingo-dialogs infinite query, not imported from a shared constants module src/app/(app)/mingo/hooks/use-mingo-dialogs.ts:62
20 🔴 15 low — review closely Raw fetch-style POST /chat/graphql call for dialogs list bypasses react-relay src/app/(app)/mingo/hooks/use-mingo-dialogs.ts:85
21 🔴 40 low — review closely Policy/query hook query keys defined locally rather than imported from admin-query-keys.ts src/app/(app)/monitoring/hooks/use-policies.ts:37
22 🟡 70 medium Unused _fetchPolicy function left dead in production hook file src/app/(app)/monitoring/hooks/use-policies.ts:55
23 🔴 25 low — review closely organizationGuardrailsQueryKeys declared locally instead of via admin-query-keys src/app/(app)/settings/ai-settings/components/guardrails/use-organization-guardrails.ts:17
24 🔴 20 low — review closely Raw POST GraphQL fetch to /chat/graphql instead of react-relay src/app/(app)/settings/ai-settings/components/guardrails/use-organization-guardrails.ts:90
25 🔴 30 low — review closely Inline query key array declared instead of imported constant in agentAiConfigQueryKeys src/app/(app)/settings/ai-settings/hooks/use-agent-ai-config.ts:17
26 🔴 0 low — review closely Duplicate GraphQL error-unwrapping boilerplate repeated across multiple hooks src/app/(app)/settings/ai-settings/hooks/use-agent-ai-config.ts:55
27 🔴 40 low — review closely queryHostsQueryKeys and policyResponseHostsQueryKeys declared inline instead of imported from admin-query-keys src/app/(app)/monitoring/query/hooks/use-query-hosts.ts:13
28 🔴 55 low — review closely fetchAllQueryHosts loops without bound, risking infinite fetch if API misreports has_next_results src/app/(app)/monitoring/query/hooks/use-query-hosts.ts:20
29 🔴 35 low — review closely Query key invalidation uses local query-key modules instead of centralized admin-query-keys.ts src/app/(app)/tickets/hooks/use-take-over-ticket.ts:12
30 🟡 60 medium GraphQL error extraction relies on array-index[0] without checking for multiple userErrors src/app/(app)/tickets/hooks/use-take-over-ticket.ts:37
31 🔴 25 low — review closely customerDetailsQueryKeys used but not confirmed to be sourced from admin-query-keys.ts src/app/(app)/customers/components/customer-details-view.tsx:29
32 🔴 55 low — review closely Silent fallback to canArchive=false on check failure could allow archiving when it shouldn't be permitted src/app/(app)/customers/components/customer-details-view.tsx:116
33 🔴 35 low — review closely Inline query key literal used instead of admin-query-keys constant src/app/(app)/monitoring/query/hooks/use-query-devices-table.ts:37
34 🔴 55 low — review closely React Query cache keys declared as inline string arrays instead of imported from a central query-keys module src/app/(app)/mingo/hooks/use-mingo-dialog-actions.ts:60
35 🔴 40 low — review closely Guardrails query keys declared as local literals instead of centralized admin-query-keys constants src/app/(app)/settings/ai-settings/components/guardrails/use-guardrails-policies.ts:22
36 🔴 30 low — review closely Inline query key array declared instead of imported constant in clientViewQueryKeys src/app/(app)/settings/ai-settings/hooks/use-client-view.ts:14
37 🔴 25 low — review closely Inline query key array declared in useOrganizationClientAiConfig, not imported from a central admin-query-keys module src/app/(app)/settings/ai-settings/hooks/use-organization-ai-config.ts:16
38 🔴 40 low — review closely usersQueryKeys declared inline in the hook file instead of imported from admin-query-keys.ts src/app/(app)/settings/hooks/use-users.ts:50
39 🔴 40 low — review closely ticket-dialog-messages queryKey built as an inline array literal, not from a shared key module src/app/(app)/tickets/hooks/use-ticket-messages.ts:10
40 🔴 55 low — review closely Inline query key for assignee options bypasses centralized key registry src/app/(app)/tickets/hooks/use-ticket-options.ts:152
41 🔴 45 low — review closely Ticket query keys declared inline in ticketsQueryKeys/dialogsQueryKeys instead of imported from a central admin-query-keys module src/app/(app)/tickets/utils/query-keys.ts:22
42 🔴 25 low — review closely Inline query key array instead of imported constant from admin-query-keys.ts src/app/(app)/customers/hooks/use-customers.ts:93
43 🔴 35 low — review closely GraphQL query key/tools cache not using admin-query-keys constant src/app/(app)/settings/hooks/use-api-keys.ts:20
44 🔴 30 low — review closely Race condition: apiKey enabled/disabled state overwritten by stale updateApiKey response src/app/(app)/settings/hooks/use-api-keys.ts:83
45 🔴 15 low — review closely Ticket query key composed inline via dialogsQueryKeys.list rather than confirmed centralized constant import src/app/(app)/tickets/hooks/use-tickets-query.ts:44

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: c0694bf2-6181-476d-893d-a771cd4f4765

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

ClickUp task: CU-86akbhhue MULTIPLA-002-2 multi-repo review findings (8 PRs)

@flamingo flamingo Bot changed the title fix(MULTIPLA-002-2): 46 review findings across 26 files fix(MULTIPLA-002-2): CU-86akbhhue 46 review findings across 26 files Sep 8, 2026
@michaelassraf

Copy link
Copy Markdown
Contributor

…sages query keys, drop dead _fetchPolicy [preview:none]
@michaelassraf michaelassraf changed the title fix(MULTIPLA-002-2): CU-86akbhhue 46 review findings across 26 files fix(MULTIPLA-002-2): CU-86akbhhue name the fleet token and ticket messages query keys, drop dead _fetchPolicy Sep 15, 2026
@michaelassraf
michaelassraf force-pushed the ai-fix/multipla-002-2-18ce84f8-c0694bf2 branch from 4e0693a to 3d31abe Compare September 15, 2026 18:41
@michaelassraf

Copy link
Copy Markdown
Contributor

Reviewed against current main and rebuilt: of the 46 findings, three survive: a named FLEET_API_TOKEN_QUERY_KEY in use-live-campaign.ts, a named ticketDialogMessagesQueryKey builder in use-ticket-messages.ts (both byte-identical keys), and removal of the unreferenced _fetchPolicy in use-policies.ts.

Dropped: almost every other hunk imports a module that does not exist in this repo (admin-query-keys under several paths, @/lib/logger, @/lib/query-keys/*, mingo/query-keys), use-policies.ts deleted the still-imported policiesQueryKeys, and use-dashboard-stats.ts contained leftover generator text. Several hunks also changed runtime behaviour outside this rule (dev bearer token moved from the WebSocket URL into the auth frame, the customer archive-check flow, private-IP classification, a full useApiKeys rewrite onto React Query, error copy). The assignee-options key was already named on main by #275.

Kept changes pass tsc --noEmit (0 errors), eslint (both configs), prettier and use-live-campaign.test.tsx.

@michaelassraf
michaelassraf marked this pull request as ready for review September 15, 2026 18:41
@michaelassraf
michaelassraf requested review from a team as code owners September 15, 2026 18:41
@michaelassraf
michaelassraf merged commit 31da175 into main Sep 15, 2026
19 of 21 checks passed
@michaelassraf
michaelassraf deleted the ai-fix/multipla-002-2-18ce84f8-c0694bf2 branch September 15, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant