ci: load postgres in a way that works for v3 and v4 #342
No reviewers
Labels
No labels
dependencies
major
security-pin
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
trails-cool/trails!342
Loading…
Reference in a new issue
No description provided.
Delete branch "ci-postgres-require-v4-compatible"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The two "Provision database" steps in
.forgejo/workflows/ci.yml(E2E Tests and Journal Image Smoke Test) loaded the driver withrequire("postgres")and called the result. postgres v4 is ESM-only, sorequire()returns the module namespace and the step fails before any test runs:This is why #311 (postgres v4) is red: CI never reached application code, so the PR says nothing yet about whether the app works on v4.
The steps now use
mod.default ?? mod, which resolves to the function on both v3 (CommonJS) and v4 (ESM). No dependency changes.Verification
node -ewith the same two lines against the installed postgres 3.4.9:typeof postgres === "function".require()returns an object,mod.default ?? modis a function.prettier --checkpasses on the workflow file.pnpm typecheck,lint,test,test:e2e. The change is inside two CI shell steps; this PR's own E2E and smoke jobs exercise it on v3.Risk and rollback
infer: falseparameter typing, drizzle-orm's use of driver internals).🤖 Generated with Claude Code
The two "Provision database" steps used `require("postgres")` and called the result. postgres v4 is ESM-only, so require() returns the module namespace and the call fails with "postgres is not a function" before any test runs (#311: E2E Tests and Journal Image Smoke Test). Use `mod.default ?? mod`, which resolves to the function on both majors. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>