@aotter/mantle 0.1.5-alpha.1 → 0.2.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +166 -298
- package/dist/auth/adapter.d.ts +32 -0
- package/dist/auth/adapter.js +288 -0
- package/dist/auth/admin.d.ts +3 -0
- package/dist/auth/admin.js +21 -0
- package/dist/auth/caller.d.ts +86 -0
- package/dist/auth/caller.js +155 -0
- package/dist/auth/hardening.d.ts +24 -0
- package/dist/auth/hardening.js +40 -0
- package/dist/auth/identity.d.ts +121 -0
- package/dist/auth/identity.js +203 -0
- package/dist/auth/oauth.d.ts +63 -0
- package/dist/auth/oauth.js +217 -0
- package/dist/auth/resource-seeds.js +10 -0
- package/dist/auth/routes.d.ts +32 -0
- package/dist/auth/routes.js +226 -0
- package/dist/build/compiler.d.ts +721 -0
- package/dist/build/compiler.js +7029 -0
- package/dist/build/spec/domain/model/ManifestGrammar.d.ts +439 -0
- package/dist/build/spec/domain/model/RuntimePlan.d.ts +168 -0
- package/dist/build/spec/domain/model/SqlIr.d.ts +129 -0
- package/dist/build/spec/domain/model/UserFields.d.ts +21 -0
- package/dist/build/spec/domain/service/PlanFingerprint.d.ts +7 -0
- package/dist/build/spec/kernel/diagnostic.d.ts +108 -0
- package/dist/bun/assets.d.ts +2 -0
- package/dist/bun/assets.js +24 -0
- package/dist/domain/adminOrder.js +24 -0
- package/dist/domain/columns.js +57 -0
- package/dist/domain/describe/chunk-ZVXBGP7Y.js +424 -0
- package/dist/domain/describe/index.d.ts +58 -0
- package/dist/domain/describe/index.js +115 -0
- package/dist/domain/describe/target-hash.d.ts +8 -0
- package/dist/domain/describe/target-hash.js +12 -0
- package/dist/domain/describe/targets.d.ts +40 -0
- package/dist/domain/entry.js +33 -0
- package/dist/domain/generated-tools.js +19 -0
- package/dist/domain/generation.d.ts +16 -0
- package/dist/domain/generation.js +1 -0
- package/dist/domain/input.js +17 -0
- package/dist/domain/model.js +1 -0
- package/dist/domain/paging.js +230 -0
- package/dist/domain/recipes.js +24 -0
- package/dist/domain/userReferences.js +5 -0
- package/dist/domain/wireScalars.js +47 -0
- package/dist/infrastructure/adminEntries.js +153 -0
- package/dist/infrastructure/adminPaging.js +72 -0
- package/dist/infrastructure/artifacts.js +71 -0
- package/dist/infrastructure/authSchema.js +83 -0
- package/dist/infrastructure/bundle.js +188 -0
- package/dist/infrastructure/cli.js +118 -0
- package/dist/infrastructure/generate.d.ts +12 -0
- package/dist/infrastructure/generate.js +189 -0
- package/dist/infrastructure/generateAuth.d.ts +8 -0
- package/dist/infrastructure/generateAuth.js +74 -0
- package/dist/infrastructure/help.js +60 -0
- package/dist/infrastructure/init.js +54 -0
- package/dist/infrastructure/inputs.js +41 -0
- package/dist/infrastructure/mounts.js +25 -0
- package/dist/infrastructure/wrangler.js +109 -0
- package/dist/kernel/authorization.d.ts +4 -0
- package/dist/kernel/authorization.js +16 -0
- package/dist/kernel/binds.d.ts +60 -0
- package/dist/kernel/binds.js +49 -0
- package/dist/kernel/caller-identity.d.ts +24 -0
- package/dist/kernel/caller-identity.js +22 -0
- package/dist/kernel/contract-error.d.ts +12 -0
- package/dist/kernel/contract-error.js +14 -0
- package/dist/kernel/contracts.d.ts +143 -0
- package/dist/kernel/contracts.js +97 -0
- package/dist/kernel/cron.d.ts +1 -0
- package/dist/kernel/cron.js +58 -0
- package/dist/kernel/dialect/common.d.ts +38 -0
- package/dist/kernel/dialect/common.js +6 -0
- package/dist/kernel/dialect/postgres.d.ts +16 -0
- package/dist/kernel/dialect/postgres.js +18 -0
- package/dist/kernel/dialect/sqlite.d.ts +20 -0
- package/dist/kernel/dialect/sqlite.js +34 -0
- package/dist/kernel/drain.d.ts +5 -0
- package/dist/kernel/drain.js +35 -0
- package/dist/kernel/driver/bun-sqlite.d.ts +19 -0
- package/dist/kernel/driver/bun-sqlite.js +77 -0
- package/dist/kernel/driver/d1.d.ts +24 -0
- package/dist/kernel/driver/d1.js +22 -0
- package/dist/kernel/driver/postgres.d.ts +25 -0
- package/dist/kernel/driver/postgres.js +99 -0
- package/dist/kernel/driver/transaction-context.d.ts +10 -0
- package/dist/kernel/driver/transaction-context.js +29 -0
- package/dist/kernel/email.d.ts +28 -0
- package/dist/kernel/email.js +38 -0
- package/dist/kernel/host-access.d.ts +10 -0
- package/dist/kernel/host-access.js +65 -0
- package/dist/kernel/host-caller.d.ts +39 -0
- package/dist/kernel/host-caller.js +56 -0
- package/dist/kernel/json-body.d.ts +4 -0
- package/dist/kernel/json-body.js +44 -0
- package/dist/kernel/mcp-apps.d.ts +69 -0
- package/dist/kernel/mcp-apps.js +40 -0
- package/dist/kernel/mcp-call.d.ts +5 -0
- package/dist/kernel/mcp-call.js +25 -0
- package/dist/kernel/mcp-handler.js +371 -0
- package/dist/kernel/mcp.d.ts +110 -0
- package/dist/kernel/mcp.js +50 -0
- package/dist/kernel/media.d.ts +27 -0
- package/dist/kernel/media.js +216 -0
- package/dist/kernel/paging.d.ts +55 -0
- package/dist/kernel/paging.js +95 -0
- package/dist/kernel/publishing.d.ts +4 -0
- package/dist/kernel/publishing.js +16 -0
- package/dist/kernel/r2-media.d.ts +42 -0
- package/dist/kernel/r2-media.js +78 -0
- package/dist/kernel/rest-dispatch.js +38 -0
- package/dist/kernel/rest-router.js +64 -0
- package/dist/kernel/rest.d.ts +58 -0
- package/dist/kernel/rest.js +41 -0
- package/dist/kernel/scalars.d.ts +6 -0
- package/dist/kernel/scalars.js +44 -0
- package/dist/kernel/search.js +5 -0
- package/dist/kernel/site-types.d.ts +146 -0
- package/dist/kernel/site-types.js +1 -0
- package/dist/kernel/site.d.ts +39 -0
- package/dist/kernel/site.js +32 -0
- package/dist/kernel/store.d.ts +175 -0
- package/dist/kernel/store.js +269 -0
- package/dist/kernel/surface.d.ts +10 -0
- package/dist/kernel/surface.js +19 -0
- package/dist/kernel/sweep.d.ts +17 -0
- package/dist/kernel/sweep.js +27 -0
- package/dist/kernel/translations.d.ts +1 -0
- package/dist/kernel/translations.js +13 -0
- package/dist/kernel/user-caller.d.ts +31 -0
- package/dist/kernel/user-caller.js +67 -0
- package/dist/kernel/user-field-name.js +3 -0
- package/dist/kernel/user-fields.d.ts +35 -0
- package/dist/kernel/user-fields.js +81 -0
- package/dist/kernel/validation.d.ts +15 -0
- package/dist/kernel/validation.js +54 -0
- package/dist/kernel/web-gateway.js +68 -0
- package/dist/kernel/web-head.js +15 -0
- package/dist/kernel/web-index.js +40 -0
- package/dist/kernel/web-response.js +8 -0
- package/dist/kernel/web.d.ts +77 -0
- package/dist/kernel/web.js +124 -0
- package/dist/kernel/where.js +27 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +1 -0
- package/dist/usecase/adminBindings.js +143 -0
- package/dist/usecase/adminClient.js +87 -0
- package/dist/usecase/adminDescriptors.js +107 -0
- package/dist/usecase/generate.js +166 -0
- package/dist/usecase/handlers.js +21 -0
- package/dist/usecase/mcp-media.js +17 -0
- package/dist/usecase/mcp.js +100 -0
- package/dist/usecase/paging.js +71 -0
- package/dist/usecase/publishing.js +63 -0
- package/dist/usecase/refusals.js +27 -0
- package/dist/usecase/rest.js +54 -0
- package/dist/usecase/search.js +7 -0
- package/dist/usecase/site.js +39 -0
- package/dist/usecase/stores.js +64 -0
- package/dist/usecase/tool-version.js +9 -0
- package/dist/usecase/translations.js +78 -0
- package/dist/usecase/ttl.js +20 -0
- package/dist/usecase/validation.js +241 -0
- package/dist/usecase/web.js +23 -0
- package/docs/examples/README.md +39 -18
- package/docs/examples/app-shell/.dev.vars.example +4 -0
- package/docs/examples/app-shell/README.md +121 -0
- package/docs/examples/app-shell/accept.mjs +91 -0
- package/docs/examples/app-shell/gitignore +7 -0
- package/docs/examples/app-shell/package.json +43 -0
- package/docs/examples/app-shell/pnpm-workspace.yaml +8 -0
- package/docs/examples/app-shell/smoke-kit.mjs +168 -0
- package/docs/examples/app-shell/src/auth.ts +58 -0
- package/docs/examples/app-shell/src/handlers.ts +5 -0
- package/docs/examples/app-shell/src/index.ts +4 -0
- package/docs/examples/app-shell/src/routes.ts +14 -0
- package/docs/examples/app-shell/src/schedule.ts +8 -0
- package/docs/examples/app-shell/src/service.ts +70 -0
- package/docs/examples/app-shell/src/sign-in.ts +41 -0
- package/docs/examples/app-shell/src/signup.ts +8 -0
- package/docs/examples/app-shell/tsconfig.json +26 -0
- package/docs/examples/app-shell/worker-configuration.d.ts +22 -0
- package/docs/examples/app-shell/wrangler.jsonc +62 -0
- package/docs/examples/club-events/README.md +65 -0
- package/docs/examples/club-events/manifests/club-events.yaml +247 -0
- package/docs/examples/club-events/smoke.mjs +127 -0
- package/docs/examples/club-events/src/handlers.ts +25 -0
- package/docs/examples/club-events/src/signup.ts +9 -0
- package/docs/examples/generated-web/README.md +78 -0
- package/docs/examples/generated-web/posts.yaml +38 -0
- package/docs/examples/generated-web/seed.sql +6 -0
- package/docs/examples/generated-web/src/worker.ts +43 -0
- package/docs/examples/generated-web/tsconfig.json +8 -0
- package/docs/examples/generated-web/wrangler.jsonc +8 -0
- package/docs/examples/purchasing/.dev.vars.example +6 -0
- package/docs/examples/purchasing/README.md +99 -0
- package/docs/examples/purchasing/manifests/purchasing.yaml +374 -0
- package/docs/examples/purchasing/seed.sql +4 -0
- package/docs/examples/purchasing/smoke.mjs +191 -0
- package/docs/examples/purchasing/src/admin.tsx +13 -0
- package/docs/examples/purchasing/src/handlers.ts +33 -0
- package/docs/examples/purchasing/src/notify.ts +29 -0
- package/docs/examples/purchasing/src/requests-page.ts +57 -0
- package/docs/examples/purchasing/src/routes.ts +53 -0
- package/docs/examples/purchasing/src/schedule.ts +31 -0
- package/docs/examples/purchasing/src/signup.ts +5 -0
- package/docs/examples/purchasing/src/supplier.ts +32 -0
- package/docs/examples/purchasing/wrangler.jsonc +69 -0
- package/docs/examples/recipes/README.md +60 -0
- package/docs/examples/recipes/manifests/recipes.yaml +75 -0
- package/docs/examples/recipes/smoke.mjs +102 -0
- package/docs/examples/recipes/src/media.ts +13 -0
- package/docs/examples/recipes/src/pages.ts +99 -0
- package/docs/examples/recipes/src/routes.ts +71 -0
- package/docs/examples/recipes/src/site-config.ts +12 -0
- package/docs/examples/recipes/wrangler.jsonc +74 -0
- package/docs/handbook/cloudflare/authentication.md +180 -322
- package/docs/handbook/cloudflare/chatgpt-sites.md +5 -23
- package/docs/handbook/cloudflare/deploy-and-operate.md +55 -77
- package/docs/handbook/cloudflare/media-r2.md +61 -205
- package/docs/handbook/cloudflare/service-entry.md +239 -0
- package/docs/handbook/concepts/authorization.md +10 -107
- package/docs/handbook/concepts/four-atoms.md +9 -168
- package/docs/handbook/concepts/lifecycle-and-locales.md +9 -132
- package/docs/handbook/concepts/mcp-and-agents.md +24 -121
- package/docs/handbook/concepts/procedures-and-triggers.md +5 -217
- package/docs/handbook/concepts/runtime-and-adapters.md +15 -169
- package/docs/handbook/concepts/views.md +10 -185
- package/docs/handbook/examples/hub.md +3 -8
- package/docs/handbook/guides/adapter-guide.md +11 -0
- package/docs/handbook/guides/admin-ui.md +115 -133
- package/docs/handbook/guides/agent-setup.md +64 -74
- package/docs/handbook/guides/agent-workflow-acceptance.md +232 -0
- package/docs/handbook/guides/email.md +86 -0
- package/docs/handbook/guides/local-testing.md +40 -0
- package/docs/handbook/guides/mcp-apps.md +560 -0
- package/docs/handbook/guides/native-admin.md +566 -0
- package/docs/handbook/guides/native-execution.md +133 -0
- package/docs/handbook/guides/oauth.md +219 -0
- package/docs/handbook/guides/postgres-adapters.md +56 -0
- package/docs/handbook/guides/public-pages.md +87 -0
- package/docs/handbook/guides/size-and-startup.md +9 -0
- package/docs/handbook/guides/sql-patterns.md +266 -0
- package/docs/handbook/guides/typed-queries.md +211 -107
- package/docs/handbook/navigation.json +176 -55
- package/docs/handbook/reference/admin-descriptors.md +53 -0
- package/docs/handbook/reference/authorization.md +39 -266
- package/docs/handbook/reference/describe.md +56 -0
- package/docs/handbook/reference/diagnostics.md +19 -186
- package/docs/handbook/reference/features.md +45 -55
- package/docs/handbook/reference/manifest.md +6 -129
- package/docs/handbook/reference/procedure.md +11 -303
- package/docs/handbook/reference/schema.md +64 -240
- package/docs/handbook/reference/site-config.md +5 -218
- package/docs/handbook/reference/sql.md +64 -0
- package/docs/handbook/reference/surface.md +392 -201
- package/docs/handbook/reference/trigger.md +56 -192
- package/docs/handbook/reference/view.md +24 -243
- package/docs/handbook/releases/index.md +244 -77
- package/docs/handbook/start/agents.md +45 -0
- package/docs/handbook/start/overview.md +9 -48
- package/docs/handbook/start/project-and-cli.md +51 -104
- package/docs/handbook/start/quickstart-worker.md +43 -178
- package/docs/skills/develop/SKILL.md +79 -249
- package/docs/skills/integrate/SKILL.md +39 -50
- package/docs/skills/media-gc/SKILL.md +34 -10
- package/docs/skills/provision/SKILL.md +36 -186
- package/docs/skills/update/SKILL.md +23 -38
- package/docs/source/scripts/postgres-adapter.ts +101 -0
- package/docs/upgrade-0.1-to-0.2.md +227 -0
- package/package.json +120 -131
- package/skills/README.md +48 -108
- package/skills/mantle/SKILL.md +76 -0
- package/dist/admin-ui.d.ts +0 -2
- package/dist/admin-ui.d.ts.map +0 -1
- package/dist/admin-ui.js +0 -2
- package/dist/admin-ui.js.map +0 -1
- package/dist/admin.d.ts +0 -2
- package/dist/admin.d.ts.map +0 -1
- package/dist/admin.js +0 -2
- package/dist/admin.js.map +0 -1
- package/dist/auth.d.ts +0 -2
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -2
- package/dist/auth.js.map +0 -1
- package/dist/bun.d.ts +0 -2
- package/dist/bun.d.ts.map +0 -1
- package/dist/bun.js +0 -2
- package/dist/bun.js.map +0 -1
- package/dist/cli/generate-cloudflare.d.ts +0 -7
- package/dist/cli/generate-cloudflare.d.ts.map +0 -1
- package/dist/cli/generate-cloudflare.js +0 -123
- package/dist/cli/generate-cloudflare.js.map +0 -1
- package/dist/cli/generate-project.d.ts +0 -25
- package/dist/cli/generate-project.d.ts.map +0 -1
- package/dist/cli/generate-project.js +0 -282
- package/dist/cli/generate-project.js.map +0 -1
- package/dist/cli/generate-sites.d.ts +0 -8
- package/dist/cli/generate-sites.d.ts.map +0 -1
- package/dist/cli/generate-sites.js +0 -273
- package/dist/cli/generate-sites.js.map +0 -1
- package/dist/cli/generate.d.ts +0 -20
- package/dist/cli/generate.d.ts.map +0 -1
- package/dist/cli/generate.js +0 -299
- package/dist/cli/generate.js.map +0 -1
- package/dist/cli/harness.d.ts +0 -3
- package/dist/cli/harness.d.ts.map +0 -1
- package/dist/cli/harness.js +0 -214
- package/dist/cli/harness.js.map +0 -1
- package/dist/cli/main.d.ts +0 -3
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -77
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/skills.d.ts +0 -3
- package/dist/cli/skills.d.ts.map +0 -1
- package/dist/cli/skills.js +0 -128
- package/dist/cli/skills.js.map +0 -1
- package/dist/cloudflare.d.ts +0 -2
- package/dist/cloudflare.d.ts.map +0 -1
- package/dist/cloudflare.js +0 -2
- package/dist/cloudflare.js.map +0 -1
- package/dist/codegen/emitMantleModule.d.ts +0 -22
- package/dist/codegen/emitMantleModule.d.ts.map +0 -1
- package/dist/codegen/emitMantleModule.js +0 -291
- package/dist/codegen/emitMantleModule.js.map +0 -1
- package/dist/codegen.d.ts +0 -2
- package/dist/codegen.d.ts.map +0 -1
- package/dist/codegen.js +0 -2
- package/dist/codegen.js.map +0 -1
- package/dist/runtime-testing.d.ts +0 -2
- package/dist/runtime-testing.d.ts.map +0 -1
- package/dist/runtime-testing.js +0 -2
- package/dist/runtime-testing.js.map +0 -1
- package/dist/runtime.d.ts +0 -2
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -2
- package/dist/runtime.js.map +0 -1
- package/dist/spec.d.ts +0 -2
- package/dist/spec.d.ts.map +0 -1
- package/dist/spec.js +0 -2
- package/dist/spec.js.map +0 -1
- package/dist/vercel-libsql.d.ts +0 -2
- package/dist/vercel-libsql.d.ts.map +0 -1
- package/dist/vercel-libsql.js +0 -2
- package/dist/vercel-libsql.js.map +0 -1
- package/dist/vercel.d.ts +0 -2
- package/dist/vercel.d.ts.map +0 -1
- package/dist/vercel.js +0 -2
- package/dist/vercel.js.map +0 -1
- package/dist/web.d.ts +0 -2
- package/dist/web.d.ts.map +0 -1
- package/dist/web.js +0 -2
- package/dist/web.js.map +0 -1
- package/docs/adapter-guide.md +0 -222
- package/docs/adr/0001-four-atom-manifest-model.md +0 -440
- package/docs/adr/0002-closed-enums-for-bindings.md +0 -253
- package/docs/adr/0007-ai-as-primary-author.md +0 -473
- package/docs/adr/0008-structured-diagnostic-shape.md +0 -338
- package/docs/adr/0009-consumer-supplied-manifests.md +0 -149
- package/docs/adr/0010-locale-and-translates.md +0 -453
- package/docs/adr/0011-adapter-port-spec.md +0 -281
- package/docs/adr/0012-views-as-public-rest.md +0 -161
- package/docs/adr/0013-agent-provisioned-consumer-projects.md +0 -154
- package/docs/adr/0014-auth-better-auth-and-multi-tenant-mcp.md +0 -900
- package/docs/adr/0016-site-semantic-layer.md +0 -70
- package/docs/adr/0017-media-multi-variant-agent-side-optimization.md +0 -181
- package/docs/adr/0018-core-starters-repository-boundary.md +0 -179
- package/docs/adr/0019-sealed-manifest-runtime-pipeline.md +0 -240
- package/docs/adr/0020-builtin-handler-contracts-and-matched-upsert.md +0 -199
- package/docs/adr/0021-retire-starter-scaffolding.md +0 -30
- package/docs/adr/0022-caller-observed-version-occ.md +0 -212
- package/docs/adr/0023-port-failure-contract.md +0 -69
- package/docs/adr/0024-manifest-native-schema-tables.md +0 -264
- package/docs/adr/0025-reserved-native-columns-and-published-only-public-views.md +0 -105
- package/docs/adr/0026-progressive-generate.md +0 -36
- package/docs/adr/0027-scheduled-procedure-triggers.md +0 -31
- package/docs/adr/0028-schema-ttl-expiry.md +0 -33
- package/docs/adr/README.md +0 -81
- package/docs/adr/adr-lite-803-request-diagnostics.md +0 -38
- package/docs/adr/adr-lite-808-route-readiness.md +0 -47
- package/docs/adr/adr-lite-809-bounded-public-content.md +0 -71
- package/docs/adr/adr-lite-812-native-parity.md +0 -150
- package/docs/adr/adr-lite-823-home-statistics.md +0 -64
- package/docs/adr/adr-lite-842-mcp-authoring.md +0 -30
- package/docs/adr/adr-lite-845-frontend-client.md +0 -38
- package/docs/adr/adr-lite-861-admin-webmcp.md +0 -42
- package/docs/adr/adr-lite-909-admin-ui-kit.md +0 -37
- package/docs/agent-prompts.md +0 -64
- package/docs/api-mcp-authorization.md +0 -5
- package/docs/assets/mantle-admin-developer.png +0 -0
- package/docs/assets/mantle-admin-operations.png +0 -0
- package/docs/assets/mantle-hero.jpg +0 -0
- package/docs/auth-hosting-model.md +0 -166
- package/docs/cloudflare-low-level-composition.md +0 -5
- package/docs/consumer-onboarding-audit.md +0 -65
- package/docs/deferred-lifecycle-queues.md +0 -5
- package/docs/design-atoms.md +0 -16
- package/docs/design-references/editorial-blog-2026-05-05.md +0 -218
- package/docs/direct-authoring.md +0 -5
- package/docs/examples/builtin-commerce.md +0 -269
- package/docs/examples/builtin-intake.md +0 -143
- package/docs/examples/builtin-legal-documents.md +0 -189
- package/docs/examples/builtin-procurement.md +0 -241
- package/docs/examples/builtin-publication.md +0 -241
- package/docs/examples/builtin-reservation.md +0 -149
- package/docs/examples/cf-primitives-commerce-inventory.md +0 -809
- package/docs/examples/cf-primitives-guarded-api.md +0 -429
- package/docs/examples/cf-primitives-intake-hooks.md +0 -319
- package/docs/examples/host-chatgpt-sites/.openai/hosting.json +0 -1
- package/docs/examples/host-chatgpt-sites/README.md +0 -70
- package/docs/examples/host-chatgpt-sites/drizzle/0000_sites_users.sql +0 -8
- package/docs/examples/host-chatgpt-sites/drizzle/0001_mantle.sql +0 -294
- package/docs/examples/host-chatgpt-sites/drizzle/0002_article_cover.sql +0 -5
- package/docs/examples/host-chatgpt-sites/drizzle/0003_store_instance_id.sql +0 -1
- package/docs/examples/host-chatgpt-sites/drizzle/0004_mantle.sql +0 -10
- package/docs/examples/host-chatgpt-sites/drizzle/0005_mantle.sql +0 -24
- package/docs/examples/host-chatgpt-sites/drizzle/meta/_journal.json +0 -1
- package/docs/examples/host-chatgpt-sites/drizzle/meta/mantle-state.json +0 -60
- package/docs/examples/host-chatgpt-sites/manifests/site.yaml +0 -27
- package/docs/examples/host-chatgpt-sites/package.json +0 -1
- package/docs/examples/host-chatgpt-sites/public/site.css +0 -1
- package/docs/examples/host-chatgpt-sites/scripts/build.mjs +0 -13
- package/docs/examples/host-chatgpt-sites/scripts/check.mjs +0 -101
- package/docs/examples/host-chatgpt-sites/scripts/migration.mjs +0 -43
- package/docs/examples/host-chatgpt-sites/src/chatgpt-auth.ts +0 -66
- package/docs/examples/host-chatgpt-sites/src/index.ts +0 -46
- package/docs/examples/host-chatgpt-sites/src/mcp.ts +0 -49
- package/docs/examples/host-chatgpt-sites/src/media.ts +0 -109
- package/docs/examples/host-chatgpt-sites/src/r2-lab.ts +0 -38
- package/docs/examples/host-chatgpt-sites/src/storage-fingerprint.json +0 -1
- package/docs/examples/host-chatgpt-sites/src/web.ts +0 -35
- package/docs/examples/host-chatgpt-sites/tsconfig.json +0 -1
- package/docs/examples/host-chatgpt-sites/wrangler.jsonc +0 -10
- package/docs/examples/host-local-admin-otp/.dev.vars.example +0 -3
- package/docs/examples/host-local-admin-otp/README.md +0 -80
- package/docs/examples/host-local-admin-otp/ensure-dev-vars.mjs +0 -5
- package/docs/examples/host-local-admin-otp/manifests/site.yaml +0 -25
- package/docs/examples/host-local-admin-otp/package.json +0 -29
- package/docs/examples/host-local-admin-otp/public/.gitkeep +0 -1
- package/docs/examples/host-local-admin-otp/smoke.mjs +0 -141
- package/docs/examples/host-local-admin-otp/src/index.ts +0 -54
- package/docs/examples/host-local-admin-otp/tsconfig.json +0 -17
- package/docs/examples/host-local-admin-otp/wrangler.jsonc +0 -23
- package/docs/examples/host-minimal-worker/README.md +0 -41
- package/docs/examples/host-minimal-worker/manifests/site.yaml +0 -25
- package/docs/examples/host-minimal-worker/package.json +0 -26
- package/docs/examples/host-minimal-worker/smoke.mjs +0 -23
- package/docs/examples/host-minimal-worker/src/index.ts +0 -4
- package/docs/examples/host-minimal-worker/tsconfig.json +0 -17
- package/docs/examples/host-minimal-worker/wrangler.jsonc +0 -22
- package/docs/handbook/chatgpt-sites/equipment-checkout.md +0 -231
- package/docs/handbook/chatgpt-sites/generated-app.md +0 -84
- package/docs/handbook/chatgpt-sites/host-reference.md +0 -113
- package/docs/handbook/chatgpt-sites/index.md +0 -133
- package/docs/handbook/cloudflare/bindings.md +0 -291
- package/docs/handbook/cloudflare/conventional-worker.md +0 -166
- package/docs/handbook/cloudflare/deferred-hooks-queues.md +0 -170
- package/docs/handbook/cloudflare/low-level-composition.md +0 -169
- package/docs/handbook/cloudflare/public-web.md +0 -144
- package/docs/handbook/cloudflare/site-chrome.md +0 -75
- package/docs/handbook/examples/commerce-transaction.md +0 -11
- package/docs/handbook/examples/commerce.md +0 -11
- package/docs/handbook/examples/guarded-api.md +0 -10
- package/docs/handbook/examples/intake-form.md +0 -12
- package/docs/handbook/examples/intake-hooks.md +0 -11
- package/docs/handbook/examples/legal-documents.md +0 -10
- package/docs/handbook/examples/procurement-approvals.md +0 -10
- package/docs/handbook/examples/publication.md +0 -10
- package/docs/handbook/examples/reservation.md +0 -10
- package/docs/handbook/start/quickstart-admin.md +0 -52
- package/docs/labels.md +0 -71
- package/docs/media-uploads.md +0 -5
- package/docs/migration-0.1.2.md +0 -13
- package/docs/performance-harness.md +0 -228
- package/docs/release-process.md +0 -244
- package/docs/schema-indexes.md +0 -5
- package/docs/sealed-pipeline-ownership.md +0 -101
- package/docs/skills/plugin/SKILL.md +0 -132
- package/docs/skills/theme/SKILL.md +0 -77
- package/docs/spec-only-host-adoption.md +0 -157
- package/docs/transaction-patterns.md +0 -5
- package/skills/develop/SKILL.md +0 -258
- package/skills/install/SKILL.md +0 -112
- package/skills/integrate/SKILL.md +0 -60
- package/skills/media-gc/SKILL.md +0 -85
- package/skills/plugin/SKILL.md +0 -132
- package/skills/provision/SKILL.md +0 -194
- package/skills/theme/SKILL.md +0 -77
- package/skills/update/SKILL.md +0 -51
- package/templates/chatgpt-sites/auth.ts +0 -66
- package/templates/chatgpt-sites/build.mjs +0 -14
- package/templates/chatgpt-sites/env.ts +0 -1
- package/templates/chatgpt-sites/mcp.ts +0 -48
- package/templates/chatgpt-sites/public-mcp.ts +0 -29
- package/templates/chatgpt-sites/smoke-local.mjs +0 -20
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
# ADR-0024: Materialize each Schema as a native storage table
|
|
2
|
-
|
|
3
|
-
**Status:** Accepted; the clauses allowing authored data to use `id`, `status` or `createdAt` are superseded by [ADR-0025](0025-reserved-native-columns-and-published-only-public-views.md) (2026-09-22)
|
|
4
|
-
|
|
5
|
-
**Date:** 2026-09-18
|
|
6
|
-
|
|
7
|
-
**Related:** ADR-0010, ADR-0011, ADR-0019, ADR-0020, ADR-0022, ADR-0023
|
|
8
|
-
|
|
9
|
-
## Context
|
|
10
|
-
|
|
11
|
-
The SQLite adapter currently stores every Schema row in one `entries` table.
|
|
12
|
-
Business fields live in a JSON `data` column. Schema indexes add generated
|
|
13
|
-
columns and partial indexes to that shared table, and Schema-shaped SQL views
|
|
14
|
-
project JSON fields back into columns.
|
|
15
|
-
|
|
16
|
-
That layout made the first dynamic runtime small, but it is now the wrong
|
|
17
|
-
authority for a manifest-built system:
|
|
18
|
-
|
|
19
|
-
- a successfully built Manifest already fixes every Schema and field type;
|
|
20
|
-
- generated columns for every historical indexed field accumulate on one
|
|
21
|
-
table, while D1 allows at most 100 columns per table;
|
|
22
|
-
- native SQL, inspection, export, and migration tooling see an implementation
|
|
23
|
-
envelope instead of the authored data model;
|
|
24
|
-
- application migrations and Mantle's canonical `entries` migrations form two
|
|
25
|
-
persistence systems;
|
|
26
|
-
- the compatibility layer is now larger than direct table CRUD.
|
|
27
|
-
|
|
28
|
-
Mantle has not shipped a stable storage format. Keeping the generic table for
|
|
29
|
-
downward compatibility would create the dual path this change is intended to
|
|
30
|
-
remove.
|
|
31
|
-
|
|
32
|
-
## Decision
|
|
33
|
-
|
|
34
|
-
### One physical table per Schema
|
|
35
|
-
|
|
36
|
-
The SQLite/D1 storage adapter materializes every compiled Schema as a quoted
|
|
37
|
-
native table. The table contains:
|
|
38
|
-
|
|
39
|
-
- Mantle columns: `_mantle_id`, `_mantle_status`, `_mantle_version`,
|
|
40
|
-
`_mantle_created_at`, `_mantle_updated_at`, and `_mantle_author_id`;
|
|
41
|
-
- one column for every top-level Schema property;
|
|
42
|
-
- native indexes for every `indexes` and `uniqueIndexes` tuple.
|
|
43
|
-
|
|
44
|
-
Single scalar JSON Schema types map to SQLite affinities: string to `TEXT`,
|
|
45
|
-
integer and boolean to `INTEGER`, and number to `REAL`. Objects, arrays, unions,
|
|
46
|
-
and otherwise polymorphic values use `TEXT` containing canonical JSON so a
|
|
47
|
-
round trip cannot change their JSON type. Nullable values use SQL `NULL`.
|
|
48
|
-
|
|
49
|
-
Business columns remain nullable at the database layer. Mantle allows an
|
|
50
|
-
incomplete authoring draft; Runtime validation enforces required fields when a
|
|
51
|
-
record becomes complete or when an operational Schema is written. An optional
|
|
52
|
-
nullable property reads as `null` when its column is null. This is the v0.1
|
|
53
|
-
native-table contract; it intentionally does not preserve a distinction
|
|
54
|
-
between an absent optional nullable field and an explicit null.
|
|
55
|
-
|
|
56
|
-
Schema names and field names remain authored wire names and are always SQL
|
|
57
|
-
identifier quoted. A Schema table uses its authored Schema name. SQLite
|
|
58
|
-
preparation rejects collisions with selected infrastructure tables or views,
|
|
59
|
-
including auth tables; this check belongs to the concrete deployment because
|
|
60
|
-
the portable Manifest cannot know which optional infrastructure a host binds.
|
|
61
|
-
Internal Mantle tables and columns use the reserved `_mantle_` prefix, so
|
|
62
|
-
Mantle metadata never collides with authored column names. *Superseded in
|
|
63
|
-
part by ADR-0025:* authored data may no longer use the six native column
|
|
64
|
-
names (`id`, `status`, `version`, `createdAt`, `updatedAt`, `authorId`); the
|
|
65
|
-
prefix remains for every other authored name.
|
|
66
|
-
|
|
67
|
-
The SQLite adapter no longer creates `entries`, generated field columns, or
|
|
68
|
-
Schema projection views. There is no dual write, compatibility view, or
|
|
69
|
-
fallback JSON repository.
|
|
70
|
-
|
|
71
|
-
### The compiled storage plan owns DDL
|
|
72
|
-
|
|
73
|
-
SQLite preparation lowers the Schemas already present in the sealed
|
|
74
|
-
`RuntimePlan` into quoted DDL and prepared queries. A persistence-only
|
|
75
|
-
projection of those Schemas has a deterministic storage fingerprint; changes
|
|
76
|
-
to Procedures, Views, or Triggers do not create a storage revision. No second
|
|
77
|
-
physical-plan model mirrors `RuntimePlan`.
|
|
78
|
-
|
|
79
|
-
Other adapters map the same Schema manifests into their own native storage.
|
|
80
|
-
Runtime continues to consume semantic `EntryRepository`,
|
|
81
|
-
`EntryReader`, and `ViewQueryExecutor` ports; SQL remains infrastructure.
|
|
82
|
-
|
|
83
|
-
Repository operations that address one row carry its Schema collection.
|
|
84
|
-
`get(id)` and `readById(id)` become collection-qualified operations. Generated
|
|
85
|
-
bindings hide this argument behind Schema-specific APIs. Runtime operations
|
|
86
|
-
already know the target Schema from their compiled handler, route, or row
|
|
87
|
-
context; callers must not search every table for an unqualified id.
|
|
88
|
-
|
|
89
|
-
Cross-Schema reads are compiled explicitly from the Runtime plan. There is no
|
|
90
|
-
implicit union of all tables. A caller that needs several Schemas invokes the
|
|
91
|
-
declared Views or Schema-specific readers and combines their results at the
|
|
92
|
-
application layer.
|
|
93
|
-
|
|
94
|
-
### Migrations are build artifacts
|
|
95
|
-
|
|
96
|
-
The SQLite build compares a stored source Schema description with the target
|
|
97
|
-
RuntimePlan and emits a versioned SQL migration artifact containing:
|
|
98
|
-
|
|
99
|
-
- source and target storage fingerprints;
|
|
100
|
-
- ordered SQLite SQL;
|
|
101
|
-
- a checksum over the exact migration content;
|
|
102
|
-
- whether the change is expand-only or destructive.
|
|
103
|
-
|
|
104
|
-
Mantle deterministically emits initial tables and safe additive changes. Field
|
|
105
|
-
renames, type conversions, data transforms, narrowing constraints, and any
|
|
106
|
-
`uniqueIndexes` tuple change are
|
|
107
|
-
destructive in the pre-beta contract. Cloud rejects them; operators rebuild the
|
|
108
|
-
database and move required data manually outside Mantle and Control. Production
|
|
109
|
-
neither generates nor accepts arbitrary migration SQL.
|
|
110
|
-
|
|
111
|
-
Preparation records applied migration ids in the existing `_migrations` ledger.
|
|
112
|
-
The enclosing immutable artifact checksum protects the ordered SQL,
|
|
113
|
-
fingerprints, and target projections. Preparation rejects an unknown source
|
|
114
|
-
fingerprint, changed artifact checksum, skipped revision, or target mismatch.
|
|
115
|
-
Generated migrations are idempotent and retryable after partial application;
|
|
116
|
-
activation and integrity verification run on every attempt instead of being
|
|
117
|
-
treated as one-time ledger entries.
|
|
118
|
-
|
|
119
|
-
Generated migrations quote all identifiers and never interpolate runtime
|
|
120
|
-
input. Automatic deployments retain removed fields, indexes, and tables as a
|
|
121
|
-
physical superset; logical reads follow the selected plan, while retained
|
|
122
|
-
storage keeps the previous Worker rollback-compatible.
|
|
123
|
-
|
|
124
|
-
### Builder support
|
|
125
|
-
|
|
126
|
-
Builder keeps its in-memory or IndexedDB semantic adapter for interactive
|
|
127
|
-
preview. It does not carry SQLite into portable Runtime.
|
|
128
|
-
|
|
129
|
-
Each successful build can show a draft-to-draft storage delta for authoring
|
|
130
|
-
feedback. It is not labeled as the deployment artifact: only Cloud knows the
|
|
131
|
-
last successfully deployed source revision and produces the exact immutable
|
|
132
|
-
artifact used by deployment. The publish result shows its source/target
|
|
133
|
-
fingerprints, risk classification, ordered SQL, and checksum.
|
|
134
|
-
The interactive preview continues to run the real Mantle Runtime over the
|
|
135
|
-
existing IndexedDB semantic adapter; it does not carry a second SQLite runtime
|
|
136
|
-
or copy preview data into one. Destructive changes remain previewable but are
|
|
137
|
-
not deployable on the pre-beta Cloud path.
|
|
138
|
-
|
|
139
|
-
CI executes generated SQL against SQLite. Mantle Cloud/D1 is authoritative at
|
|
140
|
-
deployment: it checks the immutable artifact, migration ledger, source/target
|
|
141
|
-
fingerprints, database integrity, and canary before restoring traffic. Running
|
|
142
|
-
the same DDL in every Builder browser would duplicate those gates while adding
|
|
143
|
-
WASM weight and a second Worker/browser compatibility surface.
|
|
144
|
-
|
|
145
|
-
Unsaved invalid Manifest edits produce diagnostics and no storage revision.
|
|
146
|
-
Intermediate Builder edits do not become production migrations. Deployment
|
|
147
|
-
diffs the last deployed storage revision against the selected project revision.
|
|
148
|
-
|
|
149
|
-
### Cloud runtime and Schema upgrades
|
|
150
|
-
|
|
151
|
-
Every Cloud deployment pins these immutable identities:
|
|
152
|
-
|
|
153
|
-
- Mantle runtime release;
|
|
154
|
-
- project revision and compiled plan fingerprint;
|
|
155
|
-
- source and target storage fingerprints;
|
|
156
|
-
- migration checksum;
|
|
157
|
-
- application artifact checksum.
|
|
158
|
-
|
|
159
|
-
Automatic migrations are expand-only and therefore run online. The deployment
|
|
160
|
-
sequence is:
|
|
161
|
-
|
|
162
|
-
1. verify the current tenant D1 storage fingerprint;
|
|
163
|
-
2. apply idempotent additive DDL and verify the ledger, marker, and integrity;
|
|
164
|
-
3. upload an immutable Worker script named by project revision;
|
|
165
|
-
4. run the canary directly against that script and the actual D1 marker;
|
|
166
|
-
5. select that revision for the default and custom host routes;
|
|
167
|
-
6. record the revision active.
|
|
168
|
-
|
|
169
|
-
There is no KV maintenance gate: KV propagation cannot drain in-flight writes,
|
|
170
|
-
and additive DDL does not need one. Destructive changes stop before deployment.
|
|
171
|
-
The old revision script remains addressable, so route failure or operator
|
|
172
|
-
rollback selects the previous script without rebuilding or replacing it.
|
|
173
|
-
|
|
174
|
-
Automatic deployments retain old columns and tables needed by the previous
|
|
175
|
-
active Worker. This keeps code rollback valid. Physical cleanup happens only
|
|
176
|
-
during a later reset or rebuild. Mantle runtime upgrades use the same mechanism
|
|
177
|
-
even when the authored Manifest does not change.
|
|
178
|
-
|
|
179
|
-
Release and application objects are content-addressed. A retry validates and
|
|
180
|
-
reads the same bytes selected by the original operation; mutable release names
|
|
181
|
-
are not valid deployment input.
|
|
182
|
-
|
|
183
|
-
## Consequences
|
|
184
|
-
|
|
185
|
-
### Positive
|
|
186
|
-
|
|
187
|
-
- D1, SQLite tools, generated types, and the Manifest describe the same tables.
|
|
188
|
-
- Each Schema gets independent native limits, indexes, query plans, and schema
|
|
189
|
-
evolution.
|
|
190
|
-
- The shared-table column ceiling and permanent generated-column buildup are
|
|
191
|
-
removed.
|
|
192
|
-
- Application migrations and Mantle runtime upgrades use one revision model.
|
|
193
|
-
- Removing the compatibility repository leaves less persistence code.
|
|
194
|
-
|
|
195
|
-
### Negative
|
|
196
|
-
|
|
197
|
-
- This is a storage-format break and requires coordinated changes across Spec,
|
|
198
|
-
Runtime, SQLite adapters, conformance tests, Builder, and Cloud deployment.
|
|
199
|
-
- Unqualified global entry lookups and implicit cross-Schema lists disappear.
|
|
200
|
-
- Optional nullable fields no longer distinguish absent from explicit null.
|
|
201
|
-
- Destructive schema changes require a manual rebuild and data move outside
|
|
202
|
-
Mantle and Control.
|
|
203
|
-
|
|
204
|
-
## Alternatives
|
|
205
|
-
|
|
206
|
-
### Keep `entries` and improve its generated indexes
|
|
207
|
-
|
|
208
|
-
Rejected. It preserves the shared table's column ceiling, JSON inspection
|
|
209
|
-
surface, and a second schema representation after Manifest build already knows
|
|
210
|
-
the physical model.
|
|
211
|
-
|
|
212
|
-
### Keep `entries` as a registry beside native Schema tables
|
|
213
|
-
|
|
214
|
-
Rejected. A registry adds dual-write atomicity and stale-index failure modes.
|
|
215
|
-
Schema-qualified access removes the need for it.
|
|
216
|
-
|
|
217
|
-
### Put SQLite WASM in the portable Runtime
|
|
218
|
-
|
|
219
|
-
Rejected. Runtime already has a semantic storage boundary. Builder can verify
|
|
220
|
-
the SQLite lowering as a build check without making every adapter or browser
|
|
221
|
-
preview depend on SQLite.
|
|
222
|
-
|
|
223
|
-
### Generate production migrations at deploy time
|
|
224
|
-
|
|
225
|
-
Rejected. Deployment must execute an immutable reviewed artifact and remain
|
|
226
|
-
deterministic when retried. AI generation belongs before review, not inside a
|
|
227
|
-
production mutation.
|
|
228
|
-
|
|
229
|
-
## How to apply
|
|
230
|
-
|
|
231
|
-
1. Add the sealed physical storage plan and SQLite DDL lowering.
|
|
232
|
-
2. Change semantic row operations to require collection identity and update all
|
|
233
|
-
first-party callers.
|
|
234
|
-
3. Replace the shared SQLite repository and View compiler with native-table
|
|
235
|
-
implementations; delete shared-table DDL, views, index reconciliation, and
|
|
236
|
-
compatibility helpers.
|
|
237
|
-
4. Update memory and IndexedDB adapters to the new semantic port shape.
|
|
238
|
-
5. Add build-time migration diff/artifact inspection, plus SQLite execution in
|
|
239
|
-
CI and Cloud/D1 deployment verification.
|
|
240
|
-
6. Pin content-addressed runtime, storage, migration, application, and Worker
|
|
241
|
-
revision identities in Cloud deploys; test initial deploy, additive Schema
|
|
242
|
-
change, runtime-only upgrade, partial migration retry, and route rollback.
|
|
243
|
-
7. Update all public storage, Schema, Builder, deployment, and migration
|
|
244
|
-
documentation after the conformance and consumer checks pass.
|
|
245
|
-
|
|
246
|
-
## Decision review
|
|
247
|
-
|
|
248
|
-
Reviewed after implementation against ADR-0019, the semantic storage ports,
|
|
249
|
-
Builder preview persistence, and Mantle Cloud's retryable deployment state.
|
|
250
|
-
The review found and corrected three boundary mistakes before acceptance:
|
|
251
|
-
|
|
252
|
-
- authored data was allowed to contain `id`, `status`, or `createdAt`, so
|
|
253
|
-
physical envelope columns require the `_mantle_` prefix (the prefix stays;
|
|
254
|
-
ADR-0025 later reserved those names for authored data as well);
|
|
255
|
-
- Builder should expose draft storage risk without pretending it knows the
|
|
256
|
-
deployed baseline; Cloud shows the exact immutable artifact, while CI and
|
|
257
|
-
Cloud/D1 own executable DDL verification and preview stays on IndexedDB;
|
|
258
|
-
- Cloud must pin the runtime release and storage artifact selected when the
|
|
259
|
-
operation starts; a mutable current release would make retry and rollback
|
|
260
|
-
nondeterministic.
|
|
261
|
-
|
|
262
|
-
The native-table path is implemented without a compatibility `entries` table.
|
|
263
|
-
Acceptance is gated by the repository consumer check and the Cloud upgrade,
|
|
264
|
-
retry, and rollback checks in the ADR's final application step.
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
# ADR-0025: Reserved native column names and published-only public Views
|
|
2
|
-
|
|
3
|
-
**Status:** Accepted
|
|
4
|
-
|
|
5
|
-
**Date:** 2026-09-22
|
|
6
|
-
|
|
7
|
-
**Related:** [#962](https://github.com/aotter/mantle/issues/962),
|
|
8
|
-
[#1007](https://github.com/aotter/mantle/issues/1007),
|
|
9
|
-
[#1008](https://github.com/aotter/mantle/issues/1008),
|
|
10
|
-
[#1009](https://github.com/aotter/mantle/issues/1009),
|
|
11
|
-
[#1010](https://github.com/aotter/mantle/issues/1010),
|
|
12
|
-
[ADR-0022](0022-caller-observed-version-occ.md),
|
|
13
|
-
[ADR-0024](0024-manifest-native-schema-tables.md) (partially superseded: its clauses allowing authored `id`, `status`, `createdAt`)
|
|
14
|
-
|
|
15
|
-
## Context
|
|
16
|
-
|
|
17
|
-
Every entry carries six native columns outside `data`: `id`, `status`,
|
|
18
|
-
`version`, `createdAt`, `updatedAt`, `authorId`. Before this decision the
|
|
19
|
-
grammar treated their names inconsistently:
|
|
20
|
-
|
|
21
|
-
- A Schema data property could reuse one of the names. The SQLite dialect then
|
|
22
|
-
resolved the name to the data column first; IndexedDB resolved it to the
|
|
23
|
-
native field first. The same View read different columns on different
|
|
24
|
-
storage.
|
|
25
|
-
- `Schema.spec.indexes` could not reference the names at all
|
|
26
|
-
(`SCHEMA_INDEX_INVALID`), while the runtime's own indexes lead with
|
|
27
|
-
`_mantle_status`.
|
|
28
|
-
- A public View over a `publishing` Schema hid drafts only when the author
|
|
29
|
-
wrote `filter: eq status published`. The handbook promised drafts are
|
|
30
|
-
unreadable until published; nothing enforced it on REST, MCP
|
|
31
|
-
`query_view_*` or WebMCP, which share one compiled plan.
|
|
32
|
-
|
|
33
|
-
The #962 soak measured the consequence of the second point: the list View
|
|
34
|
-
read 14,940 rows per request on a 10,991-row D1 table. Without planner
|
|
35
|
-
statistics, which production SQLite-family storage never has, SQLite chose
|
|
36
|
-
the runtime's `(_mantle_status, _mantle_updated_at, _mantle_id)` index for the
|
|
37
|
-
status equality and sorted every published row in a temporary B-tree; the
|
|
38
|
-
declared `[publishedAt]` index was never used, and the grammar refused the
|
|
39
|
-
`(status, publishedAt)` index that would have served the query.
|
|
40
|
-
|
|
41
|
-
Two alternatives were considered and rejected during review (#1008):
|
|
42
|
-
|
|
43
|
-
- **Core derives indexes from Views.** Rejected: the manifest is a deployment
|
|
44
|
-
spec; Mantle Core is not a query optimizer, and a derived index has no
|
|
45
|
-
owner when a View is deleted.
|
|
46
|
-
- **Explicit object references** such as `{ meta: status }` /
|
|
47
|
-
`{ field: publishedAt, direction: desc }`. Deferred: it adds a grammar shape
|
|
48
|
-
to solve an ambiguity that reserving the names removes, and no shipped View
|
|
49
|
-
needs mixed-direction ordering. It remains the upgrade path.
|
|
50
|
-
|
|
51
|
-
A data-first resolution rule with only `status` reserved was also rejected: an
|
|
52
|
-
index declared as `[[createdAt]]` would silently change meaning when a data
|
|
53
|
-
property `createdAt` is added later, while the index identity (field-name
|
|
54
|
-
hex) kept the old physical index.
|
|
55
|
-
|
|
56
|
-
## Decision
|
|
57
|
-
|
|
58
|
-
1. **The six native column names are reserved.** A Schema data property may
|
|
59
|
-
not use them; `mantle validate` fails closed with
|
|
60
|
-
`INVALID_MANIFEST_ENVELOPE` at `/spec/schema/properties/<name>`, the same
|
|
61
|
-
mechanism ADR-0022 uses for `expectedVersion`. Domain names replace them
|
|
62
|
-
(`submittedAt`, `orderStatus`, `submittedBy`).
|
|
63
|
-
2. **Every storage resolves a native name to the native column, first.** With
|
|
64
|
-
shadowing rejected this is a no-op for valid manifests; it is stated so the
|
|
65
|
-
SQLite dialect, IndexedDB and the index DDL cannot drift apart again.
|
|
66
|
-
3. **`Schema.spec.indexes` may reference native names**; the SQLite dialect
|
|
67
|
-
maps them to `_mantle_*` columns in `CREATE INDEX`. `uniqueIndexes` may not:
|
|
68
|
-
native columns carry no domain uniqueness. Tuples stay `string[][]`; no
|
|
69
|
-
direction, no object form.
|
|
70
|
-
4. **The author declares the access path; Mantle measures it.** A public View
|
|
71
|
-
over a `publishing` Schema always carries `status = published`, so its
|
|
72
|
-
index leads with `status` (`indexes: [[status, publishedAt]]`). Core does
|
|
73
|
-
not synthesize that index. The harness and the D1 inspector (#1010) report
|
|
74
|
-
whether the declared index is used.
|
|
75
|
-
5. **Public Views over `publishing` Schemas read published rows only, fail
|
|
76
|
-
closed.** The linker injects `status = published` into the compiled plan
|
|
77
|
-
whether or not the manifest writes it; an authored identical predicate is
|
|
78
|
-
redundant and kept; any other `status` comparison on such a View is
|
|
79
|
-
`VIEW_PUBLIC_STATUS_INVALID`. Staff Views, `operational` Schemas and SQL
|
|
80
|
-
Views are untouched.
|
|
81
|
-
|
|
82
|
-
## Consequences
|
|
83
|
-
|
|
84
|
-
- ADR-0024's statement that authored data may legitimately use `id`, `status`
|
|
85
|
-
or `createdAt` no longer holds; its `_mantle_` physical prefix is unchanged
|
|
86
|
-
and still guards every other authored name.
|
|
87
|
-
|
|
88
|
-
- Breaking for manifests that declared a data property with one of the six
|
|
89
|
-
names; the official examples and tests were renamed (#1009). Storage is
|
|
90
|
-
additive: the renamed property is a new column and the old one stays until
|
|
91
|
-
an explicit migration. The 0.1.3 release entry carries the upgrade note.
|
|
92
|
-
- The semantic fingerprint of any plan with a public publishing View changes
|
|
93
|
-
once (the injected predicate); `mantle generate` regenerates it.
|
|
94
|
-
- Index identities of existing declarations are unchanged; native-name tuples
|
|
95
|
-
get new identities. Stale indexes left behind by redeclaration are tracked
|
|
96
|
-
separately (#1011).
|
|
97
|
-
- Verified on real D1 without `ANALYZE`: the list View reads 50 rows per
|
|
98
|
-
request with `[status, publishedAt]` and 10,000 without it (#1014).
|
|
99
|
-
|
|
100
|
-
## Where this lives
|
|
101
|
-
|
|
102
|
-
The handbook is the single source: [`reference/schema.md`](../handbook/reference/schema.md)
|
|
103
|
-
(reserved columns, index rules), [`reference/view.md`](../handbook/reference/view.md)
|
|
104
|
-
(surfaces). Skills and CLI diagnostics point there; they do not restate the
|
|
105
|
-
rules.
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# ADR-0026: Progressive application generation
|
|
2
|
-
|
|
3
|
-
**Status:** Accepted by owner for the 0.1.5 line (#1081–#1086). Supersedes the no-initialization clause of ADR-0021; direct authorship and optional package boundaries remain.
|
|
4
|
-
|
|
5
|
-
Mantle is progressive. A new application defaults to Spec, Runtime, API, MCP, Admin, and an editable blank Web home so an agent does not forget the optional Admin composition. `--features` is a positive replacement list over `spec,runtime,api,mcp,admin,web`; dependencies are closed automatically. `spec` alone is host-free. The first generated hosts are `cf` and `chatgpt-sites`. Only host-dependent selections require `--host`; a TTY may prompt, while headless use must pass it explicitly.
|
|
6
|
-
|
|
7
|
-
| Feature | Required features | Direct package additions |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
| `spec` | — | `@aotter/mantle`, `zod` peer |
|
|
10
|
-
| `runtime` | `spec` | Host adapter; current CF adapter also brings Admin/Auth/Web transitively |
|
|
11
|
-
| `api` | `runtime` | Host route composition and `hono` peer |
|
|
12
|
-
| `mcp` | `runtime` | Host MCP route composition |
|
|
13
|
-
| `admin` | `runtime,api,mcp` | `@aotter/mantle-admin`, `@aotter/mantle-admin-ui`; CF owner auth also uses `@aotter/mantle-auth` |
|
|
14
|
-
| `web` | `runtime` | `@aotter/mantle-web` and a user-owned blank home |
|
|
15
|
-
|
|
16
|
-
The host adapter's declared peers (`better-auth`, `hono`, `zod`, `aws4fetch`) are installed for host-dependent selections until its package dependency graph is split. A reduced selection still omits unselected routes and assets; it does not claim smaller transitive installation today.
|
|
17
|
-
|
|
18
|
-
An application with only Git, installed skills, package metadata, a lockfile, README, and installed dependencies is new. Existing manifests or application code remain in direct-authoring compile mode. A saved `mantle.config.json` decides subsequent runs before that heuristic. V1 refuses host changes and feature-list changes after selection; application owners can make an explicit migration rather than have generation delete routes or data. An explicitly named missing manifest path is an error. A new default manifest directory may be absent or empty, yielding a valid empty plan without a fake business Schema.
|
|
19
|
-
|
|
20
|
-
Generation preflights selection, manifest validity, package/script conflicts, file ownership, and symlink escapes before writing. It saves the selection and adds only absent package declarations and scripts; it does not run a package manager. Selected Mantle packages use the running CLI's exact version. Missing selected packages produce an incomplete, nonzero result and an explicit install-and-rerun instruction. `--check` never writes, installs, prompts, or provisions. Generated code and assets remain CLI-owned; the editable frontend, host config, identity, secrets, handlers, and historical migrations are application-owned. A later SDK upgrade does not overwrite them. Clean builds remove only copied output.
|
|
21
|
-
|
|
22
|
-
Cloudflare currently has a facade with transitive Admin/Auth/Web dependencies and mounts OAuth/MCP unconditionally. Host generation must use a lower-level composition for reduced selections or change that facade; omitting dependencies from a manifest does not prove route omission. Cloudflare D1 remains runtime-managed. ChatGPT Sites uses reviewed, append-only managed migrations with applied-state checks (owned by #1086). Neither host generator provisions resources or deploys.
|
|
23
|
-
|
|
24
|
-
This decision restores a convenient default while keeping the sealed Manifest-to-RuntimePlan pipeline and user-owned application source. It does not reintroduce a remote Starter catalog or a `mantle create` command.
|
|
25
|
-
|
|
26
|
-
## 2026-09-25 amendment — existing application integration
|
|
27
|
-
|
|
28
|
-
The original implementation added `--adopt` to convert an existing authored
|
|
29
|
-
application into the generated-project layout. This amendment removes that
|
|
30
|
-
mode. Applications with their own host shape continue direct authoring;
|
|
31
|
-
integrating Mantle is guided by the version-matched `integrate` consumer skill.
|
|
32
|
-
The agent may embed selected capabilities, replace one part at a time, or
|
|
33
|
-
build a fresh Mantle application and migrate frontend and data. The CLI owns
|
|
34
|
-
only deterministic generation and its declared checks; it does not certify
|
|
35
|
-
arbitrary user-owned host wiring. A saved generated project still reruns from
|
|
36
|
-
its own configuration, with file ownership and migration safeguards intact.
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# ADR-0027: Scheduled Procedure Triggers
|
|
2
|
-
|
|
3
|
-
**Status:** Accepted for 0.1.5 (#1087). Revises the closed Trigger-source grammar from ADR-0001 and the host-only cron guidance of #322.
|
|
4
|
-
|
|
5
|
-
**Date:** 2026-09-25
|
|
6
|
-
|
|
7
|
-
## Context
|
|
8
|
-
|
|
9
|
-
The earlier contract kept cron outside the Manifest graph. That forced an application Worker to invoke a Procedure by name with its own caller context, leaving scheduling invisible to validation and the compiled plan. A portable declaration is needed without pretending that every host can register a cron event.
|
|
10
|
-
|
|
11
|
-
## Decision
|
|
12
|
-
|
|
13
|
-
`Trigger.spec.source` gains `kind: schedule`, a five-field Cloudflare UTC `cron` (weekday 1=Sunday), and optional `enabled` (default true). It targets one Procedure whose input accepts `{}` and requires no user or staff authorization. The compiled plan carries Trigger identity, expression, target, enabled state, and the required `cloudflare` host. No HTTP route or user identity is granted.
|
|
14
|
-
|
|
15
|
-
Cloudflare's `scheduled` entry finds enabled plan entries with the exact incoming expression and invokes them in Trigger-name order through the existing Procedure pipeline, continuing after individual failures and reporting them together. The system context has null user and staff, no credential, and `ctx.schedule` with stable `${trigger}:${scheduledTime}` identity. The application registers exact expressions with Wrangler. Cloudflare Cron Triggers do not document automatic retries; handlers still use the identity for possible duplicate/manual replay. Other hosts reject enabled schedules rather than silently omit them.
|
|
16
|
-
|
|
17
|
-
## Consequences
|
|
18
|
-
|
|
19
|
-
The grammar and sealed plan version advance. Applications must rerun `mantle generate` after upgrading. A Procedure needing staff authorization cannot run from a schedule. Cron provisioning, retries, retention and exactly-once execution remain host/operator responsibilities; the runtime does not claim them.
|
|
20
|
-
|
|
21
|
-
## Alternatives
|
|
22
|
-
|
|
23
|
-
Keeping host-only calls would preserve the old grammar but fail static validation and omit the feature from introspection. A general background-job framework would add storage and scheduling responsibilities without a second host implementation.
|
|
24
|
-
|
|
25
|
-
## How to apply
|
|
26
|
-
|
|
27
|
-
Declare a schedule Trigger, export `worker.scheduled`, and register its expression in `wrangler.jsonc`. Use `ctx.schedule.id` to deduplicate writes. See [Trigger reference](../handbook/reference/trigger.md#schedule-source).
|
|
28
|
-
|
|
29
|
-
## Implementation status
|
|
30
|
-
|
|
31
|
-
Implemented in the 0.1.5 scheduled Procedure PR, with parser, linker, compiler, runtime and Cloudflare adapter tests.
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# ADR-0028: Logical Schema TTL before explicit physical cleanup
|
|
2
|
-
|
|
3
|
-
**Status:** Accepted for 0.1.5 (#1088).
|
|
4
|
-
|
|
5
|
-
**Date:** 2026-09-25
|
|
6
|
-
|
|
7
|
-
## Context
|
|
8
|
-
|
|
9
|
-
An application needs a portable expiry rule across D1 and Bun SQLite. A cron-only delete task cannot guarantee that readers stop seeing expired data if it runs late or fails. Applying a new policy to a populated table must not silently bulk-delete rows.
|
|
10
|
-
|
|
11
|
-
## Decision
|
|
12
|
-
|
|
13
|
-
`Schema.spec.ttl` names one top-level date-time field and a nonnegative `expireAfterSeconds`. At `timestamp + duration <= now`, semantic reads exclude the row. Missing, null and unparseable legacy dates never expire. Declarative Views include the same predicate. Native SQL Views are rejected while any TTL Schema exists, and shared caching of a TTL View is rejected. The compiled plan and introspection expose the policy. Public Cloudflare pages derived from TTL collections use `no-store` rather than shared caching.
|
|
14
|
-
|
|
15
|
-
SQLite storage implements an optional bounded `ExpirySweeper`. A sweep previews by default; `delete: true` is required for physical removal. It returns counts and a cursor, selects at most 100 expired IDs in stable order, and rechecks expiry in one bounded delete statement. A failed page can be retried with the previous cursor. Ref Procedures can call the semantic capability, including from a scheduled Trigger. No host automatically invokes it.
|
|
16
|
-
|
|
17
|
-
Physical TTL removal does not fire before/after entry lifecycle hooks. Expiry already changed logical visibility; cleanup reclaims storage rather than representing an editorial deletion. Consumers needing business actions at expiry must implement them in an idempotent scheduled Procedure before calling the sweep.
|
|
18
|
-
|
|
19
|
-
## Consequences
|
|
20
|
-
|
|
21
|
-
Adding or shortening TTL changes read visibility immediately but never starts physical deletion. Owners preview counts and choose when to sweep; expired rows can still occupy unique indexes until removal. Other adapters must implement equivalent read filtering and a sweep or fail closed for TTL plans. The runtime does not promise an exact deletion time.
|
|
22
|
-
|
|
23
|
-
## Alternatives
|
|
24
|
-
|
|
25
|
-
Scheduler-driven deletion alone leaves a visibility gap. Implicit migration-time cleanup risks irreversible bulk deletion. Firing ordinary deletion hooks during storage reclamation would cause delayed, retry-sensitive business effects after the row was already logically gone.
|
|
26
|
-
|
|
27
|
-
## How to apply
|
|
28
|
-
|
|
29
|
-
Declare `ttl` on a Schema, use declarative Views, preview with `runtime.sweepExpired`, then explicitly request deletion page by page. See [Schema TTL](../handbook/reference/schema.md#ttl).
|
|
30
|
-
|
|
31
|
-
## Implementation status
|
|
32
|
-
|
|
33
|
-
Implemented in the 0.1.5 TTL PR for the SQLite family, with Bun and local D1 conformance checks.
|
package/docs/adr/README.md
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# Architecture Decision Records
|
|
2
|
-
|
|
3
|
-
Records of *why* mantle ended up shaped this way. The numbering preserves POC ADR numbers where carried over (so cross-references in code comments and external docs stay valid); new ADRs continue from the highest used number.
|
|
4
|
-
|
|
5
|
-
## v0.1.0 ADRs
|
|
6
|
-
|
|
7
|
-
| # | Title | Status |
|
|
8
|
-
|---|---|---|
|
|
9
|
-
| [0001](0001-four-atom-manifest-model.md) | Four-atom manifest model (Schema / View / Procedure / Trigger). Folds POC ADR-0005 (grammar discipline) and POC ADR-0006 (multi-doc YAML). | Accepted; fixed-file contract superseded |
|
|
10
|
-
| [0002](0002-closed-enums-for-bindings.md) | Closed enums for `x-mantle-bind` and `ctx.*` predicates. | Accepted (refreshed) |
|
|
11
|
-
| [0007](0007-ai-as-primary-author.md) | AI is the primary author of consumer projects; SDK contract is three pre-serve feedback loops, runtime diagnostics, and coder/operator role surfaces. | Accepted + amended |
|
|
12
|
-
| [0008](0008-structured-diagnostic-shape.md) | Diagnostic shape for validate/boot/runtime failures, with a reserved consumer-test phase; measured harnesses keep purpose-shaped reports. | Accepted + amended |
|
|
13
|
-
| [0009](0009-consumer-supplied-manifests.md) | Historical generated-array workflow; consumer source ownership continues in ADR-0019. | Superseded by 0019 |
|
|
14
|
-
| [0010](0010-locale-and-translates.md) | Locale 3-layer (manifest / D1 site_config / data field) + translates pattern. Boot decoupled from `site_config` (issue #60 fix). | Accepted (refreshed) |
|
|
15
|
-
| [0011](0011-adapter-port-spec.md) | Adapter port spec. Required runtime ports plus optional feature ports. | Accepted (new) |
|
|
16
|
-
| [0012](0012-views-as-public-rest.md) | Views auto-expose matching REST and `query_view_*` MCP reads on their declared `public` or `staff` surface. Schemas never get a public REST endpoint. | Accepted + amended |
|
|
17
|
-
| [0013](0013-agent-provisioned-consumer-projects.md) | Historical agent-provisioned consumer projects path. | Superseded by 0021 |
|
|
18
|
-
| [0014](0014-auth-better-auth-and-multi-tenant-mcp.md) | The Cloudflare adapter owns one Better Auth 1.7 identity/OAuth/MCP authority with native method options and CIMD discovery. Verified callers are normalized into runtime context; mutable staff role and target authorization are re-evaluated per call. | Accepted + amended |
|
|
19
|
-
| [0016](0016-site-semantic-layer.md) | Historical Starter/Landing `AGENTS.md` and launch-state contract. | Superseded by 0021 |
|
|
20
|
-
| [0017](0017-media-multi-variant-agent-side-optimization.md) | Multi-variant media assets with agent-side optimization and asset-id entry references. | Accepted |
|
|
21
|
-
| [0018](0018-core-starters-repository-boundary.md) | Core produces published SDK artifacts; the separate starters repository validates them as an external consumer. Revisit after release-contract simplification. | Superseded by 0021 |
|
|
22
|
-
| [0019](0019-sealed-manifest-runtime-pipeline.md) | One sealed source-to-runtime pipeline, semantic storage seam, and optional Web/Admin/platform dependency direction. | Accepted |
|
|
23
|
-
| [0020](0020-builtin-handler-contracts-and-matched-upsert.md) | Static builtin handler contracts and natural-key matched upsert (`handler.match`). | Accepted + amended by 0022 |
|
|
24
|
-
| [0021](0021-retire-starter-scaffolding.md) | Direct authoring; retire Starter scaffolding. | Accepted; no-initialization clause superseded by 0026 |
|
|
25
|
-
| [0022](0022-caller-observed-version-occ.md) | Caller-observed `expectedVersion` for Admin bind and builtin upsert OCC. | Accepted |
|
|
26
|
-
| [0024](0024-manifest-native-schema-tables.md) | Materialize each Schema as a native storage table and deploy reviewed migration artifacts. | Accepted; authored-native-name clauses superseded by 0025 |
|
|
27
|
-
| [0025](0025-reserved-native-columns-and-published-only-public-views.md) | Reserve the six native column names, let `indexes` reference them, and compile public publishing Views published-only. | Accepted |
|
|
28
|
-
| [0026](0026-progressive-generate.md) | Progressive `mantle generate` with a full default, positive features, saved host selection, and user-owned source. | Accepted; supersedes part of 0021 |
|
|
29
|
-
| [0027](0027-scheduled-procedure-triggers.md) | Schedule Triggers in the sealed plan with Cloudflare-hosted invocation and system identity. | Accepted for 0.1.5 |
|
|
30
|
-
| [0028](0028-schema-ttl-expiry.md) | Logical TTL on Schema reads with preview-first, explicit bounded cleanup. | Accepted for 0.1.5 |
|
|
31
|
-
|
|
32
|
-
## Reading order
|
|
33
|
-
|
|
34
|
-
If you're new to the codebase:
|
|
35
|
-
|
|
36
|
-
1. **0001** — what the 4 atoms are.
|
|
37
|
-
2. **0019** — the sealed source-to-runtime pipeline and optional product boundaries.
|
|
38
|
-
3. **0009** — historical context for consumer-owned manifests.
|
|
39
|
-
4. **0007** — what running the SDK feels like as an AI author (and as the operator agent).
|
|
40
|
-
5. **0011** — the boundary between the runtime and the adapter.
|
|
41
|
-
6. **0010** — how locale flows through the system.
|
|
42
|
-
7. **0026** — current progressive generation boundary; **0021** retains the direct-authoring history and **0013** is historical install-session context.
|
|
43
|
-
8. **0002, 0008** — the two ADRs that touch every diagnostic and every binding.
|
|
44
|
-
|
|
45
|
-
## What's NOT here (and why)
|
|
46
|
-
|
|
47
|
-
POC had 16 ADRs. The rebuild ports the durable ones, writes fresh ADRs
|
|
48
|
-
for new v0.1.0 boundaries, and folds / drops the rest:
|
|
49
|
-
|
|
50
|
-
- **POC ADR-0003** OpenAPI emission → folded into `mantle-spec` README (the *what* is implementation; the *why* was already captured by ADR-0001's grammar lock).
|
|
51
|
-
- **POC ADR-0004** D1 today, Hyperdrive PG tomorrow → folded into `mantle-cloudflare` README (now a v0.2 roadmap item, not an architectural decision).
|
|
52
|
-
- **POC ADR-0005** v0.1 minimum grammar → folded into ADR-0001's fail-closed grammar policy.
|
|
53
|
-
- **POC ADR-0006** multi-doc YAML → folded into ADR-0001 §"Authoring shape: multi-doc YAML."
|
|
54
|
-
- **POC ADR-0011** lifecycle binary opt-in → distilled to a §"Lifecycle" subsection in `docs/design-atoms.md`. v0.1.0 ships `publishing` and `operational`.
|
|
55
|
-
- **POC ADR-0012** strategic posture vs adjacent CMS designs → strategic / marketing material, lives in `README.md` if anywhere.
|
|
56
|
-
- **POC ADR-0013** role-split surfaces (coder agent vs operator agent) → folded into ADR-0007 (Part B).
|
|
57
|
-
- **POC ADR-0014** builtin handlers and lifecycle Triggers → promoted to v0.1.0 and implemented in the rebuild via `LifecycleHookingEntryRepository` and `InvokeBuiltinUseCase`. Full shape spec lives in `docs/design-atoms.md`.
|
|
58
|
-
- **POC ADR-0015** cms-astro internal seam discipline → POC-specific to a package that no longer exists; replaced by ADR-0011 (adapter port spec).
|
|
59
|
-
- **POC ADR-0029** drop Astro from cms-cloudflare → POC-specific historical record; the rebuild starts post-Astro.
|
|
60
|
-
|
|
61
|
-
The rebuild's ADR-0011 (new) is the most load-bearing addition — the POC accumulated multiple *aspirational* boundaries (POC ADR-0015 was one; references in CLAUDE.md were another) without a single normative spec. ADR-0011 makes the boundary explicit and reviewable. ADR-0012 and ADR-0013 capture newer v0.1.0 product/runtime seams that were not present in the POC.
|
|
62
|
-
|
|
63
|
-
## Contributing a new ADR
|
|
64
|
-
|
|
65
|
-
1. Pick the next unused number after the highest existing ADR.
|
|
66
|
-
2. File: `docs/adr/<NNNN>-<kebab-title>.md`.
|
|
67
|
-
3. Sections: Status, Date, Context, Decision, Consequences, Alternatives, How to apply, Implementation status.
|
|
68
|
-
4. Link from this README's table.
|
|
69
|
-
5. Land it in a PR alongside (or before) the implementation it documents — ADR-as-design-artifact, not ADR-as-archaeology.
|
|
70
|
-
|
|
71
|
-
## ADR-lite records
|
|
72
|
-
|
|
73
|
-
These retain their issue-based filenames and original decision status.
|
|
74
|
-
|
|
75
|
-
| Record | Status |
|
|
76
|
-
|---|---|
|
|
77
|
-
| [#803 Request diagnostics](adr-lite-803-request-diagnostics.md) | Implemented |
|
|
78
|
-
| [#808 Route readiness](adr-lite-808-route-readiness.md) | Accepted |
|
|
79
|
-
| [#809 Bounded public content](adr-lite-809-bounded-public-content.md) | Implemented |
|
|
80
|
-
| [#812 Native parity](adr-lite-812-native-parity.md) | Implemented; deployment evidence linked in record |
|
|
81
|
-
| [#823 Home statistics](adr-lite-823-home-statistics.md) | Proposed; unmerged demo |
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# ADR-lite: request-scoped Cloudflare diagnostics
|
|
2
|
-
|
|
3
|
-
Status: implemented diagnostic record for #803; real-auth controls and measured
|
|
4
|
-
comparison acceptance belong to the #812 harness. This does not close the
|
|
5
|
-
separate starter provisioning/Smart Placement portion of #803.
|
|
6
|
-
|
|
7
|
-
Use native AsyncLocalStorage and a small versioned testing entry point instead of
|
|
8
|
-
a global current-request counter or a configurable production telemetry system.
|
|
9
|
-
Production mounts only check for an existing test context. With none, there are
|
|
10
|
-
no diagnostic clock reads, binding wrappers, records, observers or response headers.
|
|
11
|
-
Runtime, auth, role, catalog, dispatcher-build and dispatch retain their ownership
|
|
12
|
-
and authorization order. The ordinary runtime-ready promise keeps its identity.
|
|
13
|
-
|
|
14
|
-
Native D1 instrumentation sits beneath both Auth and Runtime and is idempotent.
|
|
15
|
-
It preserves receivers, bind chains, first-column behavior and native objects in
|
|
16
|
-
batches; no second driver observer is added for counting. Provider failures and
|
|
17
|
-
unknown metadata remain visible. Request context is captured when an operation
|
|
18
|
-
starts, so shared work belongs to its initiator. Catalog waiters inherit source
|
|
19
|
-
classification and wait time without inheriting the owner's binding counts.
|
|
20
|
-
|
|
21
|
-
The record freezes at response creation. Inclusive spans can overlap, and partial
|
|
22
|
-
metadata or deferred work must not be presented as a full total. A test-only cloned
|
|
23
|
-
MCP response supplies the JSON-RPC outcome without exposing its content; that
|
|
24
|
-
inspection is outside totalMs but remains instrumentation overhead for HTTP timing.
|
|
25
|
-
Observer errors never replace application results. D1/KV/R2 operations emit only
|
|
26
|
-
counts, sizes with their source/coverage, and durations; object keys, SQL, caller
|
|
27
|
-
identities and credentials never enter the record.
|
|
28
|
-
|
|
29
|
-
R2 GET bodies stay native. Successful direct stream-to-PUT completion confirms
|
|
30
|
-
payload bytes; canceled, incomplete and unconsumed reads remain unknown. This
|
|
31
|
-
avoids losing R2's known-length stream property or hiding buffering overhead.
|
|
32
|
-
|
|
33
|
-
Checks deliberately overlap MCP requests and share KV hit/failure loads, then
|
|
34
|
-
retry after failure. Native I/O is counted once per owner, and denied requests
|
|
35
|
-
leave unreached phases null. Additional checks preserve native D1 private receiver
|
|
36
|
-
and batch semantics, sync/async observer failure, immutable deferred snapshots,
|
|
37
|
-
R2 stream identity and partial-transfer uncertainty. The collector fixture labels
|
|
38
|
-
its deterministic auth explicitly; it is not evidence of native-auth parity.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Route-owned Cloudflare readiness (#808)
|
|
2
|
-
|
|
3
|
-
Status: accepted for the unreleased #806–812 implementation. Follows ADR-0019
|
|
4
|
-
(preparation owns migrations) and amends ADR-0014's unconditional HTTP boot rule.
|
|
5
|
-
|
|
6
|
-
The facade assembles immutable route projections once, then prepares only for
|
|
7
|
-
routes that consume canonical storage. It retains one retryable preparation
|
|
8
|
-
promise, the sealed plan and Better Auth's existing global AsyncLocalStorage,
|
|
9
|
-
`ready` observation, failed-assembly eviction and HTTP `waitUntil` ownership.
|
|
10
|
-
|
|
11
|
-
| Surface | Readiness, including an empty database |
|
|
12
|
-
| --- | --- |
|
|
13
|
-
| Consumer constant health, `/api/views` catalog | No content preparation. |
|
|
14
|
-
| Static Admin shell and assets | No content preparation; incomplete Auth still fails closed as before. |
|
|
15
|
-
| Manifest View/Trigger | Prepare before credential resolution, then use the same runtime invocation. |
|
|
16
|
-
| Admin API, configured Auth base path, OAuth UI/discovery | Prepare before session/provider work. Auth tables share canonical migrations. |
|
|
17
|
-
| MCP, including missing-token challenge | Prepare before the selected Auth verifier. A custom Auth implementation may require D1 even for a denied request; the facade cannot assume otherwise. |
|
|
18
|
-
| Public page/list/discovery and favicon fallback | Their existing `ref.get()` starts preparation when content is needed. |
|
|
19
|
-
| Consumer extension handlers | Call the supplied `getRuntime()` or `ref.get()` before using Mantle content or database-backed Auth. Pure handlers need neither. |
|
|
20
|
-
| Queue/scheduled `getRuntime(env)` | Await both runtime preparation and Auth initialization, unchanged. |
|
|
21
|
-
|
|
22
|
-
No deployment-time migration flag or KV readiness authority is introduced. A
|
|
23
|
-
current database's first protected route needs one fingerprint SELECT; an empty
|
|
24
|
-
or changed database performs canonical setup there. Concurrent first uses share
|
|
25
|
-
that work. A failed preparation returns the facade's redacted 500, and later
|
|
26
|
-
requests retry. Static availability is not a promise that data is ready.
|
|
27
|
-
|
|
28
|
-
The pre-change full-facade fixture recorded 106 SQL operations for its empty-DB
|
|
29
|
-
health request (its four Schemas include indexes), then 1 fingerprint operation
|
|
30
|
-
for each new-state health/catalog/shell/challenge. These are statement counts,
|
|
31
|
-
not network round trips. Its dry-run bundle was 3,921.40 KiB / 690.43 KiB gzip
|
|
32
|
-
with Wrangler 4.124.0 and compatibility date 2026-07-08. Esbuild attributed
|
|
33
|
-
1,342,428 emitted bytes to Better Auth, 76,078 to Admin, 24,624 to Web and
|
|
34
|
-
203,130 to Runtime; the rest includes transitive libraries and adapter code.
|
|
35
|
-
Byte attribution does not measure startup CPU. We retain static imports and
|
|
36
|
-
immutable mount-time projections: deferring those modules has not yet been
|
|
37
|
-
justified by a startup profile. The final #812 report owns the separate startup,
|
|
38
|
-
preparation-wall and warm-dispatch measurements.
|
|
39
|
-
|
|
40
|
-
Post-change full-facade workerd checks pass all 13 operation gates: empty-DB
|
|
41
|
-
health and fresh-state health/catalog/shell perform zero **content** queries;
|
|
42
|
-
the challenge retains its one fingerprint query. The fixture Auth is a stated
|
|
43
|
-
stub. A separate real Better Auth regression records one eager oauthResource
|
|
44
|
-
lookup while `ready` initializes; Better Auth 1.7.2 defers missing-table resource
|
|
45
|
-
seeding to first access. Subsequent static requests perform no additional Auth
|
|
46
|
-
queries. This background initialization is retained, not counted as eliminated
|
|
47
|
-
content preparation or hidden behind a zero-total-SQL claim.
|