OpenAPI follow-ups: parameters-block parity, overload merge, per-role privileges cache (#53) - #83
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds the preferParams $ref on RPC POST (issue #53 item 3) and the rest of the makeParamDefs parity: preferParams def with suppressed empty enum, preferPost resolution enum values, on_conflict def, args body required:true, PATCH/DELETE parameter lists without select, rowFilter description over format. Each cited to Response/OpenAPI.hs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The most-parameters overload supplies the whole path item, mirroring PostgREST's overload sort + last-insert-wins assembly (issue #53 item 2). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GET / in follow-privileges mode no longer runs two catalog queries per
request: results are cached per {instance, role} in a public ETS table and
stamped with the schema-cache snapshot generation, so a reload invalidates
them with zero coordination (issue #53 item 4).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rescue ArgumentError around the ETS lookup/insert path so a table that died between a GenServer crash and its restart degrades to calling the loader directly instead of raising into the request; trap exits and erase the persistent_term tid in terminate/2 so a clean shutdown never leaves a stale handle published. Mirrors the identical defense in Bier.JwtCache. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- lib/bier.ex: document that follow-privileges caches per-role privilege filtering and refreshes on schema-cache reload; add the same one-liner to README.md's config-options table. - test/bier/privileges_cache_test.exs: add on_exit cleanup for the dead tid the table-gone test re-publishes into :persistent_term. - lib/bier/privileges_cache.ex: add an explicit fetch/4 clause that bypasses the cache for a nil generation (pre-first-snapshot-load caller), instead of leaving it an unreachable implicit invariant. - CLAUDE.md: note the conditional Bier.JwtCache child in the boot-sequence list, matching lib/bier.ex's actual children. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@claude review once. |
|
Claude finished @milmazz's task in 4m 14s —— View job Review complete
|
|
Verified the
So "definition present in the shared 🤖 Generated with Claude Code |

Closes items 2–4 of #53 (item 1 follows in a stacked PR).
What's here
Parameters-block parity with PostgREST v14.12 (
Response/OpenAPI.hs, cited per change in the code):preferParamsshared definition (noenumkey — v14.12 suppresses the empty enum) and its$refon every RPC POST path item (OpenAPI.hs#L219-226)argsbody paramrequired: true(L222)preferPostenum extended with theresolution=*values (L184-186, L234)on_conflictshared definition (L242-248)select(L336-339)rowFilter.*definitions carrydescription(column COMMENT) instead offormat(L299-308)Overloaded-RPC path-item merge (#53 item 2): one
/rpc/<fn>path item; the most-parameters overload supplies it entirely, mirroring PostgREST's overload sort + last-insert-wins assembly (SchemaCache.hs#L292, Routine.hs#L89, OpenAPI.hs#L381).Per-role privileges cache (#53 item 4):
GET /underopenapi-mode = follow-privilegesno longer runs two catalog queries per request. NewBier.PrivilegesCache(GenServer-owned public ETS, tid viapersistent_term) caches per{instance, role}, stamped with a newgenerationref on the%Bier.SchemaCache{}snapshot — a schema-cache reload invalidates with zero coordination, matching PostgREST's reload-time freshness. Hardened against table-gone races following theBier.JwtCachepattern.Notes
spec//test/support//test/conformance/trees are untouched. Unit-test corrections intest/bier/openapi_test.exseach carry their PostgREST source citation.mix precommitgreen: 864 passed, 5 excluded."/"path item, RPCproduces, defaulthost/basePath) are tracked in a follow-up issue rather than here.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vdh3cbYLtKJfGkZ1ijrYGt