@ultimat3/cli 31.48.0 → 31.50.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.
Files changed (287) hide show
  1. package/CLAUDE.md +30 -23
  2. package/README.md +96 -4
  3. package/package.json +30 -30
  4. package/src/api-registration.ts +45 -14
  5. package/src/api-routes.ts +1 -0
  6. package/src/app-load.ts +7 -3
  7. package/src/app-openapi.ts +7 -1
  8. package/src/app-root.ts +7 -1
  9. package/src/budgets.ts +2 -1
  10. package/src/clean-services.ts +142 -0
  11. package/src/cmd-auth.ts +3 -0
  12. package/src/cmd-clean-spec.ts +10 -3
  13. package/src/cmd-clean.ts +23 -9
  14. package/src/cmd-db-backfill.ts +6 -0
  15. package/src/cmd-db-branch.ts +10 -4
  16. package/src/cmd-db-recount.ts +5 -12
  17. package/src/cmd-db-rollback.ts +77 -0
  18. package/src/cmd-db-spec.ts +18 -2
  19. package/src/cmd-db-status.ts +5 -10
  20. package/src/cmd-db.ts +105 -33
  21. package/src/cmd-deploy-verify.ts +14 -6
  22. package/src/cmd-docs-topic.ts +94 -0
  23. package/src/cmd-docs.ts +15 -1
  24. package/src/cmd-doctor.ts +109 -41
  25. package/src/cmd-drill.ts +80 -18
  26. package/src/cmd-env.ts +30 -8
  27. package/src/cmd-errors-app.ts +63 -0
  28. package/src/cmd-errors.ts +50 -14
  29. package/src/cmd-generate.ts +17 -4
  30. package/src/cmd-heavy-spec.ts +9 -1
  31. package/src/cmd-heavy.ts +111 -27
  32. package/src/cmd-i18n.ts +33 -1
  33. package/src/cmd-jobs.ts +27 -1
  34. package/src/cmd-merge-driver-spec.ts +12 -0
  35. package/src/cmd-merge-driver.ts +95 -0
  36. package/src/cmd-new.ts +23 -3
  37. package/src/cmd-policy-spec.ts +9 -1
  38. package/src/cmd-policy.ts +72 -17
  39. package/src/cmd-stop.ts +18 -4
  40. package/src/cmd-tasks-run.ts +87 -0
  41. package/src/cmd-tasks-spec.ts +10 -3
  42. package/src/cmd-tasks.ts +8 -5
  43. package/src/cmd-test.ts +2 -1
  44. package/src/cmd-upgrade-spec.ts +8 -1
  45. package/src/cmd-upgrade.ts +15 -1
  46. package/src/cmd-verify.ts +9 -41
  47. package/src/codemods/agents-doc-row.ts +73 -0
  48. package/src/codemods/define-error-leaf.ts +37 -12
  49. package/src/codemods/docs-many-agents.ts +11 -15
  50. package/src/codemods/docs-worker-commands.ts +26 -0
  51. package/src/codemods/engine-fs.ts +9 -2
  52. package/src/codemods/index.ts +4 -0
  53. package/src/codemods/merge-drivers.ts +147 -0
  54. package/src/command.ts +3 -0
  55. package/src/db-applied-edits.ts +117 -0
  56. package/src/db-dev-wire.ts +18 -0
  57. package/src/db-diagnostics.ts +5 -10
  58. package/src/db-generate.ts +82 -7
  59. package/src/db-migrate-pass.ts +51 -0
  60. package/src/db-migrate-through-dev.ts +209 -0
  61. package/src/db-rollback-consent.ts +128 -0
  62. package/src/db-rollback-pass.ts +76 -0
  63. package/src/db-seed-generate.ts +5 -1
  64. package/src/db-seed.ts +7 -1
  65. package/src/deploy-verify-findings.ts +3 -0
  66. package/src/deploy-verify-grade.ts +3 -0
  67. package/src/deploy-verify-processes.ts +32 -0
  68. package/src/dev-boot.ts +3 -0
  69. package/src/dev-db-migrate.ts +155 -0
  70. package/src/dev-db-rollback.ts +33 -0
  71. package/src/dev-db-settled.ts +22 -0
  72. package/src/dev-lock-errors.ts +78 -0
  73. package/src/dev-lock-holder-dir.ts +64 -0
  74. package/src/dev-lock-live.ts +44 -0
  75. package/src/dev-lock.ts +59 -84
  76. package/src/dev-policy.ts +11 -8
  77. package/src/dev-rebuild-schema.ts +116 -13
  78. package/src/dev-rebuild.ts +13 -4
  79. package/src/dev-route-table.ts +7 -0
  80. package/src/dispatch.ts +21 -1
  81. package/src/doctor-api-listing.ts +114 -0
  82. package/src/doctor-guarded.ts +41 -0
  83. package/src/doctor-port.ts +90 -17
  84. package/src/doctor-probe.ts +36 -5
  85. package/src/doctor-processes-probe.ts +127 -0
  86. package/src/doctor-processes.ts +136 -0
  87. package/src/doctor-warnings.ts +17 -0
  88. package/src/error-codes-agents.ts +35 -0
  89. package/src/error-codes-processes.ts +30 -0
  90. package/src/error-codes-tooling.ts +2 -0
  91. package/src/error-codes.ts +12 -13
  92. package/src/errors-suite.ts +27 -0
  93. package/src/errors.ts +18 -22
  94. package/src/exercise-registration.ts +4 -3
  95. package/src/exercise-services.ts +13 -3
  96. package/src/framework-env.ts +7 -3
  97. package/src/framework-schema.ts +15 -5
  98. package/src/generate-files.ts +1 -0
  99. package/src/generate-grant-findings.ts +7 -5
  100. package/src/generate-grants.ts +9 -8
  101. package/src/generate-kinds.ts +30 -6
  102. package/src/generate-roles-file.ts +30 -0
  103. package/src/generate-slice-policy.ts +3 -3
  104. package/src/guard-sources.ts +1 -2
  105. package/src/guards.ts +2 -2
  106. package/src/heavy-env.ts +2 -0
  107. package/src/heavy-errors.ts +18 -0
  108. package/src/heavy-holders.ts +78 -0
  109. package/src/heavy-ledger.ts +56 -14
  110. package/src/heavy-pressure.ts +104 -0
  111. package/src/heavy.ts +31 -13
  112. package/src/i18n-registration.ts +22 -2
  113. package/src/island-harness.ts +2 -2
  114. package/src/job-budget.ts +4 -2
  115. package/src/job-registration.ts +64 -8
  116. package/src/jobs-queue-known.ts +43 -0
  117. package/src/mcp-errors-agents.ts +20 -0
  118. package/src/mcp-errors-doctor.ts +27 -0
  119. package/src/mcp-errors-processes.ts +23 -0
  120. package/src/mcp-errors.ts +15 -29
  121. package/src/mcp-host.ts +2 -2
  122. package/src/merge-driver-catalog.ts +58 -0
  123. package/src/merge-driver-config.ts +43 -0
  124. package/src/merge-driver-lines.ts +140 -0
  125. package/src/merge-state.ts +105 -0
  126. package/src/messages-db.ts +22 -1
  127. package/src/messages-processes.ts +13 -0
  128. package/src/messages-upgrade.ts +10 -0
  129. package/src/messages.ts +54 -4
  130. package/src/output-findings.ts +48 -21
  131. package/src/page-navigation.ts +5 -2
  132. package/src/parse.ts +37 -6
  133. package/src/policy-facts.ts +38 -21
  134. package/src/policy-row.ts +99 -0
  135. package/src/port-pair-free.ts +28 -0
  136. package/src/pwa-artifacts.ts +1 -1
  137. package/src/registry-lines.ts +110 -0
  138. package/src/registry.ts +2 -0
  139. package/src/retain-sweep.ts +1 -1
  140. package/src/retained-assets-boot.ts +1 -1
  141. package/src/role-replicator.ts +4 -1
  142. package/src/role-select.ts +86 -0
  143. package/src/role-start.ts +13 -55
  144. package/src/role-sync.ts +10 -5
  145. package/src/runtime-assets-site.ts +2 -2
  146. package/src/runtime-assets.ts +1 -1
  147. package/src/runtime-cache-frame.ts +46 -0
  148. package/src/runtime-cache-ttl.ts +23 -0
  149. package/src/runtime-cache.ts +33 -16
  150. package/src/runtime-database-ssl.ts +84 -0
  151. package/src/runtime-idempotency-scope.ts +16 -2
  152. package/src/runtime-jobs-share.ts +52 -0
  153. package/src/runtime-jobs.ts +43 -12
  154. package/src/runtime-queue.ts +18 -3
  155. package/src/runtime-render-document.ts +1 -2
  156. package/src/runtime-services.ts +8 -1
  157. package/src/schema-drift.ts +19 -2
  158. package/src/schema-dump-drift.ts +4 -1
  159. package/src/serve-boot-probe.ts +30 -2
  160. package/src/serve-boot.ts +11 -1
  161. package/src/serve-env.ts +39 -3
  162. package/src/serve.ts +61 -10
  163. package/src/site-asset-routes.ts +2 -2
  164. package/src/site-assets.ts +5 -158
  165. package/src/stop-run-start.ts +12 -0
  166. package/src/supervise-boot.ts +61 -0
  167. package/src/supervise-cgroup.ts +84 -0
  168. package/src/supervise-child.ts +206 -0
  169. package/src/supervise-count.ts +244 -0
  170. package/src/supervise-errors.ts +83 -0
  171. package/src/supervise-facts.ts +40 -0
  172. package/src/supervise-messages.ts +84 -0
  173. package/src/supervise-policy.ts +46 -0
  174. package/src/supervise-pool.ts +10 -0
  175. package/src/supervise-probe.ts +158 -0
  176. package/src/supervise-run.ts +54 -0
  177. package/src/supervise.ts +383 -0
  178. package/src/sw-precache-plan.ts +1 -1
  179. package/src/templates/generate-purge.ts +6 -6
  180. package/src/templates/guard-animated-layout-property.ts +2 -2
  181. package/src/templates/guard-bare-error.ts +1 -1
  182. package/src/templates/guard-error-declared.ts +2 -2
  183. package/src/templates/guard-focus-visible.ts +1 -1
  184. package/src/templates/guard-image-dimensions.ts +2 -2
  185. package/src/templates/guard-island-mount-clears.ts +1 -1
  186. package/src/templates/guard-native-confirm.ts +1 -1
  187. package/src/templates/guard-raw-breakpoint.ts +2 -2
  188. package/src/templates/guard-raw-colour.ts +2 -2
  189. package/src/templates/guard-raw-fetch.ts +1 -1
  190. package/src/templates/guard-raw-interval.ts +1 -1
  191. package/src/templates/guard-raw-length.ts +3 -3
  192. package/src/templates/guard-raw-motion.ts +97 -1
  193. package/src/templates/guard-raw-shadow.ts +1 -1
  194. package/src/templates/guard-raw-z-index.ts +1 -1
  195. package/src/templates/guard-released-forms.ts +58 -9
  196. package/src/templates/guard-repo-await-in-loop.ts +1 -1
  197. package/src/templates/guard-repo-raw-sql.ts +4 -4
  198. package/src/templates/guard-repo-unbounded.ts +1 -1
  199. package/src/templates/guard-runtime-pin.ts +1 -1
  200. package/src/templates/guard-semantic-interactive.ts +2 -2
  201. package/src/templates/guard-unbounded-fanout.ts +1 -1
  202. package/src/templates/guard-undeclared-custom-property.ts +3 -3
  203. package/src/templates/guard-undefined-style-class.ts +3 -3
  204. package/src/templates/guard-unzoned-date.ts +3 -3
  205. package/src/templates/query-slice.ts +82 -0
  206. package/src/templates/query.ts +76 -30
  207. package/src/templates/resource-page.ts +3 -2
  208. package/src/templates/scaffold-bin.ts +2 -0
  209. package/src/templates/scaffold-claude-commands.ts +6 -0
  210. package/src/templates/scaffold-claude.ts +4 -4
  211. package/src/templates/scaffold-container-compose.ts +47 -7
  212. package/src/templates/scaffold-docs.ts +7 -3
  213. package/src/templates/scaffold-gitattributes.ts +18 -1
  214. package/src/templates/scaffold-helm-templates.ts +9 -0
  215. package/src/templates/scaffold-repo.ts +5 -2
  216. package/src/templates/scaffold-test-services.ts +33 -11
  217. package/src/templates/shapes/offline.ts +0 -7
  218. package/src/templates/shapes/realtime.ts +2 -6
  219. package/src/templates/sign-in-action-tests.ts +6 -4
  220. package/src/templates/sign-in-challenge.ts +62 -0
  221. package/src/templates/sign-in-oidc-mfa.ts +31 -0
  222. package/src/templates/sign-in-oidc.ts +11 -3
  223. package/src/templates/sign-in-password.ts +18 -56
  224. package/src/test-only-shipped.ts +29 -2
  225. package/src/test-shards.ts +134 -42
  226. package/src/test-verdict.ts +79 -0
  227. package/src/test-workers.ts +15 -0
  228. package/src/upgrade-coverage-ratchet.ts +95 -0
  229. package/src/upgrade-gate-codemods.ts +5 -3
  230. package/src/upgrade-gate.ts +42 -4
  231. package/src/upgrade-merge-drivers.ts +25 -0
  232. package/src/upgrade-report.ts +32 -4
  233. package/src/upgrade-scope.ts +62 -0
  234. package/src/verify-checks.ts +2 -8
  235. package/src/verify-coverage-run.ts +4 -1
  236. package/src/verify-e2e.ts +21 -3
  237. package/src/verify-live.ts +38 -14
  238. package/src/verify-only.ts +67 -0
  239. package/src/verify-progress.ts +7 -3
  240. package/src/verify-run.ts +20 -2
  241. package/src/verify-services-stack.ts +165 -0
  242. package/src/verify-services.ts +84 -2
  243. package/src/verify-test-run.ts +6 -7
  244. package/src/verify-tests.ts +8 -2
  245. package/src/verify-typecheck.ts +25 -2
  246. package/src/workspace-checks.ts +4 -1
  247. package/wiki/Actions.md +66 -3
  248. package/wiki/Admin-Dashboard.md +2 -2
  249. package/wiki/Agents.md +5 -5
  250. package/wiki/Auth.md +20 -6
  251. package/wiki/Bare-VM.md +1 -1
  252. package/wiki/CI-Parallel-Gate.md +2 -1
  253. package/wiki/CLI-Reference.md +115 -42
  254. package/wiki/Caching-And-Invalidation.md +1 -1
  255. package/wiki/Client-Navigation.md +35 -5
  256. package/wiki/Configuration.md +12 -10
  257. package/wiki/Deployment.md +44 -4
  258. package/wiki/Entities-And-Migrations.md +17 -3
  259. package/wiki/FAQ.md +1 -1
  260. package/wiki/Getting-Started.md +2 -2
  261. package/wiki/Home.md +3 -3
  262. package/wiki/I18n.md +6 -4
  263. package/wiki/Installation.md +12 -11
  264. package/wiki/Interface-Rules.md +3 -1
  265. package/wiki/Jobs-And-Workflows.md +24 -4
  266. package/wiki/Known-Gaps.md +2 -2
  267. package/wiki/MCP-And-AI.md +48 -13
  268. package/wiki/Many-Agents.md +69 -2
  269. package/wiki/Migrations-And-Backfills.md +18 -0
  270. package/wiki/Notify.md +5 -3
  271. package/wiki/Observability.md +13 -0
  272. package/wiki/Outbound-HTTP.md +53 -2
  273. package/wiki/Policies-And-Authz.md +1 -1
  274. package/wiki/Queries-And-Live-Queries.md +2 -2
  275. package/wiki/Realtime.md +24 -7
  276. package/wiki/Routes-And-Render-Modes.md +2 -2
  277. package/wiki/Scheduled-Tasks.md +4 -1
  278. package/wiki/Static-Assets.md +5 -3
  279. package/wiki/Testing.md +64 -7
  280. package/wiki/Theming.md +6 -3
  281. package/wiki/Timezones-And-Dates.md +5 -1
  282. package/wiki/Troubleshooting.md +1 -0
  283. package/wiki/Tutorial-01-First-App.md +3 -3
  284. package/wiki/Tutorial-02-First-Feature.md +1 -1
  285. package/wiki/Tutorial-03-Auth-And-Admin.md +7 -6
  286. package/wiki/UI-Components.md +1 -0
  287. package/wiki/Upgrading.md +38 -0
