CI: hub env-stashing wrote the string "undefined", un-skipping DB-gated suites - #176
Merged
Merged
Conversation
…ed suites Three apps/hub suites cleared environment variables with `process.env[key] = undefined`. Node — and Bun from 1.4 onward, the version CI's `bun-version: latest` now resolves to — coerces that to the *string* "undefined" rather than removing the key, so after the first memory-mount test every later read of DATABASE_URL and EMBED_BASE_URL saw a truthy value. That poisoned the whole `bun test` process for @workbench/hub, which runs in the `checks` job with no Postgres service: - `mountMemory` accepted "undefined" as a configured EMBED_BASE_URL and went on to migrate, so the two tests asserting the unconfigured path died on a connection instead. - Every DB-gated `describe.skipIf(...)`/`?? ""` gate un-skipped and handed postgres.js an unparseable URL, which falls back to its localhost:5432 default — hence `ECONNREFUSED ::1:5432` *and* `127.0.0.1:5432` on both stacks, with no service anywhere to refuse them. Clear the keys for real with `Reflect.deleteProperty` (dynamic `delete` is lint-banned). With Bun 1.4's coercion simulated locally the suite reproduces CI exactly — 151 tests, 17 fail; after the fix it is 154 tests, 134 pass, 20 skip, 0 fail.
TheGreatAxios
force-pushed
the
cl-ci-postgres-fix
branch
from
August 21, 2026 05:26
8765670 to
1da5ea1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Every recent CI run — including main's own — failed the
checksjob'sbun run teststep withconnect ECONNREFUSED ::1:5432and127.0.0.1:5432. The dual-stack refusal was the tell: nothing waslistening on either loopback address because no Postgres was expected
there.
checksdeliberately has no service container; onlywalking-skeletondoes.The connections came from three
apps/hubsuites that stash and clearenvironment variables:
Node coerces
process.env[k] = undefinedto the string"undefined"instead of removing the key. Bun did not, up to 1.3.x — but does from
1.4. The workflow pins
bun-version: latest, which now resolves to1.4.0 (
bun test v1.4.0 (34cbb9a40)in the log), so the behaviourflipped under CI with no repo change. That is why main went red wholesale
rather than at a specific commit.
bun testruns one process per package, so onceapps/hub/src/memory-mount.test.tsran,DATABASE_URLandEMBED_BASE_URLwere the string"undefined"for the rest of the run:mountMemoryparsesEMBED_BASE_URLas"string > 0"."undefined"passes, so the two tests asserting the unconfigured path proceeded to
runMemoryMigrationsand died on a socket. (The third test in thatdescribe sets
EMBED_BASE_URL=""explicitly and passed — exactly as thelog shows.)
process.env["DATABASE_URL"] ?? ""or=== undefined. A truthy"undefined"un-skipped all of them, andpostgres.js, unable to parse that as a URL, fell back to its default
host/port —
localhost:5432, resolved on both stacks.Log evidence, run
32425315884:
the hub package reports
131 pass / 2 skip / 18 fail / 1 erroracross151 tests. The same suite locally reports134 pass / 20 skip / 0 failacross
154 tests— 18 tests that should skip instead ran and failed.Reproduced locally by simulating Bun 1.4's coercion
(
DATABASE_URL=undefined EMBED_BASE_URL=undefined bun testinapps/hub): 151 tests, 17 fail — CI's numbers.Fix
Clear the keys for real, in all three suites, with
Reflect.deleteProperty(dynamicdeleteis lint-banned here).After the fix,
apps/hubwith noDATABASE_URL: 154 tests, 134 pass,20 skip, 0 fail.
No workflow change was needed: the service container is attached to the
job that needs it, and host resolution was never the problem.
Known remaining failure (pre-existing, unrelated)
walking-skeletonalso fails onchat e2e > mention fan-out drives the mentioned run—list run events for run_…: expected HTTP 200, got 404 {"code":"not_found","message":"Run not found"}atscripts/e2e/chat.test.ts:606. That is a product/e2e bug on a job thatdoes have Postgres, present in all three of main's last runs, and is out
of scope for this change.
Linear: https://linear.app/abklabs/issue/CL-6450