fix(shared): diagnose blocked 403 generation errors#297
Conversation
There was a problem hiding this comment.
Review mode: initial
Findings
No blockers or major issues found. The PR is well-structured and addresses the stated problem.
- The new
looksLikeGatewayWafBlockfunction correctly identifies gateway/WAF blocked messages using common keywords. The integration indiagnoseGenerateFailureproperly prioritises the blocked check before falling through to the generic 403 → keyInvalid path. - Unit tests in
diagnostics.test.tsand integration tests instore.test.tscover the new classification. The test verifies toast description, display_message, and diagnostic_category. - Locale strings are added for all four supported languages (en, es, pt-BR, zh-CN).
- A changeset is included with appropriate patch bumps for
@open-codesign/shared,@open-codesign/desktop, and@open-codesign/i18n.
Minor:
- The store test assertion (
toContain('gateway or reverse proxy blocked')) is brittle if the locale description wording changes. Consider checking the i18n key or a more stable substring. Not a merge blocker.
Regarding the linked issue #124: The PR body says "Fixes #124". The issue content was not accessible during this review run, so the completeness of the fix cannot be fully verified from the issue's acceptance criteria. However, the diff aligns with the PR title and description — classifying 403 blocked generation errors as gateway/WAF blocks. If the issue has additional requirements (e.g., handling other blocked response patterns or UI changes), they are not reflected here. Consider confirming with the author or updating the issue reference to Refs #124 if this is a partial implementation.
Summary
The PR adds a new diagnostic category gateway-waf-blocked for 403 generation errors that include a blocked-request message. This improves the user experience by showing a more specific cause and suggested fix (check proxy allowlist/headers) instead of a generic invalid API key message. All code paths are tested, and translations are provided. Changes are localized and backward-compatible.
Open-CoDesign Bot
Summary
Fixes #124
Validation