Repository navigation
fix(dbt-tools): move to dbt-integration 0.3.15 so the dbt adapter starts under Bun #1368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3ef5386
4c7ea0e
4873087
3137586
f09d259
ccc92cc
97f6c2c
775161b
89932fa
ada3263
9631118
c0f6a99
5018286
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,11 +9,11 @@ | |
| "scripts": { | ||
| "build": "bun build src/index.ts --outdir dist --target node --format esm && bun run script/copy-python.ts", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "bun test test/cli.test.ts test/config.test.ts test/dbt-cli.test.ts test/dbt-resolve.test.ts test/build-integrity.test.ts --timeout 30000", | ||
| "test": "bun test test/cli.test.ts test/config.test.ts test/dbt-cli.test.ts test/dbt-resolve.test.ts test/adapter-bun.test.ts test/build-integrity.test.ts --timeout 30000", | ||
| "test:e2e": "bun test test/e2e/ --timeout 300000" | ||
| }, | ||
| "dependencies": { | ||
| "@altimateai/dbt-integration": "^0.2.2" | ||
| "@altimateai/dbt-integration": "^0.3.15" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Major: with the adapter now running, dbt's log output goes to the process's stdout: over the TUI and into 0.3.15's
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. The fix belongs in
Checked under Bun 1.3.14 with dbt-tools' adapter on jaffle ( This PR moves to that release once it's out and past the 3-day |
||
| }, | ||
| "devDependencies": { | ||
| "@tsconfig/bun": "catalog:", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { describe, test, expect } from "bun:test" | ||
| import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "fs" | ||
| import { tmpdir } from "os" | ||
| import { dirname, join } from "path" | ||
| import { $ } from "bun" | ||
| import { standInPython } from "./stand-in-python" | ||
|
|
||
| const pkg = join(import.meta.dir, "..") | ||
|
|
||
| // The published-package tests run the bundle under Node. The TUI and the compiled | ||
| // binary run the adapter under Bun, the runtime the bridge used to fail on, so this | ||
| // runs the CLI from source under Bun. HOME is a temp dir from the start, so no | ||
| // ~/.dbt/dbt_cloud.yml on this machine picks dbt Cloud mode's variant. | ||
| describe.skipIf(process.platform === "win32")("the adapter under Bun", () => { | ||
| const script = join(dirname(require.resolve("@altimateai/dbt-integration")), "node_python_bridge.py") | ||
|
|
||
| // The stand-in fails the bridge run. The dbt Core modes then exit 1 with the bridge's | ||
| // report of that exit; `info` in dbt Cloud mode still answers from the project. A | ||
| // failure before the spawn shows its own message in the comparison. | ||
| test.each([ | ||
| ["core", { exitCode: 1, output: expect.stringContaining("Python process closed with exit code 3") }], | ||
| ["corecommand", { exitCode: 1, output: expect.stringContaining("Python process closed with exit code 3") }], | ||
| ["cloud", { exitCode: 0 }], | ||
| ])("%s mode spawns the bridge script", async (dbtIntegration, expected) => { | ||
| const root = mkdtempSync(join(tmpdir(), "dbt-tools-bun-")) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SUGGESTION: Neutralise
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed and fixed in 5018286. With this machine's Pointing
So the test now runs the CLI from source as a Bun subprocess (
|
||
| try { | ||
| const { python, runs } = standInPython(root) | ||
| const project = join(root, "project") | ||
| mkdirSync(project) | ||
| writeFileSync(join(project, "dbt_project.yml"), "name: p\nversion: '1.0'\nprofile: p\n") | ||
| const home = join(root, "home") | ||
| mkdirSync(join(home, ".altimate-code"), { recursive: true }) | ||
| writeFileSync( | ||
| join(home, ".altimate-code", "dbt.json"), | ||
| JSON.stringify({ projectRoot: project, pythonPath: python, dbtIntegration, queryLimit: 500 }), | ||
| ) | ||
|
|
||
| const cli = await $`${process.execPath} ${join(pkg, "src/index.ts")} info` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SUGGESTION: This duplicates the CLI harness in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Holding this one for the dependency bump that will follow this PR. That bump changes both harnesses:
|
||
| .cwd(root) | ||
| .env({ ...process.env, HOME: home }) | ||
| .quiet() | ||
| .nothrow() | ||
|
|
||
| expect({ exitCode: cli.exitCode, output: cli.stdout.toString() }).toMatchObject(expected) | ||
| expect(runs()).toContain(script) | ||
| } finally { | ||
| rmSync(root, { recursive: true, force: true }) | ||
| } | ||
| }) | ||
| }) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, non-blocking (the preceding
bun run buildstep already fails on this): the release smoke check is weaker thancopy-python.ts.Mutation on the built bundle: replacing
x.join(_, "node_python_bridge.py")with a literal/home/runner/work/…/node_python_bridge.pystill passes all three release greps.fileURLToPath(import.meta.url)is still present, and there is novar __dirname = "/…".copy-python.ts(its"node_python_bridge.py"include) and build-integrity (its checkout-path check) both catch it. To make this step stand on its own, also grep for"node_python_bridge.py"and for$GITHUB_WORKSPACEindist/index.js.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in c0f6a99. The step now checks two more things in
dist/index.js:"node_python_bridge.py"literal must be present;$GITHUB_WORKSPACEmust not appear. The step also fails if the variable is unset, because an empty pattern would match everything.Results on a local build:
joinreplaced by a literal checkout path) fails on the first new check;