Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .changeset/fix-env-loading-precedence.md
Binary file not shown.
6 changes: 3 additions & 3 deletions packages/cli-v3/src/utilities/dotEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { resolve } from "node:path";
import { env } from "std-env";

const ENVVAR_FILES = [
".env",
".env.development",
".env.local",
".env.development.local",
".env.local",
".env.development",
"dev.vars",
".env",
];

export function resolveDotEnvVars(cwd?: string, envFile?: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Dead @bugsnag/cuid dependency left in package.json after removing its only import

The import cuid from "@bugsnag/cuid" was removed from packages/core/src/v3/isomorphic/friendlyId.ts (the only file that used it), but "@bugsnag/cuid": "^3.1.1" was not removed from packages/core/package.json:171. This means @bugsnag/cuid is a dead runtime dependency that will still be installed and bundled for all consumers of @trigger.dev/core, adding unnecessary bloat — which is ironic given the PR's stated goal of improving edge compatibility by removing cuid.

(Refers to line 171)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Original file line number Diff line number Diff line change
Expand Up @@ -583,4 +583,4 @@
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"module": "./dist/esm/index.js"
}
}
5 changes: 2 additions & 3 deletions packages/core/src/v3/isomorphic/friendlyId.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { customAlphabet } from "nanoid";
import cuid from "@bugsnag/cuid";

const idGenerator = customAlphabet("123456789abcdefghijkmnopqrstuvwxyz", 21);

Expand All @@ -8,7 +7,7 @@ export function generateFriendlyId(prefix: string, size?: number) {
}

export function generateInternalId() {
return cuid();
return idGenerator();
}
Comment on lines 9 to 11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 nanoid character set is compatible with existing cuid-based database IDs

The switch from cuid() to idGenerator() (nanoid with alphabet 123456789abcdefghijkmnopqrstuvwxyz, length 21) changes the format of newly generated internal IDs. CUIDs are 25 chars from [a-z0-9]; nanoid IDs will be 21 chars from a 33-char subset ([a-z0-9] minus 0 and l). The database schema uses String columns with @default(cuid()) as a Prisma fallback, but IdUtil.generate() provides the ID explicitly. Since both old and new IDs are plain strings stored in unconstrained String columns, there's no schema incompatibility. However, new IDs will not sort chronologically the way CUIDs do (CUIDs embed a timestamp). If any code path depends on lexicographic ID ordering correlating with creation time, this could be a subtle behavioral change. A search of the run-engine for sorting/ordering by raw ID didn't surface any such pattern, but this is worth being aware of.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


/** Convert an internal ID to a friendly ID */
Expand Down Expand Up @@ -58,7 +57,7 @@ export function fromFriendlyId(friendlyId: string, expectedEntityName?: string):
}

export class IdUtil {
constructor(private entityName: string) {}
constructor(private entityName: string) { }

generate() {
const internalId = generateInternalId();
Expand Down