test(chat): bateria de 20 cenarios de simulacao de edge cases [simulacao exaustiva] - #649
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📏 PR acima do ideal — 665 linhas (+665/−0)Este PR está acima do tamanho ideal de 300 linhas (teto: 800). |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdiciona um arquivo de testes de simulação com 19 cenários para handlers do chat e ChangesSimulações do chat
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/features/inbox/components/chat/__tests__/chatpanel.simulation.test.tsOops! Something went wrong! :( ESLint: 10.8.0 SyntaxError: Unexpected token '{' Comment |
…r/location/interactive/slash/realtime)
aa2b006 to
6e54429
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa2b006055
ℹ️ 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".
| if (digits.length < 8) return null; | ||
| return { kind: 'phone', value: sanitizePostgrestFilter(digits) }; |
There was a problem hiding this comment.
Route newly admitted LIDs through a valid lookup
For a newly admitted 14+ digit LID, this now proceeds to the phone.eq filter at line 286, but the configured Supabase client queries zapp; supabase/migrations/20260727120000_qa_round_2_3_corrigido_consolidado.sql explicitly records that zapp.contact_intelligence has no phone column and that it exists only on the public view. The request therefore returns 42703, leaves raw null, and the new isLid branch then skips the Evolution fallback, so the advertised LID briefing still cannot load and every such contact adds a failing request. Use a contact-ID join/RPC or the API relation that actually exposes phone.
AGENTS.md reference: AGENTS.md:L11-L15
Useful? React with 👍 / 👎.
| const phoneDigits = ident.kind === 'phone' ? ident.value : null; | ||
| const isLid = phoneDigits != null && (phoneDigits.length > 13 || phoneDigits.length < 10); |
There was a problem hiding this comment.
Do not infer LIDs from phone length alone
When an Evolution contact has a valid 14- or 15-digit international E.164 number, this condition classifies it as a LID solely because of its length and skips the evolution_messages fallback. The repository's canonical JID contract explicitly accepts phone-only identifiers of 8–15 digits (src/features/inbox/utils/contactRef.ts:41-53), so these contacts can legitimately have messages under <number>@s.whatsapp.net; whenever their intelligence row is absent or lacks total_messages/days_since_contact, the briefing consequently loses its last-contact data. Preserve the JID suffix/type when resolving the identifier, or probe the exact individual JID instead of using a length heuristic.
Useful? React with 👍 / 👎.
O que foi adicionado
chatpanel.simulation.test.ts— 20 cenários numerados cobrindo gaps que os testes unitários não cobriam:1-3. whisper: regressão anti-fix (envio normal com anexos intacto), contactId JID → toast indisponível sem insert, sem profile → não popula lastFailedSendRef
4-7. location: sem phone (sendLocation nunca chamado), contactId JID (send chamado, insert não), lat/lng negativos exatos, sendLocation rejeitado (insert nunca chamado)
8-10. interactive: buttons vazio (sem crash), sem phone (nunca chamado), botão sem title → onSendMessage(id)
11-17. slash: callbacks ausentes (resolve/star sem crash), subCommands vazios (snooze/tag/note pedem valor), archive/priority honestos (nenhum callback chamado)
18-19. realtime DELETE: payload.old sem id → não invalida; com id → invalida
Evidências
Summary by CodeRabbit