From 86039ecfe417bc2d9147c3c3ca0be164542a41be Mon Sep 17 00:00:00 2001 From: Gustavo Date: Mon, 24 Aug 2026 20:56:02 -0300 Subject: [PATCH] fix(v2): Data Table - Buscar Envios Recentes needs alwaysOutputData (real bug found in DEV validation) Found running the real validation execution against DEV: the envios digest table starts empty (the normal state for every day until the first successful send), the "get" operation returned 0 rows, and n8n does not execute downstream nodes when a node outputs 0 items -- so Code - Guard de Envio Slack, the IF, the real Slack node, and everything else in the send branch silently never ran. This would have broken the happy path on every single day in production, not just an edge case. Fixed with alwaysOutputData: true on that node (forces at least one output item even with 0 matches; the resulting empty {} item doesn't false-positive in alreadySentSuccessfully since none of its fields match a real record's shape). Re-ran the validation execution after the fix: Code - Guard de Envio Slack now runs correctly (shouldSend: false, reason: 'send_disabled' with SEND_ENABLED=false as expected), and the IF node's true branch (Slack - Enviar Mensagem) is confirmed to never fire while disabled. Added a regression test asserting alwaysOutputData on this node. 157/157 tests passing. Co-Authored-By: Claude Sonnet 5 --- n8n/deployed/coordenador-glpi-v2.n8n.json | 3 ++- n8n/workflow.template.json | 3 ++- tools/build-workflow.test.js | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/n8n/deployed/coordenador-glpi-v2.n8n.json b/n8n/deployed/coordenador-glpi-v2.n8n.json index 507e24f..cdaa57c 100644 --- a/n8n/deployed/coordenador-glpi-v2.n8n.json +++ b/n8n/deployed/coordenador-glpi-v2.n8n.json @@ -715,7 +715,8 @@ } ] } - } + }, + "alwaysOutputData": true }, { "id": "code-guard-envio-slack", diff --git a/n8n/workflow.template.json b/n8n/workflow.template.json index 2d74125..6bd4d86 100644 --- a/n8n/workflow.template.json +++ b/n8n/workflow.template.json @@ -715,7 +715,8 @@ } ] } - } + }, + "alwaysOutputData": true }, { "id": "code-guard-envio-slack", diff --git a/tools/build-workflow.test.js b/tools/build-workflow.test.js index 70542b2..1292e74 100644 --- a/tools/build-workflow.test.js +++ b/tools/build-workflow.test.js @@ -157,6 +157,17 @@ test('guard de envio roda antes do Slack e existe IF de decisao', () => { assert.equal(ifConn.main[1][0].node, 'Code - Pular Envio Slack'); }); +test('Data Table - Buscar Envios Recentes tem alwaysOutputData=true (bug real: 0 linhas -- caso normal do dia a dia -- parava o branch de envio inteiro)', () => { + // Regressao: rodou de verdade contra o DEV -- a tabela de envios estava vazia (nenhum envio + // ja aconteceu, o caso NORMAL de todo dia), o node "get" devolveu 0 itens, e o n8n nao + // executa nenhum node downstream quando o node anterior produz 0 itens. Isso significa que + // Code - Guard de Envio Slack, o IF, o Slack real, tudo -- nunca rodava em um dia comum. + // alwaysOutputData:true garante pelo menos 1 item de saida mesmo com 0 linhas encontradas. + const wf = buildWorkflow(); + const node = wf.nodes.find((n) => n.name === 'Data Table - Buscar Envios Recentes'); + assert.equal(node.alwaysOutputData, true, 'sem isso, um dia sem envios anteriores nunca chega a avaliar se deve enviar'); +}); + test('nodes n8n-nodes-base.dataTable usam valores de operation validos (bug real: "getRows" nao existe, e "get")', () => { // Regressao: n8n_manage_datatable (a ferramenta MCP) usa a acao "getRows", mas o node // nativo n8n-nodes-base.dataTable usa o valor de parametro "get" -- nomes parecidos,