@ultimat3/cli 29.3.2 → 30.0.0
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/CLAUDE.md +64 -40
- package/README.md +61 -11
- package/package.json +42 -28
- package/src/affected-tests.ts +97 -0
- package/src/affected-unowned.ts +43 -0
- package/src/affected.ts +25 -6
- package/src/app-boundaries.ts +29 -1
- package/src/app-evals.ts +12 -4
- package/src/app-load-unresolved.ts +62 -0
- package/src/app-load.ts +30 -37
- package/src/app-mcp.ts +14 -2
- package/src/app-module-graph.ts +232 -0
- package/src/app-reload-graph.ts +2 -2
- package/src/app-root.ts +37 -1
- package/src/bin.ts +1 -0
- package/src/boundary-findings.ts +6 -0
- package/src/budgets-freshness.ts +32 -0
- package/src/budgets.ts +20 -1
- package/src/build-capture-env.ts +9 -0
- package/src/cdp-shot-a11y.ts +2 -39
- package/src/ci-tested.ts +243 -0
- package/src/client-emit-customer-runtime.ts +139 -0
- package/src/client-emit-customer.ts +108 -0
- package/src/client-emit-drift.ts +72 -0
- package/src/client-emit-header.ts +67 -0
- package/src/client-emit-schemas.ts +175 -0
- package/src/client-emit-types.ts +121 -0
- package/src/client-emit-vendor.ts +146 -0
- package/src/client-errors-routes.ts +229 -0
- package/src/client-errors-script.ts +74 -0
- package/src/client-vitals-route.ts +197 -0
- package/src/client-vitals-script.ts +56 -0
- package/src/cmd-affected.ts +23 -0
- package/src/cmd-build-spec.ts +7 -1
- package/src/cmd-build.ts +35 -9
- package/src/cmd-ci-spec.ts +42 -6
- package/src/cmd-ci.ts +99 -2
- package/src/cmd-client-customer.ts +134 -0
- package/src/cmd-client-source.ts +81 -0
- package/src/cmd-client-spec.ts +48 -0
- package/src/cmd-client-write.ts +41 -0
- package/src/cmd-client.ts +111 -0
- package/src/cmd-db-recount.ts +120 -0
- package/src/cmd-db-spec.ts +36 -6
- package/src/cmd-db.ts +13 -3
- package/src/cmd-deploy-compose.ts +61 -3
- package/src/cmd-deploy-drain.ts +10 -2
- package/src/cmd-deploy-helm.ts +11 -0
- package/src/cmd-deploy-preflight.ts +118 -0
- package/src/cmd-deploy-spec.ts +58 -6
- package/src/cmd-deploy-verify.ts +380 -0
- package/src/cmd-deploy.ts +42 -9
- package/src/cmd-docs.ts +34 -4
- package/src/cmd-doctor.ts +66 -9
- package/src/cmd-drill-spec.ts +25 -0
- package/src/cmd-drill.ts +176 -0
- package/src/cmd-env-init.ts +102 -0
- package/src/cmd-env-spec.ts +10 -3
- package/src/cmd-env.ts +15 -10
- package/src/cmd-errors-recent.ts +60 -0
- package/src/cmd-errors-spec.ts +9 -1
- package/src/cmd-errors.ts +4 -0
- package/src/cmd-exercise-spec.ts +19 -0
- package/src/cmd-exercise.ts +129 -0
- package/src/cmd-generate-spec.ts +9 -1
- package/src/cmd-generate.ts +32 -27
- package/src/cmd-graph-load.ts +97 -0
- package/src/cmd-graph-spec.ts +16 -0
- package/src/cmd-graph.ts +73 -0
- package/src/cmd-i18n.ts +4 -1
- package/src/cmd-impact-spec.ts +13 -0
- package/src/cmd-impact.ts +64 -0
- package/src/cmd-jobs-resolve.ts +76 -0
- package/src/cmd-jobs-spec.ts +21 -2
- package/src/cmd-jobs.ts +10 -6
- package/src/cmd-mail-spec.ts +28 -0
- package/src/cmd-mail.ts +70 -0
- package/src/cmd-mcp-lock.ts +69 -0
- package/src/cmd-mcp-spec.ts +23 -4
- package/src/cmd-mcp.ts +17 -3
- package/src/cmd-new-spec.ts +8 -1
- package/src/cmd-new.ts +61 -9
- package/src/cmd-planned.ts +0 -6
- package/src/cmd-repro-spec.ts +31 -0
- package/src/cmd-repro.ts +174 -0
- package/src/cmd-stop-spec.ts +21 -0
- package/src/cmd-stop.ts +166 -0
- package/src/cmd-test-spec.ts +17 -4
- package/src/cmd-test.ts +70 -14
- package/src/cmd-upgrade-spec.ts +26 -0
- package/src/cmd-upgrade.ts +274 -0
- package/src/cmd-verify-spec.ts +3 -3
- package/src/db-backfill.ts +6 -0
- package/src/db-diagnostics.ts +106 -0
- package/src/db-generate.ts +28 -8
- package/src/db-reset-template.ts +1 -1
- package/src/db-rolling.ts +45 -0
- package/src/db-seed-generate.ts +188 -0
- package/src/deploy-verify-findings.ts +98 -0
- package/src/deploy-verify-flags.ts +109 -0
- package/src/deploy-verify-grade.ts +185 -0
- package/src/deploy-verify-queues.ts +53 -0
- package/src/dev-boot.ts +35 -15
- package/src/dev-child-watch.ts +16 -4
- package/src/dev-dashboard-guard.ts +8 -1
- package/src/dev-dashboard.ts +7 -0
- package/src/dev-lock-identity.ts +61 -0
- package/src/dev-lock-port-holder.ts +80 -0
- package/src/dev-lock-steal.ts +124 -0
- package/src/dev-lock.ts +92 -120
- package/src/dev-mail-templates.ts +51 -0
- package/src/dev-rebuild.ts +26 -2
- package/src/dev-route-table.ts +17 -0
- package/src/dev-supervisor.ts +5 -2
- package/src/dev-watch-tree.ts +11 -10
- package/src/dev-watch.ts +1 -1
- package/src/dispatch.ts +29 -6
- package/src/docs-section.ts +69 -0
- package/src/docs-sources.ts +100 -0
- package/src/doctor-auth.ts +11 -2
- package/src/doctor-chart-alerts.ts +55 -0
- package/src/doctor-pooler.ts +107 -0
- package/src/doctor-rolling.ts +35 -0
- package/src/doctor-row-security.ts +40 -0
- package/src/document-options.ts +13 -0
- package/src/drill-sync-lane.ts +25 -0
- package/src/drill-targets.ts +39 -0
- package/src/duplicate-packages.ts +1 -1
- package/src/env-production.ts +93 -0
- package/src/error-codes-shot.ts +59 -0
- package/src/error-codes-tooling.ts +29 -0
- package/src/error-codes.ts +100 -54
- package/src/error-contract.ts +2 -2
- package/src/errors.ts +22 -3
- package/src/exercise-database.ts +99 -0
- package/src/exercise-findings.ts +159 -0
- package/src/exercise-overrides.ts +42 -0
- package/src/exercise-registration.ts +58 -0
- package/src/exercise-static.ts +88 -0
- package/src/exercise-subject.ts +69 -0
- package/src/failure-capture-boot.ts +30 -0
- package/src/framework-env.ts +7 -1
- package/src/framework-schema.ts +72 -5
- package/src/generate-catalog-locales.ts +19 -0
- package/src/generate-chart-alerts.ts +156 -0
- package/src/generate-feature-required.ts +65 -0
- package/src/generate-feature.ts +83 -6
- package/src/generate-files.ts +24 -0
- package/src/generate-format-written.ts +32 -0
- package/src/generate-kinds.ts +6 -0
- package/src/generate-sign-in-config.ts +100 -0
- package/src/generate-sign-in-manifest.ts +28 -0
- package/src/generate-sign-in-mode.ts +101 -0
- package/src/generate-sign-in.ts +250 -0
- package/src/generate-write.ts +44 -7
- package/src/hand-rolled-socket.ts +72 -0
- package/src/i18n-app-key-shapes.ts +29 -0
- package/src/i18n-audit.ts +10 -3
- package/src/i18n-registration.ts +18 -3
- package/src/index.ts +2 -0
- package/src/island-bundle.ts +4 -3
- package/src/island-disposer.ts +116 -0
- package/src/island-realtime-state.ts +34 -6
- package/src/island-realtime.ts +6 -2
- package/src/island-routes.ts +3 -2
- package/src/isr-query-advice.ts +6 -11
- package/src/isr-query-guard.ts +4 -3
- package/src/job-budget.ts +95 -0
- package/src/jobs-json.ts +11 -0
- package/src/lint-findings.ts +104 -0
- package/src/local-cli.ts +34 -4
- package/src/loopback-host.ts +2 -2
- package/src/mail-preview-findings.ts +24 -0
- package/src/mcp-errors.ts +82 -2
- package/src/mcp-host.ts +11 -1
- package/src/mcp-lock-findings.ts +57 -0
- package/src/measure-paths.ts +12 -4
- package/src/measure-scope.ts +27 -13
- package/src/messages-client.ts +23 -0
- package/src/messages-db.ts +56 -0
- package/src/messages-gate.ts +107 -0
- package/src/messages-repro.ts +11 -0
- package/src/messages-shot.ts +51 -0
- package/src/messages-upgrade.ts +45 -0
- package/src/messages.ts +53 -178
- package/src/metrics-endpoint.ts +23 -5
- package/src/new-shapes-generate.ts +71 -0
- package/src/new-shapes.ts +63 -0
- package/src/openapi-compile-ir.ts +68 -0
- package/src/openapi-compile-schema.ts +284 -0
- package/src/openapi-compile.ts +273 -0
- package/src/openapi-refuse.ts +45 -0
- package/src/otlp-export.ts +2 -1
- package/src/output-findings.ts +123 -0
- package/src/output.ts +32 -8
- package/src/package-boundaries.ts +110 -0
- package/src/page-pins.ts +23 -0
- package/src/plain-routes.ts +13 -0
- package/src/prerender-entries.ts +59 -0
- package/src/prerender-heaviest.ts +27 -0
- package/src/prerender-preload.ts +6 -0
- package/src/prerender-report.ts +12 -0
- package/src/prerender-seo-reads.ts +38 -0
- package/src/prerender-served.ts +22 -7
- package/src/prerender-vitals.ts +42 -0
- package/src/prerender.ts +61 -32
- package/src/pwa-artifacts.ts +4 -3
- package/src/pwa-manifest-locales.ts +1 -1
- package/src/registry.ts +18 -0
- package/src/repro-bundle.ts +65 -0
- package/src/repro-errors.ts +47 -0
- package/src/repro-job.ts +72 -0
- package/src/repro-literal.ts +41 -0
- package/src/repro-request.ts +48 -0
- package/src/repro-write.ts +100 -0
- package/src/retain-sweep.ts +27 -0
- package/src/retained-assets-boot.ts +113 -0
- package/src/retained-assets-layout.ts +110 -0
- package/src/retained-assets-read.ts +142 -0
- package/src/retained-assets-sweep.ts +70 -0
- package/src/retained-assets.ts +171 -0
- package/src/revalidated-response.ts +8 -5
- package/src/role-replicator.ts +7 -1
- package/src/role-start-devices.ts +119 -0
- package/src/role-start-types.ts +6 -0
- package/src/role-start.ts +22 -5
- package/src/role-sync.ts +7 -1
- package/src/route-islands.ts +42 -0
- package/src/route-table.ts +2 -1
- package/src/row-security-boot.ts +58 -0
- package/src/row-security-wanted.ts +32 -0
- package/src/runtime-admin.ts +0 -1
- package/src/runtime-assets-site-cache.ts +55 -0
- package/src/runtime-assets-site.ts +136 -0
- package/src/runtime-assets.ts +99 -55
- package/src/runtime-bindings.ts +19 -3
- package/src/runtime-cache.ts +23 -14
- package/src/runtime-isr-outcome.ts +114 -60
- package/src/runtime-purge.ts +14 -2
- package/src/runtime-queue.ts +31 -4
- package/src/runtime-render-document.ts +204 -0
- package/src/runtime-render.ts +48 -198
- package/src/runtime-replica-position.ts +62 -0
- package/src/runtime-replica.ts +18 -3
- package/src/runtime-s3-path-style.ts +17 -0
- package/src/runtime-services.ts +19 -6
- package/src/runtime-statement-bound.ts +22 -0
- package/src/runtime-storage-upload.ts +9 -0
- package/src/runtime-storage.ts +42 -138
- package/src/schema-diff-views.ts +54 -0
- package/src/schema-diff.ts +21 -3
- package/src/schema-drift.ts +28 -9
- package/src/schema-dump-drift.ts +91 -7
- package/src/script-csp.ts +1 -1
- package/src/seo-cards.ts +26 -0
- package/src/seo-routes.ts +22 -8
- package/src/serve-boot.ts +54 -21
- package/src/serve-drain.ts +1 -0
- package/src/serve-env.ts +26 -8
- package/src/serve-retire.ts +12 -6
- package/src/serve-web.ts +42 -4
- package/src/serve.ts +9 -7
- package/src/site-asset-routes.ts +17 -27
- package/src/site-config.ts +4 -0
- package/src/site-llms-pages.ts +106 -0
- package/src/site-llms.ts +64 -0
- package/src/site-seo-write.ts +4 -2
- package/src/site-seo.ts +55 -6
- package/src/source-mtime.ts +50 -0
- package/src/static-capture-errors.ts +41 -0
- package/src/static-capture.ts +56 -0
- package/src/static-cards-serve.ts +39 -0
- package/src/static-cards.ts +93 -0
- package/src/static-document.ts +14 -13
- package/src/static-images.ts +115 -0
- package/src/stream-hole-scope.ts +55 -0
- package/src/style-bundle.ts +1 -1
- package/src/style-routes.ts +3 -2
- package/src/sw-precache-plan.ts +2 -2
- package/src/sw-routes.ts +2 -2
- package/src/templates/action-tests.ts +306 -0
- package/src/templates/action.ts +81 -269
- package/src/templates/backfill.ts +1 -1
- package/src/templates/entity.ts +21 -5
- package/src/templates/github/ci.yml.ts +8 -9
- package/src/templates/guard-bare-error.ts +2 -2
- package/src/templates/guard-error-declared.ts +263 -0
- package/src/templates/guard-native-confirm.ts +132 -0
- package/src/templates/guard-raw-fetch.ts +151 -0
- package/src/templates/guard-raw-interval.ts +121 -0
- package/src/templates/guard-repo-raw-sql.ts +71 -2
- package/src/templates/job.ts +1 -1
- package/src/templates/naming.ts +5 -0
- package/src/templates/pinned/docker-compose.yml +6 -0
- package/src/templates/pinned-images.ts +8 -0
- package/src/templates/policy.ts +85 -2
- package/src/templates/query.ts +70 -13
- package/src/templates/resource-create.ts +3 -1
- package/src/templates/resource-form-island.ts +15 -4
- package/src/templates/resource-page-db.ts +83 -0
- package/src/templates/resource-page.ts +161 -52
- package/src/templates/route.ts +4 -6
- package/src/templates/scaffold-app.ts +3 -0
- package/src/templates/scaffold-auth.ts +2 -1
- package/src/templates/scaffold-bin.ts +5 -52
- package/src/templates/scaffold-claude-agents.ts +19 -19
- package/src/templates/scaffold-claude-commands.ts +28 -31
- package/src/templates/scaffold-claude.ts +26 -23
- package/src/templates/scaffold-container-compose.ts +6 -1
- package/src/templates/scaffold-container.ts +24 -4
- package/src/templates/scaffold-dashboard-bare.ts +3 -3
- package/src/templates/scaffold-dashboard-example-tests.ts +49 -9
- package/src/templates/scaffold-dashboard-example-view.ts +156 -0
- package/src/templates/scaffold-dashboard-example.ts +43 -131
- package/src/templates/scaffold-dashboard-shared.ts +3 -7
- package/src/templates/scaffold-db-client.ts +20 -6
- package/src/templates/scaffold-db-package.ts +5 -14
- package/src/templates/scaffold-docs.ts +73 -57
- package/src/templates/scaffold-domain-package.ts +18 -14
- package/src/templates/scaffold-entries.ts +7 -2
- package/src/templates/scaffold-exercise.ts +37 -0
- package/src/templates/scaffold-guards.ts +13 -1
- package/src/templates/scaffold-helm-alerts.ts +234 -0
- package/src/templates/scaffold-helm-templates.ts +7 -5
- package/src/templates/scaffold-helm.ts +46 -12
- package/src/templates/scaffold-i18n.ts +6 -2
- package/src/templates/scaffold-mcp-endpoint.ts +182 -0
- package/src/templates/scaffold-mcp-json.ts +31 -0
- package/src/templates/scaffold-mcp-package.ts +59 -56
- package/src/templates/scaffold-repo.ts +7 -2
- package/src/templates/scaffold-shell.ts +45 -79
- package/src/templates/scaffold-test-services.ts +13 -5
- package/src/templates/shapes/api-keys.ts +170 -0
- package/src/templates/shapes/api.ts +101 -0
- package/src/templates/shapes/blog-site.ts +340 -0
- package/src/templates/shapes/blog-slice.ts +265 -0
- package/src/templates/shapes/blog.ts +114 -0
- package/src/templates/shapes/dashboard-detail.ts +242 -0
- package/src/templates/shapes/dashboard.ts +53 -0
- package/src/templates/shapes/index.ts +17 -0
- package/src/templates/shapes/overlay.ts +99 -0
- package/src/templates/shapes/shared-edits.ts +46 -0
- package/src/templates/sign-in-action-tests.ts +237 -0
- package/src/templates/sign-in-authenticator.ts +112 -0
- package/src/templates/sign-in-oidc.ts +189 -0
- package/src/templates/sign-in-pages.ts +148 -0
- package/src/templates/sign-in-password.ts +216 -0
- package/src/templates/sign-in-shared.ts +268 -0
- package/src/templates/slice-foundation.ts +70 -15
- package/src/test-batches.ts +1 -1
- package/src/test-database.ts +1 -1
- package/src/test-shards.ts +7 -1
- package/src/test-workers.ts +18 -12
- package/src/tool-gate-names.ts +34 -0
- package/src/upgrade-agents-link.ts +49 -0
- package/src/upgrade-bun-floor.ts +225 -0
- package/src/upgrade-gate.ts +228 -0
- package/src/upgrade-pins.ts +63 -0
- package/src/upgrade-plan.ts +214 -0
- package/src/upgrade-registry.ts +53 -0
- package/src/upgrade-report.ts +139 -0
- package/src/upgrade-root.ts +74 -0
- package/src/verify-budgets-build.ts +118 -0
- package/src/verify-checks.ts +67 -24
- package/src/verify-coverage-run.ts +1 -1
- package/src/verify-e2e-lane.ts +41 -0
- package/src/verify-exercise.ts +64 -0
- package/src/verify-floor.ts +41 -0
- package/src/verify-merge.ts +19 -4
- package/src/verify-role-load.ts +2 -0
- package/src/verify-run.ts +28 -8
- package/src/verify-shard.ts +12 -2
- package/src/verify-skip-ceiling.ts +87 -0
- package/src/verify-step.ts +5 -0
- package/src/verify-tests.ts +25 -5
- package/src/view-drift.ts +55 -0
- package/src/worker-bundle.ts +3 -2
- package/src/workspace-graph.ts +38 -19
- package/src/write-generated.ts +43 -0
- package/src/zone-boot.ts +20 -0
- package/wiki/Actions.md +342 -0
- package/wiki/Admin-Dashboard.md +432 -0
- package/wiki/Agents.md +958 -0
- package/wiki/Auth.md +195 -0
- package/wiki/Bare-VM.md +111 -0
- package/wiki/Batching-And-Preloading.md +136 -0
- package/wiki/Building-Your-Own-Base.md +203 -0
- package/wiki/CI-Parallel-Gate.md +220 -0
- package/wiki/CLI-Reference.md +1894 -0
- package/wiki/Caching-And-Invalidation.md +255 -0
- package/wiki/Client-Data.md +194 -0
- package/wiki/Client-Navigation.md +513 -0
- package/wiki/Compared.md +93 -0
- package/wiki/Configuration.md +868 -0
- package/wiki/Contributing.md +12 -0
- package/wiki/Deploy-Recipes.md +122 -0
- package/wiki/Deployment.md +508 -0
- package/wiki/Entities-And-Migrations.md +1116 -0
- package/wiki/FAQ.md +175 -0
- package/wiki/Feature-Flags.md +65 -0
- package/wiki/Getting-Started.md +221 -0
- package/wiki/Home.md +160 -0
- package/wiki/I18n.md +239 -0
- package/wiki/Installation.md +206 -0
- package/wiki/Interface-Rules.md +339 -0
- package/wiki/Jobs-And-Workflows.md +783 -0
- package/wiki/Known-Gaps.md +185 -0
- package/wiki/MCP-And-AI.md +753 -0
- package/wiki/Mail.md +138 -0
- package/wiki/Migrating-An-Existing-App.md +594 -0
- package/wiki/Migrating-From-Django.md +54 -0
- package/wiki/Migrating-From-Laravel.md +53 -0
- package/wiki/Migrating-From-Node-Drizzle.md +53 -0
- package/wiki/Migrating-From-Rails.md +53 -0
- package/wiki/Migrations-And-Backfills.md +552 -0
- package/wiki/Money.md +338 -0
- package/wiki/N-Plus-One-Detection.md +197 -0
- package/wiki/Notify.md +208 -0
- package/wiki/Observability.md +245 -0
- package/wiki/Outbound-HTTP.md +109 -0
- package/wiki/PWA-And-Offline.md +343 -0
- package/wiki/Policies-And-Authz.md +251 -0
- package/wiki/Project-Layout.md +150 -0
- package/wiki/Queries-And-Live-Queries.md +429 -0
- package/wiki/Realtime.md +734 -0
- package/wiki/Resource-Management.md +121 -0
- package/wiki/Routes-And-Render-Modes.md +521 -0
- package/wiki/SEO.md +288 -0
- package/wiki/Scheduled-Tasks.md +175 -0
- package/wiki/Scraping.md +493 -0
- package/wiki/Shapes.md +63 -0
- package/wiki/Stability.md +97 -0
- package/wiki/Static-Assets.md +166 -0
- package/wiki/Storage-And-Uploads.md +404 -0
- package/wiki/Testing.md +1313 -0
- package/wiki/The-Eight-Primitives.md +247 -0
- package/wiki/Theming.md +362 -0
- package/wiki/Timezones-And-Dates.md +194 -0
- package/wiki/Troubleshooting.md +163 -0
- package/wiki/Tutorial-01-First-App.md +289 -0
- package/wiki/Tutorial-02-First-Feature.md +339 -0
- package/wiki/Tutorial-03-Auth-And-Admin.md +379 -0
- package/wiki/Tutorial-04-Jobs-And-Realtime.md +263 -0
- package/wiki/Tutorial-05-Deploy-Free.md +231 -0
- package/wiki/Tutorial-06-Growing-Up.md +158 -0
- package/wiki/UI-Components.md +156 -0
- package/wiki/Upgrading.md +3667 -0
- package/src/stored-object-headers.ts +0 -43
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Building your own base
|
|
2
|
+
|
|
3
|
+
**Ultimate ships mechanism; your app ships convention.** Ultimate's own conventions are structural —
|
|
4
|
+
file naming, the four surfaces, the tier order — and they ship as build errors. Your *business*
|
|
5
|
+
conventions are yours, and a primitive is a function returning a value, so you encode one by
|
|
6
|
+
wrapping and exporting your own factory. No fork, no monkey-patch, no plugin API, no release to
|
|
7
|
+
wait for.
|
|
8
|
+
|
|
9
|
+
Everything downstream treats the result identically — registry, manifest, projections, admin,
|
|
10
|
+
MCP, `x verify`.
|
|
11
|
+
|
|
12
|
+
**Re-run against 4.0.0** `As of 2026-08-20`: every fenced example on this page compiles under the
|
|
13
|
+
repository's own `tsconfig.base.json` (`strict`, `exactOptionalPropertyTypes`,
|
|
14
|
+
`noUncheckedIndexedAccess`, `verbatimModuleSyntax`), and both compile errors quoted under
|
|
15
|
+
[Two caveats](#two-caveats) are `tsc`'s verbatim words at that setting. The `tenantEntity` example
|
|
16
|
+
was executed as well, and again `As of 2026-11-03` — `getEntity('invoices').describe()` answers columns `id, memo, orgId,
|
|
17
|
+
createdAt`, one index `invoices_org_id_idx` on `org_id`, `orgScoped: true`, and
|
|
18
|
+
`invoices.$tenantColumn` is `'orgId'`. The projections are run too, on every gate:
|
|
19
|
+
`packages/cli/src/third-party-wrapper.test.ts` installs a factory-built entity, an MCP-exposed
|
|
20
|
+
action and a job from a package under `node_modules/`, re-exports them from an app, and asserts
|
|
21
|
+
`x entities`, the manifest and `tools/list` hold them, the action's policy refuses a caller without
|
|
22
|
+
the grant, and the job runs. It fails the day any of those learns where a primitive came from.
|
|
23
|
+
|
|
24
|
+
Put the factory in a surface both `app/` and `api/` may import — `apps/web/shared/base/` in the
|
|
25
|
+
generated layout ([Project layout](Project-Layout)).
|
|
26
|
+
|
|
27
|
+
## A tenant entity
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// apps/web/shared/base/tenant-entity.ts
|
|
31
|
+
import { entity, timestamp, uuid, type ColumnMap, type EntityInit } from '@ultimat3/entity';
|
|
32
|
+
|
|
33
|
+
/** Every table in this app is org-scoped and stamped. Declared once, not at forty call sites. */
|
|
34
|
+
export const tenantEntity = <const C extends ColumnMap>(name: string, init: EntityInit<C>) =>
|
|
35
|
+
entity(name, {
|
|
36
|
+
...init,
|
|
37
|
+
columns: { ...init.columns, orgId: uuid().tenant(), createdAt: timestamp().defaultNow() },
|
|
38
|
+
indexes: [...(init.indexes ?? []), { on: ['orgId'] }],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// apps/web/app/invoices/entity.ts
|
|
44
|
+
import { text, uuid } from '@ultimat3/entity';
|
|
45
|
+
import { tenantEntity } from '../../shared/base/tenant-entity';
|
|
46
|
+
|
|
47
|
+
export const invoices = tenantEntity('invoices', {
|
|
48
|
+
columns: { id: uuid().primaryKey(), memo: text() },
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export type Invoice = typeof invoices.$row;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
What it buys:
|
|
55
|
+
|
|
56
|
+
| Before | After |
|
|
57
|
+
|---|---|
|
|
58
|
+
| every entity file remembers `orgId: uuid().tenant()` | tenancy is a property of the base, unforgettable |
|
|
59
|
+
| a forgotten tenant column is an unscoped read that ships | there is no way to declare an unscoped table through this factory |
|
|
60
|
+
| the `orgId` index is remembered per table, or is not | it arrives with the column |
|
|
61
|
+
| `createdAt` drifts in name and default across features | one spelling, one default |
|
|
62
|
+
|
|
63
|
+
The row type still derives from the merged column set: `Invoice` carries `orgId` and `createdAt`
|
|
64
|
+
without a second declaration. `invoices.$tenantColumn` is `'orgId'`, and a read built without an org
|
|
65
|
+
predicate throws `X_TENANCY_UNSCOPED` exactly as it would for a hand-written entity.
|
|
66
|
+
|
|
67
|
+
## A mutator factory
|
|
68
|
+
|
|
69
|
+
The pattern is not entity-specific. Any primitive is a function returning a value, so any primitive
|
|
70
|
+
wraps:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// apps/web/shared/base/audited-mutator.ts
|
|
74
|
+
import { mutator, type ActionPolicy, type LocalTx, type Mutator } from '@ultimat3/action';
|
|
75
|
+
import type { Ctx } from '@ultimat3/core';
|
|
76
|
+
import type { AnySchema, InferOutput } from '@ultimat3/schema';
|
|
77
|
+
|
|
78
|
+
interface AuditedDef<TIn extends AnySchema, TOut extends AnySchema> {
|
|
79
|
+
readonly input: TIn;
|
|
80
|
+
readonly output: TOut;
|
|
81
|
+
readonly policy: ActionPolicy;
|
|
82
|
+
readonly event: string;
|
|
83
|
+
local(tx: LocalTx, input: InferOutput<TIn>): void;
|
|
84
|
+
server(ctx: Ctx, input: InferOutput<TIn>): Promise<InferOutput<TOut>>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Every write in this app records who did what. `conflict` is a house decision, made once. */
|
|
88
|
+
export const auditedMutator = <TIn extends AnySchema, TOut extends AnySchema>(
|
|
89
|
+
def: AuditedDef<TIn, TOut>,
|
|
90
|
+
): Mutator<TIn, TOut> =>
|
|
91
|
+
mutator({
|
|
92
|
+
input: def.input,
|
|
93
|
+
output: def.output,
|
|
94
|
+
policy: def.policy,
|
|
95
|
+
idempotent: true, // required on every mutator — see Actions
|
|
96
|
+
conflict: 'server-wins',
|
|
97
|
+
local: def.local,
|
|
98
|
+
server: async (ctx, input) => {
|
|
99
|
+
const row = await def.server(ctx, input);
|
|
100
|
+
ctx.logger.info('audit', { event: def.event, actor: ctx.actor.id });
|
|
101
|
+
return row;
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The result is a `Mutator`, which **is** an `Action` — so it keeps its route, its OpenAPI operation,
|
|
107
|
+
its typed client method, its MCP tool, its job handle and its contract test, and its authz is still
|
|
108
|
+
the one evaluation. The same shape works over `action()`, `job()` and `query()`.
|
|
109
|
+
|
|
110
|
+
## Why nothing downstream notices
|
|
111
|
+
|
|
112
|
+
| Machinery | Why the wrapper is invisible |
|
|
113
|
+
|---|---|
|
|
114
|
+
| the entity registry | `entity()` calls `registerEntity` itself, so registration happens whenever your factory calls it |
|
|
115
|
+
| `isAction()` | structural — a function, `kind === 'action'`, a stashed declaration. It asks whether `action()` built the value, never where |
|
|
116
|
+
| `registerActions(module)` | names the export **in place**, so `getAction('issueInvoice') === issueInvoice` by identity, not a copy |
|
|
117
|
+
| `x verify` | no step matches source text for `action(` / `entity(` / `mutator(`. Every primitive fact reaches the gate by importing the module and reading the runtime registries. The only text scanning is for `X_*` codes |
|
|
118
|
+
| manifest · admin CRUD · MCP · the five projections | all read those same registries |
|
|
119
|
+
|
|
120
|
+
## Two caveats
|
|
121
|
+
|
|
122
|
+
Both will bite. Both are the app's job, one line each.
|
|
123
|
+
|
|
124
|
+
| Caveat | Fix |
|
|
125
|
+
|---|---|
|
|
126
|
+
| **A factory must add its own index for a column it injects.** `IndexInit` is keyed on the *caller's* columns — correctly, since a call site cannot name a column it did not declare. `tenantEntity('invoices', { indexes: [{ on: ['orgId'] }] })` is a compile error: `Type '"orgId"' is not assignable to type '"id" \| "memo"'` | put the index inside the factory, next to the column it belongs to — as `tenantEntity` above does |
|
|
127
|
+
| **A factory building a derived schema must be generic over `AnySchema`**, exported from `@ultimat3/schema`. `<TOut extends StandardSchemaV1>` is *not* assignable to `AnySchema`, so `t.object({ data: out })` fails with `Type 'TOut' is not assignable to type 'AnySchema'` | constrain to `AnySchema`. `StandardSchemaV1` is the interop contract; `AnySchema` is the framework's own supertype and the one `t.object` accepts |
|
|
128
|
+
|
|
129
|
+
## An error code is declared, not wrapped
|
|
130
|
+
|
|
131
|
+
A primitive is wrapped; an error code is not. Declare each code at its own call site with
|
|
132
|
+
`defineError({ code: 'X_INVOICE_NOT_FOUND', title, status: 404, cause, fix })` from
|
|
133
|
+
`@ultimat3/core` — the title, the HTTP status and the class in one call. The `errors` step and the
|
|
134
|
+
manifest read the `code:` literal where it is written, so a factory that takes the code as a
|
|
135
|
+
parameter hides it (`X_ERROR_CODE_UNRESOLVED`). A family of codes is a prefix (`X_BILLING_*`),
|
|
136
|
+
never a base class: `guards/error-declared.ts` refuses `extends UltimateError`, and
|
|
137
|
+
`InvoiceNotFound.is(error)` matches the code where `instanceof` cannot — a browser's rebuilt
|
|
138
|
+
refusal included.
|
|
139
|
+
|
|
140
|
+
## Publish it
|
|
141
|
+
|
|
142
|
+
A base that two of your apps share, or that strangers could use, is an npm package. Nothing
|
|
143
|
+
registers it: the app re-exports what it wants, and the framework sees primitives.
|
|
144
|
+
|
|
145
|
+
| Rule | Why |
|
|
146
|
+
|---|---|
|
|
147
|
+
| name it `ultimate-<name>`, unscoped, with the keyword `ultimate-package` | `npm search keywords:ultimate-package` is the directory. There is no marketplace, registry or plugin API (axiom 8). `@ultimat3/` is reserved for the framework |
|
|
148
|
+
| `@ultimat3/*` in `peerDependencies` at `^<major>`, for every package it imports — never `dependencies` | the app's own install is the one copy of each registry; a second copy is a second registry the app's gate never reads |
|
|
149
|
+
| ship JavaScript (or `.ts` Bun can run) with `exports` | a consumer's `bun install` is the whole integration |
|
|
150
|
+
| no `tier` | tiers order the framework's own packages (`scripts/lib/tiers.ts`); a third-party package sits beside the app, below nothing |
|
|
151
|
+
| guards are copied, not imported | an app's `guards/*.ts` are its own files and `x verify` runs only those. A package that ships a guard ships it as a file the README tells the author to copy |
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"name": "ultimate-acme-log",
|
|
156
|
+
"version": "1.0.0",
|
|
157
|
+
"type": "module",
|
|
158
|
+
"exports": { ".": "./index.js" },
|
|
159
|
+
"keywords": ["ultimate-package"],
|
|
160
|
+
"peerDependencies": {
|
|
161
|
+
"@ultimat3/action": "^30.0.0",
|
|
162
|
+
"@ultimat3/entity": "^30.0.0",
|
|
163
|
+
"@ultimat3/jobs": "^30.0.0",
|
|
164
|
+
"@ultimat3/policy": "^30.0.0"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The app takes what it wants by re-export, in the surface the primitive belongs to: one line,
|
|
170
|
+
`export { acmeLog } from 'ultimate-acme-log';`, in `apps/web/app/acme/entity.ts`.
|
|
171
|
+
|
|
172
|
+
What a consumer's `x verify` sees: the package's entity in `drift` (its table needs a migration,
|
|
173
|
+
`x db gen`), its actions and jobs in `manifest` and `contract-diff`, its permissions in `policy`
|
|
174
|
+
(the app's roles grant them), its MCP tools in the tool list. It
|
|
175
|
+
does **not** see the package's own tests, lint or guards: those are the package's to run.
|
|
176
|
+
|
|
177
|
+
A **starter** (a whole app shape, not a factory) is not a package: it is a repository a person
|
|
178
|
+
copies, and its README says so. Once one exists, a community list is a wiki page added by pull
|
|
179
|
+
request.
|
|
180
|
+
|
|
181
|
+
## The honest limit
|
|
182
|
+
|
|
183
|
+
**The registry cannot tell that an entity came from your factory, and that erasure is the feature.**
|
|
184
|
+
`getEntity('invoices').describe()` reports columns, indexes and references — never `tenantEntity`.
|
|
185
|
+
A factory-built primitive is indistinguishable from a hand-written one, which is precisely why the
|
|
186
|
+
manifest, admin, MCP and the gate need no knowledge of your base.
|
|
187
|
+
|
|
188
|
+
The consequence for tooling: a subagent, a reviewer or a doc generator learns your house base **from
|
|
189
|
+
your source**, not from the registry. Name the factory for what it guarantees, keep it in one file
|
|
190
|
+
under `shared/base/`, and say so in your app's `AGENTS.md` — that file exists for conventions an
|
|
191
|
+
agent cannot infer.
|
|
192
|
+
|
|
193
|
+
This is not a gap awaiting a fix. A registry that recorded the factory would make your convention a
|
|
194
|
+
framework fact, and the next thing that read it would start depending on it.
|
|
195
|
+
|
|
196
|
+
## Read next
|
|
197
|
+
|
|
198
|
+
| Page | Why |
|
|
199
|
+
|---|---|
|
|
200
|
+
| [The eight primitives](The-Eight-Primitives) | the vocabulary you are wrapping |
|
|
201
|
+
| [Entities and migrations](Entities-And-Migrations) | tenancy, invariants, what a merged column set migrates to |
|
|
202
|
+
| [Actions](Actions) | the six artifacts a wrapped action still projects |
|
|
203
|
+
| [`docs/idea/19-mechanism-not-convention.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/19-mechanism-not-convention.md) | axiom 8: which decisions are the framework's and which are yours |
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# CI: the gate across parallel jobs
|
|
2
|
+
|
|
3
|
+
`x verify` is the gate on a laptop (its `budgets` step builds when the stats are stale): one
|
|
4
|
+
process tree, bounded to a memory budget. On CI, where wall time is what a pull request waits on,
|
|
5
|
+
the same gate splits across jobs — each step runnable on its own, the parallel test steps sharded —
|
|
6
|
+
and one aggregate job folds the parts back into the one verdict. Green means exactly what the local
|
|
7
|
+
gate's green means: every step, over the whole tree, passed.
|
|
8
|
+
|
|
9
|
+
## Every step is its own command
|
|
10
|
+
|
|
11
|
+
`x verify --only <step>[,<step>…] --json` runs just those steps, in one process, paying nothing
|
|
12
|
+
for the others (no app load for a step that does not need one, no test run for a static step). Its
|
|
13
|
+
JSON is a *part*: `x verify merge` reads it back.
|
|
14
|
+
|
|
15
|
+
| Step | One job runs | Needs |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `typecheck` | `x verify --only typecheck --json` | nothing |
|
|
18
|
+
| `lint` `boundaries` `filesize` `package-shape` `errors` | `x verify --only lint,boundaries,filesize,package-shape,errors --json` | nothing |
|
|
19
|
+
| `unit` | `x verify --only unit --shard i/n --json` | nothing (PGlite in process) |
|
|
20
|
+
| `contract` | `x verify --only contract --shard i/n --json` | nothing |
|
|
21
|
+
| `job` | `x verify --only job --shard i/n --json` | nothing |
|
|
22
|
+
| `live` | `x verify --only live --json` (or `--shard i/n`) | the test services (`docker/test-services.env`): Postgres (`TEST_DATABASE_URL`), the logical + TLS server (`TEST_REPLICATION_URL`, `TEST_TLS_REPLICATION_URL`), pooler, standby, Redis, NATS, S3 — one process per runner |
|
|
23
|
+
| `e2e` | `x verify --only e2e --json` (or `--shard i/n`) | the static build (`x build --target static --no-preflight`), Chrome — one process per runner |
|
|
24
|
+
| `eval` | `x verify --only eval --json` | nothing; baselines committed |
|
|
25
|
+
| `drift` `contract-diff` | `x verify --only drift,contract-diff --json` | nothing |
|
|
26
|
+
| `budgets` `seo` `i18n` `policy` | `x verify --only budgets,seo,i18n,policy --json` | the static build — `budgets` weighs `.x/build-stats.json` |
|
|
27
|
+
| `manifest` `roadmap` | `x verify --only manifest,roadmap --json` | nothing |
|
|
28
|
+
|
|
29
|
+
The grouping is yours: any split works as long as every step lands in exactly one part (or, for a
|
|
30
|
+
sharded step, in shards `1..n` exactly once). `x verify merge` refuses anything else.
|
|
31
|
+
|
|
32
|
+
## `--shard i/n` — the parallel test steps
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
x verify --only unit --shard 2/4 --json > part-unit-2.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- Only with `--only`, and only over the test steps: `unit`, `contract`, `live`, `job`, `e2e`
|
|
39
|
+
(any other step is `X_VERIFY_SHARD_INVALID`). `live` and `e2e` stay ONE process inside a shard —
|
|
40
|
+
serial means one replication slot and one browser per machine, and each runner starts its own
|
|
41
|
+
services — so when sharded, their shards split across runners, never across workers. `As of 2026-11-07` this
|
|
42
|
+
repository's CI still runs each as one part: its longest job is a `packages` coverage shard, so
|
|
43
|
+
a second live or e2e runner would cost runner minutes and save no wall clock.
|
|
44
|
+
- The split is a pure function of the step's **sorted** file list: round-robin by default, so job
|
|
45
|
+
2 of 4 is the same files on every runner and on your laptop. `--timings <file>` (Bun's
|
|
46
|
+
`--timings` file, e.g. the `.x/test-timings.json` every parallel run refreshes — cache it
|
|
47
|
+
between CI runs) splits greedy longest-first instead; a file the timings do
|
|
48
|
+
not know is costed at their median.
|
|
49
|
+
- The part's JSON carries `data.shard` (`index`, `total`, and per step the `corpusHash` of the whole
|
|
50
|
+
list plus the `files` this shard ran), and each step carries the same facts as `steps[].shard`.
|
|
51
|
+
- A shard whose slice is empty, or ran only skipped tests, is not red: the zero-tests floor
|
|
52
|
+
(`x.verify.json`) is applied by `merge`, on the counts summed over every shard.
|
|
53
|
+
- An app's coverage floor is not judged by a shard — one slice cannot hold it. The shard is green
|
|
54
|
+
on coverage and carries what it covered in `data.coverage.unit.facts`; `merge` folds every shard and judges
|
|
55
|
+
once (`X_COVERAGE_BELOW_FLOOR`). Shards that carry nothing fold to 0%, never to a skip.
|
|
56
|
+
- Under `--json` each finished step is one line on stderr (`{"step":"unit","ok":true,"ms":61250}`),
|
|
57
|
+
so a cancelled job's log ends on the last step that finished. Redirect stdout only.
|
|
58
|
+
- A red shard reproduces locally with the same flags.
|
|
59
|
+
|
|
60
|
+
## `x verify merge <part.json…>` — the verdict
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
x verify merge parts/*.json --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Reads each part (the **last** JSON line of the file, so an older scaffold's `bun run check --json` output works too) and
|
|
67
|
+
answers the gate:
|
|
68
|
+
|
|
69
|
+
- every step of the gate appears — `X_VERIFY_MERGE_INCOMPLETE` names a step no part ran;
|
|
70
|
+
- a sharded step has shards `1..n` exactly once, all with one `corpusHash` — a missing shard, a
|
|
71
|
+
duplicate, or two corpora (jobs on different commits) is named;
|
|
72
|
+
- and their `files` partition that corpus: a file in two shards, or in none (the union does not
|
|
73
|
+
hash to `corpusHash` — shards split by two rules, one with `--timings` and one without), is named;
|
|
74
|
+
- the zero-tests floor is applied to each sharded step's summed counts;
|
|
75
|
+
- an app's coverage floor is applied to the fold of a sharded `unit` step's `data.coverage.unit.facts`;
|
|
76
|
+
- a red step in any part is red here, with its findings and output kept.
|
|
77
|
+
|
|
78
|
+
The merged document has no `notAGateRun` — it is the gate's answer — and its `durationMs` is the
|
|
79
|
+
slowest part's, which is the wall time CI waited. A part that is not an `x verify --json`
|
|
80
|
+
document is `X_VERIFY_MERGE_INPUT` — and so is a step whose `durationMs` is not a number or whose
|
|
81
|
+
`findings` are not each a `code`, `cause` and `fix`.
|
|
82
|
+
|
|
83
|
+
## A GitHub Actions workflow
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
name: ci
|
|
87
|
+
on: [push, pull_request]
|
|
88
|
+
|
|
89
|
+
jobs:
|
|
90
|
+
part:
|
|
91
|
+
name: ${{ matrix.name }}
|
|
92
|
+
runs-on: ubuntu-latest
|
|
93
|
+
strategy:
|
|
94
|
+
fail-fast: false # every part must upload, red or green: merge decides
|
|
95
|
+
matrix:
|
|
96
|
+
include:
|
|
97
|
+
- { name: typecheck, only: typecheck }
|
|
98
|
+
- { name: static, only: 'lint,boundaries,filesize,package-shape,errors' }
|
|
99
|
+
- { name: unit-1, only: unit, shard: 1/4 }
|
|
100
|
+
- { name: unit-2, only: unit, shard: 2/4 }
|
|
101
|
+
- { name: unit-3, only: unit, shard: 3/4 }
|
|
102
|
+
- { name: unit-4, only: unit, shard: 4/4 }
|
|
103
|
+
- { name: contract-1, only: contract, shard: 1/2 }
|
|
104
|
+
- { name: contract-2, only: contract, shard: 2/2 }
|
|
105
|
+
- { name: job, only: job, shard: 1/1 }
|
|
106
|
+
- { name: tail, only: 'eval,drift,contract-diff,manifest,roadmap' }
|
|
107
|
+
- { name: built, only: 'e2e,budgets,seo,i18n,policy', build: true }
|
|
108
|
+
- { name: live, only: live, postgres: true }
|
|
109
|
+
env:
|
|
110
|
+
TEST_DATABASE_URL: ${{ matrix.postgres && 'postgres://postgres:postgres@localhost:5432/postgres' || '' }}
|
|
111
|
+
steps:
|
|
112
|
+
- uses: actions/checkout@v4
|
|
113
|
+
- uses: oven-sh/setup-bun@v2
|
|
114
|
+
- run: bun install --frozen-lockfile
|
|
115
|
+
- if: matrix.postgres # live needs logical replication: a service container cannot pass -c
|
|
116
|
+
run: |
|
|
117
|
+
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres:17 -c wal_level=logical
|
|
118
|
+
until docker run --rm --network host postgres:17 pg_isready -h localhost; do sleep 1; done
|
|
119
|
+
- if: matrix.build
|
|
120
|
+
run: bunx x build --target static --no-preflight
|
|
121
|
+
- name: x verify (one part)
|
|
122
|
+
run: |
|
|
123
|
+
bunx x verify --only '${{ matrix.only }}' \
|
|
124
|
+
${{ matrix.shard && format('--shard {0}', matrix.shard) || '' }} \
|
|
125
|
+
--json > "$RUNNER_TEMP/part.json" || true
|
|
126
|
+
# Outside the checkout: the file is open and empty while the part runs, and `lint` walks the tree.
|
|
127
|
+
- uses: actions/upload-artifact@v4
|
|
128
|
+
with: { name: 'part-${{ matrix.name }}', path: '${{ runner.temp }}/part.json' }
|
|
129
|
+
|
|
130
|
+
check: # the one required status check
|
|
131
|
+
needs: part
|
|
132
|
+
if: always()
|
|
133
|
+
runs-on: ubuntu-latest
|
|
134
|
+
steps:
|
|
135
|
+
- uses: actions/checkout@v4
|
|
136
|
+
- uses: oven-sh/setup-bun@v2
|
|
137
|
+
- run: bun install --frozen-lockfile
|
|
138
|
+
- uses: actions/download-artifact@v4
|
|
139
|
+
with: { pattern: 'part-*', path: parts }
|
|
140
|
+
- run: bunx x verify merge parts/*/part.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Make `check` the single required status. A job that crashed before uploading its part is not a
|
|
144
|
+
pass: its steps are missing and `merge` names them.
|
|
145
|
+
|
|
146
|
+
## A push a green PR run already tested
|
|
147
|
+
|
|
148
|
+
Merging an up-to-date green pull request pushes a tree CI has already tested. `x ci tested` says
|
|
149
|
+
so — `data.tested` — and every job that run answered skips. As of 2026-11, 55 of this repository's
|
|
150
|
+
last 81 pushes to `main` were such a tree.
|
|
151
|
+
|
|
152
|
+
| `tested: true` needs | Why |
|
|
153
|
+
|---|---|
|
|
154
|
+
| the subject ends `(#N)` | only a merge of PR N is a candidate |
|
|
155
|
+
| PR N merged as **this** commit | a `(#N)` typed by hand proves nothing |
|
|
156
|
+
| its head is in this repository | a fork writes its own workflow; its green is not reused |
|
|
157
|
+
| its head tree is this tree | a base that moved after the run is an untested merge |
|
|
158
|
+
| the newest same-repository run on that head concluded `success`, under `--max-age` (default `24h`) | the runner image and the registry move |
|
|
159
|
+
|
|
160
|
+
Any doubt — a condition unmet, `gh` absent, an API that did not answer — is `false`: a full run.
|
|
161
|
+
The command exits 0 on every answer.
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
jobs:
|
|
165
|
+
tested:
|
|
166
|
+
runs-on: ubuntu-latest
|
|
167
|
+
permissions: { contents: read, actions: read, pull-requests: read }
|
|
168
|
+
outputs:
|
|
169
|
+
tested: ${{ steps.tested.outputs.tested }}
|
|
170
|
+
steps:
|
|
171
|
+
# Only a push asks. Never a release commit: what publishes is a run of everything.
|
|
172
|
+
- if: github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'release')
|
|
173
|
+
uses: actions/checkout@v4
|
|
174
|
+
- if: github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'release')
|
|
175
|
+
uses: oven-sh/setup-bun@v2
|
|
176
|
+
- if: github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'release')
|
|
177
|
+
run: bun install --frozen-lockfile
|
|
178
|
+
- id: tested
|
|
179
|
+
if: github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'release')
|
|
180
|
+
env: { GH_TOKEN: '${{ github.token }}' }
|
|
181
|
+
run: |
|
|
182
|
+
bunx x ci tested --repo "$GITHUB_REPOSITORY" --json > tested.json
|
|
183
|
+
echo "tested=$(jq -r .data.tested tested.json)" >> "$GITHUB_OUTPUT"
|
|
184
|
+
|
|
185
|
+
part:
|
|
186
|
+
needs: tested
|
|
187
|
+
if: ${{ !cancelled() && needs.tested.outputs.tested != 'true' }}
|
|
188
|
+
# … the matrix above, unchanged
|
|
189
|
+
|
|
190
|
+
check:
|
|
191
|
+
needs: [tested, part]
|
|
192
|
+
if: ${{ !cancelled() && needs.tested.outputs.tested != 'true' }}
|
|
193
|
+
# … unchanged
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Each reused job carries that **one** `if` and nothing else, so a skip has exactly one cause:
|
|
197
|
+
`tested` said true. `!cancelled()` is load-bearing: a bare `needs.…` condition implies
|
|
198
|
+
`success()`, and a red or timed-out `tested` would skip every job instead of running them. A
|
|
199
|
+
reader of a skipped check (a deploy, a required status) can then accept the skip only beside a
|
|
200
|
+
green `tested` check. On a
|
|
201
|
+
pull request every step of `tested` is skipped and nothing below it is. The cost: one near-empty
|
|
202
|
+
job's runner acquisition ahead of every other job, a few seconds.
|
|
203
|
+
|
|
204
|
+
## Width and memory, per job
|
|
205
|
+
|
|
206
|
+
Each job sizes its own test width the same way the laptop does (`x verify` prints it on the step
|
|
207
|
+
line, e.g. `3 workers (budget 4.0 GB)`): a budget of `max(2.75 GiB, 25% of the runner's RAM)`,
|
|
208
|
+
1.25 GiB planned per worker, never more workers than cores. On a 16 GB `ubuntu-latest` that is 3
|
|
209
|
+
workers; a 62 GB, 16-core workstation plans 12 (`As of 2026-11-07`, when the fixed 4 GiB cap went —
|
|
210
|
+
the machine-wide slot pool is what keeps two runs on one box inside one budget). `ULTIMATE_TEST_MEMORY_BUDGET=6g` or `ULTIMATE_TEST_MAX_WORKERS=4` override it; `--workers`
|
|
211
|
+
wins over both. The machine-wide slot pool (see [Testing](Testing#memory-width-and-isolation))
|
|
212
|
+
has nothing to share on a one-job VM; `ULTIMATE_TEST_SLOTS=0` turns it off.
|
|
213
|
+
|
|
214
|
+
## Skipping the build's duplicate preflight
|
|
215
|
+
|
|
216
|
+
`x build` runs the six static steps before it builds (typecheck, lint, boundaries, filesize,
|
|
217
|
+
package-shape, errors) so a bare build never ships an artifact from a tree that does not typecheck.
|
|
218
|
+
In a gate that runs those steps anyway, `--no-preflight` skips them — `x verify`'s `budgets` step does
|
|
219
|
+
when it builds, and so does the `built` job above, whose build first leaves `budgets` fresh stats and
|
|
220
|
+
no second build. The default stays safe.
|