Repository navigation
WA.Auto: incluir processos encerrados com movimentação comprovada - #44
Conversation
|
Deployment failed for project private with the following error: Learn More: https://vercel.com/assecom?upgradeToPro=build-rate-limit |
|
Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here. |
✅ Deploy Preview for lexispredict ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bad063feaa
ℹ️ 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".
| const allowed=prepareMovementAlert(closed); | ||
| expect(allowed.reason).toBe('ok'); |
There was a problem hiding this comment.
Update the conflicting closed-case regression test
This new ok expectation directly conflicts with src/lib/wa-movement-builder.test.ts:36-38, which still expects the same prepareMovementAlert({...base, status:'ENCERRADO'}) call to return closed. Because prepareMovementAlert now always passes includeClosed:true, the pre-existing test will receive ok, causing the full Vitest suite to fail until that assertion is updated.
Useful? React with 👍 / 👎.
| } else entries.push(alert); | ||
| } else { | ||
| entries.push(alert); | ||
| if(isCasoEncerrado(row))counts.closedEligible++; |
There was a problem hiding this comment.
Count closed eligibility after removing prior notices
Incrementing closedEligible here counts every otherwise valid closed alert before wa_notice_prior removes already queued or sent events. For example, a portfolio containing one previously sent closed-case event produces eligible: 0 but closedEligible: 1, while the UI describes that case as eligible and included in the selection. Derive this count from pending, or preserve closed status on alerts so the preview reports only notices that can actually be queued.
Useful? React with 👍 / 👎.
| {kind==='publication' | ||
| ? 'Considera toda a carteira da empresa, de todos os responsáveis. Envia apenas para processos abertos com movimentação DataJud/DJEN posterior ao último retorno marcado. Eventos antigos e processos encerrados são excluídos.' | ||
| : 'Consulta toda a carteira da empresa. Prepara um aviso somente quando há movimentação posterior ao último retorno, excluindo encerrados, bloqueados e avisos já registrados.'} | ||
| ? 'Considera toda a carteira da empresa, de todos os responsáveis. Considera também processos marcados como encerrados. Envia somente movimentação DataJud/DJEN posterior ao último retorno, com teor oficial verificável, consentimento e sem bloqueio.' | ||
| : 'Consulta toda a carteira da empresa. Prepara um aviso por novidade posterior ao último retorno, inclusive de processos marcados como encerrados. Bloqueios, avisos repetidos e eventos sem prova verificável são excluídos.'} |
There was a problem hiding this comment.
Remove the contradictory closed-case exclusion notice
The updated description tells managers that closed processes are included, but the same confirmation dialog still states at lines 256-259 that the system excludes closed processes. Since the backend now includes them, an operator can start a customer-facing bulk campaign based on a false exclusion summary; the final notice should accurately describe the recipients before enabling the send.
Useful? React with 👍 / 👎.
| // Movimento posterior confirmado pode ocorrer em uma carteira marcada como encerrada. | ||
| // Apenas os avisos de movimentação da carteira optam por incluir esses casos; | ||
| // um status interno nunca é prova de encerramento definitivo no tribunal. | ||
| if(isCasoEncerrado(row) && !opts.includeClosed)return {ready:null,reason:'closed'}; |
There was a problem hiding this comment.
Allow verified terminal events for already-closed cases
When an already-closed case has a fresh official terminal event, this new bypass lets it reach the source checks, but the unchanged guards at lines 103-104 and 115-117 still return needs_source_review for terminal DataJud descriptions and verified DJEN evidence. Those guards previously only encountered open cases—the DJEN comment explicitly says they prevent announcing closure while the portfolio remains open—so the newly supported closed case is never queued for precisely the extinction, final dismissal, or archival movement that commonly accompanies closure. Apply the terminal safeguard conditionally when the portfolio is still open, or otherwise handle verified terminal evidence for closed rows.
Useful? React with 👍 / 👎.
Objetivo
Notificar clientes de toda a carteira W1 Capital, incluindo registros marcados
ENCERRADO, quando há nova movimentação DataJud/DJEN posterior ao último retorno.Alterações
due) mantêm a regra anterior para evitar comunicações sem novidade.Segurança de produção
O Supabase mostra automação diária desativada, campanha mais recente pausada e cron
lexis-wa-movementdesativado. Este PR não os reativa e não faz disparos; a conexão real WA.Auto precisa ser conferida antes de retomar envio em massa.Verificação
Executar testes CI e conferir previamente uma amostra dos avisos/entregas no WA.Auto.