@@ -13,6 +13,8 @@ import type { Finding } from './output';
13
13
  import { quoteArg } from './shell-quote';
14
14
  import { TEST_COMPOSE_PATH, TEST_ENV_PATH } from './templates/scaffold-test-services';
15
15
  import { parseDotenvValues } from './test-dotenv';
16
+ import type { StackRelation, TestStack } from './verify-services-stack';
17
+ import { readStack, relationTo, SHARED_ENV } from './verify-services-stack';
16
18
 
17
19
  /** The URL every live suite reads first; the one this file probes. */
18
20
  export const TEST_DATABASE_KEY = 'TEST_DATABASE_URL';
@@ -145,6 +147,47 @@ const foreignFinding = (url: string): Finding => ({
145
147
  at: TEST_ENV_PATH,
146
148
  });
147
149
 
150
+ /**
151
+ * Another app under this project name: refused before `up` can touch its containers. A stopped
152
+ * one is said to be stopped — `ps --all` lists exited containers too, and calling them "running"
153
+ * sent a reader looking for a server that was not there — and its fix removes it by name: it held
154
+ * its data in RAM, so nothing is lost, and the other checkout's next `up` starts it again.
155
+ */
156
+ const collisionFinding = (project: string, other: string, running: boolean): Finding =>
157
+ running
158
+ ? {
159
+ code: 'X_TEST_SERVICES_UNAVAILABLE',
160
+ cause: `compose project ${project} is already running from ${other}, which is not a checkout of this app — the two share a name, so the live suites are not run against it`,
161
+ fix: `grep -n '^name:' ${TEST_COMPOSE_PATH} # give this app its own name: there, and its own ports there and in ${TEST_ENV_PATH}; if sharing is intended: ${SHARED_ENV}=1 bunx x verify --only live`,
162
+ at: TEST_COMPOSE_PATH,
163
+ }
164
+ : {
165
+ code: 'X_TEST_SERVICES_UNAVAILABLE',
166
+ cause: `compose project ${project} is stopped, and its containers belong to ${other}, which is not a checkout of this app — the two share a name, so this run does not take them over`,
167
+ fix: `docker compose -p ${quoteArg(project)} down --volumes # removes the stopped stack (its data was in RAM), then: x verify --only live; for good, give this app its own name: in ${TEST_COMPOSE_PATH}`,
168
+ at: TEST_COMPOSE_PATH,
169
+ };
170
+
171
+ /** The stack the suites got, for the one line the gate prints about it. */
172
+ export interface StackReport {
173
+ readonly project: string;
174
+ readonly state: 'started' | 'reused' | 'shared';
175
+ readonly with?: string;
176
+ readonly why?: 'same-app' | 'declared';
177
+ }
178
+
179
+ const reportOf = (
180
+ stack: TestStack,
181
+ relation: StackRelation,
182
+ startedServices: readonly string[],
183
+ ): StackReport => {
184
+ if (relation.kind === 'shared') {
185
+ const { with: other, why } = relation;
186
+ return { project: stack.project, state: 'shared', with: other, why };
187
+ }
188
+ return { project: stack.project, state: startedServices.length > 0 ? 'started' : 'reused' };
189
+ };
190
+
148
191
  /** What `ensureTestServices` found: the env to hand the suites, and what happened on the way. */
