Skip to content

refactor!: move to the pdbcore API hygiene release - #103

Merged
archlemon merged 2 commits into
mainfrom
refactor/pdbcore-b15
Nov 24, 2026
Merged

archlemon merged 2 commits into
mainfrom
refactor/pdbcore-b15

Conversation

@archlemon

@archlemon archlemon commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Moves pdbr to the pdbcore changes in suprbdev/pdbcore PRs 89 (shared smart-tag checks), 93 (API hygiene) and 92 (schema order, env and duration checks). It pins the tagged release pdbcore v0.19.0, which contains all three.

Rebased on main, which gained the audit fixes from PR 104 (count-only limit=0, RFC 4180 CSV writer, queryField for ~ names, Vary headers, server.request_timeout of at least 1s). Only CHANGELOG.md conflicted; both sides' entries are kept, with the schema order fix listed under Fixed next to the audit fixes. Config validation has the request_timeout check alongside RemovedKeys and ValidateDatabase.

Smart tags, now the same as pdbq

  • @behavior -filterBy / -orderBy (the PostGraphile V5 spellings) are honoured as @omit filter / @omit order. pdbr used to ignore them.
  • -filter / -order keep working and now warn at build time with their replacement.
  • The smart_comments plugin runs pdbcore's catalog.Check in TransformCatalog against pdbr's @omit vocabulary (read, all, create, update, delete, many, filter, order). TransformAPI then logs unknown @omit actions and unknown @behavior tokens through the configured logger. pdbq uses the same checks.
  • Documented in docs/smart-comments.md, with tests for the warnings and for both spellings.

Schema order

A live boot used to alphabetise schema.schemas, because pdbcore's Introspect sorted the slice in place. The bare /{table} and /rpc/{fn} aliases then came from the alphabetically first schema, while a schema-cache boot used the configured first one. They now always follow schema.schemas[0]. A new e2e test boots live with [public, b15_order] and checks this.

Config (user-visible, in CHANGELOG.md and docs/upgrading.md)

  • Removed keys report the reason (RemovedKeys).
  • PDBR_* variables with a doubled underscore after the section are errors with a did-you-mean hint.
  • transactions.isolation errors name the accepted values.
  • The database.*, auth.jwt.jwks_cache_ttl and watch.poll_interval durations are validated, and examples/pdbr.example.yaml is regenerated.

Embedding API

pdbr.LoadConfig(path, flags) takes map[string]any. cliflags.Changed from pdbcore/confx/cliflags builds that map from a pflag set.

Internal

  • Isolation and error detail come from the rejecting pgexec parsers.
  • PostGIS output uses OutputSQL(ref, Output{…}), and Ops(), Deriveds() and RasterAccessors() are accessor calls.
  • The watcher is built with watch.New.
  • Contract views report an unknown policy.
  • The SQL and OpenAPI goldens are unchanged (-update / UPDATE_GOLDEN=1).

Tests

  • go test -race ./..., go vet, golangci-lint, act lint-test
  • DB e2e (./test/ ./cmd/pdbr/, -p 1) on PostGIS 18 with pgvector
  • FuzzFilter, FuzzSpatial, FuzzParse and FuzzSplitEnvelope, 10s each

- The smart_comments plugin checks every commented object against
  pdbcore's shared vocabulary and logs unknown omit actions and unknown or
  deprecated behavior tokens at build time, as pdbq does; the behavior
  smart tag now honours the PostGraphile V5 spellings -filterBy and
  -orderBy, with -filter and -order deprecated.
- LoadConfig and config.Load take command-line values as a map
  (cliflags.Changed builds it); removed keys name the reason they were
  removed; doubled underscores after a section in PDBR_* variables are
  errors; the shared database and watch durations are validated.
- A live boot no longer reorders schema.schemas, so the bare aliases come
  from the first configured schema.
- Isolation and error detail come from the rejecting pdbcore parsers,
  postgis output uses OutputSQL with options, contract views report an
  unknown policy, and the watcher is built with watch.New.
@archlemon
archlemon force-pushed the refactor/pdbcore-b15 branch from 3edc3e2 to bf1fa64 Compare November 24, 2026 02:06
@archlemon
archlemon merged commit cafbed5 into main Nov 24, 2026
4 checks passed
@archlemon
archlemon deleted the refactor/pdbcore-b15 branch November 24, 2026 02:11
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