Repository navigation
fix: keep configured schema order; strict env and duration checks - #92
Merged
Merged
Conversation
archlemon
force-pushed
the
refactor/b15
branch
from
November 24, 2026 01:52
443c4e9 to
7aea35a
Compare
Introspect stored the caller's schemas slice in the catalog and then sorted it in place, so a product's schema.schemas configuration was alphabetised by a live boot (and by every watch rebuild) but not by a schema-cache boot. Introspect now copies the slice and Catalog.Schemas keeps the configured order, which products treat as a priority order; Hash sorts its own copy, so hashes do not change.
An environment variable that doubles the underscore right after its section (PDBQ_ROLES__ALLOWED maps to roles_allowed) has no section of its own, so strict loading ignored it and the setting silently kept its default. Load now treats a key starting with a section name and an underscore as inside that section and suggests the corrected variable. ValidateDatabase rejects max_conns below 1, a non-positive connect_timeout and a negative statement_timeout; ValidateIdentity rejects a non-positive JWKS cache TTL when a JWKS URL is set (it fell back to one hour); ValidateWatch and watch.New reject a non-positive poll interval, on which the polling fallback panicked.
pdbq documents and tests database.max_conns: 0 as the pgx pool default; only a negative value is invalid.
archlemon
force-pushed
the
fix/audit-config-schemas
branch
from
November 24, 2026 01:54
e611026 to
5d6cc67
Compare
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.
Closes #88
Closes #91
Stacked on #90 (base
refactor/b15), so the products can move to one pdbcore commit that contains all three PRs. It retargets as the lower PRs merge.Schema order (#88)
introspect.Introspectcopies itsschemasargument instead of storing and then sorting the caller's slice.Catalog.Schemaskeeps the configured order. The products treat that order as a priority order, and it is the orderParseTypeNamealready searched in.Hashsorts its own copy, so hashes, and with them schema caches and the drift check, do not change.schema.schemasand a schema-cache boot did not. In pdbr, the bare aliases (/users,/rpc/{fn}) went to the alphabetically first schema after a live boot; they now followschema.schemas[0]however the server starts. The pdbr PR notes this in its changelog.Introspectleaves the caller's slice unchanged, andCatalog.Schemasneither shares that slice nor reorders it.Doubled underscore after the section (#91)
PDBQ_ROLES__ALLOWEDmaps toroles_allowed. That has no section of its own, so strict loading used to drop it silently.Loadnow treats a key that starts with a section name (or a moved or removed key's section) followed by_as inside that section. It reports the variable with the corrected spelling, for exampledid you mean PDBQ_ROLES_ALLOWED?, or with the moved-to hint.PDBQ_TEST_DATABASE_URL) stay ignored. Tests cover both cases.Shared durations
ValidateDatabaseis new. It rejects:database.max_conns(0 stays the pgx pool default)database.connect_timeout(0 waited forever)database.statement_timeout(0 still disables it)ValidateIdentityrejects a non-positiveauth.jwt.jwks_cache_ttlwhenauth.jwt.jwks_urlis set. Before, it silently became one hour.ValidateWatchandwatch.Newreject a non-positive poll interval. The polling fallback panicked on one.server.request_timeoutlives in the products and is out of scope here.CI
Like #90, the
downstreamjob fails until the pdbq and pdbr PRs merge.Tests
go test -race ./...,go vet,golangci-lintlint-test