feat!: setup() and hydrate() return a new instance - #74
Closed
martijn00 wants to merge 38 commits into
Closed
Conversation
Develop the library on TypeScript 7 while keeping the consumer peer at 5.9–7, and pin shared toolchain versions through a strict pnpm catalog so CI and local installs stay aligned. Co-authored-by: Cursor <cursoragent@cursor.com>
Give each factory its own provider/hook/Check bindings so nested policies do not share state, and hydrate dehydrated rules on the first client render without mutating during render. Co-authored-by: Cursor <cursoragent@cursor.com>
Cache one initialized instance per RSC request so concurrent server callers share setup, and keep layouts synchronous with permission work behind Suspense for Cache Components. Co-authored-by: Cursor <cursoragent@cursor.com>
Subscribe to setup/ready during render instead of after an effect so dehydrated booleans and already-initialized rules are visible on the first paint. Co-authored-by: Cursor <cursoragent@cursor.com>
Toolchain skills from skills.sh fail format check and are not project source. Co-authored-by: Cursor <cursoragent@cursor.com>
Oxfmt rejected the barrel and type-test files, and pinning React 18 in the catalog conflicts with docs/fumadocs React 19 peers. Co-authored-by: Cursor <cursoragent@cursor.com>
Oxfmt requires a single trailing newline after the merge from the React factory branch. Co-authored-by: Cursor <cursoragent@cursor.com>
Reconstruct published npm history, show it on the docs site, and wire conventional-commit releases. Co-authored-by: Cursor <cursoragent@cursor.com>
Upgrade Fumadocs to 16.15 with the Base UI alias. Ignore .agents and .claude so CI format check skips third-party skill files. Co-authored-by: Cursor <cursoragent@cursor.com>
pnpm 11 rejects packages newer than one day in frozen CI installs. Co-authored-by: Cursor <cursoragent@cursor.com>
Wire Permix into Nest via APP_GUARD so each request gets its own instance, then enforce @check on handlers without tying the API to Express middleware. Closes letstri#11. Co-authored-by: Cursor <cursoragent@cursor.com>
Store one Permix instance per Nitro event so Nuxt server routes and Vue SSR share rules without leaking state across requests. Co-authored-by: Cursor <cursoragent@cursor.com>
Store a per-request Permix instance on Astro locals so middleware, endpoints, and pages can share rules without tying UI islands to a new client adapter. Co-authored-by: Cursor <cursoragent@cursor.com>
React Router 7 (including Remix) needs a per-request instance on middleware context so loaders can dehydrate into permix/react. Co-authored-by: Cursor <cursoragent@cursor.com>
Reuse existing Zod, Valibot, or ArkType schemas on action specs and via permix/standard-schema so ReBAC callbacks stay typed without duplicate interfaces. check() still does not parse data at runtime. Co-authored-by: Cursor <cursoragent@cursor.com>
Parse check() data with the entity schema when validate is deny or throw, and lock Zod, Valibot, ArkType, and Effect Schema behind regression tests so those integrations stay working. Co-authored-by: Cursor <cursoragent@cursor.com>
…talog-extraction Co-authored-by: Cursor <cursoragent@cursor.com>
…talog-extraction Co-authored-by: Cursor <cursoragent@cursor.com>
…talog-extraction Co-authored-by: Cursor <cursoragent@cursor.com>
…talog-extraction Co-authored-by: Cursor <cursoragent@cursor.com>
…talog-extraction Co-authored-by: Cursor <cursoragent@cursor.com>
…talog-extraction Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid passing undefined React Router params. Narrow the generated Svelte component at its factory boundary so TypeScript 7 checks remain valid. Co-authored-by: Cursor <cursoragent@cursor.com>
Derive typed definitions and metadata from static permission markers so application usage becomes the catalog source of truth. Include CLI, watch and check workflows, Next.js integration, typed payload overlays, provider coverage validation, and consumer guidance. Co-authored-by: Cursor <cursoragent@cursor.com>
Measure every public entry in CI and preserve tree-shaking boundaries. Avoid rerendering Check when its permission result is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
…in CI Hydrate and check treated inherited Object.prototype names as allowing rules, and Fastify/Elysia could fall through after a custom deny handler. Freeze a null-prototype copy of rules so caller mutation cannot change authorization, and gate PRs on the full Vitest suite. Co-authored-by: Cursor <cursoragent@cursor.com>
Null-prototype frozen rules and Object.hasOwn lookups add ~550 bytes to the core graph; raise ceilings with the usual 12% headroom and keep delta caps so later PRs still cannot grow unchecked. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@martijn00 is attempting to deploy a commit to the letstri Team on Vercel. A member of the Team first needs to authorize it. |
Closed
5 tasks
Co-authored-by: Cursor <cursoragent@cursor.com>
martijn00
force-pushed
the
feat/v5-immutable-setup
branch
from
August 28, 2026 23:51
dfa4182 to
35c4f9d
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
…nstance UI check() now goes through the live instance once rules exist so hooks and Standard Schema validate run, Svelte hydrate follows state, and Vue Check caches a computed boolean. Document that core setup() is not request-safe. Co-authored-by: Cursor <cursoragent@cursor.com>
…uild Move chokidar, oxc-parser, and tinyglobby to optional peers so UI-only installs skip native parser binaries. Cache per-file parses during watch, and build dist once before the TypeScript compatibility matrix. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep check() boolean while rule functions may return { allow, reason }.
Adapters, UI hooks, and PermixForbiddenError carry the same payload.
Co-authored-by: Cursor <cursoragent@cursor.com>
Split factory from instance so overlapping setup cannot leak across requests. Adapters stash the returned frozen instance; Next cache() stores that instance instead of mutating a shared core. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
martijn00
force-pushed
the
feat/v5-immutable-setup
branch
from
August 28, 2026 23:56
ae98d17 to
2a4fdba
Compare
Owner
|
Closing: this changes the public API, which is not something we're taking from external PRs right now. |
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.
Summary
setup()andhydrate()return a new frozen instance and never mutate the factory (DIR-01 / COR-01)setup()on one factory is isolated across returned instancescache()stores that instance instead of mutating a shared coresetup/readyhooks sousePermix()/Checkstay in syncTest plan
pnpm testpnpm run check-typespnpm run lintpnpm --filter permix size:compare(intentional ~300 byte UI adapter growth; baseline refreshed)cd permix && pnpm run skills:staleMade with Cursor