File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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"
Original file line number Diff line number Diff 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.
2729const indexPath = join ( dist , "index.js" )
2830const code = readFileSync ( indexPath , "utf8" )
2931const baked = / v a r _ _ d i r n a m e \s * = \s * " (?: [ A - Z a - z ] : \\ \\ | \/ ) /
3032if ( ! 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 ` )
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ describe("build integrity", () => {
3434 expect ( code ) . not . toMatch ( / v a r _ _ d i r n a m e \s * = \s * " (?: [ A - Z a - 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"` )
You can’t perform that action at this time.
0 commit comments