docs(adr): ADR-0052 keys a hook's context to the app's DB (#1211) - #1212
Merged
Conversation
The Hook arguments section keyed `item`, `resolvedData` and `needs` but left `context` unparameterised, so the Prisma 8 keying would have re-landed the gap #1211 reports on main: a hook's context resolves over `PrismaClientLike = any`, `AccessControlledDB<any>` is assignable to nothing, and a typo'd delegate type-checks. Records that TypeInfo carries the app's DB and core's hook types read `context` off it, and that main's pre-contract fix establishes the same seam rather than a second mechanism. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6 tasks
Contributor
Coverage Report for Core Package Coverage (./packages/core)
File CoverageNo changed files found. |
Contributor
Coverage Report for UI Package Coverage (./packages/ui)
File CoverageNo changed files found. |
Contributor
Coverage Report for CLI Package Coverage (./packages/cli)
File CoverageNo changed files found. |
Contributor
Coverage Report for Auth Package Coverage (./packages/auth)
File CoverageNo changed files found. |
Contributor
Coverage Report for Storage Package Coverage (./packages/storage)
File CoverageNo changed files found. |
Contributor
Coverage Report for RAG Package Coverage (./packages/rag)
File CoverageNo changed files found. |
Contributor
Coverage Report for Storage S3 Package Coverage (./packages/storage-s3)
File CoverageNo changed files found. |
Contributor
Coverage Report for Storage Vercel Package Coverage (./packages/storage-vercel)
File CoverageNo changed files found. |
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.
Amends ADR-0052 so the Prisma 8 keying carries a hook's
contextdeliberately, rather than re-landing the gap #1211 reports onmain.Why
ADR-0052's "Hook arguments" section keys
item,resolvedDataandneeds— and says nothing aboutcontext. That omission looks like an oversight rather than a decision: under the record's own keying, the generatedContextisStackContext<DB, S, PluginServices>over the contract-derivedDB, but a hook'scontextwould still resolve over a default. Onmaintoday that default isPrismaClientLike = any, soAccessControlledDB<any>is a mapped type overkeyof anyintersected with an index signature — assignable to nothing, and happy to acceptcontext.db.typoedListName.Confirmed against the published
@opensaas/stack-core@0.41.0dist:context.db.typoedListNamecompilescontextto a client-specificdbfailsTS2322— "Property 'lessonSchedule' is missing in typeAccessControlledDB<any>"The record's "Core gains the generics and loses
any" consequence already deletesPrismaClientLikeandAccessControlledDB's structural probing. Without this amendment, the hook args are left reading a default that no longer exists.What it records
TypeInfocarries the app'sDB, and core's generic hook types readcontextoff it — a hook'scontextis the sameStackContext<DB, S, PluginServices>the generatedContextinstantiates.beforeTransaction/afterTransaction(ADR-0028) and fieldresolveOutput(ADR-0066) are keyed to the sameDBand gain nosudo/withSession/transaction.main's pre-contract fix (Hook args are not generic over the Prisma client, so a hook'scontextis untypeable in a consumer —AccessControlledDB<any>is assignable to nothing #1211,ready-for-agent) establishes the same seam — the client type enters atTypeInfo— so it is not a second mechanism and is not wasted at the merge. What changes under the contract is only whatTypeInfoholds.Docs only: one ADR section, no package or code changes, so no changeset.
Related
contextis untypeable in a consumer —AccessControlledDB<any>is assignable to nothing #1211 — themainfix, briefed andready-for-agent🤖 Generated with Claude Code