PermDock
Guides

Upgrade to 0.31

The breaking changes in permdock 0.29 to 0.31, one ordered checklist from 0.28.0 with better-supabase 0.82.0 to 0.85.0, and each change with its old and new form.

This guide is about the permdock package at 0.31.0. The tables name the version that dropped the old form: "0.30" is what permdock 0.30.0 does, "0.31" what 0.31.0 does. 0.29.0, 0.30.0 and 0.31.0 each carry a breaking change. Codemod 0.31 is also accepted as 0.32, the name an earlier draft of this guide used.

From 0.28 to 0.31

Follow these steps in order for an app that moves from permdock 0.28.0 to 0.31.0 together with better-supabase 0.82.0 to 0.85.0. The right column names the step of better-supabase's 0.82 to 0.85 checklist that the step comes before or after.

#StepPosition in better-supabase's checklist
1Peers: Node.js 26, eve 1.2.0, ai 7.0.177, chat 4.45.0, better-supabase 0.85.0, permdock 0.31.0; remove oxc-parser and pgsql-parser from your own package.json; pnpm installTogether with step 1 (bump the package), one install
2permdock codemod 0.31After step 2 (0.83 codemods), before step 3
3permdock codemod config --prune --check, then permdock codemod config --pruneAfter step 2, which prunes better-supabase.config.ts; before step 3
4permdock codemod bsb-access-tagsAfter step 2, whose table-tags codemod writes the tag comments; before step 4
5permdock codemod bsb-action-keysAfter step 2; before step 3, which moves the keys it writes onto the provider
6permdock codemod manager-chainAfter step 2; before step 4
7permdock generateBefore step 4: better-supabase gen reads the helpers and policies it writes
8permdock supabase inspect --outAfter step 7, before step 4: the provider reads the manifest
9tables: true on authorizationProvider, and sharedFunctions: true when pages load through one functionPart of step 3 (provider fields)
10permdock doctorBefore step 5
11better-supabase doctorIs step 5; it reports PermDock's findings as BS705

Then go on with steps 6 to 9 of better-supabase's checklist (data changes, bsb.kept(), warm the instance, request stats). The sections below list each change.

ReleaseBreaking changeSection
0.29.0rls generate writes permdock_role_in with rls.customRoles in database mode; regenerate the helpers and the manifestbetter-supabase provider
0.30.0permdock/eve needs eve 1.2.0, ai 7.0.177 and chat 4.45.0; EveResponseContext and the approval decision changeeve
0.31.0Node.js 26, the doctor baseline, snapshot wire v2, VersionStore, derived RLS facts, better-supabase 0.85.0The rest of this page

Node.js 26

0.300.31
engines.node: >=24engines.node: >=26
Vercel runtime 24.xVercel runtime 26.x

Parser dependencies

oxc-parser, pgsql-parser and libpg-query are exact-pinned dependencies of permdock. Remove them from your own package.json; doctor PD126 reports an app that lists one at another version, which installs a second copy.

0.300.31
oxc-parser and pgsql-parser in the app's dependenciesnot listed; permdock brings them

Doctor baseline

doctor.waivers and doctor.ignore are removed. Accepted findings live in the file doctor.baseline names, in better-supabase's grouped format (accept a finding). permdock codemod 0.31 moves both lists.

0.300.31
doctor.waivers: [{ code: "PD017", key, reason }]{ "code": "PD017", "reason": ..., "targets": [key] } in doctor-baseline.json
doctor.ignore: [{ id: "PD078:<target>", reason }]{ "code": "PD078", "reason": ..., "targets": [target] }
an entry without a reasonan error
an entry that matches no findingan error; permdock doctor --update-baseline rewrites the file

Snapshot wire v2

Snapshots are v: 2 (schemas/snapshot-v2.json). parseSnapshot, fromSnapshot, snapshotFromClaims and the React Native storage refuse v: 1, so a client drops a cached v1 snapshot and fetches a new one. Deploy the server before the clients (snapshots).

0.300.31
v: 1v: 2
vocabulary, scopes and shared grants inlineread from the client bundle (bundle, static.shared)
each requires holding repeated per grantwritten once in the requires table
getSnapshot from permdock/better-supabase lists one tenantlists every membership
flat snapshot fieldsreadSnapshot(snapshot, { bundle }) returns the flat form

VersionStore

A custom VersionStore stores the database read time, so maxStaleMs counts from the read on every instance. runtimeCacheVersionStore and postgresCacheVersionStore are new (extension interfaces).

0.300.31
get(id) answers number | undefinedget(id) answers { version, at } | undefined
set(id, version)set(id, version, at)

Derived RLS facts

rls.memberships and rls.suspension are derived from supabase.hook.memberships and supabase.hook.suspension when unset. Doctor PD121 reports a written entry that disagrees with or restates its source; the prune removes a restated one.

0.300.31
rls.memberships written beside supabase.hook.membershipsderived; junction sources get claims-first helpers
a verb without an rls.actions entry fails rls generatecompiles to none; doctor PD122 lists it
rls.actions: { archive: "none" }not needed
rls.tables: { teamMember: "team_members" }not needed when the schema files create team_members and not teamMember
rls.scopeTypes: { organization: "uuid" }read from the scope table's id column

The schema files are read from the nearest Supabase project at or above the config, in the same git checkout. A config in packages/identity reads the repository's supabase/. With rls.readOnlyActors, generate then writes a read-only actor guard for every hand-written write policy in that project, not only for the tables rls.tables names.

Active tenant

0.300.31
doctor PD078 waived for an app that picks the tenant per requestsupabase.hook.activeTenant: "request"
blocks.permissions.activeTenant in better-supabase.config.ts for BS409not needed; the provider states tokenHook.activeOrganizationFrom: "resolver"
a tenant slug resolved by hand in middlewaretenantFromPath from permdock/server, permdock/supabase/middleware or permdock/next

better-supabase provider

authorizationProvider from permdock/better-supabase supplies more of better-supabase's config. Doctor PD094 reports a key in better-supabase.config.ts that now restates the provider.

0.300.31
blocks.<block>.permissions keys in better-supabase.config.tsmeta.answers on the permission; permdock codemod bsb-action-keys moves them
functions.approverFor set by the providernot set; permdock_approver_for_ids() answers the users the caller decides for
blocks.memberships.options.roleThrough, blocks.invitations.options.platformRolesderived from the provider's roleSources and platformRoles
doctor findings run separatelydoctor.command runs permdock doctor --format findings; better-supabase reports them as BS705

Permission key renames

permdock keys rename <from> <to> moves the action in the permissions module and adds "from": "to" to definePermissions(..., { renamed }). With custom roles stored in the database it also writes a data migration that moves the stored grants (keys).

eve

0.300.31
subjectFromEve reads session.auth.initiatorreads the turn's caller, session.auth.current, then the initiator
actorFromEve varies with the sessionalways { id: "eve:app", kind: "eve" }
EveResponseContext has request.requestIdrequest.interactionId and request.principal; the decision is "approve" | "deny", with no cancel
the session reads id and the callerreads id and initiator; a response on another instance recomputes the token with request.principal

OpenAPI

0.300.31
x-authorization: "handler" names a key handlermarks an operation the handler checks
a file header @permission on the first handleronly the JSDoc block directly above each handler counts

Session cookies

PermDock's claims stay within supabase.hook.budget. Most of a Supabase session cookie is the user object. better-supabase 0.85 writes cookies.encode: "tokens-only" for a new app and reports an app whose cookie still carries the object as BS644. Set it in your better-supabase client; PermDock needs no change.

Last updated on

On this page