diff --git a/.changeset/bundle-deterministic-file-order.md b/.changeset/bundle-deterministic-file-order.md new file mode 100644 index 00000000000..d8e7a0ca264 --- /dev/null +++ b/.changeset/bundle-deterministic-file-order.md @@ -0,0 +1,5 @@ +--- +"trigger.dev": patch +--- + +Fix non-deterministic task-to-file attribution when multiple tasks share an output bundle. `Object.entries` iteration order is not guaranteed, so tasks defined in imported files could be attributed to the wrong source file. Files are now sorted by entry path before registration. diff --git a/packages/cli-v3/src/build/bundle.ts b/packages/cli-v3/src/build/bundle.ts index 4d1cfd53f86..a0197934a8a 100644 --- a/packages/cli-v3/src/build/bundle.ts +++ b/packages/cli-v3/src/build/bundle.ts @@ -307,6 +307,8 @@ export async function getBundleResultFromBuild( } } + files.sort((a, b) => a.entry.localeCompare(b.entry)); + if (!configPath) { return undefined; }