Skip to content
Merged
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
18 changes: 7 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ jobs:
pull-requests: read
with:
# The test legs below are skipped on release PRs; the unit tests run
# here instead, in the stable environment a consumer gets.
# here instead, in the environment a consumer gets.
task: test
env: stable
env: default
mojo-compiler: "==1.3.0.dev2026111805"

test:
needs: release
if: ${{ !cancelled() && needs.release.outputs.release_only != 'true' }}
name: ${{ matrix.env == 'default' && 'nightly' || matrix.env }} / ${{ matrix.os }}
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON((github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && '["ubuntu-latest", "macos-latest"]' || '["ubuntu-latest"]') }}
env: [default, stable]

steps:
- uses: actions/checkout@v4
Expand All @@ -58,21 +58,17 @@ jobs:
# Pinned: the committed lock file is written by 0.78.0, and an
# unpinned pixi rejects it as not up-to-date with the workspace.
pixi-version: v0.78.0
environments: ${{ matrix.env }}

# `unit` needs no server. `server` starts a throwaway PostgreSQL cluster
# from the conda `postgresql` package (no Docker, no service container —
# GitHub's macOS runners have neither), runs the live suite and the
# psql/psycopg cross-check against it, and stops it on exit. `pool` does
# the same for the connection-pool suite and its negative control, and
# runs only on `stable`: it imports the threads-mojo package, and a
# .mojopkg is readable only by the compiler that built it, so on the
# nightly leg tests/run_pool.sh prints why and skips.
# the same for the connection-pool suite and its negative control.
- name: Tests
run: pixi run -e ${{ matrix.env }} test
run: pixi run test

- name: Lint (mojolint --lsp)
run: pixi run -e ${{ matrix.env }} lint
run: pixi run lint

# Imports: no cycles between modules, and each name imported from the
# module that defines it (github.com/magmalake/customs).
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Contributing

1. Fork, branch off `main`.
2. `pixi run test` on both toolchains (`pixi run -e stable test` for 1.2.0) —
the server suite needs nothing but the conda env, it starts its own cluster.
2. `pixi run test` — the server suite needs nothing but the conda env, it
starts its own cluster.
3. `pixi run format-check` before committing.
4. If you change the public API, update `README.md` and `examples/`.
5. Open a PR. Small focused PRs over big ones.
Expand Down
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ inventory are his. Thank you.
**What changed here, and why.** Upstream targets Mojo 0.25.7, where FFI and
pointer APIs have since moved, and it reaches libpq through `PQexec` plus
`PQescapeLiteral` — values are escaped into SQL text, so there is no way to
bind a parameter. This fork is a rewrite on the 1.x toolchain (stable 1.2.0 and
nightly) that keeps the shape and replaces the substance: `PQexecParams` and
bind a parameter. This fork is a rewrite on the 1.x toolchain that keeps the
shape and replaces the substance: `PQexecParams` and
prepared statements instead of escaping, a process-wide libpq handle instead
of `external_call`, SQLSTATE on every error, transactions, `COPY`, and a test
suite that runs against a real server. Upstream's open issues
Expand Down Expand Up @@ -374,14 +374,6 @@ waiting on a condition variable that is about to be destroyed is precisely the
use-after-free this module exists to rule out. A service that must not pin
backends overnight already has a timer; `reap()` is one call on it.

### Caveat: stable toolchain only

`postgres.pool` builds under **mojo 1.2.0** only. A precompiled `.mojoc` is readable only
by the compiler version that built it, and tins are built with 1.2.0, so
`from threads import ...` does not resolve under the nightly. `pixi run pool`
detects this and skips with a reason there. The rest of the tin is unaffected
and still builds and tests on both.

## Performance

Four benchmarks over `(id int8, price numeric(12,4), qty int4, label text)`,
Expand All @@ -408,8 +400,7 @@ scan benchmark pays for, arriving as digits and staying a `String`.
## Test

```sh
pixi run test # unit + server + crosscheck + pool
pixi run -e stable test # same, on Mojo 1.2.0
pixi run test # unit + server + crosscheck + pool (Mojo 1.3.0.dev2026111805)
pixi run pool # just the pool suite and its negative control
pixi run examples # every examples/*.mojo file, against a live server
```
Expand Down Expand Up @@ -438,7 +429,7 @@ pixi run examples # every examples/*.mojo file, against a live server
cross-checked a third way against `psql ... COPY ... TO STDOUT` of the same
table.

- **Pool tests** (`pixi run pool`, stable toolchain only) — concurrent
- **Pool tests** (`pixi run pool`) — concurrent
checkout from twelve threads over a four-connection pool, each lease
asserting that the session marker it set is still its own when it reads it
back (a shared `PGconn` fails that deterministically); exhaustion raising
Expand Down
Loading
Loading