149
192
  export type ServicesVerdict =
150
193
  /** Nothing to do: the caller's own URL, or a repo with no test stack to start. */
@@ -158,12 +201,14 @@ export type ServicesVerdict =
158
201
  readonly env: Readonly<Record<string, string>>;
159
202
  /** What this run's `up` started — compose's answer, never inferred from Postgres. */
160
203
  readonly startedServices: readonly string[];
204
+ readonly stack?: StackReport;
161
205
  }
162
206
  /** This run started it, and left it running. */
163
207
  | {
164
208
  readonly kind: 'started';
165
209
  readonly env: Readonly<Record<string, string>>;
166
210
  readonly startedServices: readonly string[];
211
+ readonly stack?: StackReport;
167
212
  }
168
213
  /** It could not be started: the suites run as they would have, and this says why. */
169
214
  | { readonly kind: 'unavailable'; readonly finding: Finding };
@@ -206,6 +251,27 @@ export async function ensureTestServices(input: ServicesInput): Promise<Services
206
251
  probe(declared).then((up) => (up ? (input.login ?? postgresLogin)(declared) : 'down'));
207
252
  const before = await login();
208
253
  if (before === 'refused') return { kind: 'unavailable', finding: foreignFinding(declared) };
254
+ // Same name, same credentials: only the containers' own labels tell the apps apart.
255
+ const relate = async () => {
256
+ const read = await readStack(input.root, input.runner);
257
+ if (!read.answered || read.stack === undefined) return undefined;
258
+ const { stack } = read;
259
+ return { stack, relation: await relationTo(stack, input.root, input.runner, input.env) };
260
+ };
261
+ const collided = (found: Awaited<ReturnType<typeof relate>>): ServicesVerdict | undefined =>
262
+ found?.relation.kind === 'collision'
263
+ ? {
264
+ kind: 'unavailable',
265
+ finding: collisionFinding(
266
+ found.stack.project,
267
+ found.relation.with,
268
+ found.relation.running,
269
+ ),
270
+ }
271
+ : undefined;
272
+ const existing = await relate();
273
+ const refusedByName = collided(existing);
274
+ if (refusedByName !== undefined) return refusedByName;
209
275
  // Always the idempotent `up`, even with Postgres answering: it may still be starting (`unknown`),
210
276
  // and the env file names Redis, NATS and S3 too — a key handed on must have a service behind it.
211
277
  const running = await runningServices(input);
@@ -213,13 +279,29 @@ export async function ensureTestServices(input: ServicesInput): Promise<Services
213
279
  if (refused === undefined) {
214
280
  const now = (await runningServices(input)) ?? new Set<string>();
215
281
  const startedServices = [...now].filter((name) => running?.has(name) !== true).sort();
216
- return { kind: before === 'down' ? 'started' : 'reachable', env, startedServices };
282
+ // Asked again: on a cold start another app's `up` can have won the name since the first look.
283
+ const found = await relate();
284
+ const lostTheName = collided(found);
285
+ if (lostTheName !== undefined) return lostTheName;
286
+ return {
287
+ kind: before === 'down' ? 'started' : 'reachable',
288
+ env,
289
+ startedServices,
290
+ ...(found === undefined
291
+ ? {}
292
+ : { stack: reportOf(found.stack, found.relation, startedServices) }),
293
+ };
217
294
  }
218
295
  // A failed `up` may be a concurrent run's container-name conflict: ask the database again.
219
296
  const after = await login();
220
297
  if (after === 'refused') return { kind: 'unavailable', finding: foreignFinding(declared) };
221
298
  if (after !== 'ok') return { kind: 'unavailable', finding: refused };
222
- return { kind: 'reachable', env: await answering(env, probe), startedServices: [] };
299
+ return {
300
+ kind: 'reachable',
301
+ env: await answering(env, probe),
302
+ startedServices: [],
303
+ ...(existing === undefined ? {} : { stack: reportOf(existing.stack, existing.relation, []) }),
304
+ };
223
305
  }
224
306
 
225
307
  /**
@@ -15,7 +15,11 @@ import type { TestFile } from './test-select';
15
15
  import { failureOf, TEST_TIMINGS_FILE, testArgs } from './test-shards';
16
16
  import type { MachineLease } from './test-slots';
17
17
  import { loadTimings, slowestOf } from './test-timings';
18
- import { BATCH_FILES_PER_WORKER, SHARED_BATCH_FILES_PER_WORKER } from './test-workers';
18
+ import {
19
+ BATCH_FILES_PER_WORKER,
20
+ reachedWidth,
21
+ SHARED_BATCH_FILES_PER_WORKER,
22
+ } from './test-workers';
19
23
  import type { MachinePace } from './verify-pace';
20
24
  import { defaultTimeoutArgs, paceEnv } from './verify-pace';
21
25
  import type { StepOutcome } from './verify-step';
@@ -108,18 +112,13 @@ export async function runParallel(options: ParallelRunOptions): Promise<StepOutc
108
112
  // The width the run REACHED: a batch the machine pool narrowed ran narrower than planned, and a
109
113
  // step line that printed the plan would name a width that never ran.
110
114
  const reached = Math.max(1, ...result.widths);
111
- const narrowed = reached < workers;
112
115
  return {
113
116
  ok: findings.length === 0,
114
117
  findings,
115
118
  workers: reached,
116
119
  ...(options.widthReason === undefined
117
120
  ? {}
118
- : {
119
- widthReason: narrowed
120
- ? `${String(reached)} of ${options.widthReason} — machine slots held by another run`
121
- : options.widthReason,
122
- }),
121
+ : { widthReason: reachedWidth(reached, workers, options.widthReason) }),
123
122
  // Per batch: each process printed its own summary, and one parse of the joined text would
124
123
  // read only the last one.
125
124
  tests: countsOf(result.results),
@@ -25,7 +25,13 @@ import { discoverTests } from './test-select';
25
25
  import { TEST_TIMINGS_FILE } from './test-shards';
26
26
  import { machineLease, suiteWeight } from './test-slots';
27
27
  import type { WorkerPlan } from './test-workers';
28
- import { availableCpus, SERIAL_TYPES, totalMemory, workerPlan } from './test-workers';
28
+ import {
29
+ availableCpus,
30
+ fileBoundWidth,
31
+ SERIAL_TYPES,
32
+ totalMemory,
33
+ workerPlan,
34
+ } from './test-workers';
29
35
  import { runCovered } from './verify-coverage-run';
30
36
  import { judgeE2eBrowser, withE2eApp } from './verify-e2e';
31
37
  import { factoryFindings } from './verify-factories';
@@ -232,7 +238,7 @@ const runType = async (ctx: VerifyContext, type: TestType): Promise<StepOutcome>
232
238
  plan === undefined
233
239
  ? `${String(Math.min(workers, files.length))} workers (--workers)`
234
240
  : files.length < plan.workers
235
- ? `${String(files.length)} of ${plan.reason}`
241
+ ? fileBoundWidth(files.length, plan.reason)
236
242
  : plan.reason;
237
243
  // A subset cannot hold the whole tree's coverage floor: only a full unit run is judged.
238
244
  if (type === 'unit' && isApp(ctx.root) && selected === undefined) {
@@ -1,11 +1,14 @@
1
- // Which `tsc` invocation the `typecheck` step runs: `-p` with `incremental`, never `-b`.
1
+ // Which `tsc` invocation the `typecheck` step runs: `-p` with `incremental` for a root with no
2
+ // project references (every scaffolded app), `-b` for one that declares them — its only walker.
2
3
  //
3
4
  // `tsc -b` decides "up to date" by mtime, and Bun installs a package as HARDLINKS out of its cache,
4
5
  // carrying the cache's old mtimes — so upgrading a dependency to a version already in the cache
5
6
  // left every input older than the buildinfo, `-b` skipped the program and reported green while a
6
7
  // cold CI went red (#450). `-p` with `incremental` re-reads every input and compares content
7
- // hashes, so it cannot be fooled by a date.
8
+ // hashes, so it cannot be fooled by a date. A root WITH references still runs `-b` and keeps
9
+ // that exposure: after a dependency upgrade there, start over with a clean build.
8
10
 
11
+ import type { Finding } from './output';
9
12
  import { checkRootReferences } from './tsconfig-references';
10
13
 
11
14
  /**
@@ -28,3 +31,23 @@ export async function typecheckArgs(root: string, bin: string): Promise<readonly
28
31
  const mode = (await usesProjectReferences(root)) ? ['-b'] : ['-p', '.'];
29
32
  return [bin, ...mode, '--pretty', 'false'];
30
33
  }
34
+
35
+ /** `apps/web/a.ts(3,7): error TS2322: …`, the first line of `tsc --pretty false` that names a place. */
36
+ const FIRST_ERROR = /^(.+?)\((\d+),\d+\): error TS/m;
37
+
38
+ /**
39
+ * The step's red finding. The errors are already printed under it, so the fix opens at the first of
40
+ * them and re-runs the step: a raw `tsc` repeats the list outside the machine ledger and this
41
+ * checkout's compiler lock.
42
+ */
43
+ export function typecheckFinding(output: string): Omit<Finding, 'docs'> {
44
+ const first = FIRST_ERROR.exec(output);
45
+ return {
46
+ code: 'X_TYPECHECK_FAILED',
47
+ cause: 'the project does not typecheck',
48
+ fix:
49
+ first === null
50
+ ? 'x verify --only typecheck --json # its output carries what tsc printed'
51
+ : `edit ${first[1]}:${first[2]} — and each other file(line) tsc listed under this finding, then: x verify --only typecheck`,
52
+ };
53
+ }
@@ -442,7 +442,10 @@ export async function checkPackageShape(
442
442
  }
443
443
  if (record.private !== true) {
444
444
  findings.push(...(await fixtureReach(root, dir, manifest)));
445
- shipped.push({ dir, entries: entryPatternsOf(manifest) });
445
+ const excluded = filesOf(manifest)
446
+ .filter((entry) => entry.startsWith('!'))
447
+ .map((entry) => entry.slice(1));
448
+ shipped.push({ dir, entries: entryPatternsOf(manifest), excluded });
446
449
  }
