@opensaas/stack-core 0.44.0-alpha.6 → 0.44.0-alpha.7

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 (352) hide show
  1. package/CHANGELOG.md +655 -0
  2. package/dist/.build-hash +1 -1
  3. package/dist/access/actor.d.ts +56 -0
  4. package/dist/access/actor.d.ts.map +1 -0
  5. package/dist/access/actor.js +66 -0
  6. package/dist/access/actor.js.map +1 -0
  7. package/dist/access/decide-advertisement.d.ts +55 -0
  8. package/dist/access/decide-advertisement.d.ts.map +1 -0
  9. package/dist/access/decide-advertisement.js +125 -0
  10. package/dist/access/decide-advertisement.js.map +1 -0
  11. package/dist/access/declared-dependencies.d.ts +4 -89
  12. package/dist/access/declared-dependencies.d.ts.map +1 -1
  13. package/dist/access/declared-dependencies.js +14 -84
  14. package/dist/access/declared-dependencies.js.map +1 -1
  15. package/dist/access/depth-limits.d.ts +2 -0
  16. package/dist/access/depth-limits.d.ts.map +1 -1
  17. package/dist/access/depth-limits.js +2 -0
  18. package/dist/access/depth-limits.js.map +1 -1
  19. package/dist/access/engine.d.ts +1 -24
  20. package/dist/access/engine.d.ts.map +1 -1
  21. package/dist/access/engine.js +0 -35
  22. package/dist/access/engine.js.map +1 -1
  23. package/dist/access/field-access.d.ts +21 -19
  24. package/dist/access/field-access.d.ts.map +1 -1
  25. package/dist/access/field-access.js +100 -122
  26. package/dist/access/field-access.js.map +1 -1
  27. package/dist/access/index.d.ts +3 -6
  28. package/dist/access/index.d.ts.map +1 -1
  29. package/dist/access/index.js +3 -6
  30. package/dist/access/index.js.map +1 -1
  31. package/dist/access/rule-item.d.ts +7 -7
  32. package/dist/access/rule-item.d.ts.map +1 -1
  33. package/dist/access/rule-item.js +38 -38
  34. package/dist/access/rule-item.js.map +1 -1
  35. package/dist/access/session-vocabulary.d.ts +124 -0
  36. package/dist/access/session-vocabulary.d.ts.map +1 -0
  37. package/dist/access/session-vocabulary.js +366 -0
  38. package/dist/access/session-vocabulary.js.map +1 -0
  39. package/dist/access/transaction-registry.d.ts +6 -0
  40. package/dist/access/transaction-registry.d.ts.map +1 -1
  41. package/dist/access/transaction-registry.js +19 -2
  42. package/dist/access/transaction-registry.js.map +1 -1
  43. package/dist/access/types.d.ts +55 -6
  44. package/dist/access/types.d.ts.map +1 -1
  45. package/dist/access/vocabulary-filter-specs.d.ts +17 -0
  46. package/dist/access/vocabulary-filter-specs.d.ts.map +1 -0
  47. package/dist/access/vocabulary-filter-specs.js +27 -0
  48. package/dist/access/vocabulary-filter-specs.js.map +1 -0
  49. package/dist/client-safe.d.ts +8 -0
  50. package/dist/client-safe.d.ts.map +1 -0
  51. package/dist/client-safe.js +8 -0
  52. package/dist/client-safe.js.map +1 -0
  53. package/dist/config/field-kind.d.ts +7 -21
  54. package/dist/config/field-kind.d.ts.map +1 -1
  55. package/dist/config/field-kind.js +8 -5
  56. package/dist/config/field-kind.js.map +1 -1
  57. package/dist/config/index.d.ts +1 -1
  58. package/dist/config/index.d.ts.map +1 -1
  59. package/dist/config/index.js +3 -2
  60. package/dist/config/index.js.map +1 -1
  61. package/dist/config/mcp-default-tools.d.ts +3 -0
  62. package/dist/config/mcp-default-tools.d.ts.map +1 -0
  63. package/dist/config/mcp-default-tools.js +14 -0
  64. package/dist/config/mcp-default-tools.js.map +1 -0
  65. package/dist/config/mcp-tool-names.d.ts +2 -0
  66. package/dist/config/mcp-tool-names.d.ts.map +1 -1
  67. package/dist/config/mcp-tool-names.js +17 -5
  68. package/dist/config/mcp-tool-names.js.map +1 -1
  69. package/dist/config/nav-count.d.ts +8 -16
  70. package/dist/config/nav-count.d.ts.map +1 -1
  71. package/dist/config/nav-count.js +20 -32
  72. package/dist/config/nav-count.js.map +1 -1
  73. package/dist/config/plugin-engine.d.ts.map +1 -1
  74. package/dist/config/plugin-engine.js +6 -0
  75. package/dist/config/plugin-engine.js.map +1 -1
  76. package/dist/config/types.d.ts +141 -28
  77. package/dist/config/types.d.ts.map +1 -1
  78. package/dist/context/engine-context.d.ts +2 -0
  79. package/dist/context/engine-context.d.ts.map +1 -1
  80. package/dist/context/engine-context.js +8 -0
  81. package/dist/context/engine-context.js.map +1 -1
  82. package/dist/context/hook-pipeline.d.ts +2 -1
  83. package/dist/context/hook-pipeline.d.ts.map +1 -1
  84. package/dist/context/hook-pipeline.js +4 -2
  85. package/dist/context/hook-pipeline.js.map +1 -1
  86. package/dist/context/index.d.ts +5 -1
  87. package/dist/context/index.d.ts.map +1 -1
  88. package/dist/context/index.js +156 -84
  89. package/dist/context/index.js.map +1 -1
  90. package/dist/context/junction.d.ts +28 -21
  91. package/dist/context/junction.d.ts.map +1 -1
  92. package/dist/context/junction.js +74 -69
  93. package/dist/context/junction.js.map +1 -1
  94. package/dist/context/plugin-field-write.d.ts.map +1 -1
  95. package/dist/context/plugin-field-write.js +19 -25
  96. package/dist/context/plugin-field-write.js.map +1 -1
  97. package/dist/context/process-lifetime.d.ts +8 -0
  98. package/dist/context/process-lifetime.d.ts.map +1 -0
  99. package/dist/context/process-lifetime.js +14 -0
  100. package/dist/context/process-lifetime.js.map +1 -0
  101. package/dist/context/relationship-input.d.ts +2 -15
  102. package/dist/context/relationship-input.d.ts.map +1 -1
  103. package/dist/context/relationship-input.js +44 -85
  104. package/dist/context/relationship-input.js.map +1 -1
  105. package/dist/context/transaction-boundary.d.ts +3 -2
  106. package/dist/context/transaction-boundary.d.ts.map +1 -1
  107. package/dist/context/transaction-boundary.js +17 -2
  108. package/dist/context/transaction-boundary.js.map +1 -1
  109. package/dist/context/write-pipeline.d.ts +5 -19
  110. package/dist/context/write-pipeline.d.ts.map +1 -1
  111. package/dist/context/write-pipeline.js +40 -98
  112. package/dist/context/write-pipeline.js.map +1 -1
  113. package/dist/context/write-target.d.ts +52 -0
  114. package/dist/context/write-target.d.ts.map +1 -0
  115. package/dist/context/write-target.js +118 -0
  116. package/dist/context/write-target.js.map +1 -0
  117. package/dist/contract/dependencies.d.ts +24 -10
  118. package/dist/contract/dependencies.d.ts.map +1 -1
  119. package/dist/contract/dependencies.js +120 -80
  120. package/dist/contract/dependencies.js.map +1 -1
  121. package/dist/contract/derive.d.ts +6 -11
  122. package/dist/contract/derive.d.ts.map +1 -1
  123. package/dist/contract/derive.js +256 -211
  124. package/dist/contract/derive.js.map +1 -1
  125. package/dist/contract/id-boundary.js +1 -1
  126. package/dist/contract/id-boundary.js.map +1 -1
  127. package/dist/contract/strategy.d.ts +13 -0
  128. package/dist/contract/strategy.d.ts.map +1 -0
  129. package/dist/contract/strategy.js +38 -0
  130. package/dist/contract/strategy.js.map +1 -0
  131. package/dist/db/client-alias.d.ts +12 -0
  132. package/dist/db/client-alias.d.ts.map +1 -0
  133. package/dist/db/client-alias.js +8 -0
  134. package/dist/db/client-alias.js.map +1 -0
  135. package/dist/extend.d.ts +1 -1
  136. package/dist/extend.d.ts.map +1 -1
  137. package/dist/extend.js.map +1 -1
  138. package/dist/fields/index.d.ts +0 -3
  139. package/dist/fields/index.d.ts.map +1 -1
  140. package/dist/fields/index.js +25 -10
  141. package/dist/fields/index.js.map +1 -1
  142. package/dist/filter/collect.d.ts +28 -39
  143. package/dist/filter/collect.d.ts.map +1 -1
  144. package/dist/filter/collect.js +46 -68
  145. package/dist/filter/collect.js.map +1 -1
  146. package/dist/filter/index.d.ts +1 -1
  147. package/dist/filter/index.d.ts.map +1 -1
  148. package/dist/filter/index.js +1 -1
  149. package/dist/filter/index.js.map +1 -1
  150. package/dist/filter/map.d.ts +4 -0
  151. package/dist/filter/map.d.ts.map +1 -1
  152. package/dist/filter/map.js +36 -3
  153. package/dist/filter/map.js.map +1 -1
  154. package/dist/hooks/index.d.ts +4 -1
  155. package/dist/hooks/index.d.ts.map +1 -1
  156. package/dist/hooks/index.js +34 -5
  157. package/dist/hooks/index.js.map +1 -1
  158. package/dist/index.d.ts +8 -7
  159. package/dist/index.d.ts.map +1 -1
  160. package/dist/index.js +5 -5
  161. package/dist/index.js.map +1 -1
  162. package/dist/internal.d.ts +5 -2
  163. package/dist/internal.d.ts.map +1 -1
  164. package/dist/internal.js +4 -5
  165. package/dist/internal.js.map +1 -1
  166. package/dist/mcp/advertise.d.ts +5 -13
  167. package/dist/mcp/advertise.d.ts.map +1 -1
  168. package/dist/mcp/advertise.js +7 -22
  169. package/dist/mcp/advertise.js.map +1 -1
  170. package/dist/mcp/arguments.d.ts.map +1 -1
  171. package/dist/mcp/arguments.js +8 -11
  172. package/dist/mcp/arguments.js.map +1 -1
  173. package/dist/mcp/field-schema.d.ts +4 -15
  174. package/dist/mcp/field-schema.d.ts.map +1 -1
  175. package/dist/mcp/field-schema.js +41 -71
  176. package/dist/mcp/field-schema.js.map +1 -1
  177. package/dist/mcp/handler.d.ts +111 -18
  178. package/dist/mcp/handler.d.ts.map +1 -1
  179. package/dist/mcp/handler.js +168 -73
  180. package/dist/mcp/handler.js.map +1 -1
  181. package/dist/mcp/index.d.ts +2 -1
  182. package/dist/mcp/index.d.ts.map +1 -1
  183. package/dist/mcp/index.js +1 -1
  184. package/dist/mcp/index.js.map +1 -1
  185. package/dist/mcp/procedure-tools.d.ts +63 -0
  186. package/dist/mcp/procedure-tools.d.ts.map +1 -0
  187. package/dist/mcp/procedure-tools.js +139 -0
  188. package/dist/mcp/procedure-tools.js.map +1 -0
  189. package/dist/mcp/projection.d.ts.map +1 -1
  190. package/dist/mcp/projection.js +28 -36
  191. package/dist/mcp/projection.js.map +1 -1
  192. package/dist/mcp/reachability.d.ts +5 -1
  193. package/dist/mcp/reachability.d.ts.map +1 -1
  194. package/dist/mcp/reachability.js +24 -5
  195. package/dist/mcp/reachability.js.map +1 -1
  196. package/dist/mcp/relation-member.d.ts +15 -0
  197. package/dist/mcp/relation-member.d.ts.map +1 -0
  198. package/dist/mcp/relation-member.js +50 -0
  199. package/dist/mcp/relation-member.js.map +1 -0
  200. package/dist/mcp/types.d.ts +12 -0
  201. package/dist/mcp/types.d.ts.map +1 -1
  202. package/dist/mcp/where-id-boundary.d.ts.map +1 -1
  203. package/dist/mcp/where-id-boundary.js +12 -24
  204. package/dist/mcp/where-id-boundary.js.map +1 -1
  205. package/dist/mcp/where-reachability.d.ts +2 -0
  206. package/dist/mcp/where-reachability.d.ts.map +1 -1
  207. package/dist/mcp/where-reachability.js +39 -23
  208. package/dist/mcp/where-reachability.js.map +1 -1
  209. package/dist/members/claims.d.ts +71 -0
  210. package/dist/members/claims.d.ts.map +1 -0
  211. package/dist/members/claims.js +199 -0
  212. package/dist/members/claims.js.map +1 -0
  213. package/dist/members/list-members.d.ts +87 -0
  214. package/dist/members/list-members.d.ts.map +1 -0
  215. package/dist/members/list-members.js +250 -0
  216. package/dist/members/list-members.js.map +1 -0
  217. package/dist/procedures/client.d.ts +163 -0
  218. package/dist/procedures/client.d.ts.map +1 -0
  219. package/dist/procedures/client.js +152 -0
  220. package/dist/procedures/client.js.map +1 -0
  221. package/dist/procedures/codes.d.ts +23 -0
  222. package/dist/procedures/codes.d.ts.map +1 -0
  223. package/dist/procedures/codes.js +46 -0
  224. package/dist/procedures/codes.js.map +1 -0
  225. package/dist/procedures/context-face.d.ts +4 -0
  226. package/dist/procedures/context-face.d.ts.map +1 -0
  227. package/dist/procedures/context-face.js +31 -0
  228. package/dist/procedures/context-face.js.map +1 -0
  229. package/dist/procedures/failures.d.ts +31 -0
  230. package/dist/procedures/failures.d.ts.map +1 -0
  231. package/dist/procedures/failures.js +51 -0
  232. package/dist/procedures/failures.js.map +1 -0
  233. package/dist/procedures/http.d.ts +114 -0
  234. package/dist/procedures/http.d.ts.map +1 -0
  235. package/dist/procedures/http.js +224 -0
  236. package/dist/procedures/http.js.map +1 -0
  237. package/dist/procedures/index.d.ts +7 -0
  238. package/dist/procedures/index.d.ts.map +1 -0
  239. package/dist/procedures/index.js +11 -0
  240. package/dist/procedures/index.js.map +1 -0
  241. package/dist/procedures/procedure.d.ts +204 -0
  242. package/dist/procedures/procedure.d.ts.map +1 -0
  243. package/dist/procedures/procedure.js +123 -0
  244. package/dist/procedures/procedure.js.map +1 -0
  245. package/dist/procedures/result.d.ts +42 -0
  246. package/dist/procedures/result.d.ts.map +1 -0
  247. package/dist/procedures/result.js +51 -0
  248. package/dist/procedures/result.js.map +1 -0
  249. package/dist/procedures/run.d.ts +36 -0
  250. package/dist/procedures/run.d.ts.map +1 -0
  251. package/dist/procedures/run.js +76 -0
  252. package/dist/procedures/run.js.map +1 -0
  253. package/dist/procedures/server.d.ts +131 -0
  254. package/dist/procedures/server.d.ts.map +1 -0
  255. package/dist/procedures/server.js +115 -0
  256. package/dist/procedures/server.js.map +1 -0
  257. package/dist/procedures/validate.d.ts +60 -0
  258. package/dist/procedures/validate.d.ts.map +1 -0
  259. package/dist/procedures/validate.js +254 -0
  260. package/dist/procedures/validate.js.map +1 -0
  261. package/dist/procedures/web-session.d.ts +12 -0
  262. package/dist/procedures/web-session.d.ts.map +1 -0
  263. package/dist/procedures/web-session.js +35 -0
  264. package/dist/procedures/web-session.js.map +1 -0
  265. package/dist/query/relationship-options.d.ts +2 -0
  266. package/dist/query/relationship-options.d.ts.map +1 -1
  267. package/dist/query/relationship-options.js +3 -2
  268. package/dist/query/relationship-options.js.map +1 -1
  269. package/dist/secured/binding.d.ts +84 -0
  270. package/dist/secured/binding.d.ts.map +1 -0
  271. package/dist/secured/binding.js +52 -0
  272. package/dist/secured/binding.js.map +1 -0
  273. package/dist/secured/declared-branch.d.ts +11 -0
  274. package/dist/secured/declared-branch.d.ts.map +1 -0
  275. package/dist/secured/declared-branch.js +17 -0
  276. package/dist/secured/declared-branch.js.map +1 -0
  277. package/dist/secured/field-visibility.d.ts +56 -0
  278. package/dist/secured/field-visibility.d.ts.map +1 -0
  279. package/dist/secured/field-visibility.js +624 -0
  280. package/dist/secured/field-visibility.js.map +1 -0
  281. package/dist/secured/include.d.ts +68 -41
  282. package/dist/secured/include.d.ts.map +1 -1
  283. package/dist/secured/include.js +217 -115
  284. package/dist/secured/include.js.map +1 -1
  285. package/dist/secured/lower.d.ts.map +1 -1
  286. package/dist/secured/lower.js +1 -3
  287. package/dist/secured/lower.js.map +1 -1
  288. package/dist/secured/read.d.ts +11 -108
  289. package/dist/secured/read.d.ts.map +1 -1
  290. package/dist/secured/read.js +46 -633
  291. package/dist/secured/read.js.map +1 -1
  292. package/dist/secured/select.d.ts +0 -24
  293. package/dist/secured/select.d.ts.map +1 -1
  294. package/dist/secured/select.js +60 -153
  295. package/dist/secured/select.js.map +1 -1
  296. package/dist/secured/vocabulary.d.ts +13 -1
  297. package/dist/secured/vocabulary.d.ts.map +1 -1
  298. package/dist/secured/vocabulary.js +173 -83
  299. package/dist/secured/vocabulary.js.map +1 -1
  300. package/dist/testing/untyped-rule.d.ts +8 -0
  301. package/dist/testing/untyped-rule.d.ts.map +1 -0
  302. package/dist/testing/untyped-rule.js +4 -0
  303. package/dist/testing/untyped-rule.js.map +1 -0
  304. package/dist/types/index.d.ts +1 -1
  305. package/dist/types/index.d.ts.map +1 -1
  306. package/dist/types/rows.d.ts +18 -1
  307. package/dist/types/rows.d.ts.map +1 -1
  308. package/dist/validation/config-refusal.d.ts +3 -1
  309. package/dist/validation/config-refusal.d.ts.map +1 -1
  310. package/dist/validation/database-config.d.ts +1 -0
  311. package/dist/validation/database-config.d.ts.map +1 -1
  312. package/dist/validation/database-config.js +1 -1
  313. package/dist/validation/database-config.js.map +1 -1
  314. package/dist/validation/default-value.d.ts.map +1 -1
  315. package/dist/validation/default-value.js +3 -8
  316. package/dist/validation/default-value.js.map +1 -1
  317. package/dist/validation/extension-packs.d.ts.map +1 -1
  318. package/dist/validation/extension-packs.js +1 -0
  319. package/dist/validation/extension-packs.js.map +1 -1
  320. package/dist/validation/field-config.d.ts +3 -2
  321. package/dist/validation/field-config.d.ts.map +1 -1
  322. package/dist/validation/field-config.js +3 -1
  323. package/dist/validation/field-config.js.map +1 -1
  324. package/dist/validation/field-names.d.ts +2 -1
  325. package/dist/validation/field-names.d.ts.map +1 -1
  326. package/dist/validation/field-names.js +76 -63
  327. package/dist/validation/field-names.js.map +1 -1
  328. package/dist/validation/identifier-names.d.ts +1 -0
  329. package/dist/validation/identifier-names.d.ts.map +1 -1
  330. package/dist/validation/identifier-names.js +17 -9
  331. package/dist/validation/identifier-names.js.map +1 -1
  332. package/dist/validation/needs-closure.d.ts +30 -14
  333. package/dist/validation/needs-closure.d.ts.map +1 -1
  334. package/dist/validation/needs-closure.js +184 -31
  335. package/dist/validation/needs-closure.js.map +1 -1
  336. package/dist/validation/schema.d.ts +1 -0
  337. package/dist/validation/schema.d.ts.map +1 -1
  338. package/dist/validation/schema.js +4 -2
  339. package/dist/validation/schema.js.map +1 -1
  340. package/package.json +20 -4
  341. package/dist/access/field-visibility.d.ts +0 -11
  342. package/dist/access/field-visibility.d.ts.map +0 -1
  343. package/dist/access/field-visibility.js +0 -366
  344. package/dist/access/field-visibility.js.map +0 -1
  345. package/dist/access/query-validation.d.ts +0 -30
  346. package/dist/access/query-validation.d.ts.map +0 -1
  347. package/dist/access/query-validation.js +0 -49
  348. package/dist/access/query-validation.js.map +0 -1
  349. package/dist/access/system-fields.d.ts +0 -2
  350. package/dist/access/system-fields.d.ts.map +0 -1
  351. package/dist/access/system-fields.js +0 -7
  352. package/dist/access/system-fields.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,660 @@
