Skip to content

refactor: #54 edtf-postgres becomes a workspace member - #59

Merged
CarlAllenn merged 3 commits into
mainfrom
refactor/postgres-workspace-member
Jul 31, 2026
Merged

refactor: #54 edtf-postgres becomes a workspace member#59
CarlAllenn merged 3 commits into
mainfrom
refactor/postgres-workspace-member

Conversation

@CarlAllenn

Copy link
Copy Markdown
Owner

Deletes the special-casing #54 was built to work around, rather than adding more of it.

The premise was wrong

edtf-postgres sat outside the workspace because a member's [profile] is ignored, and the root profile is wasm-tuned (opt-level = "z", strip = "symbols") while a Postgres extension needs speed and its symbol table intact.

That constraint is real. What I had asserted — that it was unfixable — was not. Cargo takes per-package profile overrides, and opt-level and strip are both overridable; only panic, lto and rpath are not, and none of those need to differ here (root already sets lto = "fat", matching, and panic defaults to unwind for both).

Proven in a single build:

edtf_core:     opt-level=z   strip=symbols     ← workspace default
edtf_postgres: opt-level=3   strip=<none>      ← package override

The layout

default-members holds the five pure-Rust crates, so bare cargo build/test/clippy need no $PGRX_HOME and never hit the mutually-exclusive pg14pg18 features. Verified: cargo check --all-features --all-targets passes with no Postgres present.

This is what established pgrx projects do. ParadeDB sets default-members = ["pg_search", "tokenizers"] with the same rationale in a comment; pgvectorscale keeps its extension a member too. Both put the macOS linker flags in the root .cargo/config.toml — because Cargo "does not read config files from crates within the workspace", so a crate-local one silently stops applying to anything run from the root. pg_search has no .cargo/ at all.

What this deletes

  • The hand-bump, check-version-drift.sh, and the lint:versions gate — release-plz now owns version, tag, changelog and release via version_group
  • The crate's own Cargo.lock and .cargo/config.toml
  • 40 lines of lint config mirrored from the root because it could not inherit
  • The postgres branch in publish-crates.sh and the dual-workspace handling in package-all.sh

semver_check = false for it: cargo-semver-checks builds the crate, which needs $PGRX_HOME, and its contract is its SQL surface, not a Rust API — the lib target exists only because pgrx requires one.

The finding that matters most

cargo-deny had never audited this crate's ~150 dependencies. The gate runs over the workspace; the crate wasn't in it. A published crate has sat outside the supply-chain gate since it shipped.

Bringing it in surfaced an unmaintained advisory (serde_cbor via pgrx — informational, not a vulnerability; patched = [] because there is nothing to patch; tracked upstream at pgrx#524), three permissive licences, nine duplicate versions, and fifteen build scripts. Each is recorded with a reason, and unused-ignored-advisory = "deny" plus -D unmatched-skip mean every entry fails CI the moment upstream moves.

None of this is new exposure. It was invisible.

Two things found by running it

lefthook.yml carries its own copies of the clippy and test commands, so the Taskfile sweep missed them — --workspace --all-features there hit the pg-feature clash on push. Fixed.

Dropping --workspace then dropped edtf-postgres out of clippy entirely. It cannot rejoin the workspace gate — linting it needs $PGRX_HOME and exactly one pg feature — so it is now linted in ci.yml's postgres job, against every Postgres major, at the same -D warnings tier as everything else.

Verified locally

cargo pgrx test pg18 in the exact CI form — 6 passed, 13 SQL entities discovered. cargo package with the verify build, exact CI form — clean. cargo package -p edtf-postgres yields the same dependency set as the old standalone lockfile (225 → 227; wasm-bindgen was already there via whoami → web-sys). task lint --force green. cargo deny check green. task pg:lint green.

Refs #54

It sat outside the workspace because a member's [profile] is ignored,
and the root profile is wasm-tuned (opt-level = "z", strip =
"symbols") while a Postgres extension needs speed and its symbols.
That is real, but it is not the whole story: Cargo takes per-package
profile overrides, and opt-level and strip are both overridable
(only panic, lto and rpath are not — and this workspace needs
neither of those to differ). Verified in one build:

  edtf_core:     opt-level=z  strip=symbols
  edtf_postgres: opt-level=3  strip=<none>

So the crate joins the workspace, with default-members holding the
five pure-Rust crates so bare cargo build/test/clippy still need no
$PGRX_HOME and never hit the mutually-exclusive pg14-pg18 features.
This is the layout every serious pgrx project uses: ParadeDB sets
default-members for exactly this reason, and both it and
pgvectorscale keep the extension a member and the macOS linker flags
in the ROOT .cargo/config.toml — Cargo does not read config files
from crates inside a workspace, so a crate-local one silently stops
applying.

What this deletes: the hand-bump, check-version-drift.sh, the
lint:versions gate, the crate's own Cargo.lock, and 40 lines of lint
config mirrored from the root because it could not inherit.
release-plz now owns edtf-postgres's version, tag, changelog and
release like the other five, via version_group. semver_check is off
for it: cargo-semver-checks builds the crate, which needs PGRX_HOME,
and its contract is its SQL surface, not a Rust API.

The find that matters most: cargo-deny had never audited this
crate's ~150 dependencies, because the gate runs over the workspace
and the crate was not in it. A published crate has been outside the
supply-chain gate since it shipped. Bringing it in surfaced an
unmaintained advisory (serde_cbor via pgrx, upstream pgrx#524), three
permissive licenses, nine duplicate versions and fifteen build
scripts — each now recorded with a reason that expires itself when
upstream moves. None of this is new exposure; it was simply
invisible.

Verified locally: cargo pgrx test pg18 passes (6 tests, 13 SQL
entities discovered), cargo check --all-features --all-targets needs
no Postgres, cargo package -p edtf-postgres produces the same
dependency set as the old standalone lockfile, and cargo deny is
green.

Refs #54
lefthook's pre-push ran cargo test/clippy --workspace --all-features,
which now reaches edtf-postgres and enables pg14-pg18 at once — the
hard error pgrx raises for multiple pg$VERSION features. It never
surfaced in the Taskfile sweep because the hooks carry their own
copies of those commands.

Dropping --workspace also dropped edtf-postgres out of clippy
entirely, since it is not a default member. It cannot rejoin the
workspace gate: linting it needs $PGRX_HOME and exactly one pg
feature. So it is linted in ci.yml's postgres job, which has both,
against every Postgres major, at the same tier as everything else.
The action queries api.deps.dev and api.securityscorecards.dev for
dependencies a PR ADDS. Every PR so far added none, so the calls were
never made and the allowlist was never wrong. Bringing edtf-postgres
into the workspace adds ~150 crates to the graph, the action went to
score them, and egress-block turned it into a bare 'fetch failed'.

Endpoints taken from what harden-runner reported blocked, same
derivation as every other allowlist here.
@CarlAllenn
CarlAllenn merged commit 5945694 into main Jul 31, 2026
13 checks passed
@CarlAllenn
CarlAllenn deleted the refactor/postgres-workspace-member branch July 31, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant