Conversation
…ative compiler the postgres fixtures shipped in #512 were @test-skip — ci never exercised them, so any regression in lib/postgres.ts or pg-bridge.c would land silently. this gates them behind a new `@test-requires-env: PG_TESTS_ENABLED` annotation and wires up postgres in both ci jobs: - linux: services: postgres:16 container, libpq-dev installed, PG_TESTS_ENABLED=1 - macos: brew install libpq postgresql@16, brew services start, provision postgres user/password/chadtest db, PG_TESTS_ENABLED=1 also fixes a separate gap in #512: src/chad-native.ts never called registerStdlib for postgres.ts, so .build/chad rejected `import { Pool } from "chadscript/postgres"` with 'stdlib module not found'. all my prior verification went through node dist/chad-node.js which reads lib/*.ts from disk — the embedded-stdlib path was untested. fixed by adding the registerStdlib call alongside the other lib/ modules. new test-discovery annotation: `@test-requires-env: VAR` skips a fixture unless the env var is set and non-empty. enables conditional integration tests without a separate test runner. extra docs added to the annotation header in test-discovery.ts. pg-bridge.o now appears in the verify-vendor loop, the package release artifact cp commands (linux + macos), and scripts/build-target-sdk.sh, matching the pattern used by every other bridge. verified locally: full `PG_TESTS_ENABLED=1 npm run verify` green against podman postgres:16 — all 5 fixtures pass, stage 0/1/2 self-hosting clean.
Contributor
Benchmark Results (Linux x86-64)
CLI Tool Benchmarks
|
cs01
added a commit
that referenced
this pull request
Apr 15, 2026
ubuntu/debian's libpq-dev installs libpq-fe.h to /usr/include/postgresql/, not /usr/include/, so the previous fallback (cc -xc -fsyntax-only against default include path) silently failed on linux. pg-bridge.o was never built, the verify-vendor step caught the missing object, and ci #514's build-linux-glibc job failed in 1m22s. new detection order: 1. pg_config --includedir — works on any platform with libpq dev headers 2. brew --prefix libpq — keg-only on macos, no pg_config in PATH 3. /usr/include/postgresql/libpq-fe.h — debian/ubuntu fallback 4. default cc include path — last resort also bumps the cache key (file content hash includes build-vendor.sh), which forces ci to re-run build-vendor instead of restoring a stale c_bridges/ from before libpq was installed.
ubuntu/debian's libpq-dev installs libpq-fe.h to /usr/include/postgresql/, not /usr/include/, so the previous fallback (cc -xc -fsyntax-only against default include path) silently failed on linux. pg-bridge.o was never built, the verify-vendor step caught the missing object, and ci #514's build-linux-glibc job failed in 1m22s. new detection order: 1. pg_config --includedir — works on any platform with libpq dev headers 2. brew --prefix libpq — keg-only on macos, no pg_config in PATH 3. /usr/include/postgresql/libpq-fe.h — debian/ubuntu fallback 4. default cc include path — last resort also bumps the cache key (file content hash includes build-vendor.sh), which forces ci to re-run build-vendor instead of restoring a stale c_bridges/ from before libpq was installed.
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.
What you get
The 5 postgres fixtures shipped in #512 now actually run in CI. Before this PR they were
@test-skip, so any regression inlib/postgres.tsorpg-bridge.cwould land silently on main and only get caught when someone ran a fixture by hand. Now both the linux and macOS jobs spin up a real postgres and exercise the full path: connect, parameterized query, SELECT, type coercion, Pool lazy-connect.Why
This was the highest-leverage cleanup from PR #512's punch list. Without CI coverage we had no actual regression net for postgres; with it, the next four follow-ups (null detection, reconnect-on-drop, date type, etc.) can be developed and reviewed safely. It also unblocks any future stdlib module that wants the same "test against a real service" pattern.
How
build-linux-glibc):services: postgres:16container withPOSTGRES_USER=postgres POSTGRES_PASSWORD=test POSTGRES_DB=chadtestmatching the fixture conninfo, pluslibpq-devin apt andPG_TESTS_ENABLED=1at job env.build-macos):brew install libpq postgresql@16,brew services start postgresql@16, provision the postgres user/password/db,PG_TESTS_ENABLED=1at job env.@test-requires-env: VAR: new test-discovery annotation that skips a fixture unless the named env var is set and non-empty. Replaces@test-skipon the 5 postgres fixtures. The discovery filter happens at the test-runner level, so platforms or developer machines without postgres see the fixtures cleanly skipped instead of failing or polluting unrelated runs.Side fix (separate gap from #512)
src/chad-native.tsnever calledregisterStdlib("postgres.ts", ...). The native compiler (.build/chad) embeds stdlib files at build time viaChadScript.embedFile, andpostgres.tswas missing from the registry — so any user trying toimport { Pool } from "chadscript/postgres"against the native compiler gotstdlib module not found: postgres.ts. All my prior verification went throughnode dist/chad-node.js(which readslib/*.tsfrom disk), so the embedded-stdlib path was untested. Now registered alongside the otherlib/modules. Without this fix.build/chadusers couldn't have usedchadscript/postgresat all — that's a real user-facing bug from #512 caught by this PR's stronger CI coverage.Test plan
PG_TESTS_ENABLED=1 npm run verify(full, with stage 2) green locally against podmanpostgres:16— all 5 fixtures passnpm run verify:quickwithoutPG_TESTS_ENABLED— fixtures cleanly skipped, no regressionsbuild-linux-glibc(service container) andbuild-macos(brew postgres)🤖 Generated with Claude Code