fix(dbt-tools): move to dbt-integration 0.3.13 so the dbt adapter starts under Bun - #1368
Draft
ralphstodomingo wants to merge 1 commit into
Draft
ralphstodomingo wants to merge 1 commit into
ralphstodomingo wants to merge 1 commit into
Conversation
…rts under Bun `dbt-tools` resolved `@altimateai/dbt-integration` 0.2.14, which spawns its Python child through `python-bridge`. Under Bun that module fails to load (`bluebird.promisifyAll(child_process)` throws on `ChildProcess.prototype.stdin`), and past that, Bun's IPC to a non-JS child closes after the first message. So the dbt-first path of `sql_execute` never ran; the adapter silently fell back. 0.3.x vendors the bridge and talks newline JSON over a plain fd-3 pipe, with no `python-bridge` or `bluebird` in the tree. - `adapter.ts`: the 0.3.x constructors take `UnitTestParser` and `SemanticModelParser`; the Fusion integration no longer takes the cloud-variant detector (the Cloud integration still does). - `copy-python.ts`: the vendored bridge resolves its script from the bundle's own location at runtime, so the `python-bridge` `__dirname` patch is gone; the build now fails if a build-time path is baked in. `build-adversarial.test.ts` tested only that patch and is removed; `build-integrity.test.ts` and the release smoke check assert the new invariant. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172qrhMa5TQgETASi5hxMqD
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch has not been deployed
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.
Issue for this PR
Closes #1367
Type of change
What does this PR do?
Moves
packages/dbt-toolsfrom@altimateai/dbt-integration0.2.14 to^0.3.13. 0.2.x started its Python child throughpython-bridge, which fails to load under Bun (bluebird.promisifyAllonchild_processthrowsCannot access invalid private field (evaluating 'this.#stdin')), so the dbt-first path ofsql_executenever ran. 0.3.x vendors the bridge and uses a plain fd-3 pipe;python-bridgeandbluebirdleave the lockfile.adapter.ts: 0.3.x'sDBTProjectIntegrationAdaptertakes aUnitTestParserand aSemanticModelParser; the Fusion integration no longer takes the cloud-variant detector (the Cloud integration still does).copy-python.ts: the vendored bridge findsnode_python_bridge.pyfrom the bundle's own location at runtime (fileURLToPath(import.meta.url)→dist/), so thepython-bridge__dirnamepatch is removed. The build now fails if a build-time path is ever baked in.build-adversarial.test.tsonly tested that removed patch, so it goes;build-integrity.test.tsand the release smoke check assert the new invariant.Not fixed here — the compiled binary.
altimatebundles the library into the binary, where the bridge looks for its script at/$bunfs/root/node_python_bridge.py, which the Python child can't open. From source and from the npmaltimate-dbt(Node) the adapter works; in the binary the failure changes from the#stdinTypeError to "can't open file" (still caught byensureDbtAdapter, so no behaviour change for users there). That needs a change in@altimateai/dbt-integration, tracked on the issue.How did you verify your code works?
packages/dbt-tools:bun run typecheckclean,bun run buildpasses the new guard,bun run test83 pass.dbt-toolsunder Bun 1.3.14:main(0.2.14):createfails withTypeError: Cannot access invalid private field (evaluating 'this.#stdin').createsucceeds in ~5 s,getDBTVersion()returns[1, 11, 7]through the Python child, andimmediatelyExecuteSQL("select 1 …")returns the row.dist/index.jsunder Node (altimate-dbt info/execute --query "select 1 as one") returns the project and[{"one": 1}].bun build --compilefails withcan't open file '/$bunfs/root/node_python_bridge.py'— the open item above.Checklist
Appendix — complexity delta (dbt-tools on dbt-integration 0.3.13)
282e784055→3ef53864ba· only functions this diff touches · advisory, not a gate.✅ No touched function changed in complexity (2 touched, 0 new, all under 10).
ℹ️ How to read these numbers
Cognitive (Sonar spec) counts breaks in linear reading flow — each
if/loop/catch/ternary/boolean-operator switch adds 1, and nesting makes every further break cost more. It approximates how much you must hold in your head to follow the function: 0–5 trivial · 6–10 easy · 11–15 moderate (15 = Sonar's recommended per-function cap) · 16–25 hard to follow · >25 needs decomposition.CCN (cyclomatic) counts independent paths — also the minimum number of test cases for full branch coverage of the function.
Only functions this diff touches are measured, as deltas — pre-existing complexity is not counted against this change. Rising numbers aren't automatically wrong; they're where review attention should go. Test files excluded.
🤖 Generated with Claude Code
https://claude.ai/code/session_0172qrhMa5TQgETASi5hxMqD
Summary by cubic
Fixes #1367 by upgrading
packages/dbt-toolsto@altimateai/dbt-integration0.3.13 so the dbt adapter's Python child starts under Bun. The previous 0.2.x loaded Python throughpython-bridge, which crashes under Bun (bluebird.promisifyAllonchild_processthrowsCannot access invalid private field), so the dbt-first path ofsql_executenever ran; 0.3.x vendors the bridge and talks over a plain fd-3 pipe.UnitTestParserandSemanticModelParserto the 0.3.x adapter and no longer passes the cloud-variant detector (the Cloud integration still does).node_python_bridge.pyat runtime from the bundle's own location, so the old__dirnamepatch is removed and the build fails if a build-time path is baked in.build-adversarial.test.ts, which only tested that patch, is gone;build-integrity.test.tsand the release smoke check assert the new invariant.altimatebinary still fails: the bridge can't open/$bunfs/root/node_python_bridge.py. Source and npmaltimate-dbtbuilds work; the binary failure is caught byensureDbtAdapter, so there's no user-facing behavior change there. The fix is tracked upstream.Written for commit 3ef5386. Summary will update on new commits.