Skip to content

The documentation site rewritten for Prisma 8, with the costs placed where users meet them - #1379

Draft
borisno2 wants to merge 2 commits into
prisma-8from
claude/issue-1174-docs-prisma-8
Draft

The documentation site rewritten for Prisma 8, with the costs placed where users meet them#1379
borisno2 wants to merge 2 commits into
prisma-8from
claude/issue-1174-docs-prisma-8

Conversation

@borisno2

@borisno2 borisno2 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Implements #1174
Part of #1129
Closes #1317
Closes #1333

Draft while the remaining page groups land. Group 1 (reference/context-api.md, reference/config-api.md) is in; groups 2–4 are in flight and will be pushed to this branch as they complete. The full costs table, per-class sweep results and per-page type-check evidence go in this body before the draft is lifted.

Group 1 — the two reference pages

reference/context-api.md is rewritten around the two surfaces the runtime actually has:

  • the secured surface: the composed read (composers and their accumulate/replace semantics, the four terminals and their denial values, the per-terminal refusals), .select()/.include() with refinement callbacks, aggregate((a) => ({ k: a.count() })), nearest(), materialisation
  • the Where vocabulary as the closed set it is — nine scalar operators, three relation quantifiers, AND/OR/NOT, and the fail-closed rule that undefined is refused rather than dropped
  • the write subset: args objects, identity-only where, { connect: { id } } or null, and the four refusal errors
  • transactions with no options argument, and the row-lock gate
  • silent failure, the stack-owned error classes, sudo(), withSession()
  • a bypass section that is the Unsafe surface's own recipe and cost list

findMany/findUnique/findFirst/count() are gone from the page; list keys are PascalCase throughout; the four @opensaas/stack-core/context imports are replaced with the generated @/.opensaas/context.

reference/config-api.md documents every key DatabaseConfig actually carries and says plainly that prismaClientConstructor, db.url, extendPrismaSchema, joinTableNaming, shadowDatabaseUrl and useMigrations do not exist. It adds typed referential actions, db.timestamps (the user-facing spelling of what the contract module emits as temporal), the junction-list pattern that replaces implicit many-to-many, the list-level db keys and isSingleton, and corrects db.indexessort is gone from the type and refused at generate. OutputConfig.prismaSchema becomes contractModule; AccessContext.prisma becomes ormHandle.

Costs placed so far

# Cost Page Heading
1 updatedAt is application-side reference/config-api.md Cost: updatedAt is application-side
4 every to-one read off an included row is a null-check reference/context-api.md Cost: every to-one read off an included row is a null-check
5 a secured read holds its whole result reference/context-api.md Cost: a secured read holds its whole result
6 a row lock is two round trips reference/context-api.md Cost: a row lock is two round trips
7 a required-foreign-key cycle is unwritable reference/config-api.md Cost: a required-foreign-key cycle is unwritable
10 aggregate's count throws beyond ±(2^53 − 1) reference/context-api.md Cost: aggregate's count throws beyond ±(2^53 − 1)
12 a hand-managed index gets no per-field messages reference/config-api.md Cost: a hand-managed index gets no per-field violation messages

The remaining seven land with groups 2–4.

Type-checking

scripts/check-doc-typescript-blocks.mjs (PR #1324) is not merged, so this uses a scratch harness: each fenced ts/typescript block is extracted verbatim, compiled with tsc --strict --noEmit against packages/*/dist declarations, with a stand-in for the generated bundle. The harness was falsified first — a deliberately broken import and a deliberately wrong assignment both failed before any pass was trusted.

Page compiled fragment excerpt failing
reference/context-api.md 16 0 0 3
reference/config-api.md 12 31 27 5

fragment = an object-literal excerpt (db: { … }) that is not a module. excerpt = a detached property or type sketch, the reference form. The remaining failures are harness limits, not doc bugs: two module-init recipes whose relative imports (../opensaas.config, ../prisma/contract.json) resolve against the reader's own file, the Unsafe lane's structurally-typed sql/orm members, and three pre-existing samples on sections this group did not rewrite.

Checks

  • pnpm --filter opensaas-stack-docs link-check passes
  • grep -rnE '\bP[0-9]{4}\b' docs/content returns nothing
  • grep -rnE 'context\.db\.[a-z]' docs/content/reference/{context,config}-api.md returns only prose stating the camelCase form is a compile error

🤖 Generated with Claude Code

The context-API reference now documents the two surfaces the runtime actually
has: the secured surface's composed read (composers, terminals, denial values,
refusals, the Where vocabulary) and write subset (args objects, identity-only
`where`, `connect`/`null` relation input), with transactions and the row lock,
and a bypass section that is the Unsafe surface's own recipe and cost list.
`findMany`/`findUnique`/`findFirst`/`count` are gone; list keys are PascalCase.

