Skip to content

Upgrade pg.zig pin to a Zig 0.16-compatible version (blocks nanoapi runtime adoption) #165

@justrach

Description

@justrach

Problem

`zig/build.zig.zon` pins `pg.zig` at SHA `7605502f24e348c50341cbdf84ac135613d512af`:

```zig
.pg = .{
.url = "git+https://github.com/justrach/pg.zig?ref=master#7605502f24e348c50341cbdf84ac135613d512af\",
.hash = "pg-0.0.0-Wp_7gYTxBgDOvvLXaKfiXksk9WArPQJWgY833oQjfk1y",
},
```

That version of pg.zig calls `lib_test.addLibraryPath(p)` in its own build.zig — the `addLibraryPath` API on `Build.Step.Compile` was removed in Zig 0.16. The whole turboAPI build fails before even compiling the lib:

```
zig-pkg/pg-.../build.zig:73:21: error: no field or member function named 'addLibraryPath' in 'Build.Step.Compile'
lib_test.addLibraryPath(p);
```

Why now

This blocks adopting nanoapi's runtime layer as the shared HTTP base (see nanoapi#12). Wiring nanoapi into turbonet's main `build.zig` triggers full dep resolution including pg.zig, which fails. The `feat/nanoapi-runtime-spike` branch works around this by living in a self-contained `spike/` subproject — fine for proving the integration shape, not viable for the real port.

Resolution options

  1. Bump `pg.zig` to a newer commit on `master` that fixes `addLibraryPath` for Zig 0.16. Check if upstream has already moved.
  2. Fork `justrach/pg.zig` and patch the build.zig directly. Pin the fork.
  3. Drop pg.zig from turbonet's build if TurboPG can be built as a separate Zig artifact — pg.zig only goes into the postgres path, not the HTTP runtime, so a build-time split might work cleanly.

Option 1 is preferred if a compatible upstream exists. Option 2 is the fast path. Option 3 is the right end state but more refactor.

Acceptance

  • `python zig/build_turbonet.py --install` succeeds on Zig 0.16
  • Adding `.nanoapi = .{ .path = "" }` to `zig/build.zig.zon` and importing nanoapi from `zig/src/main.zig` does not break the build
  • TurboPG functionality (test suite under `tests/test_turbopg*.py`) still works

Blocks

turboAPI — the nanoapi runtime-layer port (PyDispatcher, removing the duplicated server.zig HTTP plumbing).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions