-
Notifications
You must be signed in to change notification settings - Fork 0
Phase 2: Fix 7 critical bugs from production audit #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: phase-1/auth-cors-ratelimit
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -206,7 +206,7 @@ function applyEventToSession(prev: ZPSession | null, data: Record<string, unknow | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| card_id: cardId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| video_id: String(data.video_id || cardId), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| title: stringifyValue(data.title) || stringifyValue(data.video_id) || cardId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| score: Number(data.score || 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| score: Number(data.score ?? 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| status: (String(data.status || "analyzing") as CardStatus), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reason: stringifyValue(data.reason), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reason_code: stringifyValue(data.reason_code), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -245,22 +245,22 @@ function applyEventToSession(prev: ZPSession | null, data: Record<string, unknow | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const merged: ZPCard = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...current, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...nextPatch, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| score: nextPatch.score || current.score, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reason: nextPatch.reason || current.reason, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reason_code: nextPatch.reason_code || current.reason_code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| score_breakdown: nextPatch.score_breakdown || current.score_breakdown, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| domain: nextPatch.domain || current.domain, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| papers_found: nextPatch.papers_found || current.papers_found, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| competitors_found: nextPatch.competitors_found || current.competitors_found, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| saturation: nextPatch.saturation || current.saturation, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| novelty_boost: nextPatch.novelty_boost || current.novelty_boost, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| analysis_step: nextPatch.analysis_step || current.analysis_step, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_step: nextPatch.build_step || current.build_step, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_phase: nextPatch.build_phase || current.build_phase, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_node: nextPatch.build_node || current.build_node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| repo_url: nextPatch.repo_url || current.repo_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| live_url: nextPatch.live_url || current.live_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| thread_id: nextPatch.thread_id || current.thread_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| score: nextPatch.score ?? current.score, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reason: nextPatch.reason ?? current.reason, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reason_code: nextPatch.reason_code ?? current.reason_code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| score_breakdown: nextPatch.score_breakdown ?? current.score_breakdown, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| domain: nextPatch.domain ?? current.domain, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| papers_found: nextPatch.papers_found ?? current.papers_found, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| competitors_found: nextPatch.competitors_found ?? current.competitors_found, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| saturation: nextPatch.saturation ?? current.saturation, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| novelty_boost: nextPatch.novelty_boost ?? current.novelty_boost, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| analysis_step: nextPatch.analysis_step ?? current.analysis_step, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_step: nextPatch.build_step ?? current.build_step, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_phase: nextPatch.build_phase ?? current.build_phase, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_node: nextPatch.build_node ?? current.build_node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| repo_url: nextPatch.repo_url ?? current.repo_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| live_url: nextPatch.live_url ?? current.live_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| thread_id: nextPatch.thread_id ?? current.thread_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+248
to
+263
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While switching from
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const cards = [...prev.cards]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for initializing the SSE client is duplicated in both the success path (when no existing result is found) and the error path of the
getBrainstormResultcall. Refactoring this into a helper function within theuseEffectwould improve maintainability and reduce code duplication.