The config-API reference documents every key `DatabaseConfig` actually has —
and states that `prismaClientConstructor`, `db.url` and `extendPrismaSchema`
have none — plus typed referential actions, `db.timestamps`, the junction-list
pattern that replaces implicit many-to-many, and `db.indexes` without the
`sort` the type no longer carries.

Four costs from the architecture spec's section 14 land on context-api (the
to-one null check, materialisation, the two-statement row lock, aggregate's
safe-integer bound) and three on config-api (application-side `updatedAt`, the
unwritable required-FK cycle, hand-managed indexes losing per-field messages).

Part of #1129

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stack-docs Ready Ready Preview Sep 9, 2026 4:05am UTC

@changeset-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8927ad5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

`concepts/config.md` loses the SQLite/Neon adapter recipes: postgres is the
only provider, there is no connection string in the config, and the resolution
order lives here in one sentence with the reference page as its home.

`how-to/migrate.md` replaces `prisma db push` with the `opensaas dev` loop and
`pnpm db:update`, carries cost 14 (the loop must be running; a destructive
mid-session change restarts the app), and drops `getAdminContext` for the real
`AdminUI` mount. Two access rules that returned `{ teamId: undefined }` were
fail-open bugs as well as refusals now, and are null-checked composed reads.

`how-to/migrate-from-keystone.md` replaces the whole `joinTableNaming` /
`db.relationName` section with the junction-list pattern, rewrites the access
section around the fact that `access: { filter }` does not exist, adds the
closed Where vocabulary and the write shape, and corrects
`output.prismaSchema` to `output.contractModule`.

The config-API reference gains the `{ map }` form of a relationship's
`db.foreignKey`, which is how an adopted foreign-key column is renamed.

Part of #1129

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for Core Package Coverage (./packages/core)

Status Category Percentage Covered / Total
🟢 Lines 92.91% (🎯 81%) 3447 / 3710
🟢 Statements 91.31% (🎯 76%) 3881 / 4250
🟢 Functions 95.77% (🎯 78%) 770 / 804
🟢 Branches 86% (🎯 71%) 2631 / 3059
File CoverageNo changed files found.
Generated in workflow #2157 for commit 8927ad5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for UI Package Coverage (./packages/ui)

Status Category Percentage Covered / Total
🔵 Lines 78.7% 244 / 310
🔵 Statements 78.43% 251 / 320
🔵 Functions 69.81% 74 / 106
🔵 Branches 67.51% 160 / 237
File CoverageNo changed files found.
Generated in workflow #2157 for commit 8927ad5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for CLI Package Coverage (./packages/cli)

Status Category Percentage Covered / Total
🔵 Lines 71.69% 1672 / 2332
🔵 Statements 71.45% 1792 / 2508
🔵 Functions 79.12% 288 / 364
🔵 Branches 59.26% 828 / 1397
File CoverageNo changed files found.
Generated in workflow #2157 for commit 8927ad5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for Auth Package Coverage (./packages/auth)

Status Category Percentage Covered / Total
🔵 Lines 91.2% 280 / 307
🔵 Statements 89.94% 313 / 348
🔵 Functions 96.05% 73 / 76
🔵 Branches 82.38% 262 / 318
File CoverageNo changed files found.
Generated in workflow #2157 for commit 8927ad5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for Storage Package Coverage (./packages/storage)

Status Category Percentage Covered / Total
🔵 Lines 80.21% 227 / 283
🔵 Statements 81.61% 253 / 310
🔵 Functions 91.35% 74 / 81
🔵 Branches 77.46% 220 / 284
File CoverageNo changed files found.
Generated in workflow #2157 for commit 8927ad5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for RAG Package Coverage (./packages/rag)

Status Category Percentage Covered / Total
🔵 Lines 91.29% 556 / 609
🔵 Statements 90.58% 606 / 669
🔵 Functions 97.39% 112 / 115
🔵 Branches 84.26% 375 / 445
File CoverageNo changed files found.
Generated in workflow #2157 for commit 8927ad5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for Storage S3 Package Coverage (./packages/storage-s3)

Status Category Percentage Covered / Total
🔵 Lines 100% 40 / 40
🔵 Statements 100% 40 / 40
🔵 Functions 100% 9 / 9
🔵 Branches 100% 19 / 19
File CoverageNo changed files found.
Generated in workflow #2157 for commit 8927ad5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for Storage Vercel Package Coverage (./packages/storage-vercel)

Status Category Percentage Covered / Total
🔵 Lines 100% 68 / 68
🔵 Statements 100% 71 / 71
🔵 Functions 100% 15 / 15
🔵 Branches 97.87% 46 / 47
File CoverageNo changed files found.
Generated in workflow #2157 for commit 8927ad5 by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant