β¨ feat: add generation error business hook#14195
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e558d3b947
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // 3. Refresh generation batches to show the real data | ||
| await store.refreshGenerationBatches(); | ||
| } catch (error) { | ||
| handleGenerationPromptModerationError(error); |
There was a problem hiding this comment.
Limit moderation hook to prompt-policy errors
This catch now covers removeGenerationBatch and refreshGenerationBatches in addition to imageService.createImage, so non-moderation failures (for example, the existing batch-removal failure path) will also call handleGenerationPromptModerationError. That can misclassify infra/state-sync errors as prompt moderation events in business builds and trigger the wrong error handling side effects; the hook should be invoked only when the creation call fails with a moderation-related error (or after explicit error-type filtering).
Useful? React with πΒ / π.
Codecov Reportβ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## canary #14195 +/- ##
==========================================
- Coverage 67.85% 67.85% -0.01%
==========================================
Files 2227 2228 +1
Lines 191364 191383 +19
Branches 23747 19160 -4587
==========================================
+ Hits 129847 129854 +7
- Misses 61388 61400 +12
Partials 129 129
Flags with carried forward coverage won't be shown. Click here to find out more.
π New features to boost your workflow:
|
β¦ paths await expect(act(...)).rejects.toThrow() can settle before the inner async catch handler runs when act schedules React commits between multiple awaited setState calls. Move try/catch inside act so the test waits for the full createImage/recreateImage rejection chain before asserting the moderation error handler was called.
π» Change Type
π Related Issue
Related to LOBE-8248
π Description of Change
π§ͺ How to Test
Validation:
bunx eslint --fix src/business/client/handleGenerationPromptModerationError.ts src/store/image/slices/createImage/action.ts src/store/image/slices/createImage/action.test.ts src/store/video/slices/createVideo/action.tsNote: running
bunx vitest run --silent=passed-only src/store/image/slices/createImage/action.test.tsin this local checkout currently fails during test bootstrap withlocalStorage.getItem is not a functionbefore collecting tests.πΈ Screenshots / Videos
π Additional Information
The new submodule hook is intentionally generic and contains no cloud-specific implementation details.