Commit 32ffe32
fix(dbt-tools): bubble real errors and redact SQL across all execDbt* paths
Pulls #943, #944, and #945 into this PR — each was tagged as out-of-scope
in the earlier rounds but they share so much of the same fix surface
(extractDbtError / fallbackExitMessage already in place) that fixing them
in-PR is cleaner than spawning three follow-up PRs.
Closes #943 — execDbtCompile / execDbtCompileInline used to swallow the
real dbt error with `try { … } catch { lines = [] }`. They now capture
the run error, skip the success-only tiers when the primary run failed
(same anti-spurious-data reasoning as execDbtShow), and throw via a new
shared `bubbleDbtError(label, primary, plain)` helper that combines
extractDbtError + fallbackExitMessage with the same SQL-safety,
ANSI-stripping, and category-prefix-dedup guarantees.
Closes #944 — execDbtShow Tier 1 used to assign a truthy non-array
`data.preview` straight into `rows`, returning `{ data: {} }` to callers
and crashing downstream `.map` / `.length`. The else-branch now guards
with `Array.isArray(preview)` and emits empty rows for any unexpected
shape (object, number, etc.).
Closes #945 — execDbtCompileInline's final throw used `e.message`
directly, which is Node's "Command failed: <dbt-path> compile --inline
'<entire user SQL>' …" — leaking PII / secrets templated into the inline
query. The new bubbleDbtError helper routes through fallbackExitMessage,
which redacts the command line for both exit-code and signal/timeout
rejections.
Tests: 41 pass / 0 fail (was 33). New coverage:
- execDbtShow non-array preview shape (object + numeric)
- execDbtCompile error bubbling (real stderr, structured JSON event,
category-prefix dedup)
- execDbtCompileInline error bubbling
- execDbtCompileInline SQL-redaction canaries for both exit-code and
signal-kill failure modes
Refs #932
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 44d9215 commit 32ffe32
2 files changed
Lines changed: 205 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 297 | + | |
| 298 | + | |
298 | 299 | | |
| 300 | + | |
| 301 | + | |
299 | 302 | | |
300 | 303 | | |
301 | 304 | | |
| |||
464 | 467 | | |
465 | 468 | | |
466 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
467 | 492 | | |
468 | 493 | | |
469 | 494 | | |
470 | 495 | | |
471 | 496 | | |
472 | 497 | | |
473 | | - | |
| 498 | + | |
| 499 | + | |
474 | 500 | | |
475 | 501 | | |
476 | 502 | | |
477 | | - | |
478 | | - | |
| 503 | + | |
| 504 | + | |
479 | 505 | | |
480 | 506 | | |
481 | | - | |
482 | | - | |
483 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
484 | 513 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
489 | 519 | | |
490 | 520 | | |
491 | | - | |
492 | | - | |
493 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
494 | 527 | | |
495 | 528 | | |
496 | | - | |
497 | | - | |
498 | | - | |
| 529 | + | |
| 530 | + | |
499 | 531 | | |
500 | 532 | | |
501 | 533 | | |
502 | 534 | | |
503 | | - | |
| 535 | + | |
| 536 | + | |
504 | 537 | | |
505 | 538 | | |
506 | 539 | | |
507 | 540 | | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
512 | 549 | | |
| 550 | + | |
| 551 | + | |
513 | 552 | | |
514 | 553 | | |
515 | 554 | | |
| |||
521 | 560 | | |
522 | 561 | | |
523 | 562 | | |
524 | | - | |
| 563 | + | |
| 564 | + | |
525 | 565 | | |
526 | 566 | | |
527 | 567 | | |
528 | | - | |
529 | | - | |
| 568 | + | |
| 569 | + | |
530 | 570 | | |
531 | 571 | | |
532 | | - | |
533 | | - | |
534 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
535 | 577 | | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
540 | 583 | | |
541 | 584 | | |
542 | 585 | | |
| 586 | + | |
543 | 587 | | |
544 | 588 | | |
545 | 589 | | |
546 | 590 | | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
| 591 | + | |
551 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
552 | 602 | | |
553 | 603 | | |
554 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
424 | 451 | | |
425 | 452 | | |
426 | 453 | | |
| |||
513 | 540 | | |
514 | 541 | | |
515 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
516 | 582 | | |
517 | 583 | | |
518 | 584 | | |
| |||
533 | 599 | | |
534 | 600 | | |
535 | 601 | | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
536 | 649 | | |
537 | 650 | | |
538 | 651 | | |
| |||
0 commit comments