1
1
  # @opensaas/stack-core
2
2
 
3
+ ## 0.44.0-alpha.7
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2559](https://github.com/OpenSaasAU/stack/pull/2559) [`9ead1d9`](https://github.com/OpenSaasAU/stack/commit/9ead1d9233bde5ce9c5396fd56b43227cbeabd7a) Thanks [@borisno2](https://github.com/borisno2)! - Every session a host builds carries an actor, so access rules and hooks can tell a person on the web from an agent acting for one
8
+
9
+ `session.actor` is a reserved key. The procedure HTTP host sets a human actor and the MCP handler sets an agent actor. Only a host can set it: an `actor` no host created, whether from a token claim, a session provider, a `getSession` result or an object application code passes to `getContext` or `withSession`, is removed before the session reaches an access rule or a hook, and reads as absent.
10
+
11
+ ```typescript
12
+ import type { AccessControl } from '@opensaas/stack-core'
13
+
14
+ // { kind: 'human', userId, via: 'web' }
15
+ const humansOnly: AccessControl = ({ session }) => session?.actor?.kind === 'human'
16
+
17
+ // { kind: 'agent', clientId, onBehalfOf, via: 'mcp' }
18
+ const trustedAgent: AccessControl = ({ session }) =>
19
+ session?.actor?.kind === 'agent' && session.actor.clientId === 'my-first-party-client'
20
+ ```
21
+
22
+ An agent's session keeps the user's `userId`, so rules that scope by it still limit the agent to what that user can do. A session no host built (`getContext(session)` in a server component, `withSession`, a test context) has no actor, and an absent actor is never human: check `=== 'human'` or `=== 'agent'`, never `!== 'agent'`. The actor is the same frozen object in access rules, hooks, `sudo()` and `context.transaction()`.
23
+
24
+ `context.session` is now a frozen shallow copy of the session you pass, so assigning to it (`context.session.role = …`) throws. The object you passed is not frozen or changed. Rebinding it (`context.session = …`) throws `TypeError` on every context, including the ones hooks, access rules and `context.transaction()` callbacks receive.
25
+
26
+ A session must therefore be plain data, or an instance of a class with no private (`#`) fields and no methods that write to it. The copy keeps the prototype but never runs the constructor, so a `Map`, `Date` or array session, or a class reading private state, no longer works.
27
+
28
+ **This can break an existing custom MCP session provider.** `McpSession` now requires `clientId`, the OAuth client id the provider verified. A provider that returns a session without one fails to compile, and at runtime every request it authenticates is answered `500`, with the missing field named in the server log (`401` stays the answer for no session). Return the client the credential was issued to, read from the part the authorization server controls and never from a custom claim:
29
+
30
+ ```typescript
31
+ import type { McpSessionProvider } from '@opensaas/stack-core/mcp'
32
+
33
+ declare function verifyToken(
34
+ request: Request,
35
+ ): Promise<{ subject: string; clientId: string; scopes: string[] } | null>
36
+
37
+ export const getSession: McpSessionProvider = async (request) => {
38
+ const verified = await verifyToken(request)
39
+ if (verified === null) return null
40
+ return { userId: verified.subject, clientId: verified.clientId, scopes: verified.scopes }
41
+ }
42
+ ```
43
+
44
+ `createBetterAuthMcpAdapter` needs no change in your app: it now carries the verified token's `azp` as `clientId` and refuses a token without one. `clientId` and `actor` are no longer usable as custom claim names or flat session fields over MCP.
45
+
46
+ A context built under `withMcpAuth` carries the agent actor too: `mcpSessionToContextSession` now returns `{ userId, actor }`. For a custom provider, `mcpContextSession` from `@opensaas/stack-core/mcp` builds the session the MCP handler builds.
47
+
48
+ Other changes that can affect an app:
49
+
50
+ - `createProcedureHandler` fails a call with `INTERNAL` when `getSession` resolves a session with no usable `userId`, because it cannot say who is acting. `userId` must be an own property holding a non-empty string or a finite number. With `@opensaas/stack-auth`, `authPlugin({ sessionFields })` must include `userId` for an app that serves procedures; nothing refuses a config without it at startup, and the reported error names the fix.
51
+ - `sessionFields` naming `actor` is refused when the auth instance is created, and by `getSessionFromAuth`.
52
+ - `Session` now declares `actor`, so a `Session` augmentation must not redeclare it, and a rule annotated with an inline all-optional session type (`{ session: { role?: string } | null }`) no longer accepts `Session`. Annotate with `Session` or `AccessControl`.
53
+
54
+ - [#2553](https://github.com/OpenSaasAU/stack/pull/2553) [`299fd83`](https://github.com/OpenSaasAU/stack/commit/299fd83a50593f4e8eee0265253b750964fd2327) Thanks [@borisno2](https://github.com/borisno2)! - A procedure can run several operations atomically and throw a named failure that rolls them back.
55
+
56
+ `run` opens no transaction of its own. Wrap the writes that must succeed together in `context.transaction`; its context is narrowed like the procedure's own (no `sudo`, `unsafe`, `withSession` or `serverAction`, at runtime as well as in the type) and keeps `.forUpdate()` and `advisoryLock`. Declare the outcomes a caller should handle in `failures`, and throw what `fail` constructs:
57
+
58
+ ```typescript
59
+ import * as z from 'zod'
60
+ import { procedure } from '@/.opensaas/procedures'
61
+
62
+ export const bookSlot = procedure({
63
+ description: 'Book a place in a slot',
64
+ input: z.object({ slotId: z.string() }),
65
+ output: z.object({ bookingId: z.string() }),
66
+ failures: { SLOT_FULL: 'The slot has no places left', NO_SLOT: 'No such slot' },
67
+ access: ({ session }) => session !== null,
68
+ expose: ['web'],
69
+ run: async ({ input, context, fail }) =>
70
+ context.transaction(async (tx) => {
71
+ const held = await tx.db.Slot.where({ id: { equals: input.slotId } })
72
+ .forUpdate()
73
+ .first()
74
+ if (held === null) throw fail('NO_SLOT')
75
+
76
+ const booking = await tx.db.Booking.create({ data: { slotId: input.slotId } })
77
+ const slot = await tx.db.Slot.where({ id: { equals: input.slotId } }).first()
78
+ const { taken } = await tx.db.Booking.where({ slotId: { equals: input.slotId } }).aggregate(
79
+ (aggregate) => ({ taken: aggregate.count() }),
80
+ )
81
+ // Thrown after the write: the booking is rolled back.
82
+ if (booking === null || slot === null || taken > slot.capacity) throw fail('SLOT_FULL')
83
+ return { bookingId: booking.id }
84
+ }),
85
+ })
86
+ ```
87
+
88
+ `fail` accepts only the codes the procedure declares, so an undeclared code is a compile error, and `ProcedureResultOf<typeof bookSlot>` exposes the declared codes beside the reserved ones. Over HTTP a declared failure answers 200 with `{ success: false, error: { code, message } }`; `VALIDATION` stays 400 with field errors and `RETRY` and `CONFLICT` stay 409. Nothing retries a `RETRY` automatically: it reports that the transaction rolled back, not that work outside it was undone.
89
+
90
+ Things to know:
91
+
92
+ - `throw` a failure. One returned from `run` or from a transaction callback is treated as thrown, so it still rolls the transaction back and answers its code.
93
+ - A code is upper-case letters, digits and `_`. Declaring a reserved code (`UNAUTHENTICATED`, `DENIED`, `INVALID_INPUT`, `VALIDATION`, `RETRY`, `CONFLICT`, `INTERNAL`) is a compile error and is refused when the procedure is defined.
94
+ - Output is parsed after `run` returns, so output that fails its schema is `INTERNAL` and does not undo a transaction that already committed.
95
+ - A defined procedure's `access` and `run` now take the application context (`{ context }` and `{ input, context }`) and narrow it themselves. This only matters to code that called them directly instead of going through a host.
96
+
97
+ See ADR-0086.
98
+
99
+ - [#2549](https://github.com/OpenSaasAU/stack/pull/2549) [`d7d8b10`](https://github.com/OpenSaasAU/stack/commit/d7d8b1039447305165ffbd1e302f6a320fa93b1a) Thanks [@borisno2](https://github.com/borisno2)! - Bulk actions run in one transaction, and the selection bar behaves like Row actions
100
+
101
+ A Bulk action's handler now runs inside one transaction, with its `context` bound
102
+ to it, so a handler that throws part way rolls back every write it made. Keep slow
103
+ external calls out of the handler, since they hold the transaction open.
104
+
105
+ In the list view, a Bulk action that cannot reach the server says the result is
106
+ unknown and refreshes. The selection bar is disabled while one runs, and the table
107
+ stays on the current page afterwards. The status line can be dismissed. A refused
108
+ row delete says it may already be gone, or the session may not have access.
109
+
110
+ Confirmations now pluralise by English rules ("Delete 2 categories"). A list with
111
+ an irregular plural sets `ui.plural`:
112
+
113
+ ```typescript
114
+ const Person = list({ fields: { name: text() }, ui: { plural: 'People' } })
115
+ ```
116
+
117
+ - [#2549](https://github.com/OpenSaasAU/stack/pull/2549) [`d7d8b10`](https://github.com/OpenSaasAU/stack/commit/d7d8b1039447305165ffbd1e302f6a320fa93b1a) Thanks [@borisno2](https://github.com/borisno2)! - Brand the admin, name lists in the plural, and theme under a strict CSP
118
+
119
+ `ui.brand` sets the name, and an optional logo, that the admin shows in place of
120
+ "OpenSaas Admin":
121
+
122
+ ```typescript
123
+ export default config({
124
+ db: { provider: 'postgresql' },
125
+ lists: {},
126
+ ui: { brand: { name: 'Acme Console', logo: '/acme.svg' } },
127
+ })
128
+ ```
129
+
130
+ Lists are now named in the plural in the sidebar, on list pages, on the
131
+ dashboard and in "Back to …" links, using `ui.plural` when a list sets one.
132
+
133
+ `AdminUI` takes a `nonce` for the inline style that carries `ui.theme`. The sidebar
134
+ no longer marks a list active on another list whose URL starts with its own
135
+ (`/post` on `/post-tag`).
136
+
137
+ - [#2431](https://github.com/OpenSaasAU/stack/pull/2431) [`6422e97`](https://github.com/OpenSaasAU/stack/commit/6422e97c0a5e22a3ae19c5cb2fbe9a076feee34e) Thanks [@borisno2](https://github.com/borisno2)! - Add client-safe entry points so `next build --webpack` builds the admin
138
+
139
+ A `'use client'` module that imported from `@opensaas/stack-core` or `@opensaas/stack-ui` pulled the
140
+ server graph into the browser bundle, and webpack refused it (`UnhandledSchemeError: node:async_hooks`).
141
+ Turbopack tolerated the same graph, so only `next build --webpack` failed. The admin's own client
142
+ components now import from two new entries that reach nothing server-side:
143
+
144
+ - `@opensaas/stack-core/client-safe` — `getUrlKey`, `getListKeyFromUrl`, `resolveListKeyFromUrl` and the
145
+ filter-query helpers (`parseFilterQuery`, `serializeFilterQuery`, `recordIdFilterToken`, …). The root
146
+ entry still exports the same bindings.
147
+ - `@opensaas/stack-ui/cells` — the cell components and `registerCellComponent`.
148
+
149
+ A field-registration module in your app should import from these, never from a package root:
150
+
151
+ ```ts
152
+ // lib/register-fields.ts
153
+ 'use client'
154
+
155
+ // Before: pulled AdminUI and the server graph into the client bundle
156
+ // import { registerFieldComponent } from '@opensaas/stack-ui'
157
+ import { registerFieldComponent } from '@opensaas/stack-ui/fields'
158
+ import { registerCellComponent } from '@opensaas/stack-ui/cells'
159
+ import { getUrlKey } from '@opensaas/stack-core/client-safe'
160
+ ```
161
+
162
+ The rag and tiptap registration modules now do the same.
163
+
164
+ - [#2562](https://github.com/OpenSaasAU/stack/pull/2562) [`76fce00`](https://github.com/OpenSaasAU/stack/commit/76fce00b7ea85b0ac2af8d4f979757d1600912e9) Thanks [@borisno2](https://github.com/borisno2)! - Add `createServerCaller`, the in-process host for procedures, and a session-resolved context for server components
165
+
166
+ Server actions call procedures without passing an identity, and server components read through a context whose session comes from the request. Neither takes a session: `getSession` takes no argument and runs on every call, and the session it resolves carries the same human actor the HTTP host sets.
167
+
168
+ ```typescript
169
+ // lib/server.ts
170
+ import { createServerCaller } from '@opensaas/stack-core/procedures'
171
+ import { config, getContext } from '@/.opensaas/context'
172
+ import { procedures } from '@/lib/procedures' // declared with `satisfies ProcedureRegistry<Context>`
173
+ import { getSession } from '@/lib/auth'
174
+
175
+ const server = createServerCaller({ procedures, config: await config, getContext, getSession })
176
+
177
+ export const callProcedure = server.call
178
+ export const getServerContext = server.context
179
+ ```
180
+
181
+ ```typescript
182
+ // app/posts/actions.ts
183
+ 'use server'
184
+
185
+ import { redirect } from 'next/navigation'
186
+ import { callProcedure } from '@/lib/server'
187
+
188
+ export async function createPost(formData: FormData) {
189
+ const result = await callProcedure('createPost', { title: String(formData.get('title')) })
190
+ if (!result.success) return result.error
191
+ redirect(`/posts/${result.data.id}`)
192
+ }
193
+ ```
194
+
195
+ The caller performs no cookie or `Origin` check. In a server action the protection is Next's own server-action `Origin` check, and only that; a route handler that calls `call` for a mutation must be non-`GET` and check the origin itself (or use `createProcedureHandler`), and outside a request `getSession` must resolve `null`, since any session it resolves is acted on as a human on the web.
196
+
197
+ `call` runs the HTTP host's pipeline (exposure, access, input and output parsing, declared failures, redaction) and resolves to the same result, typed per procedure. Only procedures exposed to `'web'` are callable; any other name is `INTERNAL` and reported. A `redirect()` or `notFound()` thrown by the session resolver, the access rule or `run` reaches the framework in-process, and is `INTERNAL` over HTTP.
198
+
199
+ - [#2425](https://github.com/OpenSaasAU/stack/pull/2425) [`bc97369`](https://github.com/OpenSaasAU/stack/commit/bc973693857be40587c0c6903557cf32fe118ce5) Thanks [@borisno2](https://github.com/borisno2)! - Resolve Session vocabulary answers lazily, one question at a time
200
+
201
+ A list's Session vocabulary no longer resolves every rule of the list on the first ask. Each answer (an operation, a field's `read`/`create`/`update`, `filterable`, `sortable`) is asked only when a consumer needs it, and is memoised on its own for the context's life, so asking a related list's `query` and one field's `filterable` asks only those two rules. The whole vocabulary is assembled from the same answers, so no rule is asked twice per context.
202
+
203
+ The admin's list view filter labels, Relationship table column labels and link controls, item form relationship options and operation gates ask a related list only the questions they need.
204
+
205
+ `resolveNavCounts` behaviour changes:
206
+
207
+ - A list whose vocabulary read fails is now omitted and logged instead of rejecting the whole call.
208
+ - A framework's control flow (`redirect()`, `notFound()`) raised by a list's count call (`aggregate`) was previously caught, logged and the badge dropped; it now propagates out of `resolveNavCounts`, as control flow from the vocabulary read already did.
209
+
210
+ - [#2547](https://github.com/OpenSaasAU/stack/pull/2547) [`878c2ca`](https://github.com/OpenSaasAU/stack/commit/878c2ca8c30b0f7862ce71d639af00bacca7fa6d) Thanks [@borisno2](https://github.com/borisno2)! - Define an application action once as a procedure and call it over HTTP.
211
+
212
+ `opensaas generate` now writes `.opensaas/procedures.ts`, a `procedure` builder typed to your own `Context`. Keep procedures in a registry module of your own (never in `opensaas.config.ts`) and serve it with `createProcedureHandler` from `@opensaas/stack-core/procedures`:
213
+
214
+ ```typescript
215
+ // lib/procedures.ts
216
+ import * as z from 'zod'
217
+ import { procedure } from '@/.opensaas/procedures'
218
+
219
+ export const procedures = {
220
+ createPost: procedure({
221
+ description: 'Create a draft post authored by the caller',
222
+ input: z.object({ title: z.string().min(1) }),
223
+ output: z.object({ id: z.string(), title: z.string() }),
224
+ access: ({ session }) => session !== null,
225
+ expose: ['web'],
226
+ run: async ({ input, context }) => {
227
+ const post = await context.db.Post.create({ data: { title: input.title } })
228
+ if (post === null) throw new Error('Post was not created')
229
+ return post
230
+ },
231
+ }),
232
+ }
233
+
234
+ // app/api/procedures/[name]/route.ts
235
+ import { createProcedureHandler } from '@opensaas/stack-core/procedures'
236
+ import { getContext } from '@/.opensaas/context'
237
+ import { procedures } from '@/lib/procedures'
238
+ import { auth } from '@/lib/auth'
239
+
240
+ export const POST = createProcedureHandler({
241
+ procedures,
242
+ getContext,
243
+ getSession: async (request) => {
244
+ const result = await auth.api.getSession({ headers: request.headers })
245
+ return result ? { userId: result.user.id } : null
246
+ },
247
+ allowedOrigins: ['http://localhost:3000'],
248
+ })
249
+ ```
250
+
251
+ A caller POSTs JSON to `/api/procedures/<name>`. A call that reaches the procedure pipeline gets `{ success: true, data }` or `{ success: false, error: { code, message, fieldErrors? } }`. Transport failures do not use that envelope: 404 (unknown or unexposed name), 405 (not `POST`), 413 (body too large) and 415 (not `application/json`) answer `{ error: "<message>" }` with `error` as a string, so branch on the status first. Description, input, output, access and a non-empty `expose` are required. `run` receives `db`, `session`, `storage` and `plugins` only. A cookie request must come from an allowed origin, any `Authorization` header is refused, and unknown and unexposed names both answer 404. A default `z.object` output schema removes keys it does not declare and a strict one refuses them; a schema that does neither returns whatever `run` returned, and refusing such schemas when the host is created is [#2535](https://github.com/OpenSaasAU/stack/issues/2535). See ADR-0086.
252
+
253
+ - [#2420](https://github.com/OpenSaasAU/stack/pull/2420) [`4374e65`](https://github.com/OpenSaasAU/stack/commit/4374e651496547cafd7094fbd8330620b088a2ff) Thanks [@borisno2](https://github.com/borisno2)! - `checkFieldAccess` and `isListQueryStaticallyDenied` are gone from core's entry points, nav counts read the Session vocabulary, and the vocabulary rethrows only real framework control flow
254
+
255
+ The admin reads the Session vocabulary instead of evaluating access rules itself, so the field-access evaluator leaves `@opensaas/stack-core/internal`, and `isListQueryStaticallyDenied` leaves the root entry point.
256
+
257
+ `resolveNavCounts` counts a list only where the session's vocabulary does not deny `query`. A `query` rule returning `null` or `undefined` now shows no nav count instead of a `0`, and a context that resolves no vocabulary counts nothing.
258
+
259
+ A rule that throws while the vocabulary or MCP decides what to advertise is rethrown only when it is framework control flow: a string `digest` starting with one of Next.js's control-flow prefixes (`NEXT_REDIRECT`, `NEXT_HTTP_ERROR_FALLBACK`, `NEXT_NOT_FOUND`, `DYNAMIC_SERVER_USAGE`, `BAILOUT_TO_CLIENT_SIDE_RENDERING`, `HANGING_PROMISE_REJECTION`, `NEXT_PRERENDER_INTERRUPTED`), or React's postpone. As Next's `unstable_rethrow` does, an `Error` whose `cause` chain reaches one of those has that cause rethrown, so a rule wrapping `redirect()` in `new Error(message, { cause })` still redirects. Any other throw, including one carrying an unrelated `digest` or an unrelated `cause`, denies that answer and logs a warning.
260
+
261
+ `isHookOnlyField(field)` is added to `@opensaas/stack-core/internal`, so the admin marks a Hook-only field without reading its `access` itself.
262
+
263
+ - [#2516](https://github.com/OpenSaasAU/stack/pull/2516) [`9f17366`](https://github.com/OpenSaasAU/stack/commit/9f17366402cb263793d2a38c8ca52791ed79be1b) Thanks [@borisno2](https://github.com/borisno2)! - `needs` takes an object form that reaches any depth, so a computed field over a chain of relations no longer reads per row (ADR-0085).
264
+
265
+ ```ts
266
+ label: virtual({
267
+ type: 'string',
268
+ needs: { enrolment: { student: true, classTerm: ['class', 'term'] } },
269
+ hooks: {
270
+ resolveOutput: ({ item }) => `${item.enrolment?.student?.name ?? ''}`,
271
+ },
272
+ })
273
+ ```
274
+
275
+ A column takes `true`. A relation takes `true` for its rows' stored columns, or an array or object for exactly what is named beneath it. Every hop keeps its list's `query` access. The array form still reaches one hop.
276
+
277
+ - A synthetic back-relation (`from_<List>_<field>`) is accepted as a key in either form.
278
+ - `pnpm generate` warns when an array form names a relation whose list has a computed field with relation `needs` of its own, and prints the object form.
279
+ - A hook is handed shallow copies of its declared rows, carrying no relation it did not declare and each multi-column field under its own key in place of its part columns.
280
+ - A field `read` rule sees one hop: a relation on a related row is withheld.
281
+
282
+ Re-run `pnpm generate` after adopting it.
283
+
284
+ - [#2566](https://github.com/OpenSaasAU/stack/pull/2566) [`e06f639`](https://github.com/OpenSaasAU/stack/commit/e06f639fb3099b71586771008bdf0be5f9a5f93d) Thanks [@borisno2](https://github.com/borisno2)! - Serve procedures as MCP tools
285
+
286
+ Pass the procedure registry to `createMcpHandlers`, and each procedure whose `expose` names `'mcp'` becomes a tool named after it, with its description and its input schema as JSON Schema. A call runs the same pipeline as `createProcedureHandler` under the agent's session, and the tool result's text is the result envelope as JSON (`{ success, data }` or `{ success: false, error: { code, message, fieldErrors? } }`), with `isError` set on a failure. A procedure not exposed to `'mcp'` answers as an unknown tool.
287
+
288
+ ```typescript
289
+ import * as z from 'zod'
290
+ import { createMcpHandlers } from '@opensaas/stack-core/mcp'
291
+ import { procedure } from '@/.opensaas/procedures'
292
+
293
+ const publishPost = procedure({
294
+ description: 'Publish one of your draft posts',
295
+ input: z.object({ postId: z.string() }),
296
+ output: z.object({ id: z.string() }),
297
+ access: ({ session }) => session !== null,
298
+ expose: ['web', 'mcp'],
299
+ scopes: ['posts:publish'], // omitted: requires mcp.scopes.write; [] requires none
300
+ run: async ({ input, context }) => {
301
+ const post = await context.db.Post.update({
302
+ where: { id: input.postId },
303
+ data: { status: 'published' },
304
+ })
305
+ if (post === null) throw new Error('Post was not published')
306
+ return post
307
+ },
308
+ })
309
+
310
+ export const { GET, POST, DELETE } = createMcpHandlers({
311
+ config: await config,
312
+ getSession,
313
+ getContext,
314
+ procedures: { publishPost },
315
+ onUnexpectedProcedureError: (error, name) => console.error(name, error),
316
+ })
317
+ ```
318
+
319
+ A procedure is listed only when the token holds its scopes and its access rule admits the session, and both are checked again on every call; a missing scope is `DENIED` with the scope named. The registry is checked when the handlers are created, and an MCP-exposed procedure's input must be an object at its top level. With `procedures`, the context type is inferred from the registry, so the generated `getContext` and `procedure` builder type-check together.
320
+
321
+ - [#2546](https://github.com/OpenSaasAU/stack/pull/2546) [`a2598d5`](https://github.com/OpenSaasAU/stack/commit/a2598d5613274027b3c9500ad99f4b352547cecf) Thanks [@borisno2](https://github.com/borisno2)! - MCP write tools are now opt-in per list. This changes a default.
322
+
323
+ Enabling MCP gives each list its `list_<list>_query` tool and no generated `create`, `update` or `delete` tool. A list enables each write tool deliberately in its own `mcp.tools`; a write tool it has not enabled is neither listed nor callable (`Unknown tool`). An enabled tool still runs the list's access control, hooks and scopes. Custom and plugin tools are unchanged.
324
+
325
+ ```typescript
326
+ Post: list({
327
+ fields: { title: text() },
328
+ mcp: { tools: { create: true, update: true } }, // delete stays off
329
+ })
330
+ ```
331
+
332
+ `mcp.defaultTools` now takes `read` only. A config setting `create`, `update` or `delete` there, even to `false`, is refused by `config()` and `createMcpHandlers` with an error naming `lists.<List>.mcp.tools.<operation>`. `config()` refuses it even when `mcp.enabled` is not `true`, so an app with MCP switched off and the old `defaultTools` shape must remove those keys too.
333
+
334
+ To keep a list's write tools, move them onto the list:
335
+
336
+ ```typescript
337
+ // Before
338
+ mcp: { enabled: true, defaultTools: { read: true, create: true, update: true, delete: true } }
339
+
340
+ // After
341
+ mcp: { enabled: true, defaultTools: { read: true } }
342
+ // and on each list agents may write to:
343
+ Post: list({ fields: { /* ... */ }, mcp: { tools: { create: true, update: true, delete: true } } })
344
+ ```
345
+
346
+ - [#2549](https://github.com/OpenSaasAU/stack/pull/2549) [`d7d8b10`](https://github.com/OpenSaasAU/stack/commit/d7d8b1039447305165ffbd1e302f6a320fa93b1a) Thanks [@borisno2](https://github.com/borisno2)! - Relationship tables page in place, link only unlinked records, and can undo an unlink
347
+
348
+ A to-many table on the item page now pages through its rows: the footer reads
349
+ "Showing 11–20 of 42 rows" with Previous and Next, driven by a `<field>Page`
350
+ URL parameter, so each table keeps its own page. `ui.itemView.take` is the page size.
351
+
352
+ ```typescript
353
+ posts: relationship({ ref: 'Post.author', many: true, ui: { itemView: { take: 20 } } })
354
+ ```
355
+
356
+ "Link" now offers only records not already linked to this one. The
357
+ `relationshipOptions` server action takes `linkableFor`, the parent row's id,
358
+ and leaves out records already linked to that row, through a foreign key or a
359
+ junction list:
360
+
361
+ ```typescript
362
+ await context.serverAction({
363
+ listKey: 'Author',
364
+ action: 'relationshipOptions',
365
+ field: 'posts',
366
+ linkableFor: authorId,
367
+ })
368
+ ```
369
+
370
+ Each row's label cell links to the related record, so rows open from the
371
+ keyboard. Each ✕ is named for its row ("Unlink “Hello world”"). Unlinking shows
372
+ Undo, and the delete confirmation names the row it deletes.
373
+
374
+ - [#2415](https://github.com/OpenSaasAU/stack/pull/2415) [`59e8d70`](https://github.com/OpenSaasAU/stack/commit/59e8d70029aa90c01373aa8600a665bc538523ce) Thanks [@borisno2](https://github.com/borisno2)! - The Session vocabulary can answer its row-dependent write questions for one stored row
375
+
376
+ A consumer naming one row by its id now gets the vocabulary with each `'row-dependent'` write answer resolved for that row, against the stored row, as the write decides: core reads the row by identity exactly as an update does before it decides (every column, no relation), then answers a field's `update` against it as the row's guarded `item`, and the list's `update` and `delete` by the same target resolution a write runs (a filter-returning rule allows only a row its filter matches). A rule reaching for a relation the stored row does not carry answers deny, as the write does, and a row that is not there answers every row-dependent write question deny. A field's `read` is not resolved per row: Field Visibility decides it on each read, against the row that read delivers, so a row-dependent `read` stays `'row-dependent'`. `allow` and `deny` answers pass through without their rules being asked again, a rule that reads the payload stays `'row-dependent'`, and a rule that throws answers deny and is logged. It is disclosure only; the write still decides.
377
+
378
+ It is internal plumbing on the engine context (`_sessionVocabularyForItem(listKey, id)`), which `@opensaas/stack-ui` reads for the admin edit form and for `serializeFieldConfigs(context, listKey, 'update', item)`.
379
+
380
+ - [#2428](https://github.com/OpenSaasAU/stack/pull/2428) [`21bce38`](https://github.com/OpenSaasAU/stack/commit/21bce381ec8a4459bd591c3651962c4d6b21f646) Thanks [@borisno2](https://github.com/borisno2)! - Make the framework control-flow rethrow predicate injectable
381
+
382
+ A new `isFrameworkControlFlow` config option recognises a host framework's control flow thrown from inside an access rule, so the Session vocabulary, MCP's advertised vocabulary and the admin's nav counts let it propagate instead of folding it into a logged deny. It is OR'ed with the built-in recognition of Next.js's digests and React's postpone, and the `cause` walk applies to both. A predicate that throws recognises nothing and is reported once, so a rule's own throw still denies.
383
+
384
+ ```typescript
385
+ export default config({
386
+ db: { provider: 'postgresql' },
387
+ lists: {},
388
+ isFrameworkControlFlow: (thrown) => thrown instanceof Response,
389
+ })
390
+ ```
391
+
392
+ `opensaas generate` now wires Next.js's own `unstable_rethrow` into `.opensaas/context.ts` when the project's `package.json` declares `next`, so new Next control-flow signals are recognised without waiting for core to learn their digests. It is imported lazily, so the bundle still loads under plain Node, where it keeps the built-in recognition. Re-run `pnpm generate` to pick it up. A project without `next` gets the same context as before.
393
+
394
+ - [#2452](https://github.com/OpenSaasAU/stack/pull/2452) [`dc6ae19`](https://github.com/OpenSaasAU/stack/commit/dc6ae1999ef9b4e02573f308dc8f69f03dabbd8b) Thanks [@borisno2](https://github.com/borisno2)! - Junction-edge detection, the delegate's singleton shape and write-field ownership now ask the List member resolver, so a context built over a config whose list or member names `opensaas generate` refuses throws generate's own error at construction. Generate still runs further checks that context construction does not.
395
+
396
+ **Migrating:** a test or script that builds a context over a hand-written config with names `opensaas generate` would refuse (for example a camelCase list key, or a list-only to-many) now fails at `getContext`/`createTestContext`. Fix the config so `pnpm generate` accepts it.
397
+
398
+ - [#2418](https://github.com/OpenSaasAU/stack/pull/2418) [`4c5d2d2`](https://github.com/OpenSaasAU/stack/commit/4c5d2d275e667287b1ae5443dfb8b41902c84b48) Thanks [@borisno2](https://github.com/borisno2)! - The admin list view reads the Session vocabulary for everything it offers
399
+
400
+ The column picker, default columns, Preset views and the Filter builder offer only fields the session can read, sorting follows each field's `sortable` answer, and a field with `isFilterable: false` is absent from every place a filter can be built. A row-dependent readable field stays shown but is neither filterable nor sortable (ADR-0031). Count links and filter-chip labels read the related list's vocabulary, so a related list whose `query` rule returns `false`, `null` or `undefined` gets no link and no label lookup.
401
+
402
+ A session denied the list's `query` now sees an explicit "can't be shown here" state instead of an empty table, and keeps the Create button when it may still create (a write-only inbox). A Preset view's search drops every token naming a field the session cannot filter by (a never-readable or row-dependent field, or `isFilterable: false`), and a context that resolves no Session vocabulary shows the list's "could not be loaded" state instead of failing the page.
403
+
404
+ `collectFilterSpecs`, `buildListFilterWhere`, `collectFilterSuggestions` and `isFieldFilterableById` now answer from the context's Session vocabulary, which builds each Filter spec once per request: a `read` rule or a spec builder that throws denies that one field and is logged instead of failing the list. They answer for the context's own session and config, so `FilterAccessArgs` no longer takes a `session`, and `listConfig` and `config` must be the context's own. A context core did not build gets no specs and no throw:
405
+
406
+ ```ts
407
+ const specs = await collectFilterSpecs(listConfig, 'Post', config, { context })
408
+ ```
409
+
410
+ A throw carrying a string `digest` (Next.js's `redirect()`, `notFound()` and dynamic-usage bailouts) now propagates out of the Session vocabulary and the MCP vocabulary instead of being treated as a deny, so a rule that redirects still redirects.
411
+
412
+ The internal `_orderableKeys` context member and `collectUnreadableFields` are removed; read `context._sessionVocabulary(listKey)` instead (`fields.get(key)?.sortable`, `fields.get(key)?.read`).
413
+
414
+ - [#2449](https://github.com/OpenSaasAU/stack/pull/2449) [`e2e18be`](https://github.com/OpenSaasAU/stack/commit/e2e18be4812600f83c924e62d1ece0b05ee0f180) Thanks [@borisno2](https://github.com/borisno2)! - The Write Pipeline's ownership, singleton and part-column checks ask the List member resolver instead of re-deriving them from the config.
415
+
416
+ - Writes on a config whose list or member names `opensaas generate` refuses now throw generate's own error.
417
+ - Under sudo, a Synthetic back-relation key whose value is `undefined` is now refused as undeclared, like any other unknown key.
418
+ - `RelationTargetMissingError` is removed from `@opensaas/stack-core`: a `connect` to an undeclared list now fails with generate's refusal, so the error could no longer be thrown.
419
+
420
+ **Migrating:** remove any `instanceof RelationTargetMissingError` checks. The same mistake (a relationship whose `ref` names a list that does not exist) is now refused by `pnpm generate`, with a message naming the list and field, before any context is built.
421
+
422
+ - [#2412](https://github.com/OpenSaasAU/stack/pull/2412) [`ad85f09`](https://github.com/OpenSaasAU/stack/commit/ad85f095916eae5500e6e6b7e77e1ccbff24fa36) Thanks [@borisno2](https://github.com/borisno2)! - Add the Session vocabulary: one answer, per list and context, for what a session may be told ahead of any request (ADR-0084)
423
+
424
+ A context core built carries an internal `_sessionVocabulary(listKey)` member. It answers each field's read, create and update as `'allow'`, `'deny'` or `'row-dependent'`, each list operation by the engine's own rule (no rule, `null` and `undefined` deny; `true` or a filter allows), and whether each field is filterable and sortable. System fields (`id`, and automatic `createdAt`/`updatedAt`) have entries too, readable and never writable. A computed field and a relationship side that does not own the foreign key are never writable, and a hook-only field's writes stay denied under sudo. On a singleton list, `delete` is denied for every session, sudo included, and no field is filterable or sortable. A rule that throws, or a field rule that returns a filter, answers deny for that one question and is logged, so one broken rule never takes the rest of the list with it. Each context resolves with its own session and connection, once per list, and keeps the answer for its life: a write's transaction-bound hook context and its `afterTransaction` context each have their own, and a `resolveOutput` hook shares the answer of the read that ran it:
425
+
426
+ ```ts
427
+ import { engineContextOf } from '@opensaas/stack-core'
428
+
429
+ const vocabulary = await engineContextOf(context)._sessionVocabulary?.('Post')
430
+ vocabulary?.operations.update // 'allow' | 'deny' | 'row-dependent'
431
+ vocabulary?.fields.get('title') // { read, create, update, filterable, sortable, relationship }
432
+ ```
433
+
434
+ - [#2469](https://github.com/OpenSaasAU/stack/pull/2469) [`2f48eab`](https://github.com/OpenSaasAU/stack/commit/2f48eab7d64911588624fe7e66741c0c0ba540a9) Thanks [@borisno2](https://github.com/borisno2)! - Add `@opensaas/stack-core/db-client`, the server-only subpath for `resolveRuntimeConnection`, and deprecate `@opensaas/stack-core/client`
435
+
436
+ `/client` sat beside `/client-safe` and read as browser-safe, but it reaches `pg`. `opensaas generate` now emits the new subpath in `.opensaas/context.ts`. `/client` still resolves to the same bindings, marked `@deprecated`, and is removed at the next major.
437
+
438
+ Migration — regenerate (`pnpm generate`) and update any hand-written import:
439
+
440
+ ```typescript
441
+ // Before
442
+ import { resolveRuntimeConnection } from '@opensaas/stack-core/client'
443
+
444
+ // After
445
+ import { resolveRuntimeConnection } from '@opensaas/stack-core/db-client'
446
+ ```
447
+
448
+ - [#2462](https://github.com/OpenSaasAU/stack/pull/2462) [`5621a97`](https://github.com/OpenSaasAU/stack/commit/5621a977d4d13104c72d5166301ab8a3d2c535e7) Thanks [@relationship({](https://github.com/relationship({), [@relationship({](https://github.com/relationship({)! - `opensaas generate` refuses a computed (virtual) or multi-column field keyed like another field's foreign-key or part column
449
+
450
+ Such a field used to be accepted and then win every name lookup, so the foreign-key or part column it shadowed could not be named in `where`, `orderBy` or `select`. Generate, `deriveContract` and the List member resolver now refuse it with the same message, naming the list, both fields and the fix. A stored field keyed like another field's part column, already refused, now gets the same named message (reason `part-column-collision`):
451
+
452
+ ```
453
+ List "Post": fields.authorId collides with the foreign-key column "authorId" that fields.author derives for its relationship. Rename fields.authorId, or remove it and read the key through fields.author.
454
+ ```
455
+
456
+ Migration: rename the virtual or multi-column field.
457
+
458
+ ```ts
459
+ // Before: refused by generate
460
+ Post: list({
461
+ fields: {
462
+ ref: 'Author' }),
463
+ authorId: virtual({ type: 'string', hooks: { resolveOutput: () => '' } }),
464
+ },
465
+ })
466
+
467
+ // After
468
+ Post: list({
469
+ fields: {
470
+ ref: 'Author' }),
471
+ authorLabel: virtual({ type: 'string', hooks: { resolveOutput: () => '' } }),
472
+ },
473
+ })
474
+ ```
475
+
476
+ - [#2482](https://github.com/OpenSaasAU/stack/pull/2482) [`bab30df`](https://github.com/OpenSaasAU/stack/commit/bab30dfe01663f03ba49717d5c3d688ef0792f42) Thanks [@borisno2](https://github.com/borisno2)! - Require `assembleColumns` on every multi-column field
477
+
478
+ A field whose `getContractField` returns `{ kind: 'columns' }` must now supply `assembleColumns`. Without it the field had no value under its own key, so `.select()` returned nothing for it, a `needs` entry naming it gave the hook nothing, and MCP advertised a field it never returned. `opensaas generate` now refuses such a config, and so does building a context over it; each names the list, the field and the member. Generate reports:
479
+
480
+ ```
481
+ Profile.avatar (type "avatar") is missing assembleColumns()
482
+ ```
483
+
484
+ and context construction throws:
485
+
486
+ ```
487
+ Field "Profile.avatar" (type "avatar") is not self-contained: it does not declare assembleColumns(). ...
488
+ ```
489
+
490
+ Migration: supply `assembleColumns` on any `kind: 'columns'` field.
491
+
492
+ ```typescript
493
+ import type { BaseFieldConfig, TypeInfo } from '@opensaas/stack-core/extend'
494
+ import { z } from 'zod'
495
+
496
+ const avatar: BaseFieldConfig<TypeInfo> = {
497
+ type: 'avatar',
498
+ outputType: '{ filename: string; filesize: number } | null',
499
+ getZodSchema: () => z.object({ filename: z.string(), filesize: z.number() }).nullable(),
500
+ getContractField: () => ({
501
+ kind: 'columns',
502
+ columns: [
503
+ { name: 'avatar_filename', type: { pack: 'pg', type: 'text' }, nullable: true },
504
+ { name: 'avatar_filesize', type: { pack: 'pg', type: 'int' }, nullable: true },
505
+ ],
506
+ }),
507
+ assembleColumns: (_fieldName, row) =>
508
+ row.avatar_filename === null
509
+ ? null
510
+ : { filename: row.avatar_filename, filesize: row.avatar_filesize },
511
+ splitColumns: (_fieldName, value) => {
512
+ const parts = typeof value === 'object' && value !== null ? value : {}
513
+ return {
514
+ avatar_filename: 'filename' in parts ? parts.filename : null,
515
+ avatar_filesize: 'filesize' in parts ? parts.filesize : null,
516
+ }
517
+ },
518
+ }
519
+ ```
520
+
521
+ `image()`/`file()` in multi-column mode and `embedding()` already supply it.
522
+
523
+ - [#2561](https://github.com/OpenSaasAU/stack/pull/2561) [`df9191f`](https://github.com/OpenSaasAU/stack/commit/df9191f4b8f9810cc25280a822b8786d03cca3cd) Thanks [@borisno2](https://github.com/borisno2)! - Call procedures from the browser with a typed client.
524
+
525
+ `createProcedureClient` from the new `@opensaas/stack-core/procedures/client` entry calls the HTTP host with the name, the input and the result inferred from your registry. Give it the registry's **type**: the import is erased, so the entry is safe in a `'use client'` module and no server code reaches the bundle.
526
+
527
+ Declare the registry with `satisfies`, which keeps each procedure's own type:
528
+
529
+ ```typescript
530
+ // lib/procedures.ts
531
+ import type { ProcedureRegistry } from '@opensaas/stack-core/procedures'
532
+ import type { Context } from '@/.opensaas/types'
533
+
534
+ export const procedures = { createPost, bookSlot } satisfies ProcedureRegistry<Context>
535
+ ```
536
+
537
+ ```typescript
538
+ // components/book.ts
539
+ 'use client'
540
+
541
+ import { createProcedureClient } from '@opensaas/stack-core/procedures/client'
542
+ import type { procedures } from '@/lib/procedures'
543
+
544
+ const call = createProcedureClient<typeof procedures>()
545
+
546
+ export async function book(slotId: string): Promise<string> {
547
+ const result = await call('bookSlot', { slotId })
548
+ if (result.success) return `Booked ${result.data.bookingId}`
549
+ switch (result.error.code) {
550
+ case 'SLOT_FULL':
551
+ return 'That slot is full'
552
+ case 'transport':
553
+ return 'Could not reach the server'
554
+ default:
555
+ return result.error.message
556
+ }
557
+ }
558
+ ```
559
+
560
+ An unknown procedure name or a renamed input field is a compile error (and a registry type that admits any name, an annotated one or a missing type argument, leaves no name callable), and `error.code` is the union of the reserved codes, the codes that procedure declares and `'transport'`. A call never throws: a request the client did not send (an input JSON cannot carry, or a name no host serves), a request that was never answered, a refusal from the host before the pipeline ran (404, 405, 413, 415) and a response that is not a procedure result all resolve to `{ success: false, error: { code: 'transport', reason, status?, message } }` with `reason` `'unsent'`, `'network'`, `'refused'` or `'malformed'`. The client never retries, `RETRY` included, sends no `Authorization` header, and sends the input as given: leaving it out sends an empty body, which is allowed only where the input schema accepts `undefined`. Options are `baseUrl` (default `/api/procedures`), `credentials` (default `'same-origin'`) and `fetch`. A host on the page's own origin needs nothing more. A host on another origin also needs the application to answer the CORS preflight and add the CORS headers itself, since the host sends none. See ADR-0086.
561
+
562
+ - [#2552](https://github.com/OpenSaasAU/stack/pull/2552) [`6e9c64f`](https://github.com/OpenSaasAU/stack/commit/6e9c64f6afa74705ac5f5a34a5d13829ff4ba4ac) Thanks [@borisno2](https://github.com/borisno2)! - Refuse unsafe procedure definitions when the host is created.
563
+
564
+ `createProcedureHandler` now throws `ProcedureHostError`, naming the procedure, the offending part and the fix, for:
565
+
566
+ - an `input` or `output` schema that does not convert to JSON Schema on its own side (dates, bigints, output transforms, `z.undefined()`, `z.void()`)
567
+ - the open-ended shapes Zod provides, at any depth: `z.any()`, `z.unknown()`, `z.json()`, a loose object, a `z.looseRecord` or a `z.record` of `any`/`unknown`; and an output object with a `.catchall()`. A hand-written schema that accepts as much is not recognised
568
+ - `z.file()`, which a JSON body cannot carry
569
+ - a `config` option that is not a resolved config, such as an un-awaited promise
570
+ - a name matching the reserved `list_<list>_<operation>` pattern of generated MCP tools
571
+ - a name a list custom tool or a plugin-registered MCP tool already carries, when the host is given the config
572
+
573
+ ```typescript
574
+ // app/api/procedures/[name]/route.ts
575
+ import { createProcedureHandler } from '@opensaas/stack-core/procedures'
576
+ import config from '@/opensaas.config'
577
+ import { getContext } from '@/.opensaas/context'
578
+ import { procedures } from '@/lib/procedures'
579
+ import { getSession } from '@/lib/auth'
580
+
581
+ export const POST = createProcedureHandler({
582
+ procedures,
583
+ config: await config, // optional: adds the custom and plugin tool name check
584
+ getContext,
585
+ getSession: (request) => getSession(request.headers),
586
+ allowedOrigins: ['http://localhost:3000'],
587
+ })
588
+ ```
589
+
590
+ A procedure that takes no input uses `z.object({}).optional()`, one that returns nothing uses `z.null()`, and a date travels as `z.iso.datetime()`. The checks are also exported for other hosts: `assertProcedureRegistry`, `assertProcedureSchemas` and `assertProcedureNamesAvailable`.
591
+
592
+ ### Patch Changes
593
+
594
+ - [#2488](https://github.com/OpenSaasAU/stack/pull/2488) [`ae613f9`](https://github.com/OpenSaasAU/stack/commit/ae613f9fce8b76eaeb93354e527ad041504cb965) Thanks [@borisno2](https://github.com/borisno2)! - `tx.advisoryLock()` now poisons its transaction when the lock statement fails, so a caught failure still rolls back with the original cause.
595
+
596
+ - [#2522](https://github.com/OpenSaasAU/stack/pull/2522) [`7cb1192`](https://github.com/OpenSaasAU/stack/commit/7cb1192bc538049ec8f3cd91233a89daf9baafdf) Thanks [@borisno2](https://github.com/borisno2)! - Fix `bigInt` writes given a number or numeric string failing with a raw encode error; validation's coerced bigint now reaches the write.
597
+
598
+ - [#2471](https://github.com/OpenSaasAU/stack/pull/2471) [`4b768f2`](https://github.com/OpenSaasAU/stack/commit/4b768f232d8fed6af88b292e469e05ffb5203983) Thanks [@borisno2](https://github.com/borisno2)! - Internal restructuring: every write return now goes through Field Visibility's read funnel and carries the visible-row brand.
599
+
600
+ - [#2451](https://github.com/OpenSaasAU/stack/pull/2451) [`28ff344`](https://github.com/OpenSaasAU/stack/commit/28ff34407741a466cafd21048a8e385b7800652e) Thanks [@borisno2](https://github.com/borisno2)! - Contract derivation, the constraint map and generate-time field-name validation read names and foreign-key ownership from the List member table; the contract is unchanged.
601
+ A `db.indexes`/`db.foreignKeys` entry naming a field with a `computed` descriptor is now refused by name at generate.
602
+
603
+ - [#2490](https://github.com/OpenSaasAU/stack/pull/2490) [`05e83be`](https://github.com/OpenSaasAU/stack/commit/05e83bed1ce8abc38675036b5eea7da32e97dcbb) Thanks [@borisno2](https://github.com/borisno2)! - The Filter builder reads numeric dates in the viewer's locale order, and a date-only `lte`/range end on a timestamp covers its whole UTC day.
604
+
605
+ - [#2511](https://github.com/OpenSaasAU/stack/pull/2511) [`c97bea7`](https://github.com/OpenSaasAU/stack/commit/c97bea7e07a22467c1d348b45f7b5295a204a147) Thanks [@borisno2](https://github.com/borisno2)! - A declared field named `constructor`, `toString` or `hasOwnProperty` no longer breaks its list, `__proto__` is refused at generate, a foreign-key/part-column collision names a remedy that works, and a singleton's MCP `query` refuses a `where`.
606
+
607
+ - [#2528](https://github.com/OpenSaasAU/stack/pull/2528) [`0fe5094`](https://github.com/OpenSaasAU/stack/commit/0fe5094a919b42fb256722ec111b6d5d3d30c885) Thanks [@borisno2](https://github.com/borisno2)! - Fix admin list filters that made the read throw: integer and bigInt values outside the column range and NUL bytes now match nothing, a search too long for the where limit raises `FilterTooLongError`, and the list error panel offers "Clear filters" when the request carried a search.
608
+
609
+ - [#2543](https://github.com/OpenSaasAU/stack/pull/2543) [`ba3e7ae`](https://github.com/OpenSaasAU/stack/commit/ba3e7ae4127ceea26f1bc8699c385da1412c444c) Thanks [@borisno2](https://github.com/borisno2)! - A field's `afterOperation` hook now runs on create and update only when the field is in the write, matching `beforeOperation`. Delete still runs every field's hook, and `afterTransaction` stays ungated.
610
+
611
+ - [#2480](https://github.com/OpenSaasAU/stack/pull/2480) [`846f622`](https://github.com/OpenSaasAU/stack/commit/846f622c7e2f080c1d746f7ccd284fba214f5b6a) Thanks [@borisno2](https://github.com/borisno2)! - Fix part columns of a multi-column field without `assembleColumns` reaching a session the field's own `read` rule denies.
612
+
613
+ - [#2523](https://github.com/OpenSaasAU/stack/pull/2523) [`e790bf1`](https://github.com/OpenSaasAU/stack/commit/e790bf10fe4853fa65df5bf76ec2a4ae6bfda649) Thanks [@borisno2](https://github.com/borisno2)! - `pnpm generate` now refuses configs that fail at apply: a `db.foreignKeys` entry referencing a partial unique, repeating another entry's columns, or pairing mismatched column types; constraint names over 63 bytes; and an index name shared across lists or equal to a table name.
614
+
615
+ - [#2529](https://github.com/OpenSaasAU/stack/pull/2529) [`2867a27`](https://github.com/OpenSaasAU/stack/commit/2867a279c54d2bea13b3cccdddea7630dc403426) Thanks [@borisno2](https://github.com/borisno2)! - The admin hides nav entries and dashboard cards for lists the session cannot query, and an item page renders read-only with no Save or Delete when a filter-returning `update`/`delete` rule does not match the row. The session vocabulary now answers `'row-dependent'` for a filter-returning `update` or `delete` rule.
616
+
617
+ - [#2521](https://github.com/OpenSaasAU/stack/pull/2521) [`db8a224`](https://github.com/OpenSaasAU/stack/commit/db8a224028dcd92dc878c27f81df508069360d79) Thanks [@borisno2](https://github.com/borisno2)! - Fix a write through a leaked transaction context firing `beforeTransaction` but never `afterTransaction`; a flush enqueued after the registry drained now runs immediately with the rolled-back outcome.
618
+
619
+ - [#2474](https://github.com/OpenSaasAU/stack/pull/2474) [`9774d08`](https://github.com/OpenSaasAU/stack/commit/9774d082befd990e392748487bab65fbd916c27c) Thanks [@borisno2](https://github.com/borisno2)! - Internal restructuring: Field Visibility gains a single traversal for reads and write returns with no relation nodes, behind an internal switch that defaults to the existing walks.
620
+
621
+ - [#2494](https://github.com/OpenSaasAU/stack/pull/2494) [`5501533`](https://github.com/OpenSaasAU/stack/commit/5501533d6a6bd03e22fd8b6bcba95193ce0cf5fa) Thanks [@borisno2](https://github.com/borisno2)! - MCP: write schemas omit relations into lists whose read tool is off, a non-string tool name returns `-32602`, and `ping` answers an empty result.
622
+
623
+ - [#2514](https://github.com/OpenSaasAU/stack/pull/2514) [`f188f16`](https://github.com/OpenSaasAU/stack/commit/f188f16f01c73358e6bd79587ff5f9a8ba8a7c64) Thanks [@borisno2](https://github.com/borisno2)! - MCP per-list scopes now apply through relations (`fields`, `where`, `orderBy`, `connect`), and `create`/`update` return only the `id` to a token without the list's read scope or read tool.
624
+
625
+ - [#2518](https://github.com/OpenSaasAU/stack/pull/2518) [`dd3a77f`](https://github.com/OpenSaasAU/stack/commit/dd3a77f35ceff097fe397a56ce43839a58af2cc5) Thanks [@borisno2](https://github.com/borisno2)! - MCP `where`: a throwing `query` rule on an unnamed list no longer fails the query, `__proto__` is refused like on `context.db`, and `in`/`notIn` length and over-deep `AND` get the named cap refusal first.
626
+
627
+ - [#2475](https://github.com/OpenSaasAU/stack/pull/2475) [`756558e`](https://github.com/OpenSaasAU/stack/commit/756558eee7b8723827ff8770f0b346b43b4bd895) Thanks [@borisno2](https://github.com/borisno2)! - Internal restructuring: Field Visibility's single traversal now also handles reads with plain includes, behind the same internal switch, which still defaults to the existing walks.
628
+
629
+ - [#2470](https://github.com/OpenSaasAU/stack/pull/2470) [`df46667`](https://github.com/OpenSaasAU/stack/commit/df466677dd0d9a1b3de7cda12cd3901e656b8b3a) Thanks [@borisno2](https://github.com/borisno2)! - Internal restructuring: Field Visibility's tests now run through the secured surface, and its field-strip step drops an unused depth parameter.
630
+
631
+ - [#2468](https://github.com/OpenSaasAU/stack/pull/2468) [`94e8358`](https://github.com/OpenSaasAU/stack/commit/94e8358c069e34b96ee2f75e9581029572abbe59) Thanks [@borisno2](https://github.com/borisno2)! - Cover the delete path's Session vocabulary clear with a test.
632
+
633
+ - [#2444](https://github.com/OpenSaasAU/stack/pull/2444) [`6840f89`](https://github.com/OpenSaasAU/stack/commit/6840f89e366f6e52bbe0612628169db6f83fd566) Thanks [@borisno2](https://github.com/borisno2)! - Add an internal List member resolver that answers, once per list, what each usable name on a list is. No call site uses it yet.
634
+
635
+ - [#2426](https://github.com/OpenSaasAU/stack/pull/2426) [`a4dcb7e`](https://github.com/OpenSaasAU/stack/commit/a4dcb7e45a3aadab0251121d566520cee027b654) Thanks [@borisno2](https://github.com/borisno2)! - Fix the session vocabulary keeping stale answers: a successful write or committed transaction clears it, `rawOpensaasContext` keeps nothing, and a `resolveOutput` hook no longer waits on its own pending answer.
636
+
637
+ - [#2447](https://github.com/OpenSaasAU/stack/pull/2447) [`dff4310`](https://github.com/OpenSaasAU/stack/commit/dff4310b1cbf901f9ba401b85f33b0200fd81179) Thanks [@borisno2](https://github.com/borisno2)! - MCP asks the List member resolver which names a `where`, `orderBy`, write `data` and singleton read accept, and refuses a config `generate` refuses when its handlers are created.
638
+
639
+ - [#2466](https://github.com/OpenSaasAU/stack/pull/2466) [`5bd3fc6`](https://github.com/OpenSaasAU/stack/commit/5bd3fc6cd474acc1fea2cffa94d85209ddc913a6) Thanks [@borisno2](https://github.com/borisno2)! - A failed declared-rows fetch for a caller-shaped include now poisons its transaction owner, as every other engine read does.
640
+
641
+ - [#2424](https://github.com/OpenSaasAU/stack/pull/2424) [`565c4ca`](https://github.com/OpenSaasAU/stack/commit/565c4ca5de288b8c54cf2e3b5c811b44e913bf47) Thanks [@borisno2](https://github.com/borisno2)! - The engine context answers whether a singleton's row is stored, so `serializeItemForForm` can read a singleton without triggering `get()`'s auto-create.
642
+
643
+ - [#2478](https://github.com/OpenSaasAU/stack/pull/2478) [`1b45d87`](https://github.com/OpenSaasAU/stack/commit/1b45d877684393fb2dd61ac53ac3e4176fb5b322) Thanks [@borisno2](https://github.com/borisno2)! - Internal restructuring: Field Visibility has one implementation, its single traversal; the old walks, the switch between them and the comparison harness are deleted.
644
+
645
+ - [#2541](https://github.com/OpenSaasAU/stack/pull/2541) [`514a492`](https://github.com/OpenSaasAU/stack/commit/514a492e1d6c4f6c9f926f800c000e79a498f02c) Thanks [@borisno2](https://github.com/borisno2)! - `create`/`update` now throw `ValidationError` when `data` isn't an object, and a list `resolveInput` returning a non-object is rejected instead of silently dropping the payload.
646
+
647
+ - [#2472](https://github.com/OpenSaasAU/stack/pull/2472) [`5850dd6`](https://github.com/OpenSaasAU/stack/commit/5850dd64bbbda381027f344044ebc803cac76958) Thanks [@borisno2](https://github.com/borisno2)! - Internal restructuring: Field Visibility is one module, driven by the resolved read plan alone, and no longer imports the context module.
648
+
649
+ - [#2530](https://github.com/OpenSaasAU/stack/pull/2530) [`999eeae`](https://github.com/OpenSaasAU/stack/commit/999eeaeb595196b96f3068303812db790af9c370) Thanks [@borisno2](https://github.com/borisno2)! - Fix a concurrent first `tx.db.<Singleton>.get()` in two transactions aborting the loser's transaction: the auto-create now takes a transaction-scoped advisory lock and re-reads first.
650
+
651
+ - [#2463](https://github.com/OpenSaasAU/stack/pull/2463) [`a66e95e`](https://github.com/OpenSaasAU/stack/commit/a66e95e1fdbf6fe902b70b3ecd346084647e70cf) Thanks [@borisno2](https://github.com/borisno2)! - The dependency table, synthetic back-relation lookup, multi-column read assembly and singleton checks read from the List member table, so generated contracts and tables are unchanged.
652
+ A multi-column field is now assembled from its `columns` descriptor even without `getColumnNames`, and Field Visibility always resolves the list it reads, so a denied multi-column field's raw part columns never pass through.
653
+
654
+ - [#2448](https://github.com/OpenSaasAU/stack/pull/2448) [`b3120a1`](https://github.com/OpenSaasAU/stack/commit/b3120a1d6cc843ae53a7865a5d7e8696a3b3c935) Thanks [@borisno2](https://github.com/borisno2)! - Fix `select()` silently dropping a foreign key the list does not own ([#2388](https://github.com/OpenSaasAU/stack/issues/2388)), `distinct`/`distinctOn` refusing one it does own ([#2389](https://github.com/OpenSaasAU/stack/issues/2389)), and an undeclared `createdAt`/`updatedAt` on a list without timestamps being treated as a system field instead of an unknown name ([#2390](https://github.com/OpenSaasAU/stack/issues/2390)).
655
+
656
+ - [#2476](https://github.com/OpenSaasAU/stack/pull/2476) [`d417e3a`](https://github.com/OpenSaasAU/stack/commit/d417e3a4a1fef505587b6f83edcc6568e9db82e7) Thanks [@borisno2](https://github.com/borisno2)! - refactor(core): the single Field Visibility traversal handles reductions, caller-shaped declared relations and row-lock re-reads, with no hand-off to the old walks ([#2410](https://github.com/OpenSaasAU/stack/issues/2410))
657
+
3
658
  ## 0.44.0-alpha.6
4
659
 
5
660
  ### Minor Changes