Skip to content

fix(OFFE-009): CU-17tkuw5uezw fetchChunks swallows failures with console.error instead of surfacing via toast/getErrorMessage - #542

Draft
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/offe-009-26108135-88e36ec6
Draft

flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/offe-009-26108135-88e36ec6

Conversation

@flamingo

@flamingo flamingo Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes findings from rule OFFE-009 — fetchChunks swallows failures with console.error instead of surfacing via toast/getErrorMessage.

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 🔴 55 low — review closely fetchChunks swallows failures with console.error instead of surfacing via toast/getErrorMessage src/app/(app)/tickets/services/ticket-service.ts:418

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: 88e36ec6-9bb0-474f-b0a0-4def1af6bdb7

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-17tkuw5uezw OpenFrame OSS frontend UI and billing fixes (4 PRs)

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

1 finding(s) fixed in this draft — 1 explained inline on the diff; 1 low-confidence hunk(s) need close review before merging.

Comment on lines 424 to 430
const response = await apiClient.get<ChunkData[]>(url);

if (!response.ok) {
console.error(`Failed to fetch ${chatType} chunks:`, response.status);
return [];
throw new Error(response.error || `Failed to fetch ${chatType} chunks (${response.status})`);
}

return response.data || [];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 fetchChunks swallows failures with console.error instead of surfacing via toast/getErrorMessage

In fetchChunks (ticket-service.ts), replaced the console.error(...); return []; branch with throw new Error(response.error || ...), matching the error-surfacing pattern already used by sendMessage/approveRequest/rejectRequest in this same service class, so the failure propagates to the caller instead of being silently swallowed as an empty array. This is a service-layer file with no access to useToast/React hooks, so the actual toast/getErrorMessage presentation must happen in the calling component/hook that invokes fetchChunks (consistent with how other service methods in this file throw and presumably let callers handle UI feedback); that caller-side wiring is outside this file and not verified here, so full resolution of OFFE-009's "surface via toast" requirement depends on the call site already handling thrown errors from this service (as it apparently does for the sibling methods).

🤖 Prompt for AI agents
In src/app/(app)/tickets/services/ticket-service.ts around line 418, review and complete this code-review fix: fetchChunks swallows failures with console.error instead of surfacing via toast/getErrorMessage.
What the draft fix changed: In `fetchChunks` (ticket-service.ts), replaced the `console.error(...); return [];` branch with `throw new Error(response.error || ...)`, matching the error-surfacing pattern already used by `sendMessage`/`approveRequest`/`rejectRequest` in this same service class, so the failure propagates to the caller instead of being silently swallowed as an empty array. This is a service-layer file with no access to `useToast`/React hooks, so the actual toast/getErrorMessage presentation must happen in the calling component/hook that invokes `fetchChunks` (consistent with how other service methods in this file throw and presumably let callers handle UI feedback); that caller-side wiring is outside this file and not verified here, so full resolution of OFFE-009's "surface via toast" requirement depends on the call site already handling thrown errors from this service (as it apparently does for the sibling methods).
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.

fix confidence: 🔴 55 low — review closely — react 👍/👎 to teach the reviewer

@flamingo flamingo Bot changed the title fix(OFFE-009): fetchChunks swallows failures with console.error instead of surfacing via toast/getErrorMessage fix(OFFE-009): CU-17tkuw5uezw fetchChunks swallows failures with console.error instead of surfacing via toast/getErrorMessage Oct 5, 2026
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.

0 participants