447
450
  facts.push({
448
451
  dir,
package/wiki/Actions.md CHANGED
@@ -57,7 +57,7 @@ Declared one per file in a feature's `actions/` (`actions/publish-post.ts`, what
57
57
  | `mcp.description` | `string` | no | the tool description an agent reads, and the OpenAPI `summary`. Contract text, so it stays outside `t()` — `openapi.json` must not depend on a locale. Write it for a stranger |
58
58
  | `mcp.visibleTo` | `readonly string[]` | no | roles that may see the projected tool; a caller whose role is not named gets ToolNotFound, never Forbidden — the policy still decides every call |
59
59
  | `rateLimit` | `{ limit: number \| (({ ctx }) => number \| Promise<number>); windowMs: number }` | no | `limit` may be resolved **per call** from `ctx` (the tenant's plan, read by the app), before any bucket is touched; a resolver answering `NaN`, `0`, `Infinity` or a non-number is `X_RATE_LIMIT_INVALID`, never allow-all. A per-call limit publishes as `rateLimit: null` + `rateLimitPerCall: { windowMs }` in `describe()` and `x-ultimate.rateLimit.limit: 'per-call'` in `openapi.json`. Spent **inside `invoke`**, so the HTTP route, the MCP tool, the in-app agent's tool call and `.job()` draw on ONE bucket — the third call to a `limit: 2` action is `X_RATE_LIMITED` whichever surface it came through; a direct in-process call spends nothing. Keyed actor → org → IP; counted in `@ultimat3/http`'s installed store — the `rateLimitStore` adapter port, filled by the boot on every role, `postgresRateLimitStore` unless `apps/<app>/runtime.ts` names one ([Adapters](Adapters#ratelimitstore)). Over HTTP the refusal is `429` + `Retry-After` and `RateLimit-*`, and the route is not also capped by the `default` bucket; the same `toBucket` conversion feeds `openapi.json`, so the published numbers are the enforced ones. `/mcp` additionally buckets by verb class (`MCP_RATE_LIMITS`, read 120/min, write 20/min per token) |
60
- | `meter` | `{ name, period: 'hour' \| 'day' \| 'month', limit, warnAt?, onWarn? }` | no | a durable per-period allowance — see [Usage meters](#usage-meters-meter). Drawn on **every** surface, `server` included, after the policy and before `handle`; spent, `X_METER_EXCEEDED` (429) |
60
+ | `meter` | `{ name, period: 'hour' \| 'day' \| 'month', limit, warnAt?, onWarn? }` | no | a durable per-period allowance — see [Usage meters](#usage-meters-meter); an amount measured after the work is [`drawMeter`](#programmatic-draws-drawmeter). Drawn on **every** surface, `server` included, after the policy and before `handle`; spent, `X_METER_EXCEEDED` (429) |
61
61
  | `idempotent` | `boolean` | no — **required `true` on a `mutator`** | marks the action safe to retry with an `Idempotency-Key` header — over MCP, the tool's optional `idempotencyKey` argument. Inside a transaction the Postgres store settles the record with the write's own `COMMIT`, so a rollback never leaves a `settled` record behind. A field core redacts by name (`apiKey`, `password`, `*Token`…) or a `Secret` is stored as `[redacted]`, and the replay of such an answer is `X_IDEMPOTENT_REPLAY_REDACTED` |
62
62
  | `http.path` | `string` | no | pins the URL whatever the app's `pathStyle` derives — for a path a caller already holds (`'/api/uploads/signed'`) or a resource-shaped one (`'/orders/:id/refund'`). Lowercase static segments and `:param`s, never `/_x`; each `:param` a REQUIRED `t.string` key of `input:`, else `X_ACTION_HTTP_PATH_INVALID` at registration. The URL's value joins the body before the input is parsed, so the schema, the policy, `row` and the handler read one object; a body naming the key with another value is **400** `X_HTTP_PATH_INPUT_CONFLICT`, never overridden. Under a bearer mount the pin is served at the prefix (`/v1/orders/:id/refund`) — and still at its own path, with the cookie session, as every pin is; the policy decides both. `derivePath(name)` refuses a template; `actionHttpPath(name, { id })` fills it. A `deprecated.replacedBy` naming one is `X_ACTION_DEPRECATION_INVALID`. An inbound webhook is not this door: it is `webhookReceiver()` ([Jobs and workflows](Jobs-And-Workflows#inbound-webhooks)) |
63
63
  | `http.method` | `'POST'` · `'PUT'` · `'PATCH'` · `'DELETE'` | no — `'POST'` | the verb the pin answers; needs `http.path`. `X_ACTION_PATH_DUPLICATE` keys on method and path, so `PUT /orders/:id` and `DELETE /orders/:id` are two actions. `action.client()` sends it and fills the URL from the input (each value one encoded segment, the key left out of the body); `rpc()` by name cannot see a pin. In `openapi.json`: `{id}`, an `in: path` required parameter, the key gone from the request body, the operation under the declared verb. `x.manifest.json` writes `http: { path, method }` for a pin only; moving it is breaking. `As of 2026-11` |
@@ -129,17 +129,78 @@ export const callTool = action({
129
129
  | contract diff | breaking when a call pattern the old meter admitted is refused: a meter introduced, a lower limit, a longer period not covering the old one at full use (100/day → month needs ≥ 3,100), a rename (`meta.meter` is on the wire), a move to or from a per-call limit. A shorter period at the same limit admits MORE (100/day → 100/hour): additive, as are a higher limit and a removed meter. `warnAt` is internal. `As of 2026-11` |
130
130
  | tests | the app preload resets the meter store at every file boundary, as it does the rate-limit store: a test file never resets it itself |
131
131
 
132
+ ### Programmatic draws: `drawMeter`
133
+
134
+ Work measured after the fact — tokens a model spent, bytes exported, rows synced — is drawn with `drawMeter(ctx, { meter, period, amount, limit, key })` from `@ultimat3/action`, inside the handler that measured it. Same counters, same store, same caller as `meter:`. `As of 2026-11`.
135
+
136
+ ```ts
137
+ import { action, drawMeter, t } from '@ultimat3/action';
138
+ import { allow } from '@ultimat3/policy';
139
+
140
+ const PLAN_TOKENS = new Map([['org-free', 100_000]]);
141
+ const tokensFor = (orgId: string | undefined) => PLAN_TOKENS.get(orgId ?? '') ?? 0;
142
+ // The app's own model client, whatever it is: it answers the run's id, its text and its usage.
143
+ declare const model: {
144
+ complete(text: string): Promise<{ id: string; text: string; usage: { totalTokens: number } }>;
145
+ };
146
+
147
+ export const summarise = action({
148
+ input: t.object({ text: t.string }),
149
+ output: t.object({ summary: t.string, used: t.number.int() }),
150
+ policy: allow(),
151
+ // Admission, before the model runs: a caller with no token allowance — anonymous, or on a plan
152
+ // without one — is refused here, or every call would bill the provider and record nothing.
153
+ meter: {
154
+ name: 'summaries',
155
+ period: 'day',
156
+ limit: ({ ctx }) => (tokensFor(ctx.actor.orgId) > 0 ? 1_000 : 0),
157
+ },
158
+ handle: async ({ input, ctx }) => {
159
+ // The handler does the work, so it measures the usage: never a count or an id the caller sent,
160
+ // which would let any member spend the tenant's allowance without running anything.
161
+ // Accounting after the fact, NOT a spend cap: the model has run before the draw is judged, so a
162
+ // tenant past its tokens still costs one run per admitted call, refused here and unrecorded.
163
+ // Bound that with the admission meter's call count and the model's own max-tokens setting.
164
+ const run = await model.complete(input.text);
165
+ const drawn = await drawMeter(ctx, {
166
+ meter: 'tokens',
167
+ period: 'day',
168
+ amount: run.usage.totalTokens,
169
+ limit: ({ ctx }) => tokensFor(ctx.actor.orgId),
170
+ key: run.id, // the run's own id: a retry of this draw for the same run counts once
171
+ });
172
+ return { summary: run.text, used: drawn.used }; // also: limit, replayed, resetsAt
173
+ },
174
+ });
175
+ ```
176
+
177
+ | Use | When |
178
+ |---|---|
179
+ | `meter:` on the action | the unit is **the call**, known before the handler runs: refused before any work starts — also the admission gate in front of a costly handler, a limit of 0 for a caller with no allowance |
180
+ | `drawMeter` | the unit is an **amount known only after the work**, or one action draws several meters. It records and refuses what was spent; it cannot stop work already done, so it bounds spend only together with a pre-work gate (a `meter:`, a per-call cap on the work) |
181
+
182
+ | Rule | What happens |
183
+ |---|---|
184
+ | amount | a positive safe integer, added whole or not at all: an amount that would pass `limit` counts nothing and throws `X_METER_EXCEEDED` (429, the same `meta` and `Retry-After`). One larger than the whole limit fits no period: its refusal says so, names no `retryAfterSeconds` (no `Retry-After`) and is `retry: 'terminal'`, so a job dead-letters it instead of waiting out a reset. `limit` judges new charges: a remembered key replays even after its limit drops below its amount |
185
+ | key | required, 1–255 chars, no NUL or lone surrogate (Postgres `text` cannot hold either as written): the unit of work's own id, never one the caller made up. A second draw under it — a retry, a duplicate on another replica, a parallel one — adds nothing and answers `replayed: true`. Remembered for the period it counted in and the next, so a retry just after the reset still counts once; a lagging replica's draw counts in, and is remembered by, the counter's period. A refused draw leaves no key. Replicas share keys only through a shared store: `memoryMeterStore()` remembers per process, and either bound ends that early: `maxDrawKeys` (default 200,000 across every counter, the period before dropped first) or `maxKeys`, whose eviction of a counter takes its keys with it. A durable guarantee is the Postgres store's |
186
+ | counter | a `meter:` with the same name and period counts on the same counter; units are the app's to keep consistent |
187
+ | transaction | the draw is written outside the caller's transaction and stays counted if it rolls back — retry with the same `key` |
188
+ | store | the installed `MeterStore` with `amount` and `drawKey` on `MeterDraw`, declaring `keyedDraws: true` (one that does not is `X_METER_INVALID` before it is drawn on: a store written before keyed draws would count one call and never replay): memory in one process, `x_meter` + `x_meter_key` in Postgres (the counter row locked, then the key claimed under it). A store of your own passes `meterStoreConformance` |
189
+ | no warning | `warnAt`/`onWarn` are `meter:`'s; read `used` and `limit` off the answer |
190
+ | malformed | a bad name, period, amount, key or resolved limit is `X_METER_INVALID`, its fix naming the `drawMeter` call |
191
+
132
192
  ## Streaming: `stream:` and an async generator
133
193
 
134
194
  An action that answers in pieces declares `stream: <chunk schema>` and writes `handle` as `async *handle({ input, ctx })`: each `yield` is a chunk, the `return` is the output.
135
195
 
136
196
  | Caller | Gets |
137
197
  |---|---|
138
- | `accept: text/event-stream` on its route | `event: chunk` per yield (parsed by `stream` first), then one `event: done` (output) or `event: error` (problem document); `x-accel-buffering: no`, a `: keep-alive` every 15 s |
198
+ | `accept: text/event-stream` on its route | `event: chunk` per yield (parsed by `stream` first), then one `event: done` (output) or `event: error` (problem document). Each `chunk` and the `done` frame carry their instants on a `dates:` field, which a reader that does not know it ignores. A fault after the first chunk is recorded as the JSON path's is — monitor (5xx), `hooks.onError`, log line — once (`reportLateFault`, `@ultimat3/http`); a reader's cancel is not a fault; `x-accel-buffering: no`, a `: keep-alive` every 15 s |
139
199
  | anything else — JSON, MCP, `.job()`, `.as()`, a direct call | the generator drained, the output alone: one contract |
140
200
  | refused before the handler starts (policy, input, rate limit) | the ordinary problem response, never a stream |
141
201
  | the client leaves mid-stream | `ctx.signal` aborts inside the handler |
142
202
  | a browser | `clientStream({ url, body })` from `@ultimat3/core`: `fetch`, never `EventSource` |
203
+ | a `Date` in the output | a `Date` again in `clientStream` and the typed client: the server names each instant's path (`x-ultimate-dates` on the plain and the enveloped 200, `dates:` on each `chunk` and the `done` frame) and the client revives it. The body and OpenAPI are unchanged; a client ignoring the header reads the ISO string. `As of 2026-11-19` (`packages/action/src/record-wire.ts`, `packages/action/src/http-stream.ts`). The header is capped at 1,536 bytes (`WIRE_DATES_MAX_BYTES`): an answer whose instants need one path each — a `string \| Date` column, a `[label, instant]` tuple — past that is sent with no `x-ultimate-dates` (and no `dates:` line), the client reads those instants as ISO strings, and the operation is logged once at `warn` as `http.wire_dates_dropped`. `As of 2026-11-19`. |
143
204
 
144
205
  A chunk its schema refuses, or `stream:` beside a handle that is not a generator, is `X_ACTION_STREAM_INVALID`. The OpenAPI 200 lists `text/event-stream` beside `application/json` for a streaming action only. `agent()` streams this way.
145
206
 
@@ -193,6 +254,7 @@ export const load = async (): Promise<{ readonly answer: ActionAnswer | null }>
193
254
  | `static` / `isr` pages read `null` | a shared document is rendered as nobody, with no inbound cookie |
194
255
  | outside a request (the `llms.txt` build runs `load` with none) reads `null`, never `X_NO_REQUEST` | no request, no answer |
195
256
  | translate on `code` and `issues[].rule` with `t()` | the flash carries no prose, so no locale |
257
+ | a field's text reaches its declared type | a form posts text; the route coerces it toward `input` as a query route coerces a query string — `ok=on` is `true` for `t.boolean`, `count=7` is `7`, one value fills a `t.array`, the last of a repeated scalar wins (a hidden `false` before its checkbox). A JSON body is never coerced. `As of 2026-11` |
196
258
  | field values are not carried back | a password or a card number does not belong in a cookie; the form re-renders empty, or the page keeps a draft |
197
259
 
198
260
  **Enforced.** The `manifest` step of `x verify` reads every `page.tsx` for a `<form method="post">` whose `action` names an action — a literal path, `derivePath(name).path`, `actionHttpPath(name, …).path`, or a `const` in the same file holding one — and reports one with no `native` as `X_NATIVE_FORM_UNANSWERED`, the page's `file:line` and the fix. On `main` it is a **warning** — listed under the step's `warnings` in `--json`, the step stays green — because refusing it would turn an app's gate red between two minors (`X_BREAKING_ON_MAIN`); the refusal is planned for `next`. A form inside a component other than the page is not read. `As of 2026-11`.
@@ -242,7 +304,8 @@ There is **one execution path**. HTTP, MCP, jobs, and direct server calls differ
242
304
  | Key | Effect |
243
305
  |---|---|
244
306
  | `http.pathStyle` | `'resource'` (default — every existing URL stays) or `'readable'`: `signIn` → `/api/sign-in`, `health` → `/api/health`. A browser states nothing: the server stamps a non-default style into every document (`<meta name="ultimate-path-style">`) and `rpc({ baseUrl: '' })`, `useMutation` and the outbox replay derive under it. A caller with no document — a script, another service — passes `rpc({ baseUrl, pathStyle: 'readable' })`; the wrong one is answered 404 `X_CONTRACT_DRIFT` naming the style served and the action's real path, never a bare `X_ROUTE_NOT_FOUND`. The module scan evaluates `apps/web/api/index.ts` first, so a module-level `derivePath(name)` anywhere else sees the declared style; one evaluated earlier (inside the index's own imports) is refused at the declaration, `X_ACTION_PATH_DERIVED_EARLY` — derive inside the function that uses it |
245
- | `http.mounts[]` | `{ prefix: '/v1', scopes, resolveToken, rateLimit?, openapi? }` — a second door onto a cut of the same routes. Only `Authorization: Bearer` authenticates there (a session cookie reaches nothing, so no CSRF proof is needed); a primitive outside the token's scopes answers **404** like MCP's unknown tool; no/invalid token **401** with `WWW-Authenticate: Bearer`; a per-token `rateLimit` answers `RateLimit-*` and **429** + `Retry-After`, and it **replaces** the `default` bucket on the mount's routes (no `rateLimit`, `default` stands; a route's own bucket and the tenant allowance still apply). A `Link: rel="successor-version"` names the mounted path, and is dropped when the successor is outside this token's cut. `scopes` is the map `defineAppMcp` takes; `resolveToken` the same resolver. `/api/create-case` → `/v1/create-case`, `/_x/query/case-list` → `GET /v1/case-list` |
307
+ | `http.mounts[]` | `{ prefix: '/v1', scopes, resolveToken, rateLimit?, openapi?, tenant? }` — a second door onto a cut of the same routes. Only `Authorization: Bearer` authenticates there (a session cookie reaches nothing, so no CSRF proof is needed); a primitive outside the token's scopes answers **404** like MCP's unknown tool; no/invalid token **401** with `WWW-Authenticate: Bearer`; a per-token `rateLimit` answers `RateLimit-*` and **429** + `Retry-After`, and it **replaces** the `default` bucket on the mount's routes (no `rateLimit`, `default` stands; a route's own bucket and the tenant allowance still apply). A `Link: rel="successor-version"` names the mounted path, and is dropped when the successor is outside this token's cut. `scopes` is the map `defineAppMcp` takes; `resolveToken` the same resolver. `/api/create-case` → `/v1/create-case`, `/_x/query/case-list` → `GET /v1/case-list` |
308
+ | `http.mounts[].tenant` | `{ arg, resolve, list }` — the shape `defineAppMcp({ tenant })` takes, with MCP's three outcomes. The token resolves to a person; every call to a mounted primitive names its tenant in the query string, `?org=org_a`, read after the per-token allowance (an exhausted token is **429** before its tenant is read) and before the pipeline's tenant-aware rate limit, the body and the policy, never from the body; `resolve({ person, value })`'s actor is the caller, so policy, the tenant allowance and a meter see one org per call. None named: **400** `X_BEARER_TENANT_REQUIRED`, fix `GET /v1/tenants`. One the person is not in: the **404** a primitive outside the token's scopes gets, byte for byte. `resolve` threw, or answered no actor: **500** `X_BEARER_TENANT_UNRESOLVED`. `GET <prefix>/tenants` answers `{ tenants }` from `list({ person })` to any valid token, and is the exception: no scope, no tenant; a listed value that `isTenantValue` (`@ultimat3/http`) refuses — not a string, empty, over 256 characters (code points), or holding a lone surrogate — is **500** `X_BEARER_TENANT_LIST_INVALID`. A successor link keeps the tenant the call named. The mount's document requires the parameter on every primitive operation (keeping a read's own schema for it) and adds the `tenants` path beside any operation already there. `As of 2026-11-23` |
246
309
  | `http.mounts[].openapi` | a file (`'openapi.v1.json'`) `x manifest` writes with only the cut, bearer-secured; `x verify` refuses it stale or missing. Each operation's `security` is `[{ bearer: ['<its scope>'] }]` — the one scope of `scopes` that names it (also `x-ultimate.scope`) — and `components.securitySchemes.bearer` lists every scope with the operations it unlocks, in its `description` and as `x-ultimate.scopes` (`{ scope: [names] }`). `As of 22.12`; before, every operation said `bearer: []` |
247
310
  | `openapi` | `{ title, version, description, servers, sessionCookie }` — any key makes `openapi.json` complete: `info`, `servers`, `securitySchemes` (`cookie`, plus `bearer` with a mount), `401` + `429` (with `Retry-After`) on every operation its route authenticates, `RateLimit-*` on rate-limited ones. Absent, the bytes are unchanged |
248
311
 
@@ -74,7 +74,7 @@ A count reads no row, so it is not audited. Upgrading from a release that counte
74
74
  | `?f.<field>=<value>` | the field's default operator (`contains` for text, `eq` otherwise) |
75
75
  | `?f.<field>.<op>=<value>` | `eq` `neq` `contains` `gt` `gte` `lt` `lte` `in` (repeat the parameter) `is-null` (`true` / `false`) — the ones the field's shape answers |
76
76
  | `?scope=<name>` | a declared scope; absent is the default; `*` is no scope at all — what a related card's link opens. A scope may not be declared as `*` |
77
- | `?sort=<field>:<asc\|desc>` | a sortable field |
77
+ | `?sort=<field>:<asc\|desc>` | a sortable field. A `money()` column sorts by currency, then minor (`As of 2026-11-19`): amounts compare only within a currency, so each currency is a group, and the id breaks ties; it answered 500 `X_INVARIANT_VIOLATED` before |
78
78
  | `?cursor=<signed>` | keyset position on `(sort, id)`: any number of rows sharing a sort value, and NULLs (last ascending, first descending), are reached both ways |
79
79
 
80
80
  An unknown field, operator, sort, scope or parameter — or a value that is not the column's type (a number is decimal digits: no blank, hex or exponent; a date is one the calendar has) — is `X_ADMIN_FILTER_INVALID`: a 400 naming what the list answers, never the unfiltered list. The MCP list tool takes the same grammar (`scope`, `where: [{ field, op?, value }]`).
@@ -98,7 +98,7 @@ Statements per list page: 1 for the rows (2 when the sort column is nullable, on
98
98
  |---|---|
99
99
  | `input: t.object({ … })` | the button is a link to the action's form; a refusal is a 422 with each issue on its field. No schema: a confirm only |
100
100
  | `when: (row) => boolean` | decides the button on the detail and each list row, and is asked again before the handler: `X_ADMIN_ACTION_NOT_APPLICABLE` (409) |
101
- | `batch: true` | in the list's batch bar: checked rows, or every row the list's URL matches (200 per request, continued from where it stopped). Each row through the button's gate and on the audit log; answered `done` / `refused` / `failed` / `remaining` |
101
+ | `batch: true` | in the list's batch bar: checked rows, or every row the list's URL matches (200 per request, continued from where it stopped). Each row through the button's gate and on the audit log; answered `done` / `refused` / `failed` / `remaining`. Only an "all matching" selection continues: a checked-rows batch past the bound answers `after: null` (screen and MCP) and the caller re-sends the remaining ids — `As of 2026-11-19`; its continuation used to widen to every row the list matched |
102
102
  | `batch: { threshold, chunk? }` | past `threshold` rows, one `admin.batch` job per chunk, run by a worker as the operator; `queued` in the answer. The batch id is derived from actor, action, rows and input, so retrying a request whose enqueue failed part-way dedupes the chunks already queued |
103
103
  | `matching: ({ where, input, ctx }) => { affected, remaining }` | "all matching" as ONE set-based call over the list's `where` (row scope, scope, filters) — a store's bounded bulk verb — decided and audited once; a destructive one types `<entity>:all matching`. Checked rows still run row by row |
104
104
  | `readonly: true` | the action changes nothing (an export, a verification), so its admin-level gate is `admin:read`, not `admin:write`: a read-only staff role and an `admin:read` MCP token may run it. The action's own `permission` is still required beside it |
package/wiki/Agents.md CHANGED
@@ -332,15 +332,15 @@ That matters because the transcript **is** the request: a loop that keeps going
332
332
 
333
333
  | Surface | `ctx.signal` fires when |
334
334
  |---|---|
335
- | HTTP | the **request deadline** passes, **or the caller goes away** — the two are joined with `AbortSignal.any` ([`packages/http/src/deadline.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/http/src/deadline.ts)). The deadline is `requestTimeoutMs` (30s), or the shorter budget the caller sent as `x-request-timeout-ms` |
335
+ | HTTP | the **request deadline** passes, **or the caller goes away** — one signal: the caller's abort is forwarded into the deadline's controller, and the first abort wins with its own reason ([`packages/http/src/deadline.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/http/src/deadline.ts)). The deadline is `requestTimeoutMs` (30s), or the shorter budget the caller sent as `x-request-timeout-ms`, and it bounds **time-to-headers**: once a streamed answer has started, only the caller going away fires the signal |
336
336
  | Job / `agentJob()` | the attempt times out, or the job is cancelled — `x jobs cancel <id> --reason "…"`. The worker's own `ctx` is what `agentJob` forwards, so the abort reaches the turn loop |
337
337
  | Your own code | a signal you pass: `withChildContext({ signal }, () => supportAgent(input, { ctx }))` |
338
338
 
339
- **A closed browser tab DOES abort an in-flight agent, `As of 2026-08`.** `pipeline.ts` hands the inbound `Request.signal` to `startDeadline`, which joins it with the timer's controller through `AbortSignal.any` — so a disconnect unwinds the turn loop instead of paying for every remaining turn. This page said the opposite until 12.0.0, and it was true when it was written: nothing in `@ultimat3/http` read the inbound signal, so a closed tab held its handler, its pool slot and its vendor connection for the whole budget.
339
+ **A closed browser tab DOES abort an in-flight agent, `As of 2026-08`.** `pipeline.ts` hands the inbound `Request.signal` to `startDeadline`, which forwards its abort into the timer's controller — so a disconnect unwinds the turn loop instead of paying for every remaining turn. A handler that unwinds on that hang-up is answered `X_ABORTED` (499) and is not reported as a failure. This page said the opposite until 12.0.0, and it was true when it was written: nothing in `@ultimat3/http` read the inbound signal, so a closed tab held its handler, its pool slot and its vendor connection for the whole budget.
340
340
 
341
341
  | Want | Do |
342
342
  |---|---|
343
- | every agent request bounded | call `configureHttp({ requestTimeoutMs: 120_000 })` at module scope in a file under `apps/*/` — `ctx.signal` fires there and `X_TIMEOUT` answers the socket either way |
343
+ | every non-streamed agent request bounded | call `configureHttp({ requestTimeoutMs: 120_000 })` at module scope in a file under `apps/*/` — `ctx.signal` fires there and `X_TIMEOUT` answers the socket either way. A streamed answer (SSE, a stream-declaring action) is bounded only until its headers leave; bound the stream itself with `withChildContext({ signal: AbortSignal.timeout(ms) }, …)` |
344
344
  | this call bounded shorter | send `x-request-timeout-ms` with the milliseconds you will wait; a caller may only **shorten** the deadline, never lengthen it, and anything under 1ms falls back to the server's own budget |
345
345
  | the next hop bounded by what is LEFT | nothing — both typed clients spread `traceHeaders()` before your own headers, and it sends the **remaining** budget as `x-request-timeout-ms`. A spent budget sends no header rather than `0`, because `0` reads one hop later as "the caller asked for nothing" |
346
346
  | a run the user can actually stop | run it as a job — `agentJob()` — and cancel it by id: `x jobs cancel <id> --reason "user cancelled"` |
@@ -535,7 +535,7 @@ export async function writeThenFix(ctx: Ctx, problem: string): Promise<{ title:
535
535
 
536
536
  **The handle is signed data.** `AgentTranscript` is plain JSON that the app stores; treat it as opaque. It holds what the model was sent (already redacted) and what the tools answered, so store it where tool results may live. It also carries the run's own ceilings — `turns` and `usage` — so it is **signed**: an HMAC-SHA256 over its canonical bytes with the framework's signing secret (`ULTIMATE_CURSOR_SECRET`, under a label of its own), and **bound** to the agent (`id@version` of its prompt: a bumped prompt starts a new run), the model the run is on, the set of tool names the run was offered (every declared one unless [`offerTools()`](#per-run-picks-offertools-model-limits) narrowed it), and the tenant (`orgId`) of the actor it was written for. On the way back, before anything is loaded or spent, `.continue()` checks: at most `MAX_TRANSCRIPT_CHARS` (2,000,000) of JSON; the signature; each binding (a handle written for org A is refused for an actor of org B); then its shape — roles alternating, only the three block kinds a loop writes, every tool call answered by the next message, every tool call naming a tool the agent declares. Anything else is `X_AGENT_TRANSCRIPT_INVALID` (422, `terminal` for a job). An edited handle is therefore refused, not trusted: zeroing `usage`, lowering `turns`, rewriting a message or fabricating a tool result all break the signature. Rotating the secret invalidates stored handles. In production a process still on the shipped development key refuses `.continue()` and names `ULTIMATE_CURSOR_SECRET`; in development and test the development key signs. What the signature does not do: it does not make the transcript an authority — tools still run as `ctx.actor` under their own policies — and it does not stop a holder of a **valid** handle from continuing it, so store it per tenant like any other row.
537
537
 
538
- **A failed call leaves a handle too.** When `.run()` or `.continue()` throws after a provider answered, the error carries a signed handle — `transcriptOf(error)` — holding the transcript up to the request the failed turn was answering, with `turns` and `usage` counting everything the failed call was billed. **A job stores that handle, not the one it started with.** Continuing from the old handle forgets the failed call's spend: `maxTurns` and `budget.tokensPerRun` then count from the old figures, and only the actor and org ceilings bound the retries. A call aborted before it reported usage is not in the handle (its bill is unknown — `billedOf(error).unsettled`). A plain call keeps nothing and leaves no handle.
538
+ **A failed call leaves a handle too.** When `.run()` or `.continue()` throws after a provider answered, the error carries a signed handle — `transcriptOf(error)` — holding the transcript up to the request the failed turn was answering, with `turns` and `usage` counting everything the failed call was billed. **A job stores that handle, not the one it started with.** Continuing from the old handle forgets the failed call's spend: `maxTurns` and `budget.tokensPerRun` then count from the old figures, and only the actor and org ceilings bound the retries. A call aborted before it reported usage is not in the handle (its bill is unknown — `billedOf(error).unsettled`). A plain call keeps nothing and leaves no handle. **A handle cut inside a tool batch keeps every result the batch completed** (`As of 2026-11-19`; a throwing `onCheckpoint`, `X_AGENT_TOOL_LOOP`, the deadline or an abort): a completed call carries its real result, a call in flight when the run stopped is answered `Interrupted: … its outcome is unknown. Check whether it took effect before calling it again.`, and one never started `Not run: the run stopped before this call started.` — both `is_error`, so continuing never re-runs a tool that already charged. A failure before any tool started leaves the handle at the request, as before.
539
539
 
540
540
  ## Auto-compaction (`compact`)
541
541
 
@@ -544,7 +544,7 @@ export async function writeThenFix(ctx: Ctx, problem: string): Promise<{ title:
544
544
  | Before | After |
545
545
  |---|---|
546
546
  | tools, system prompt (stable block, per-run block) | **the same bytes** — the provider's cached prefix survives |
547
- | first user message: the rendered prompt | the prompt verbatim, then one `[compacted: N earlier turns …]` text block holding the summary |
547
+ | first user message: the rendered prompt | the prompt verbatim, then one `[compacted: N earlier turns …]` text block holding the summary, then the user's own text from summarised turns, ≤ 8,000 chars in total across every compaction (`KEPT_USER_CHARS`, newest kept first). `As of 2026-11-19` |
548
548
  | turns 1 … N−k | gone — folded into the summary |
549
549
  | the last `keepTurns` turns (each an assistant message and the user message answering its tool calls) | **the same bytes** — no tool call is ever separated from its result |
550
550
 
package/wiki/Auth.md CHANGED
@@ -65,7 +65,7 @@ issuer, discovered on the first sign-in). Both write the sign-in page, the `dest
65
65
  `auth.signInPath`, and a boot guard: outside `development` and `test` a `web` or `sync` role with
66
66
  its sign-in keys unset refuses to start (`X_AUTH_SIGN_IN_UNCONFIGURED`). `--password` also writes
67
67
  `createSession` / `confirmSession` and the second-factor page; `--oidc` writes the start and
68
- callback routes and drops `x new`'s development viewer while its files are still `x new`'s own. What each writes:
68
+ callback routes, passes `mfaPath` and writes the second-factor page and its `confirmSession` action, so an MFA-enrolled user finishes SSO (`As of 2026-11-19`; an app generated before adds `mfaPath` by hand — [Upgrading](Upgrading)), and drops `x new`'s development viewer while its files are still `x new`'s own. What each writes:
69
69
  [CLI reference](CLI-Reference#x-g).
70
70
 
71
71
  ## OAuth
@@ -129,9 +129,17 @@ export const sso = identityProviderRoutes(auth, {
129
129
  oidcIdentityProvider({ provider: 'github' }),
130
130
  ],
131
131
  successPath: '/app',
132
+ mfaPath: '/sign-in/mfa', // where a user with TOTP enrolled finishes; omitted, their callback is 401
132
133
  });
133
134
  ```
134
135
 
136
+ A user with a second factor is sent to `mfaPath` (303) with the sealed challenge in the
137
+ `__Host-x_mfa` cookie; that page finishes with
138
+ `completeMfa(auth, readMfaChallenge(request) ?? '', code)`. `oauthLogin(auth, { mfaPath })` is the
139
+ same option. The write half is exported too — `mfaChallengeOf`, `mfaChallengeCookie`,
140
+ `MFA_CHALLENGE_COOKIE` — so a password sign-in holds its challenge in the same cookie
141
+ (`x g sign-in --password` does, `As of 2026-11-19`).
142
+
135
143
  `defineAuth({ providers })` lists both ids; an unknown or not-enabled id is `X_IDENTITY_PROVIDER_UNKNOWN` (404).
136
144
 
137
145
  **OIDC replay.** `oidcIdentityProvider` claims the handshake's `state` once in the shared replay store before it spends the code, keyed on when the handshake was issued: a callback lifted from a browser is `X_OAUTH_STATE_INVALID` even inside the cookie's lifetime, and so is any answer more than 10 minutes after `begin` (`DEFAULT_HANDSHAKE_TTL_MS`).
@@ -206,6 +214,7 @@ const approved = await verifyPasskeyEvidence(evidence, { rpId: 'example.com', or
206
214
  | checked, every ceremony | `clientDataJSON` type, the origin against the declared list exactly (no cross-origin iframe), `rpIdHash`, **UP and UV** (user verification is required, never preferred), the signature with the STORED key's algorithm |
207
215
  | challenge | 32 random bytes, stored as its sha256 in `x_passkey_challenges` with a TTL, consumed by one `DELETE … RETURNING` — single-use across the fleet, never a process map. Unknown, spent and late are one code: `X_PASSKEY_CHALLENGE_EXPIRED` |
208
216
  | counter | a signature counter that did not move forward is a cloned authenticator (`X_PASSKEY_INVALID`); both zero is an authenticator that keeps none, allowed. Advanced compare-and-set |
217
+ | label | `renamePasskey(auth, { userId, id, label: 'Work laptop' })` names it — right after `register`, or later — `null` clearing it, `null` answered for an id `userId` does not hold (`As of 2026-11`). 1-64 characters after trimming, then no control character or lone surrogate, else `X_PASSKEY_LABEL_INVALID`. `PasskeyCredential.label` is absent for none. An adapter of your own without the optional `renamePasskey` member is `X_PASSKEY_RENAME_UNSUPPORTED` |
209
218
  | registration | `attestation: 'none'` — the statement is parsed, not trusted; a credential id already registered to anyone is `X_AUTH_WRITE_FAILED`; a challenge issued to one account never registers onto another |
210
219
  | sign-in | the session is `mfaSatisfied`: a user-verified passkey is possession plus the device's PIN or biometric |
211
220
  | step-up challenge | `SHA-256("ultimate.passkey.step-up.v1\0" ‖ nonce ‖ len ‖ digest ‖ userId)` — never supplied by a caller. A proof for other bytes, or none, is `X_PASSKEY_STEP_UP_REQUIRED` |
@@ -218,6 +227,7 @@ const approved = await verifyPasskeyEvidence(evidence, { rpId: 'example.com', or
218
227
  |---|---|
219
228
  | TOTP + recovery codes | `enrolTotp`, `saveTotpSecret`, `generateRecoveryCodes`. The secret is **sealed at rest** under the app's master key and a plaintext one is refused, never read (`X_MFA_SECRET_UNSEALED`; `x auth seal-mfa` seals rows from before); a recovery code is consumed in one statement, so it works once. A password proven with a factor outstanding is `X_MFA_REQUIRED`, whose `meta.challenge` is a sealed five-minute credential; `completeMfa(auth, challenge, code)` finishes the sign-in, meters the guess against the same lockout buckets a password guess spends, and refuses a spent code on every replica (`x_totp_steps`, installed by the boot) |
220
229
  | email verification, password reset, any other mailed credential | `defineVerificationPurpose({ name, template, ttlMs, identifier? })` → `{ issue, consume }` (`As of 2026-11`); `emailVerification` and `passwordReset` are its two built-in instances, and `issueVerification` / `consumeVerification` take any declared name. A token is consumed only when its hash matches, so a wrong guess cannot burn the victim's live link, and one purpose's token never consumes another's. A name declared twice or with no template is `X_VERIFICATION_PURPOSE_INVALID` at boot; an undeclared one at the call is `X_VERIFICATION_PURPOSE_UNKNOWN` (400). `VerificationPurpose` is `string`: a `switch` over it needs a default arm. The mail is sent through an injected `MailSender` ([Mail](Mail)) |
230
+ | sign-in by mailed link | Not exported yet: `signInWithLink` stays internal to `@ultimat3/auth` and ships in the next minor (`As of 2026-11`). A mailed credential today is `defineVerificationPurpose` + `consumeVerification` |
221
231
  | API keys — how an agent authenticates | `issueApiKey` → `ult_<env>_<id>_<secret>`, shown once; `verifyApiKey` + `apiKeyActor` give a `kind: 'agent'` actor whose scopes are the key's and never the owner's roles (`X_API_KEY_INVALID`). A key is its owner's credential: a missing or disabled owner refuses it on the next use, a wildcard scope (`*`, `<resource>:*`) is refused at issue, and an owned key keeps only the scopes its owner's grants cover — pass `grantsOf` to expand roles ([`packages/auth/README.md`](https://github.com/developerz-ai/ultimate/blob/main/packages/auth/README.md)); a key with no `userId` is unchanged. `apiKeyResolver(() => store)` is both as the `resolveToken` a bearer mount and `defineAppMcp()` take: `{ actor, scopes }` for a live key, one `null` for every wrong one, and a store fault left a throw. In a test the store is `memoryAuthAdapter()` |
222
232
  | service-to-service | `verifyWorkloadToken` reads a Kubernetes service-account token, a SPIFFE JWT-SVID or a cloud IMDS token (they are all one JWT); `actorFromService` gives a `kind: 'service'` actor. The returned `WorkloadToken` carries `raw`, the whole decoded payload, read only after every check held. mTLS is the mesh's job |
223
233
  | an external issuer's bearer (`As of 2026-11`) | `jwtBearerResolver({ keys, issuers, audience, requiredScope?, accept?, actorOf })` — `apiKeyResolver`'s twin for JWTs, the `resolveToken` a bearer mount and `defineAppMcp()` take. `keys` is a thunk read when a token arrives (no discovery at import); `accept(raw)` is the app's own claim check after the signature; `actorOf(token)` builds the actor. Every refusal — signature, issuer, audience, expiry, scope, `accept`, and a key set that cannot be read — is `null` plus one `auth.jwt_bearer.refused` log line naming the check, never a claim's value. The mount answers that `null` as `401 X_UNAUTHENTICATED` |
@@ -274,11 +284,12 @@ const resolveToken = oauthBearerResolver(oauth, { actor: (grant) => actorFor(gra
274
284
  | Piece | What it does |
275
285
  |---|---|
276
286
  | `routes` | `GET /.well-known/oauth-authorization-server` (RFC 8414), `POST /oauth/token`, `/oauth/revoke` (RFC 7009), `/oauth/introspect` (RFC 7662), plus `/oauth/register` (RFC 7591, `registration: 'dynamic'`) and `/oauth/device` (RFC 8628). Plain `Route`s for `runtime.routes`, public, no cookie authenticates them. Every answer is `no-store` RFC 6749 JSON |
277
- | consent | the page calls `readRequest(url, { callerKey })` (`callerKey`: the request's address) → `{ client, scopes, resource, redirectUri }` or a refusal; an unknown client or unregistered redirect has `redirectTo: null` — render it, never redirect. Its action calls `approve({ subject, request, scopes? })` / `deny({ request })` for the redirect URL (`code`, `state`, `iss`). A forged request is `X_AUTH_CONSENT_INVALID` (422) |
287
+ | consent | the page calls `readRequest(url, { callerKey })` (`callerKey`: the request's address) → `{ client, scopes, resource, redirectUri }` or a refusal; a metadata-document client carries `client.host`, its `client_id`'s host, beside the `name` its own document chose — show the host, since the name is the client's to write (`As of 2026-11-19`); an unknown client or unregistered redirect has `redirectTo: null` — render it, never redirect. Its action calls `approve({ subject, request, scopes? })` / `deny({ request })` for the redirect URL (`code`, `state`, `iss`). A forged request is `X_AUTH_CONSENT_INVALID` (422) |
278
288
  | device | the verification page calls `readDevice({ userCode, key })`, `approveDevice` / `denyDevice`; `key` is the caller's bucket — 10 misses lock it (`X_ACCOUNT_LOCKED`) |
279
289
  | `registerClient(...)` | a client the app creates itself — a partner's `client_credentials` client; the secret is shown once and stored hashed. A redirect URI, grant, scope or resource that is empty or holds whitespace is `X_AUTH_CLIENT_INVALID` (422, `meta.field`): the store keeps each list space-joined, so it would read back as a different list |
280
- | `resolve(token)` | `{ subject, scopes, clientId, resource } \| null`. `oauthBearerResolver(server, { actor, resource? })` is the `resolveToken` a bearer mount and `defineAppMcp` take; `actor` runs per call, so a removed member loses access at once |
281
- | `revoke({ subject, clientId? })` · `purge({ before })` | immediate; `purge` is the app's `task` to schedule, nothing here runs on a timer |
290
+ | `resolve(token)` | `{ grantId, subject, scopes, clientId, resource } \| null` — `grantId` is the grant the token was issued under — a user's consent, or a `client_credentials` client's own — the same across every refresh rotation (`As of 2026-11-24`). `oauthBearerResolver(server, { actor, resource? })` is the `resolveToken` a bearer mount and `defineAppMcp` take; `actor` runs per call, so a removed member loses access at once |
291
+ | `grants({ subject, clientId? })` | the subject's live grants, oldest first: `{ grantId, clientId, scopes, resource, createdAt, refreshedAt }[]` — not revoked, and holding a stored token neither expired nor retired, so an abandoned consent or a grant whose tokens all passed their stored expiry is not listed. It needs an existing, unrevoked grant row and reads stored token expiry and retirement, not the current refresh policy: after a lifetime is shortened, or a client is denied refresh, its grant can stay listed while its row and an unexpired, unretired token remain — until that stored expiry, or sooner if `purge` removes the row. Each entry is a copy (`As of 2026-11-24`). A store without `liveGrants` (one of the app's own) is `X_AUTH_GRANTS_UNSUPPORTED` (`As of 2026-11-23`) |
292
+ | `revoke({ subject, clientId? })` · `revokeGrant({ subject, grantId, clientId? })` · `purge({ before })` | immediate; `revokeGrant` ends that one grant alone, refresh tokens included, and answers 0 for an id another subject (or another client than the one named) holds — the same answer as an unknown id (`As of 2026-11-23`); two racing calls on one grant count it once, through the store's optional `revokeLiveGrant(id, at)`, which answers `true` only for the write that ended it; the memory and Postgres stores implement it, and a store without it (an app's own) is counted on its read (`As of 2026-11-24`). `grants` and `revokeGrant` are optional in the `AuthorizationServer` type only, so an app's own implementation still compiles: call them as `server.grants?.(…)`; `authorizationServer()` always sets both; `purge` is the app's `task` to schedule, nothing here runs on a timer. `purge` also deletes a self-registered client (a `d_` id, minted by `/oauth/register`) created before the refresh idle window that no grant, code or device code names; its next call is `invalid_client` and an MCP client re-registers. A client from `registerClient` (`c_`), and any registered before `As of 2026-11-19`, is never reaped |
282
293
 
283
294
  | Rule | Held by |
284
295
  |---|---|
@@ -292,10 +303,13 @@ const resolveToken = oauthBearerResolver(oauth, { actor: (grant) => actorFor(gra
292
303
  | `registerClient` refuses an empty or whitespace-holding list value, before a secret is minted (`X_AUTH_CLIENT_INVALID`) | `authorization-server-register-client.test.ts` |
293
304
  | `resource` (RFC 8707) binds the grant; one not in `resources` is `invalid_target` | `authorization-server-request.test.ts`, `oauth-bearer-resolver.test.ts` |
294
305
  | tokens are opaque and stored hashed, never a JWT, so `revoke` holds on the next lookup | `token-endpoints.test.ts` |
306
+ | `revokeGrant({ subject, grantId })` ends one grant and leaves its sibling on the same client refreshing; a rotation keeps the id; another subject's id revokes nothing | `authorization-server-grants.test.ts`, `authorization-server-postgres.test.ts` |
295
307
  | an `https://` `client_id` is a metadata document, fetched through `outbound({ dial: 'public' })`, 5 KiB, cached 5 minutes, public clients only | `authorization-server-clients.test.ts` |
296
- | every metadata-document fetch is metered (`X_ACCOUNT_LOCKED` past 10 a minute): per `callerKey`, or — when the consent page names none — on ONE shared bucket, so an unkeyed page is throttled as one caller | `authorization-server-clients.test.ts` |
308
+ | every metadata-document fetch is metered (`X_ACCOUNT_LOCKED` past 10 a minute): per `callerKey`'s network (`ipKey`: IPv4 whole, IPv6 per /64), or — when the consent page names none — on ONE shared bucket, so an unkeyed page is throttled as one caller | `authorization-server-clients.test.ts` |
297
309
  | `client_credentials`: confidential only, no refresh token, subject is the client | `grant-client-credentials.test.ts` |
298
- | dynamic registration never hands out `client_credentials` and is counted per address | `authorization-server-clients.test.ts` |
310
+ | dynamic registration never hands out `client_credentials` and is counted per network (`ipKey`, as login is) | `authorization-server-clients.test.ts` |
311
+ | dynamic registration takes at most 10 `redirect_uris` of at most 2,048 characters each, else 400 `invalid_client_metadata` and nothing stored; `scope` is deduplicated | `authorization-server-clients.test.ts` |
312
+ | `purge` reaps a `d_` client only when nothing names it, on both stores | `authorization-server-store.test.ts`, `authorization-server-postgres.test.ts`, `authServerStoreConformance` |
299
313
 
300
314
  Bad configuration is `X_AUTH_SERVER_INVALID` naming the field; a grant not in `grants` answers
301
315
  `unsupported_grant_type` and is logged `X_AUTH_GRANT_DISABLED`. The five tables (`x_oauth_*`) are
package/wiki/Bare-VM.md CHANGED
@@ -15,7 +15,7 @@ bun run verify
15
15
  |---|---|
16
16
  | `bunx create-ultimate demo --no-git` | bun, and a network the npm registry answers on. `--no-git` skips `git init`, which is the form an automated provisioner uses; without it the scaffold is committed, and that is git's only job here |
17
17
  | `cd demo` | — |
18
- | `bun run setup` | bun. Six steps: `bun install`, an `.env.development.local` touch, `x db gen "initial"` when `packages/db/migrations` holds no `.sql`, `x db migrate`, `x db seed`, `x manifest` |
18
+ | `bun run setup` | bun. Seven steps: `bun install`, `x merge-driver install`, an `.env.development.local` touch, `x db gen "initial"` when `packages/db/migrations` holds no `.sql`, `x db migrate`, `x db seed`, `x manifest` |
19
19
  | `bun run verify` | bun. `x verify`, the whole gate: its `budgets` step runs `x build --target static` itself, because `.x/build-stats.json` does not exist yet on a fresh box (`As of 30.0`) |
20
20
 
21
21
  `x new` installs nothing, so `bun run setup` is not optional and `cd demo && bun run verify` stops on
@@ -251,7 +251,8 @@ job's runner acquisition ahead of every other job, a few seconds.
251
251
  ## Width and memory, per job
252
252
 
253
253
  Each job sizes its own test width the same way the laptop does (`x verify` prints it on the step
254
- line, e.g. `3 workers (budget 4.0 GB)`): a budget of `max(2.75 GiB, 25% of the runner's RAM)`,
254
+ line, e.g. `3 workers (budget 4.0 GB)`; `ran 2 at once (peak), planned 3` when the machine held it
255
+ narrower): a budget of `max(2.75 GiB, 25% of the runner's RAM)`,
255
256
  1.25 GiB planned per worker, never more workers than cores. On a 16 GB `ubuntu-latest` that is 3
256
257
  workers; a 62 GB, 16-core workstation plans 12 (`As of 2026-11-07`, when the fixed 4 GiB cap went —
257
258
  the [machine ledger](Many-Agents) 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`