fix: handle mysql2 >=3.23 returning JSON columns pre-parsed (Gandalf relay regression) #36

Merged
jared merged 1 commits from hotfix/mysql2-json-columns into main 2026-09-08 22:41:26 -04:00
Owner

Summary

mysql2 was bumped to 3.24.4 by the npm audit fix in #35. Since mysql2 3.23, MariaDB JSON columns come back from the driver already parsed. Two endpoints still called JSON.parse on the column value, threw, and silently fell back to an empty value:

  • GET /api/internal/executions/:id (Gandalf M2M relay) returned logs: [] for every execution, so Gandalf's ping-through-Pulse check never saw REACHABLE and opened a false P2 (ticket 234226988). Link Debug ethtool/SFP collection was empty for the same reason.
  • GET /api/workflows/:id returned definition: {}, breaking the workflow Edit modal.

Fix

Guard both sites with the same typeof === 'string' check that GET /api/executions/:id already uses.

Verification

  • Queried the production DB with the current driver: logs arrives as an array, definition as an object. Old code parses to 0 log entries; fixed code returns the real entries.
  • npx eslint 0 errors, npx jest 31/31.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HamVMDrA8RqhyxmUHgiqRp

## Summary mysql2 was bumped to 3.24.4 by the `npm audit fix` in #35. Since mysql2 3.23, MariaDB JSON columns come back from the driver already parsed. Two endpoints still called `JSON.parse` on the column value, threw, and silently fell back to an empty value: - `GET /api/internal/executions/:id` (Gandalf M2M relay) returned `logs: []` for every execution, so Gandalf's ping-through-Pulse check never saw `REACHABLE` and opened a false P2 (ticket 234226988). Link Debug ethtool/SFP collection was empty for the same reason. - `GET /api/workflows/:id` returned `definition: {}`, breaking the workflow Edit modal. ## Fix Guard both sites with the same `typeof === 'string'` check that `GET /api/executions/:id` already uses. ## Verification - Queried the production DB with the current driver: `logs` arrives as an array, `definition` as an object. Old code parses to 0 log entries; fixed code returns the real entries. - `npx eslint` 0 errors, `npx jest` 31/31. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HamVMDrA8RqhyxmUHgiqRp
jared added 1 commit 2026-09-08 22:39:59 -04:00
fix: handle mysql2 >=3.23 returning JSON columns pre-parsed
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / JS Security (npm audit) (pull_request) Successful in 10s
Test / JS Tests (jest) (pull_request) Successful in 10s
Lint / JS (eslint) (push) Successful in 11s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / JS Security (npm audit) (push) Successful in 11s
Test / JS Tests (jest) (push) Successful in 11s
2173b5ab8f
mysql2 3.24 (pulled in by the audit fix in #35) returns MariaDB JSON columns as
JS objects. GET /api/internal/executions/:id and GET /api/workflows/:id still
called JSON.parse on the value, threw, and silently returned [] / {}. This broke
Gandalf's relay checks (false 'PBS unreachable' ticket) and the workflow edit
modal. Guard both sites with the same typeof check already used by
GET /api/executions/:id.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HamVMDrA8RqhyxmUHgiqRp
jared merged commit 3edb2da174 into main 2026-09-08 22:41:26 -04:00
Sign in to join this conversation.