Repository navigation
fix(frenet): Update order delivery status from Frenet tracking again - #866
Merged
Merged
Conversation
Tracking codes were never read back from Firestore (`data.toDate()` on the whole document threw), so the hourly cron hung until timeout and orders were never updated by Frenet tracking. Delivered and old codes were never cleaned. - Read `createdAt` from each tracking doc - Only track codes from the last 60 days, so customers of old orders are not notified; older codes are removed by the daily cleanup, which now awaits - Store tracking status as string so delivered codes match the queries - Fail Frenet API calls after 10s instead of hanging on HTTP errors - Await removal of delivered codes and stop logging an error when none exist Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011YfvCxVikTh42WGmNu6chf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011YfvCxVikTh42WGmNu6chf
…ng runs - Propagate Firestore errors in remove, update and code listing instead of leaving promises pending forever - Process tracking codes 10 at a time and raise cron timeout to 540s - Remove old codes on every run with BulkWriter, not only at 23h Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011YfvCxVikTh42WGmNu6chf
… week Fulfillments from Frenet events older than 7 days are posted with `customer_notified: true`, so the emails app skips them while the order status and other apps still get the update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011YfvCxVikTh42WGmNu6chf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
O rastreio automático da Frenet nunca funcionou no v2:
getAllchamavadata.toDate()sobre o documento inteiro (em vez dedata.createdAt.toDate()), o erro estourava dentro do.thene a promise nunca resolvia. O cron horário ficava pendurado até o timeout, nenhum pedido era atualizado e a limpeza das 23h nunca rodava. Encontrado na review adversarial do #863.Mudanças
createdAtcorretamente emgetAllegetAllDelivered.customer_notified: true: o status do pedido é atualizado, mas o app de e-mails não notifica o cliente.clearroda a cada execução (antes só às 23h) comBulkWriter, para esvaziar a coleção acumulada.remove,update,savee nas listagens agora propagam, em vez de deixar a promise pendurada.update(antes era número, e as consultas!= '9'/== '9'nunca casavam com entregues). As consultas aceitam'9'e9.removeDeliveredToFirestoreespera as remoções e não loga erro quando não há códigos entregues.Validação
tsc --noEmit, ESLint e build do pacote. Não houve teste em runtime contra o Firestore.🤖 Generated with Claude Code
https://claude.ai/code/session_011YfvCxVikTh42WGmNu6chf