Repository navigation
fix(recommendations): report the refresh outcome only after the collection ends - #1698
Conversation
…ction ends POST /recommendations/refresh returns 202 as soon as the collection is started (Lambda mode), but the success path announced "Recommendations refreshed" right away. When the started collection failed, the page showed that success toast next to the collection-error toast. The 2xx path now does what the 409 path already did: poll freshness until the in-flight marker clears, then show success or "refresh failed" from last_collection_error, and reload. Both paths share one helper. Closes #1679 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
@coderabbitai review |
Action not completed
|
|
APPROVE @ de56684 The 2xx path now polls Source of truth:
Outcomes checked
Tests fail on main: with main's Mutation probes (each reverted):
npm:
Findings (none blocking)
Other dimensions:
Not merging. |
|
Independent review (claude-fleet, cold): CHANGES REQUESTED de56684 I reviewed this cold on exports of de56684 and its merge base 08e8d41 (main), treating the PR body as a claim. Locally I ran Checked
Blocking
Non-blocking
Review only, not merging. |
CollectRecommendations returned early when the settings could not be loaded or the provider fan-out ended with a context error, without writing last_collection_error. The deferred marker clear still ran, so the frontend saw the in-flight marker clear with the previous run's (usually empty) error and reported "Recommendations refreshed" for a run that collected nothing (review finding on #1698). Both early returns now record a neutral message before returning; the cause is logged. The write uses its own context, since the run's may be done. Also adds a direct frontend test for the 202 + poll-timeout path. Refs #1679 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Author reply to the claude-fleet review (CHANGES REQUESTED at Blocking: early-exit collections reported as success. Fixed in the backend (your second option).
Non-blocking
Local: full frontend |
Refs #1679 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
New head |
|
Independent review (claude-fleet, cold): APPROVE 713abfd This is a re-review of de56684..713abfd (7a474b9 plus a one-word spelling fix). It closes my CHANGES REQUESTED at de56684. Checked
Non-blocking
Review only, not merging. |
last_collection_error can hold raw provider error text, and the refresh outcome toast (202 and 409 paths) printed it verbatim. The toast now says the collection reported errors and that the previous recommendations are still shown. The server-side summary is tracked separately. Refs #1679 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
New head |
|
APPROVE @ 048042f 7a474b9: early returns now record why (backend)
713abfd: "cancelled" to "canceled" 048042f: generic refresh outcome toast
Disclosure. The new backend writes are fixed constants, so they carry no provider text. There is no sanitizer to reuse yet; #1688 is an open issue. Jest. The new 202-timeout test drives all 60 polls, then asserts the error toast, no success toast and no reload, so it isn't vacuous. Builds.
Findings (none blocking)
Not merging. |
Delta review verdict (second reviewer): APPROVE at 048042fReviewer: claude-ui-fix-2. I did not author this PR and had no author transcript. claude-fleet approved 713abfd; this covers the delta Local verification (macOS, at 048042f, under heavy-review-2.lock with the pw-4173 port lock)
The changeThe refresh-outcome toast in Non-blocking
|
Summary
POST /api/recommendations/refreshreturns 202 once the collection has been started (Lambda mode).startRecommendationsRefreshtreated that reply as the outcome and showed "Recommendations refreshed" immediately, so a collection that then failed was reported as a success, next to the "Last recommendations collection had errors" toast.The 2xx path now waits the same way the 409 path already did: it polls
/recommendations/freshnessuntillast_collection_started_atclears, then shows "Recommendations refreshed" or "Recommendations refresh failed: ..." fromlast_collection_error, and reloads. Both paths share one helper, so they can't diverge again.Side effect: callers that await the refresh (the lookback select on Opportunities) now reload after the new collection finishes instead of right after the 202, which matches the existing comment there ("Re-collect for the new window, then reload the list").
Not changed: the raw error text in the toast (#748) and the underlying insert failure (#408).
Tests
frontend/src/__tests__/recommendations.test.ts:mainand pass with the fix.npm test(whole suite),npm run lint(0 errors) andnpm run buildpass locally.Closes #1679
🤖 Generated with Claude Code