Files
SLACK_COORD_RELATORIO/docs/superpowers/notes/2026-08-24-schema-introspection.md
T
GustavoandClaude Sonnet 5 af48ea69d8 feat(v2): create DEV data tables, deploy V2 workflow (inactive), record schema introspection
- Fixed 3 remaining "return [...].join(...)" false-positive triggers in
  logic/message.js (n8n-mcp's static validator flags any inner return-array
  pattern as if it were the node's own output shape) by extracting each to
  a named variable before joining. All 3 occurrences of the pattern lived
  inside buildTopMessage/buildCoordinationDigest, which get fully inlined
  into both "Code - Montar Mensagem Curta" and "Code - Montar Digest
  Coordenacao" (whichever function is actually called, the whole module is
  inlined), so both nodes needed the same fix.
- Deployed [DEV] Coordenador GLPI - Chamados Abertos v2 (Shadow)
  (id y6JFEnp7Z2IJEUe2) to devn8n.gtigrupo.com.br: 36 nodes, inactive,
  n8n_validate_workflow reports valid:true (0 errors, 1 minor deprecation
  warning on continueOnFail).
- Ran n8n_autofix_workflow: 6 safe typeVersion upgrades applied and mirrored
  back into n8n/workflow.template.json so future rebuilds stay in sync.
- Found and fixed a real safety issue: creating the workflow before the
  "MySQL GLPI - Coordenador" credential existed caused n8n to silently
  auto-bind the 3 MySQL nodes to the only other mySql-type credential in
  the instance (an unrelated Asaas billing credential). Cleared those
  credential bindings (both live and in the template) rather than leave
  them pointing at the wrong database.
- Created the two Data Tables the pipeline needs: coordenador_glpi_memoria
  (17 columns) and coordenador_glpi_shadow_runs (6 columns).
- Documented the pending schema introspection (glpi_tickettasks.state
  column name unverified, blocked on the MySQL credential) and an unrelated
  discovery (two other Data Tables, dev_glpi_v2_insights_memory and
  dev_glpi_v2_run_history, appeared on the DEV instance mid-session from a
  source other than this one) in docs/superpowers/notes/.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 15:47:48 -03:00

2.7 KiB

Introspecção de schema GLPI — Task 14

Status: bloqueado, pendente da credencial MySQL.

O que falta confirmar

A credencial MySQL GLPI - Coordenador ainda não existe no n8n DEV (devn8n.gtigrupo.com.br) — nem em nenhum outro lugar acessível a mim. Sem ela não há como executar SHOW COLUMNS nem rodar a query real.

Quando a credencial existir, rodar antes de qualquer execução real do workflow V2:

SHOW COLUMNS FROM glpi_tickettasks;
SHOW COLUMNS FROM glpi_itilfollowups;

e confirmar:

  • glpi_tickettasks: a coluna de status foi assumida como state (sql/contexto_glpi.sql) — nome comum no schema GLPI 9.x/10.x, mas não verificado neste ambiente. Se o nome real for outro, ajustar sql/contexto_glpi.sql (linha state AS status) e rodar node tools/build-workflow.js de novo antes de reaplicar no n8n.
  • glpi_itilfollowups: content, date, is_private, items_id, itemtype — todos já usados sem alteração pela query V1 (comprovada em produção), então a suposição aqui é de risco baixo.

Depois, rodar sql/candidatos_v2_glpi.sql com {CANDIDATE_POOL_SIZE} → 5 para conferir que a query devolve linhas plausíveis antes de rodar o workflow completo.

Achado durante o deploy (não é sobre schema do GLPI, mas registrado aqui)

Ao criar o workflow via API sem a credencial MySQL existir ainda, o n8n resolveu sozinho por tipo e vinculou os 3 nodes MySQL à única credencial mySql existente no ambiente (MySQL account - Gerar e Enviar Chave, do sistema Asaas/cobrança — nada a ver com GLPI). Removi essa vinculação (credentials: null) nos 3 nodes MySQL do workflow y6JFEnp7Z2IJEUe2 e no template local, para não deixar o workflow silenciosamente "configurado" apontando pro banco errado. Quando a credencial MySQL GLPI - Coordenador existir, alguém precisa abrir os 3 nodes MySQL no n8n e selecioná-la manualmente (ou eu faço isso via n8n_update_partial_workflow assim que souber o ID real da credencial).

Nodes afetados: MySQL - Buscar Candidatos, MySQL - Legado Top 10 (Shadow), MySQL - Buscar Contexto.

Achado adicional (Data Tables de terceiros)

No mesmo instante em que eu investigava este ambiente, apareceram duas Data Tables novas no DEV que eu não criei: dev_glpi_v2_insights_memory e dev_glpi_v2_run_history (criadas ~18:37, no meio desta sessão). O schema delas não bate com o desenho deste projeto (parecem de outra tentativa — colunas tipo fingerprint/insight_type/subject_key e tipo_periodo/history_bucket). Não toquei nelas. Criei as minhas com nomes próprios (coordenador_glpi_memoria, coordenador_glpi_shadow_runs) para não colidir. Vale confirmar com quem estiver por trás dessas tabelas se é trabalho duplicado.