Skip to content

Commit ada3263

Browse files
fix(dbt-tools): say what the bundle check checks
The build check, its test and the release smoke check only find the references the bridge path is built from. The relocation test checks where the script is found. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VEmKQtZqePG8x1GSELVNdE
1 parent 89932fa commit ada3263

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ jobs:
286286
echo "::error::dbt-tools bundle contains hardcoded absolute path in __dirname"
287287
exit 1
288288
fi
289-
# Verify the bridge script resolves relative to the bundle at runtime
289+
# The bridge path is built at runtime from the bundle's own URL
290290
if ! grep -q 'fileURLToPath(import.meta.url)' packages/dbt-tools/dist/index.js; then
291-
echo "::error::dbt-tools bundle does not resolve node_python_bridge.py at runtime"
291+
echo "::error::dbt-tools bundle lacks fileURLToPath(import.meta.url), which the bridge path is built from"
292292
exit 1
293293
fi
294294
echo "dbt-tools smoke test passed"

‎packages/dbt-tools/script/copy-python.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ console.log(`Copied node_python_bridge.py → dist/`)
2222

2323
// 3. dbt-integration resolves node_python_bridge.py at runtime from its own
2424
// location (`fileURLToPath(import.meta.url)`), which in this bundle is dist/,
25-
// where step 2 put the script. Fail the build if the bundle ever carries a
26-
// path baked in at build time instead.
25+
// where step 2 put the script. This only checks that the bundle still has
26+
// the references that path is built from and no path baked in at build time;
27+
// test/build-integrity.test.ts runs the packaged CLI from another directory
28+
// to check where the script is found.
2729
const indexPath = join(dist, "index.js")
2830
const code = readFileSync(indexPath, "utf8")
2931
const baked = /var __dirname\s*=\s*"(?:[A-Za-z]:\\\\|\/)/
3032
if (!code.includes("fileURLToPath(import.meta.url)") || !code.includes(`"node_python_bridge.py"`) || baked.test(code)) {
31-
console.error(`ERROR: dist/index.js does not resolve node_python_bridge.py relative to itself at runtime`)
33+
console.error(`ERROR: dist/index.js lacks the references the bridge path is built from, or has a build-time path`)
3234
console.error(` Has the @altimateai/dbt-integration bundle format changed?`)
3335
process.exit(1)
3436
}
35-
console.log(`Verified dist/index.js resolves node_python_bridge.py at runtime`)
37+
console.log(`Checked dist/index.js: bridge path references present, no build-time path`)

‎packages/dbt-tools/test/build-integrity.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe("build integrity", () => {
3434
expect(code).not.toMatch(/var __dirname\s*=\s*"(?:[A-Za-z]:\\\\|\/)/)
3535
})
3636

37-
test("the bridge script resolves relative to the bundle at runtime", () => {
37+
test("the bundle keeps the references the bridge path is built from at runtime", () => {
3838
const code = readFileSync(join(dist, "index.js"), "utf8")
3939
expect(code).toContain("fileURLToPath(import.meta.url)")
4040
expect(code).toContain(`"node_python_bridge.py"`)

0 commit comments

Comments
 (0)