@open-mercato/cli 0.9.1-develop.7574.1.837288eec1 → 0.10.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 (591) hide show
  1. package/.turbo/turbo-build.log +12 -2
  2. package/build.mjs +1 -0
  3. package/dist/agentic/claude-code/mcp.json.example +5 -1
  4. package/dist/agentic/codex/mcp.json.example +3 -0
  5. package/dist/agentic/cursor/mcp.json.example +4 -1
  6. package/dist/agentic/github-copilot/mcp.json.example +5 -1
  7. package/dist/agentic/guides/ai-workflows.md +1 -0
  8. package/dist/agentic/guides/architecture.md +7 -5
  9. package/dist/agentic/guides/module-facts.json +17621 -2604
  10. package/dist/agentic/guides/module-facts.v2.json +17710 -2604
  11. package/dist/agentic/guides/module-tool.md +21 -0
  12. package/dist/agentic/guides/modules/agent_orchestrator/acl-features.md +2 -1
  13. package/dist/agentic/guides/modules/agent_orchestrator/active-extension-bindings.md +1 -1
  14. package/dist/agentic/guides/modules/agent_orchestrator/backend-pages.md +3 -0
  15. package/dist/agentic/guides/modules/agent_orchestrator/cli-commands.md +4 -0
  16. package/dist/agentic/guides/modules/agent_orchestrator/contribution-resolutions.md +6 -0
  17. package/dist/agentic/guides/modules/agent_orchestrator/di-registrations-rich.md +32 -32
  18. package/dist/agentic/guides/modules/agent_orchestrator/di-service-tokens.md +14 -14
  19. package/dist/agentic/guides/modules/agent_orchestrator/domain-commands.md +3 -0
  20. package/dist/agentic/guides/modules/agent_orchestrator/events.md +30 -29
  21. package/dist/agentic/guides/modules/agent_orchestrator/exact-override-targets.md +104 -35
  22. package/dist/agentic/guides/modules/agent_orchestrator/index.md +17 -6
  23. package/dist/agentic/guides/modules/agent_orchestrator/setup.md +1 -1
  24. package/dist/agentic/guides/modules/agent_orchestrator/umes-contributions.md +6 -0
  25. package/dist/agentic/guides/modules/agent_orchestrator/umes-hosts.md +2 -1
  26. package/dist/agentic/guides/modules/agent_orchestrator/workers.md +2 -0
  27. package/dist/agentic/guides/modules/ai_assistant/acl-features.md +4 -1
  28. package/dist/agentic/guides/modules/ai_assistant/ai-tools-mcp-capabilities.md +1 -0
  29. package/dist/agentic/guides/modules/ai_assistant/backend-pages.md +4 -0
  30. package/dist/agentic/guides/modules/ai_assistant/cli-commands.md +1 -0
  31. package/dist/agentic/guides/modules/ai_assistant/contribution-resolutions.md +3 -0
  32. package/dist/agentic/guides/modules/ai_assistant/di-registrations-rich.md +5 -3
  33. package/dist/agentic/guides/modules/ai_assistant/di-service-tokens.md +4 -2
  34. package/dist/agentic/guides/modules/ai_assistant/encryption.md +3 -0
  35. package/dist/agentic/guides/modules/ai_assistant/entities.md +3 -0
  36. package/dist/agentic/guides/modules/ai_assistant/events.md +9 -8
  37. package/dist/agentic/guides/modules/ai_assistant/exact-override-targets.md +23 -6
  38. package/dist/agentic/guides/modules/ai_assistant/index.md +9 -9
  39. package/dist/agentic/guides/modules/ai_assistant/notifications.md +1 -0
  40. package/dist/agentic/guides/modules/ai_assistant/setup.md +1 -1
  41. package/dist/agentic/guides/modules/ai_assistant/umes-contributions.md +3 -0
  42. package/dist/agentic/guides/modules/ai_assistant/umes-hosts.md +4 -0
  43. package/dist/agentic/guides/modules/ai_assistant/workers.md +2 -1
  44. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  45. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  46. package/dist/agentic/guides/modules/attachments/active-extension-bindings.md +12 -0
  47. package/dist/agentic/guides/modules/attachments/ai-tools-mcp-capabilities.md +11 -0
  48. package/dist/agentic/guides/modules/attachments/backend-pages.md +1 -0
  49. package/dist/agentic/guides/modules/attachments/cli-commands.md +1 -0
  50. package/dist/agentic/guides/modules/attachments/contribution-resolutions.md +13 -0
  51. package/dist/agentic/guides/modules/attachments/di-registrations-rich.md +6 -6
  52. package/dist/agentic/guides/modules/attachments/di-service-tokens.md +5 -5
  53. package/dist/agentic/guides/modules/attachments/domain-commands.md +11 -0
  54. package/dist/agentic/guides/modules/attachments/encryption.md +12 -0
  55. package/dist/agentic/guides/modules/attachments/entities.md +2 -0
  56. package/dist/agentic/guides/modules/attachments/events.md +3 -3
  57. package/dist/agentic/guides/modules/attachments/exact-override-targets.md +17 -7
  58. package/dist/agentic/guides/modules/attachments/generator-plugins.md +11 -0
  59. package/dist/agentic/guides/modules/attachments/index.md +13 -5
  60. package/dist/agentic/guides/modules/attachments/search-entities.md +11 -0
  61. package/dist/agentic/guides/modules/attachments/setup.md +1 -1
  62. package/dist/agentic/guides/modules/attachments/umes-contributions.md +13 -0
  63. package/dist/agentic/guides/modules/attachments/umes-hosts.md +4 -0
  64. package/dist/agentic/guides/modules/attachments/workers.md +2 -0
  65. package/dist/agentic/guides/modules/audit_logs/active-extension-bindings.md +11 -0
  66. package/dist/agentic/guides/modules/audit_logs/incoming-installed-contributions.md +12 -0
  67. package/dist/agentic/guides/modules/audit_logs/index.md +4 -2
  68. package/dist/agentic/guides/modules/auth/events.md +12 -12
  69. package/dist/agentic/guides/modules/auth/index.md +1 -1
  70. package/dist/agentic/guides/modules/availability/events.md +3 -3
  71. package/dist/agentic/guides/modules/availability/index.md +1 -1
  72. package/dist/agentic/guides/modules/business_rules/events.md +1 -1
  73. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  74. package/dist/agentic/guides/modules/carrier_inpost/acl-features.md +12 -0
  75. package/dist/agentic/guides/modules/carrier_inpost/contribution-resolutions.md +13 -0
  76. package/dist/agentic/guides/modules/carrier_inpost/di-registrations-rich.md +11 -0
  77. package/dist/agentic/guides/modules/carrier_inpost/exact-override-targets.md +16 -0
  78. package/dist/agentic/guides/modules/carrier_inpost/index.md +18 -0
  79. package/dist/agentic/guides/modules/carrier_inpost/owned-contract-module-metadata.md +11 -0
  80. package/dist/agentic/guides/modules/carrier_inpost/setup.md +11 -0
  81. package/dist/agentic/guides/modules/carrier_inpost/umes-contributions.md +13 -0
  82. package/dist/agentic/guides/modules/cart/acl-features.md +19 -0
  83. package/dist/agentic/guides/modules/cart/contribution-resolutions.md +24 -0
  84. package/dist/agentic/guides/modules/cart/di-registrations-rich.md +11 -0
  85. package/dist/agentic/guides/modules/cart/di-service-tokens.md +11 -0
  86. package/dist/agentic/guides/modules/cart/domain-commands.md +24 -0
  87. package/dist/agentic/guides/modules/cart/encryption.md +11 -0
  88. package/dist/agentic/guides/modules/cart/entities.md +15 -0
  89. package/dist/agentic/guides/modules/cart/events.md +35 -0
  90. package/dist/agentic/guides/modules/cart/exact-override-targets.md +27 -0
  91. package/dist/agentic/guides/modules/cart/index.md +25 -0
  92. package/dist/agentic/guides/modules/cart/owned-contract-module-metadata.md +11 -0
  93. package/dist/agentic/guides/modules/cart/setup.md +11 -0
  94. package/dist/agentic/guides/modules/cart/umes-contributions.md +24 -0
  95. package/dist/agentic/guides/modules/cart/umes-hosts.md +40 -0
  96. package/dist/agentic/guides/modules/cart/workers.md +14 -0
  97. package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +1 -1
  98. package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +7 -5
  99. package/dist/agentic/guides/modules/catalog/di-service-tokens.md +4 -2
  100. package/dist/agentic/guides/modules/catalog/events.md +18 -18
  101. package/dist/agentic/guides/modules/catalog/exact-override-targets.md +7 -5
  102. package/dist/agentic/guides/modules/catalog/index.md +2 -2
  103. package/dist/agentic/guides/modules/catalog/owned-contract-module-metadata.md +1 -1
  104. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  105. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  106. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  107. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  108. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  109. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  110. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  111. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  112. package/dist/agentic/guides/modules/channel_smtp/acl-features.md +12 -0
  113. package/dist/agentic/guides/modules/channel_smtp/contribution-resolutions.md +11 -0
  114. package/dist/agentic/guides/modules/channel_smtp/di-registrations-rich.md +12 -0
  115. package/dist/agentic/guides/modules/channel_smtp/exact-override-targets.md +16 -0
  116. package/dist/agentic/guides/modules/channel_smtp/index.md +18 -0
  117. package/dist/agentic/guides/modules/channel_smtp/owned-contract-module-metadata.md +11 -0
  118. package/dist/agentic/guides/modules/channel_smtp/setup.md +11 -0
  119. package/dist/agentic/guides/modules/channel_smtp/umes-contributions.md +11 -0
  120. package/dist/agentic/guides/modules/checkout/events.md +16 -16
  121. package/dist/agentic/guides/modules/checkout/exact-override-targets.md +5 -4
  122. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  123. package/dist/agentic/guides/modules/checkout/setup.md +1 -1
  124. package/dist/agentic/guides/modules/checkout/workers.md +1 -1
  125. package/dist/agentic/guides/modules/communication_channels/events.md +17 -17
  126. package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +5 -4
  127. package/dist/agentic/guides/modules/communication_channels/index.md +2 -2
  128. package/dist/agentic/guides/modules/communication_channels/setup.md +1 -1
  129. package/dist/agentic/guides/modules/communication_channels/workers.md +2 -2
  130. package/dist/agentic/guides/modules/configs/active-extension-bindings.md +1 -1
  131. package/dist/agentic/guides/modules/configs/index.md +1 -1
  132. package/dist/agentic/guides/modules/content/index.md +1 -1
  133. package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +11 -0
  134. package/dist/agentic/guides/modules/currencies/di-service-tokens.md +11 -0
  135. package/dist/agentic/guides/modules/currencies/events.md +6 -6
  136. package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -0
  137. package/dist/agentic/guides/modules/currencies/index.md +4 -2
  138. package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -0
  139. package/dist/agentic/guides/modules/customer_accounts/contribution-resolutions.md +2 -2
  140. package/dist/agentic/guides/modules/customer_accounts/domain-commands.md +11 -0
  141. package/dist/agentic/guides/modules/customer_accounts/events.md +27 -26
  142. package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +1 -1
  143. package/dist/agentic/guides/modules/customer_accounts/index.md +5 -4
  144. package/dist/agentic/guides/modules/customer_accounts/umes-contributions.md +2 -2
  145. package/dist/agentic/guides/modules/customer_accounts/umes-hosts.md +1 -0
  146. package/dist/agentic/guides/modules/customer_groups/active-extension-bindings.md +1 -1
  147. package/dist/agentic/guides/modules/customer_groups/contribution-resolutions.md +2 -2
  148. package/dist/agentic/guides/modules/customer_groups/events.md +7 -7
  149. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  150. package/dist/agentic/guides/modules/customer_groups/umes-contributions.md +2 -2
  151. package/dist/agentic/guides/modules/customers/active-extension-bindings.md +9 -10
  152. package/dist/agentic/guides/modules/customers/di-registrations-rich.md +6 -5
  153. package/dist/agentic/guides/modules/customers/encryption.md +1 -1
  154. package/dist/agentic/guides/modules/customers/events.md +51 -51
  155. package/dist/agentic/guides/modules/customers/exact-override-targets.md +6 -5
  156. package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +12 -8
  157. package/dist/agentic/guides/modules/customers/index.md +12 -4
  158. package/dist/agentic/guides/modules/customers/umes-hosts.md +46 -0
  159. package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +1 -1
  160. package/dist/agentic/guides/modules/dashboards/index.md +1 -1
  161. package/dist/agentic/guides/modules/data_sync/events.md +4 -4
  162. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  163. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  164. package/dist/agentic/guides/modules/devices/events.md +5 -5
  165. package/dist/agentic/guides/modules/devices/index.md +1 -1
  166. package/dist/agentic/guides/modules/dictionaries/events.md +3 -3
  167. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  168. package/dist/agentic/guides/modules/directory/active-extension-bindings.md +1 -1
  169. package/dist/agentic/guides/modules/directory/contribution-resolutions.md +1 -0
  170. package/dist/agentic/guides/modules/directory/events.md +6 -6
  171. package/dist/agentic/guides/modules/directory/exact-override-targets.md +1 -0
  172. package/dist/agentic/guides/modules/directory/incoming-installed-contributions.md +4 -0
  173. package/dist/agentic/guides/modules/directory/index.md +2 -2
  174. package/dist/agentic/guides/modules/directory/umes-contributions.md +1 -0
  175. package/dist/agentic/guides/modules/documents/contribution-resolutions.md +3 -3
  176. package/dist/agentic/guides/modules/documents/events.md +15 -15
  177. package/dist/agentic/guides/modules/documents/index.md +1 -1
  178. package/dist/agentic/guides/modules/documents/umes-contributions.md +5 -5
  179. package/dist/agentic/guides/modules/ecommerce/contribution-resolutions.md +1 -0
  180. package/dist/agentic/guides/modules/ecommerce/events.md +12 -12
  181. package/dist/agentic/guides/modules/ecommerce/exact-override-targets.md +1 -0
  182. package/dist/agentic/guides/modules/ecommerce/index.md +3 -3
  183. package/dist/agentic/guides/modules/ecommerce/umes-contributions.md +1 -0
  184. package/dist/agentic/guides/modules/entities/contribution-resolutions.md +14 -0
  185. package/dist/agentic/guides/modules/entities/exact-override-targets.md +4 -0
  186. package/dist/agentic/guides/modules/entities/index.md +5 -3
  187. package/dist/agentic/guides/modules/entities/umes-contributions.md +14 -0
  188. package/dist/agentic/guides/modules/eudr/events.md +23 -23
  189. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  190. package/dist/agentic/guides/modules/eudr/owned-contract-module-metadata.md +1 -1
  191. package/dist/agentic/guides/modules/events/index.md +1 -1
  192. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  193. package/dist/agentic/guides/modules/forms/events.md +18 -18
  194. package/dist/agentic/guides/modules/forms/index.md +1 -1
  195. package/dist/agentic/guides/modules/forms/owned-contract-module-metadata.md +1 -1
  196. package/dist/agentic/guides/modules/gateway_autopay/acl-features.md +12 -0
  197. package/dist/agentic/guides/modules/gateway_autopay/cli-commands.md +12 -0
  198. package/dist/agentic/guides/modules/gateway_autopay/contribution-resolutions.md +12 -0
  199. package/dist/agentic/guides/modules/gateway_autopay/di-registrations-rich.md +11 -0
  200. package/dist/agentic/guides/modules/gateway_autopay/exact-override-targets.md +17 -0
  201. package/dist/agentic/guides/modules/gateway_autopay/index.md +19 -0
  202. package/dist/agentic/guides/modules/gateway_autopay/owned-contract-module-metadata.md +11 -0
  203. package/dist/agentic/guides/modules/gateway_autopay/setup.md +11 -0
  204. package/dist/agentic/guides/modules/gateway_autopay/umes-contributions.md +12 -0
  205. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  206. package/dist/agentic/guides/modules/gateway_tpay/contribution-resolutions.md +1 -0
  207. package/dist/agentic/guides/modules/gateway_tpay/di-registrations-rich.md +1 -1
  208. package/dist/agentic/guides/modules/gateway_tpay/exact-override-targets.md +6 -3
  209. package/dist/agentic/guides/modules/gateway_tpay/index.md +5 -4
  210. package/dist/agentic/guides/modules/gateway_tpay/setup.md +1 -1
  211. package/dist/agentic/guides/modules/gateway_tpay/umes-contributions.md +1 -0
  212. package/dist/agentic/guides/modules/gateway_tpay/workers.md +11 -0
  213. package/dist/agentic/guides/modules/generators/index.md +1 -1
  214. package/dist/agentic/guides/modules/inbox_ops/events.md +13 -13
  215. package/dist/agentic/guides/modules/inbox_ops/index.md +2 -2
  216. package/dist/agentic/guides/modules/integrations/events.md +4 -4
  217. package/dist/agentic/guides/modules/integrations/exact-override-targets.md +3 -2
  218. package/dist/agentic/guides/modules/integrations/incoming-installed-contributions.md +11 -0
  219. package/dist/agentic/guides/modules/integrations/index.md +3 -2
  220. package/dist/agentic/guides/modules/integrations/setup.md +1 -1
  221. package/dist/agentic/guides/modules/messages/entities.md +2 -0
  222. package/dist/agentic/guides/modules/messages/events.md +9 -9
  223. package/dist/agentic/guides/modules/messages/index.md +1 -1
  224. package/dist/agentic/guides/modules/messages/umes-hosts.md +2 -0
  225. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  226. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  227. package/dist/agentic/guides/modules/payment_gateways/active-extension-bindings.md +1 -1
  228. package/dist/agentic/guides/modules/payment_gateways/di-registrations-rich.md +4 -4
  229. package/dist/agentic/guides/modules/payment_gateways/di-service-tokens.md +2 -2
  230. package/dist/agentic/guides/modules/payment_gateways/events.md +9 -9
  231. package/dist/agentic/guides/modules/payment_gateways/exact-override-targets.md +5 -4
  232. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  233. package/dist/agentic/guides/modules/payment_gateways/setup.md +1 -1
  234. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  235. package/dist/agentic/guides/modules/phone_calls/events.md +3 -3
  236. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  237. package/dist/agentic/guides/modules/planner/active-extension-bindings.md +1 -1
  238. package/dist/agentic/guides/modules/planner/events.md +6 -6
  239. package/dist/agentic/guides/modules/planner/exact-override-targets.md +3 -3
  240. package/dist/agentic/guides/modules/planner/index.md +1 -1
  241. package/dist/agentic/guides/modules/planner/setup.md +1 -1
  242. package/dist/agentic/guides/modules/portal/exact-override-targets.md +1 -0
  243. package/dist/agentic/guides/modules/portal/frontend-pages.md +1 -0
  244. package/dist/agentic/guides/modules/portal/index.md +1 -1
  245. package/dist/agentic/guides/modules/progress/events.md +6 -6
  246. package/dist/agentic/guides/modules/progress/index.md +2 -2
  247. package/dist/agentic/guides/modules/promotions/acl-features.md +18 -0
  248. package/dist/agentic/guides/modules/promotions/active-extension-bindings.md +12 -0
  249. package/dist/agentic/guides/modules/promotions/backend-pages.md +16 -0
  250. package/dist/agentic/guides/modules/promotions/contribution-resolutions.md +18 -0
  251. package/dist/agentic/guides/modules/promotions/di-registrations-rich.md +15 -0
  252. package/dist/agentic/guides/modules/promotions/di-service-tokens.md +15 -0
  253. package/dist/agentic/guides/modules/promotions/domain-commands.md +23 -0
  254. package/dist/agentic/guides/modules/promotions/entities.md +19 -0
  255. package/dist/agentic/guides/modules/promotions/events.md +24 -0
  256. package/dist/agentic/guides/modules/promotions/exact-override-targets.md +41 -0
  257. package/dist/agentic/guides/modules/promotions/index.md +26 -0
  258. package/dist/agentic/guides/modules/promotions/owned-contract-module-metadata.md +11 -0
  259. package/dist/agentic/guides/modules/promotions/setup.md +11 -0
  260. package/dist/agentic/guides/modules/promotions/umes-contributions.md +18 -0
  261. package/dist/agentic/guides/modules/promotions/umes-hosts.md +33 -0
  262. package/dist/agentic/guides/modules/promotions/workers.md +12 -0
  263. package/dist/agentic/guides/modules/push_notifications/active-extension-bindings.md +11 -0
  264. package/dist/agentic/guides/modules/push_notifications/events.md +2 -2
  265. package/dist/agentic/guides/modules/push_notifications/index.md +3 -2
  266. package/dist/agentic/guides/modules/query_index/events.md +8 -8
  267. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  268. package/dist/agentic/guides/modules/record_locks/events.md +10 -10
  269. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  270. package/dist/agentic/guides/modules/resources/events.md +15 -15
  271. package/dist/agentic/guides/modules/resources/index.md +1 -1
  272. package/dist/agentic/guides/modules/sales/active-extension-bindings.md +5 -0
  273. package/dist/agentic/guides/modules/sales/di-registrations-rich.md +30 -30
  274. package/dist/agentic/guides/modules/sales/di-service-tokens.md +5 -5
  275. package/dist/agentic/guides/modules/sales/domain-commands.md +1 -0
  276. package/dist/agentic/guides/modules/sales/events.md +44 -44
  277. package/dist/agentic/guides/modules/sales/exact-override-targets.md +30 -30
  278. package/dist/agentic/guides/modules/sales/incoming-installed-contributions.md +3 -1
  279. package/dist/agentic/guides/modules/sales/index.md +4 -4
  280. package/dist/agentic/guides/modules/sales/umes-hosts.md +5 -2
  281. package/dist/agentic/guides/modules/scheduler/events.md +4 -4
  282. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  283. package/dist/agentic/guides/modules/search/events.md +1 -1
  284. package/dist/agentic/guides/modules/search/exact-override-targets.md +1 -1
  285. package/dist/agentic/guides/modules/search/index.md +1 -1
  286. package/dist/agentic/guides/modules/search/workers.md +1 -1
  287. package/dist/agentic/guides/modules/security/contribution-resolutions.md +2 -0
  288. package/dist/agentic/guides/modules/security/events.md +22 -21
  289. package/dist/agentic/guides/modules/security/exact-override-targets.md +2 -0
  290. package/dist/agentic/guides/modules/security/index.md +2 -2
  291. package/dist/agentic/guides/modules/security/notifications.md +1 -0
  292. package/dist/agentic/guides/modules/security/umes-contributions.md +2 -0
  293. package/dist/agentic/guides/modules/security/umes-hosts.md +1 -0
  294. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  295. package/dist/agentic/guides/modules/shipping_carriers/contribution-resolutions.md +1 -1
  296. package/dist/agentic/guides/modules/shipping_carriers/events.md +7 -7
  297. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  298. package/dist/agentic/guides/modules/shipping_carriers/umes-contributions.md +1 -1
  299. package/dist/agentic/guides/modules/sso/di-registrations-rich.md +8 -7
  300. package/dist/agentic/guides/modules/sso/di-service-tokens.md +7 -6
  301. package/dist/agentic/guides/modules/sso/events.md +12 -12
  302. package/dist/agentic/guides/modules/sso/exact-override-targets.md +8 -7
  303. package/dist/agentic/guides/modules/sso/index.md +1 -1
  304. package/dist/agentic/guides/modules/staff/active-extension-bindings.md +5 -3
  305. package/dist/agentic/guides/modules/staff/backend-pages.md +1 -0
  306. package/dist/agentic/guides/modules/staff/cli-commands.md +1 -0
  307. package/dist/agentic/guides/modules/staff/contribution-resolutions.md +23 -0
  308. package/dist/agentic/guides/modules/staff/di-registrations-rich.md +8 -8
  309. package/dist/agentic/guides/modules/staff/domain-commands.md +2 -0
  310. package/dist/agentic/guides/modules/staff/encryption.md +1 -0
  311. package/dist/agentic/guides/modules/staff/entities.md +3 -0
  312. package/dist/agentic/guides/modules/staff/events.md +75 -70
  313. package/dist/agentic/guides/modules/staff/exact-override-targets.md +99 -12
  314. package/dist/agentic/guides/modules/staff/frontend-pages.md +3 -0
  315. package/dist/agentic/guides/modules/staff/index.md +26 -13
  316. package/dist/agentic/guides/modules/staff/notifications.md +4 -0
  317. package/dist/agentic/guides/modules/staff/owned-contract-module-metadata.md +1 -1
  318. package/dist/agentic/guides/modules/staff/setup.md +1 -1
  319. package/dist/agentic/guides/modules/staff/umes-contributions.md +24 -1
  320. package/dist/agentic/guides/modules/staff/umes-hosts.md +9 -0
  321. package/dist/agentic/guides/modules/storage_s3/di-registrations-rich.md +3 -3
  322. package/dist/agentic/guides/modules/storage_s3/di-service-tokens.md +1 -1
  323. package/dist/agentic/guides/modules/storage_s3/exact-override-targets.md +3 -3
  324. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  325. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  326. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  327. package/dist/agentic/guides/modules/sync_excel/owned-contract-module-metadata.md +1 -1
  328. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  329. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  330. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  331. package/dist/agentic/guides/modules/translations/active-extension-bindings.md +1 -1
  332. package/dist/agentic/guides/modules/translations/events.md +2 -2
  333. package/dist/agentic/guides/modules/translations/index.md +1 -1
  334. package/dist/agentic/guides/modules/warranty_claims/contribution-resolutions.md +2 -2
  335. package/dist/agentic/guides/modules/warranty_claims/events.md +14 -14
  336. package/dist/agentic/guides/modules/warranty_claims/exact-override-targets.md +5 -4
  337. package/dist/agentic/guides/modules/warranty_claims/index.md +2 -2
  338. package/dist/agentic/guides/modules/warranty_claims/setup.md +1 -1
  339. package/dist/agentic/guides/modules/warranty_claims/umes-contributions.md +2 -2
  340. package/dist/agentic/guides/modules/warranty_claims/workers.md +1 -1
  341. package/dist/agentic/guides/modules/webhooks/events.md +12 -12
  342. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  343. package/dist/agentic/guides/modules/wms/acl-features.md +3 -1
  344. package/dist/agentic/guides/modules/wms/backend-pages.md +4 -0
  345. package/dist/agentic/guides/modules/wms/contribution-resolutions.md +7 -1
  346. package/dist/agentic/guides/modules/wms/custom-entities.md +3 -0
  347. package/dist/agentic/guides/modules/wms/domain-commands.md +16 -0
  348. package/dist/agentic/guides/modules/wms/entities.md +3 -0
  349. package/dist/agentic/guides/modules/wms/events.md +40 -29
  350. package/dist/agentic/guides/modules/wms/exact-override-targets.md +10 -0
  351. package/dist/agentic/guides/modules/wms/host-extension-points.md +1 -1
  352. package/dist/agentic/guides/modules/wms/index.md +14 -10
  353. package/dist/agentic/guides/modules/wms/owned-contract-module-metadata.md +1 -1
  354. package/dist/agentic/guides/modules/wms/search-entities.md +2 -0
  355. package/dist/agentic/guides/modules/wms/umes-contributions.md +7 -1
  356. package/dist/agentic/guides/modules/wms/umes-diagnostics.md +2 -0
  357. package/dist/agentic/guides/modules/wms/umes-hosts.md +53 -0
  358. package/dist/agentic/guides/modules/workflows/contribution-resolutions.md +3 -3
  359. package/dist/agentic/guides/modules/workflows/events.md +32 -32
  360. package/dist/agentic/guides/modules/workflows/exact-override-targets.md +2 -1
  361. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  362. package/dist/agentic/guides/modules/workflows/setup.md +1 -1
  363. package/dist/agentic/guides/modules/workflows/umes-contributions.md +3 -3
  364. package/dist/agentic/guides/production-deployment.md +82 -0
  365. package/dist/agentic/guides/reference-module-facts.json +384 -16
  366. package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +6 -0
  367. package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -3
  368. package/dist/agentic/guides/reference-modules/example/di-service-tokens.md +1 -1
  369. package/dist/agentic/guides/reference-modules/example/events.md +5 -5
  370. package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +12 -8
  371. package/dist/agentic/guides/reference-modules/example/index.md +4 -4
  372. package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
  373. package/dist/agentic/guides/reference-modules/example/umes-contributions.md +6 -0
  374. package/dist/agentic/guides/template-tool.md +38 -0
  375. package/dist/agentic/guides/testing-debugging.md +2 -2
  376. package/dist/agentic/guides/upstream/AGENTS.md +3 -3
  377. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +321 -230
  378. package/dist/agentic/guides/upstream/manifest.json +3 -3
  379. package/dist/agentic/shared/AGENTS.md.template +16 -11
  380. package/dist/agentic/shared/ai/harness/README.md +6 -2
  381. package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
  382. package/dist/agentic/shared/ai/harness/cases.json +282 -19
  383. package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
  384. package/dist/agentic/shared/ai/harness/source-link-inventory.json +204 -4
  385. package/dist/agentic/shared/ai/harness/validators.json +1 -1
  386. package/dist/agentic/shared/ai/qa/tests/playwright.config.ts +1 -0
  387. package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.9.0-to-0.10.0/SKILL.md +269 -0
  388. package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +6 -5
  389. package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +27 -0
  390. package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +1 -1
  391. package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +13 -1
  392. package/dist/agentic/shared/ai/skills/om-find-module/SKILL.md +52 -0
  393. package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +1 -0
  394. package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +1 -0
  395. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +7 -5
  396. package/dist/agentic/shared/ai/skills/om-setup-ci/SKILL.md +42 -0
  397. package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/setup-ci.mjs +525 -0
  398. package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/verify-semgrep-rules.mjs +54 -0
  399. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/docs/README.md +463 -0
  400. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/gitleaks/action.yml +25 -0
  401. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/playwright/action.yml +31 -0
  402. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/setup/action.yml +55 -0
  403. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/dependabot.yml +27 -0
  404. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/audit.yml +193 -0
  405. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/ci.yml +477 -0
  406. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/codeql.yml +63 -0
  407. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/security.yml +254 -0
  408. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci-allowlist.json +4 -0
  409. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci.mjs +283 -0
  410. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.fixture.txt +89 -0
  411. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.yml +146 -0
  412. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/time-bomb-scanner.mjs +286 -0
  413. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/zap-rules.tsv +11 -0
  414. package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +1 -1
  415. package/dist/agentic/shared/ai/skills/tiers.json +5 -2
  416. package/dist/agentic/shared/ai/trackers/github.md +314 -44
  417. package/dist/agentic/shared/scripts/execution-sandbox.mjs +1 -0
  418. package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +3 -3
  419. package/dist/i18n/de.json +4 -0
  420. package/dist/i18n/en.json +4 -0
  421. package/dist/i18n/es.json +4 -0
  422. package/dist/i18n/ko.json +4 -0
  423. package/dist/i18n/pl.json +4 -0
  424. package/dist/lib/__fixtures__/module-search/built-in.json +235 -0
  425. package/dist/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
  426. package/dist/lib/__fixtures__/module-search/modules-index.json +1980 -0
  427. package/dist/lib/__fixtures__/official-module-package/package.json +33 -0
  428. package/dist/lib/__integration__/TC-INT-007.spec.js +241 -21
  429. package/dist/lib/__integration__/TC-INT-007.spec.js.map +2 -2
  430. package/dist/lib/__integration__/TC-INT-009.spec.js +267 -0
  431. package/dist/lib/__integration__/TC-INT-009.spec.js.map +7 -0
  432. package/dist/lib/db/commands.js +2 -0
  433. package/dist/lib/db/commands.js.map +2 -2
  434. package/dist/lib/db/numeric-snapshots.js +13 -0
  435. package/dist/lib/db/numeric-snapshots.js.map +7 -0
  436. package/dist/lib/eject.js +25 -9
  437. package/dist/lib/eject.js.map +2 -2
  438. package/dist/lib/env-example.js +25 -0
  439. package/dist/lib/env-example.js.map +7 -0
  440. package/dist/lib/generate-child-process.js +23 -0
  441. package/dist/lib/generate-child-process.js.map +7 -0
  442. package/dist/lib/generators/ast/imports.js +9 -4
  443. package/dist/lib/generators/ast/imports.js.map +2 -2
  444. package/dist/lib/generators/entity-ids.js +12 -12
  445. package/dist/lib/generators/entity-ids.js.map +2 -2
  446. package/dist/lib/generators/extensions/agent-files.js +119 -4
  447. package/dist/lib/generators/extensions/agent-files.js.map +2 -2
  448. package/dist/lib/generators/module-di.js +8 -9
  449. package/dist/lib/generators/module-di.js.map +2 -2
  450. package/dist/lib/generators/module-entities.js +8 -9
  451. package/dist/lib/generators/module-entities.js.map +2 -2
  452. package/dist/lib/generators/module-facts.js +7 -5
  453. package/dist/lib/generators/module-facts.js.map +2 -2
  454. package/dist/lib/generators/module-override-targets.js +6 -1
  455. package/dist/lib/generators/module-override-targets.js.map +2 -2
  456. package/dist/lib/generators/module-package-sources.js +6 -4
  457. package/dist/lib/generators/module-package-sources.js.map +2 -2
  458. package/dist/lib/generators/module-registry.js +157 -144
  459. package/dist/lib/generators/module-registry.js.map +2 -2
  460. package/dist/lib/generators/openapi.js +9 -2
  461. package/dist/lib/generators/openapi.js.map +2 -2
  462. package/dist/lib/generators/source-exports.js +73 -0
  463. package/dist/lib/generators/source-exports.js.map +7 -0
  464. package/dist/lib/in-process-generate-watcher.js +11 -5
  465. package/dist/lib/in-process-generate-watcher.js.map +2 -2
  466. package/dist/lib/init-existing-database.js +26 -0
  467. package/dist/lib/init-existing-database.js.map +7 -0
  468. package/dist/lib/init-secrets.js +33 -1
  469. package/dist/lib/init-secrets.js.map +2 -2
  470. package/dist/lib/init-summary.js +44 -0
  471. package/dist/lib/init-summary.js.map +7 -0
  472. package/dist/lib/module-github.js +98 -0
  473. package/dist/lib/module-github.js.map +7 -0
  474. package/dist/lib/module-identity.js +131 -0
  475. package/dist/lib/module-identity.js.map +7 -0
  476. package/dist/lib/module-inspection.js +124 -0
  477. package/dist/lib/module-inspection.js.map +7 -0
  478. package/dist/lib/module-install.js +186 -19
  479. package/dist/lib/module-install.js.map +3 -3
  480. package/dist/lib/module-package.js +205 -15
  481. package/dist/lib/module-package.js.map +2 -2
  482. package/dist/lib/module-search-args.js +97 -0
  483. package/dist/lib/module-search-args.js.map +7 -0
  484. package/dist/lib/module-search-index.js +681 -0
  485. package/dist/lib/module-search-index.js.map +7 -0
  486. package/dist/lib/module-search.js +727 -0
  487. package/dist/lib/module-search.js.map +7 -0
  488. package/dist/lib/modules-config.js +210 -66
  489. package/dist/lib/modules-config.js.map +2 -2
  490. package/dist/lib/queue-worker-supervisor.js +3 -0
  491. package/dist/lib/queue-worker-supervisor.js.map +2 -2
  492. package/dist/lib/resolver.js +54 -35
  493. package/dist/lib/resolver.js.map +2 -2
  494. package/dist/lib/telemetry-init.js +1 -1
  495. package/dist/lib/telemetry-init.js.map +1 -1
  496. package/dist/lib/testing/integration-discovery.js +61 -21
  497. package/dist/lib/testing/integration-discovery.js.map +2 -2
  498. package/dist/lib/testing/integration.js +33 -4
  499. package/dist/lib/testing/integration.js.map +2 -2
  500. package/dist/mercato.js +126 -66
  501. package/dist/mercato.js.map +2 -2
  502. package/jest.config.cjs +1 -1
  503. package/package.json +9 -9
  504. package/src/__tests__/documented-queue-subcommands.test.ts +63 -0
  505. package/src/__tests__/mercato.test.ts +429 -4
  506. package/src/i18n/de.json +4 -0
  507. package/src/i18n/en.json +4 -0
  508. package/src/i18n/es.json +4 -0
  509. package/src/i18n/ko.json +4 -0
  510. package/src/i18n/pl.json +4 -0
  511. package/src/lib/__fixtures__/module-search/README.md +97 -0
  512. package/src/lib/__fixtures__/module-search/built-in.json +235 -0
  513. package/src/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
  514. package/src/lib/__fixtures__/module-search/modules-index.json +1980 -0
  515. package/src/lib/__fixtures__/official-module-package/dist/modules/test_package/widgets/injection/test/widget.js +1 -0
  516. package/src/lib/__integration__/TC-INT-007.spec.ts +259 -21
  517. package/src/lib/__integration__/TC-INT-009.spec.ts +279 -0
  518. package/src/lib/__tests__/agentic-setup.ownership.test.ts +4 -0
  519. package/src/lib/__tests__/eject.test.ts +98 -4
  520. package/src/lib/__tests__/env-example.test.ts +58 -0
  521. package/src/lib/__tests__/generate-child-process.test.ts +185 -0
  522. package/src/lib/__tests__/generate-quiet-entrypoint.test.ts +47 -0
  523. package/src/lib/__tests__/in-process-generate-watcher.test.ts +91 -0
  524. package/src/lib/__tests__/init-existing-database.test.ts +27 -0
  525. package/src/lib/__tests__/init-secrets.test.ts +85 -1
  526. package/src/lib/__tests__/init-summary.test.ts +50 -0
  527. package/src/lib/__tests__/module-github.test.ts +108 -0
  528. package/src/lib/__tests__/module-identity.test.ts +144 -0
  529. package/src/lib/__tests__/module-inspection.test.ts +195 -0
  530. package/src/lib/__tests__/module-install.test.ts +614 -19
  531. package/src/lib/__tests__/module-package.test.ts +154 -0
  532. package/src/lib/__tests__/module-search.test.ts +1040 -0
  533. package/src/lib/__tests__/modules-config.test.ts +453 -1
  534. package/src/lib/__tests__/queue-worker-supervisor.test.ts +145 -1
  535. package/src/lib/__tests__/resolver.enterprise.test.ts +60 -0
  536. package/src/lib/__tests__/resolver.packages.test.ts +29 -0
  537. package/src/lib/__tests__/telemetry-init.test.ts +1 -1
  538. package/src/lib/db/__tests__/identifiers.test.ts +19 -0
  539. package/src/lib/db/__tests__/numeric-snapshots.test.ts +79 -0
  540. package/src/lib/db/commands.ts +2 -0
  541. package/src/lib/db/numeric-snapshots.ts +12 -0
  542. package/src/lib/eject.ts +28 -10
  543. package/src/lib/env-example.ts +31 -0
  544. package/src/lib/generate-child-process.ts +35 -0
  545. package/src/lib/generators/__tests__/agent-files-extension.test.ts +178 -0
  546. package/src/lib/generators/__tests__/attachment-access.test.ts +70 -0
  547. package/src/lib/generators/__tests__/module-extension-activations.test.ts +42 -18
  548. package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +9 -8
  549. package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +5 -1
  550. package/src/lib/generators/__tests__/module-id-collisions.test.ts +146 -0
  551. package/src/lib/generators/__tests__/module-override-targets.test.ts +8 -2
  552. package/src/lib/generators/__tests__/module-package-sources.test.ts +26 -6
  553. package/src/lib/generators/__tests__/module-registry-requires-enforcement.test.ts +130 -0
  554. package/src/lib/generators/__tests__/module-requirements.test.ts +56 -0
  555. package/src/lib/generators/__tests__/module-requires.test.ts +242 -0
  556. package/src/lib/generators/__tests__/module-subset.test.ts +103 -0
  557. package/src/lib/generators/__tests__/openapi.test.ts +24 -0
  558. package/src/lib/generators/ast/imports.ts +14 -4
  559. package/src/lib/generators/entity-ids.ts +12 -12
  560. package/src/lib/generators/extensions/agent-files.ts +154 -4
  561. package/src/lib/generators/module-di.ts +8 -9
  562. package/src/lib/generators/module-entities.ts +8 -9
  563. package/src/lib/generators/module-facts.ts +9 -5
  564. package/src/lib/generators/module-override-targets.ts +6 -1
  565. package/src/lib/generators/module-package-sources.ts +7 -5
  566. package/src/lib/generators/module-registry.ts +224 -182
  567. package/src/lib/generators/openapi.ts +10 -2
  568. package/src/lib/generators/source-exports.ts +93 -0
  569. package/src/lib/in-process-generate-watcher.ts +14 -6
  570. package/src/lib/init-existing-database.ts +24 -0
  571. package/src/lib/init-secrets.ts +37 -0
  572. package/src/lib/init-summary.ts +54 -0
  573. package/src/lib/module-github.ts +109 -0
  574. package/src/lib/module-identity.ts +145 -0
  575. package/src/lib/module-inspection.ts +133 -0
  576. package/src/lib/module-install.ts +214 -22
  577. package/src/lib/module-package.ts +243 -16
  578. package/src/lib/module-search-args.ts +116 -0
  579. package/src/lib/module-search-index.ts +1037 -0
  580. package/src/lib/module-search.ts +1013 -0
  581. package/src/lib/modules-config.ts +278 -80
  582. package/src/lib/queue-worker-supervisor.ts +3 -0
  583. package/src/lib/resolver.ts +58 -40
  584. package/src/lib/telemetry-init.ts +1 -1
  585. package/src/lib/testing/__tests__/integration-discovery.test.ts +89 -0
  586. package/src/lib/testing/__tests__/integration.test.ts +55 -0
  587. package/src/lib/testing/integration-discovery.ts +101 -32
  588. package/src/lib/testing/integration.ts +34 -4
  589. package/src/mercato.ts +167 -84
  590. package/src/types/cross-spawn.d.ts +2 -2
  591. package/src/lib/__tests__/agentic-build-artifacts.test.ts +0 -28
@@ -1,6 +1,6 @@
1
1
  # Backward Compatibility Contract
2
2
 
3
- Open Mercato modules are developed by third-party developers who depend on stable platform APIs. Every surface listed below is a **public contract**. Changes to these surfaces MUST follow the deprecation protocol or they are **breaking changes** that block merge.
3
+ Every listed surface is a **public contract**. Changes MUST follow the deprecation protocol or block merge as **breaking changes**.
4
4
 
5
5
  ## Deprecation Protocol
6
6
 
@@ -32,43 +32,43 @@ Downstream authors get no bridge in this case, so the compensating obligation is
32
32
 
33
33
  The following file names, their expected export names, and their role in module auto-discovery MUST NOT change. New convention files may be added, but existing ones are immutable.
34
34
 
35
- | Convention File | Required Export | Contract |
36
- |-----------------|---------------|----------|
37
- | `index.ts` | `metadata: ModuleInfo` | MUST NOT rename export or change `ModuleInfo` shape in a breaking way |
38
- | `acl.ts` | `features: Array<{id,title,module}>` | MUST NOT change array item shape; may add optional fields |
39
- | `setup.ts` | `setup: ModuleSetupConfig` | MUST NOT remove hooks (`onTenantCreated`, `seedDefaults`, `seedExamples`, `defaultRoleFeatures`); may add optional hooks |
40
- | `runtime.ts` | `runtime: ModuleRuntime` (or default export) | MUST NOT change `ModuleRuntime` required members (`start`) or the `ModuleRuntimeContext` / `ModuleRuntimeHandle` shape; may add optional fields and additional `ModuleRuntimeRole` values |
41
- | `ce.ts` | `entities: CustomEntitySpec[]` | MUST NOT change `CustomEntitySpec` required fields; may add optional fields |
42
- | `search.ts` | `searchConfig: SearchModuleConfig` | MUST NOT change `SearchEntityConfig` required fields; may add optional fields |
43
- | `events.ts` | `eventsConfig` via `createModuleEvents()` | MUST NOT change `EventDefinition` required fields (`id`, `label`); may add optional fields |
44
- | `extension-points.ts` | `extensionPoints: ModuleExtensionPoints` | New additive convention; declared exact/pattern host IDs, aliases, fallbacks, family/capability semantics, and bound call-site meaning MUST NOT change incompatibly |
45
- | `translations.ts` | `translatableFields` | MUST NOT change record shape |
46
- | `notifications.ts` | `notificationTypes: NotificationTypeDefinition[]` | MUST NOT change required fields; may add optional fields |
47
- | `notifications.client.ts` | — | MUST NOT change renderer props contract |
48
- | `ai-agents.ts` | `aiAgents: AiAgentDefinition[]` | MUST NOT change `AiAgentDefinition` required fields; optional sibling exports `aiAgentOverrides` and `aiAgentExtensions` are stable |
49
- | `ai-tools.ts` | `aiTools: AiToolDefinition[]` | MUST NOT change `AiToolDefinition` / inherited `McpToolDefinition` required fields; optional sibling export `aiToolOverrides` is stable |
50
- | `di.ts` | `register(container)` | MUST NOT change function signature |
51
- | `cli.ts` | default export | MUST NOT change expected signature |
52
- | `data/entities.ts` | Entity class exports | See Database Schema rules below |
53
- | `data/validators.ts` | Zod schema exports | MUST NOT remove or narrow existing schemas |
54
- | `data/extensions.ts` | `extensions: EntityExtension[]` | MUST NOT change required fields (`base`, `extension`, `join`); may add optional fields |
55
- | `widgets/injection-table.ts` | `ModuleInjectionTable` | MUST NOT change table type or spot ID resolution |
56
- | `widgets/injection/*/widget.ts` | `InjectionWidgetModule` | MUST NOT change module shape or component props |
57
- | `widgets/dashboard/*/widget.ts` | `DashboardWidgetModule` | MUST NOT change module shape or component props |
35
+ |Convention File|Required Export|Contract|
36
+ |---|---|---|
37
+ |`index.ts`|`metadata: ModuleInfo`|MUST NOT rename export or change `ModuleInfo` shape in a breaking way|
38
+ |`acl.ts`|`features: Array<{id,title,module}>`|MUST NOT change array item shape; may add optional fields|
39
+ |`setup.ts`|`setup: ModuleSetupConfig`|MUST NOT remove hooks (`onTenantCreated`, `seedDefaults`, `seedExamples`, `defaultRoleFeatures`); may add optional hooks|
40
+ |`runtime.ts`|`runtime: ModuleRuntime` (or default export)|MUST NOT change `ModuleRuntime` required members (`start`) or the `ModuleRuntimeContext` / `ModuleRuntimeHandle` shape; may add optional fields and additional `ModuleRuntimeRole` values|
41
+ |`ce.ts`|`entities: CustomEntitySpec[]`|MUST NOT change `CustomEntitySpec` required fields; may add optional fields|
42
+ |`search.ts`|`searchConfig: SearchModuleConfig`|MUST NOT change `SearchEntityConfig` required fields; may add optional fields|
43
+ |`events.ts`|`eventsConfig` via `createModuleEvents()`|MUST NOT change `EventDefinition` required fields (`id`, `label`); may add optional fields|
44
+ |`extension-points.ts`|`extensionPoints: ModuleExtensionPoints`|New additive convention; declared exact/pattern host IDs, aliases, fallbacks, family/capability semantics, and bound call-site meaning MUST NOT change incompatibly|
45
+ |`translations.ts`|`translatableFields`|MUST NOT change record shape|
46
+ |`notifications.ts`|`notificationTypes: NotificationTypeDefinition[]`|MUST NOT change required fields; may add optional fields|
47
+ |`notifications.client.ts`|—|MUST NOT change renderer props contract|
48
+ |`ai-agents.ts`|`aiAgents: AiAgentDefinition[]`|MUST NOT change `AiAgentDefinition` required fields; optional sibling exports `aiAgentOverrides` and `aiAgentExtensions` are stable|
49
+ |`ai-tools.ts`|`aiTools: AiToolDefinition[]`|MUST NOT change `AiToolDefinition` / inherited `McpToolDefinition` required fields; optional sibling export `aiToolOverrides` is stable|
50
+ |`di.ts`|`register(container)`|MUST NOT change function signature|
51
+ |`cli.ts`|default export|MUST NOT change expected signature|
52
+ |`data/entities.ts`|Entity class exports|See Database Schema rules below|
53
+ |`data/validators.ts`|Zod schema exports|MUST NOT remove or narrow existing schemas|
54
+ |`data/extensions.ts`|`extensions: EntityExtension[]`|MUST NOT change required fields (`base`, `extension`, `join`); may add optional fields|
55
+ |`widgets/injection-table.ts`|`ModuleInjectionTable`|MUST NOT change table type or spot ID resolution|
56
+ |`widgets/injection/*/widget.ts`|`InjectionWidgetModule`|MUST NOT change module shape or component props|
57
+ |`widgets/dashboard/*/widget.ts`|`DashboardWidgetModule`|MUST NOT change module shape or component props|
58
58
 
59
59
  **Auto-discovery directory conventions** (FROZEN):
60
60
 
61
- | Directory Pattern | Route Mapping | Contract |
62
- |-------------------|--------------|----------|
63
- | `frontend/<path>.tsx` | `/<path>` | MUST NOT change routing algorithm |
64
- | `backend/<path>.tsx` | `/backend/<path>` | MUST NOT change routing algorithm |
65
- | `api/<method>/<path>.ts` | `/api/<path>` by HTTP method | MUST NOT change dispatch logic |
66
- | `subscribers/*.ts` | Event handler auto-registered | MUST NOT change metadata shape `{event, persistent?, id?}` |
67
- | `workers/*.ts` | Queue worker auto-registered | MUST NOT change metadata shape `{queue, id?, concurrency?}` |
61
+ |Directory Pattern|Route Mapping|Contract|
62
+ |---|---|---|
63
+ |`frontend/<path>.tsx`|`/<path>`|MUST NOT change routing algorithm|
64
+ |`backend/<path>.tsx`|`/backend/<path>`|MUST NOT change routing algorithm|
65
+ |`api/<method>/<path>.ts`|`/api/<path>` by HTTP method|MUST NOT change dispatch logic|
66
+ |`subscribers/*.ts`|Event handler auto-registered|MUST NOT change metadata shape `{event, persistent?, id?}`|
67
+ |`workers/*.ts`|Queue worker auto-registered|MUST NOT change metadata shape `{queue, id?, concurrency?}`|
68
68
 
69
69
  ### 2. Type Definitions & Interfaces (STABLE)
70
70
 
71
- These exported types are consumed by module developers. Required fields MUST NOT be removed or have their types narrowed. Optional fields may be added freely.
71
+ Required fields MUST NOT be removed or narrowed. Optional fields may be added freely.
72
72
 
73
73
  **Immutable required fields** (removing or renaming any is a breaking change):
74
74
 
@@ -99,7 +99,7 @@ These exported types are consumed by module developers. Required fields MUST NOT
99
99
  - `AiAgentOverridesMap` / `AiToolOverridesMap`: `Record<string, AiAgentDefinition | null>` and `Record<string, AiToolDefinition | null>` semantics are STABLE; `null` means disable
100
100
  - `ModuleOverrides`: `overrides.ai.agents`, `overrides.ai.tools`, and `overrides.ai.extensions` shapes are STABLE; other domain keys are reserved by the unified override contract and may be wired additively. `nav` was wired 2026-07-30 under that clause (see [spec](.ai/specs/2026-07-30-nav-group-order-override-domain.md)): `overrides.nav.groupOrder` **prepends** sidebar nav group ids ahead of the built-in `defaultGroupOrder`, and ids it does not name keep their existing position. It is a default applied *beneath* role and per-user sidebar preferences, so an operator's own arrangement still wins. With no override configured, group ordering is byte-identical to before — that guarantee MUST hold for any future change to this domain.
101
101
  - `ModulesRegisteredListener` (`@open-mercato/shared/lib/modules/registry`): added 2026-08-12 as `(modules: Module[]) => void | PromiseLike<void>` (see [spec](.ai/specs/2026-08-12-module-registry-registration-listeners.md)). The listener MUST keep receiving the reconciled module list, and the return type MUST NOT be narrowed back to `void` — a subscriber returning a promise is supported and its rejection is observed and logged rather than escaping into bootstrap.
102
- - `WorkerMeta`: `queue` — MUST NOT remove
102
+ - `WorkerMeta.queue` STABLE; coalescing OPTIONAL/active-no-drop; BullMQ ≥5.72.
103
103
  - `TelemetryProvider` (`@open-mercato/telemetry`): `name`, `supports`, `start`, `shutdown`, `runInSpan`, `activeSpan`, `activeTraceContext`, `inject`, `runInRemoteSpan`, `emitLog`, `recordMetric` — MUST NOT remove. `reportError?()` was added 2026-09-08 as an additive OPTIONAL method (see [spec](.ai/specs/2026-09-08-error-reporting-policy.md)); it **MUST stay optional** — third parties implement this interface and a required method would break every existing provider. The facade calls it as `provider.reportError?.(…)` *in addition to* the span/log/metric path, so a provider that omits it loses nothing.
104
104
  - `ReportErrorContext` (`@open-mercato/telemetry`) and the `reportError` context of `TelemetryRuntime` (`@open-mercato/shared/lib/telemetry/runtime`): `module?` and `attributes?` — MUST NOT remove. `code?: string` was added 2026-09-08 as an additive optional field carrying the enumerated `module.reason` fingerprint the backend groups on; it MUST stay optional so existing callers (the API dispatcher, the CRUD factory) keep compiling and keep emitting exactly what they emit today. `om.errors` gains an `error.code` label only when a caller supplies one — the same attribute name the span and the log record use, so one query works against all three.
105
105
  - `RefreshCredentialsInput` (communication_channels hub): `channelId`, `credentials`, `scope` — MUST NOT remove. `oauthClient?` was added 2026-05-27 as an additive optional field (see [Spec A](.ai/specs/implemented/2026-05-27-email-integration-inbound-reliability-and-threading.md)). The legacy `credentials._client` read path in the Gmail adapter was **removed** (see #3828 / UPGRADE_NOTES) — OAuth client config MUST be passed via `RefreshCredentialsInput.oauthClient`.
@@ -112,45 +112,45 @@ These exported types are consumed by module developers. Required fields MUST NOT
112
112
 
113
113
  ### 3. Function Signatures (STABLE)
114
114
 
115
- These functions are called directly by module code. Their signatures MUST NOT change in a breaking way. New optional parameters may be added.
116
-
117
- | Function | Package | Contract |
118
- |----------|---------|----------|
119
- | `createModuleEvents(options)` | `@open-mercato/shared/modules/events` | MUST NOT change `options` required shape or return type |
120
- | `makeCrudRoute(opts)` | `@open-mercato/shared/lib/crud/factory` | MUST NOT remove existing `opts` fields; MUST NOT change return shape |
121
- | `findWithDecryption(em, entityName, where, options?, scope?)` | `@open-mercato/shared/lib/encryption/find` | MUST NOT change parameter order or required params |
122
- | `findOneWithDecryption(...)` | `@open-mercato/shared/lib/encryption/find` | Same as above |
123
- | `findAndCountWithDecryption(...)` | `@open-mercato/shared/lib/encryption/find` | Same as above |
124
- | `entityId(moduleId, entity)` | `@open-mercato/shared/modules/dsl` | MUST NOT change |
125
- | `defineLink(base, extension, opts)` | `@open-mercato/shared/modules/dsl` | MUST NOT change |
126
- | `defineModuleExtensionPoints(declaration)` | `@open-mercato/shared/modules/widgets/extension-points` | MUST preserve immutable data-only declaration semantics and exact module/host values |
127
- | `injectionExtensionHost`, `dataTableExtensionHost`, `crudFormExtensionHost`, `componentExtensionHost` | `@open-mercato/shared/modules/widgets/extension-points` | MUST preserve family discrimination, exact/pattern validation, and returned IDs |
128
- | `defineFields(entity, fields, source?)` | `@open-mercato/shared/modules/dsl` | MUST NOT change |
129
- | `cf.text`, `cf.multiline`, `cf.integer`, `cf.float`, `cf.boolean`, `cf.select`, `cf.currency`, `cf.dictionary` | `@open-mercato/shared/modules/dsl` | MUST NOT remove any helper or change required params |
130
- | `lazyDashboardWidget(loader)` | `@open-mercato/shared/modules/dashboard/widgets` | MUST NOT change |
131
- | `registerMcpTool(tool, options?)` | `@open-mercato/ai-assistant` | MUST NOT change |
132
- | `defineAiAgent(definition)` | `@open-mercato/ai-assistant` | MUST NOT change parameter or return shape |
133
- | `defineAiAgentExtension(extension)` | `@open-mercato/ai-assistant` | MUST NOT change parameter or return shape |
134
- | `defineAiTool(definition)` | `@open-mercato/ai-assistant` | MUST NOT change parameter or return shape |
135
- | `applyAiAgentOverrides(overrides)` | `@open-mercato/ai-assistant` | MUST preserve map semantics and precedence |
136
- | `applyAiToolOverrides(overrides)` | `@open-mercato/ai-assistant` | MUST preserve map semantics and precedence |
137
- | `applyAiAgentExtensions(extensions)` | `@open-mercato/ai-assistant` | MUST preserve append/patch semantics |
138
- | `applyAiOverridesFromEnabledModules(modules)` | `@open-mercato/ai-assistant` | MUST keep accepting the `overrides.ai` module-entry shape |
139
- | `prepareMutation(input, context)` | `@open-mercato/ai-assistant` | MUST NOT bypass pending-action approval semantics or change required params |
140
- | `runAiAgentText(input)` / `runAiAgentObject(input)` | `@open-mercato/ai-assistant` | MUST NOT remove existing input fields or narrow output shape |
141
- | `applyModuleOverridesFromEnabledModules(modules)` | `@open-mercato/shared/modules/overrides` | MUST keep dispatching `entry.overrides.<domain>` by module-load order |
142
- | `registerModuleOverrideApplier(domain, applier)` | `@open-mercato/shared/modules/overrides` | MUST NOT change registration semantics |
143
- | `onModulesRegistered(listener)` | `@open-mercato/shared/lib/modules/registry` | MUST keep accepting a single listener and returning an unsubscribe function; MUST keep notifying synchronously after `setGlobalModules()`; MUST stay fail-soft for a listener that throws or rejects. Full contract: [spec](.ai/specs/2026-08-12-module-registry-registration-listeners.md) |
144
- | `apiCall` / `apiCallOrThrow` / `readApiResultOrThrow` | `@open-mercato/ui/backend/utils/apiCall` | MUST NOT change |
145
- | `useT()` | `@open-mercato/shared/lib/i18n/context` | MUST NOT change return type |
146
- | `resolveTranslations()` | `@open-mercato/shared/lib/i18n/server` | MUST NOT change |
147
- | `createCrudOpenApiFactory(config)` | `@open-mercato/shared/lib/openapi/crud` | MUST NOT change |
148
- | `collectCustomFieldValues()` | `@open-mercato/ui/backend/utils/customFieldValues` | MUST NOT change |
149
- | `flash()` | `@open-mercato/ui` | MUST NOT change |
150
- | `CrudForm` component props | `@open-mercato/ui/backend/crud` | MUST NOT remove existing props |
151
- | Built-in `CrudFormGroup.id` values | any module's form-group builder (e.g. `createCompanyFormGroups`) | MUST NOT rename or remove an id a shipped form declares — `CrudForm`'s `hiddenGroupIds` addresses groups by id, and an unmatched id is ignored, so a rename makes a card the host hid silently reappear in production. Renames follow the deprecation protocol; pin a builder's ids with a guard test (pattern: `packages/core/src/modules/customers/components/__tests__/companyFormHiddenGroups.test.tsx`). MAY add new groups freely |
152
- | `DataTable` component props | `@open-mercato/ui/backend` | MUST NOT remove existing props |
153
- | `parseBooleanToken` / `parseBooleanWithDefault` | `@open-mercato/shared/lib/boolean` | MUST NOT change |
115
+ Signatures MUST NOT change incompatibly. New optional parameters may be added.
116
+
117
+ |Function|Package|Contract|
118
+ |---|---|---|
119
+ |`createModuleEvents(options)`|`@open-mercato/shared/modules/events`|MUST NOT change `options` required shape or return type|
120
+ |`makeCrudRoute(opts)`|`@open-mercato/shared/lib/crud/factory`|MUST NOT remove existing `opts` fields; MUST NOT change return shape|
121
+ |`findWithDecryption(em, entityName, where, options?, scope?)`|`@open-mercato/shared/lib/encryption/find`|MUST NOT change parameter order or required params|
122
+ |`findOneWithDecryption(...)`|`@open-mercato/shared/lib/encryption/find`|Same as above|
123
+ |`findAndCountWithDecryption(...)`|`@open-mercato/shared/lib/encryption/find`|Same as above|
124
+ |`entityId(moduleId, entity)`|`@open-mercato/shared/modules/dsl`|MUST NOT change|
125
+ |`defineLink(base, extension, opts)`|`@open-mercato/shared/modules/dsl`|MUST NOT change|
126
+ |`defineModuleExtensionPoints(declaration)`|`@open-mercato/shared/modules/widgets/extension-points`|MUST preserve immutable data-only declaration semantics and exact module/host values|
127
+ |`injectionExtensionHost`, `dataTableExtensionHost`, `crudFormExtensionHost`, `componentExtensionHost`|`@open-mercato/shared/modules/widgets/extension-points`|MUST preserve family discrimination, exact/pattern validation, and returned IDs|
128
+ |`defineFields(entity, fields, source?)`|`@open-mercato/shared/modules/dsl`|MUST NOT change|
129
+ |`cf.text`, `cf.multiline`, `cf.integer`, `cf.float`, `cf.boolean`, `cf.select`, `cf.currency`, `cf.dictionary`|`@open-mercato/shared/modules/dsl`|MUST NOT remove any helper or change required params|
130
+ |`lazyDashboardWidget(loader)`|`@open-mercato/shared/modules/dashboard/widgets`|MUST NOT change|
131
+ |`registerMcpTool(tool, options?)`|`@open-mercato/ai-assistant`|MUST NOT change|
132
+ |`defineAiAgent(definition)`|`@open-mercato/ai-assistant`|MUST NOT change parameter or return shape|
133
+ |`defineAiAgentExtension(extension)`|`@open-mercato/ai-assistant`|MUST NOT change parameter or return shape|
134
+ |`defineAiTool(definition)`|`@open-mercato/ai-assistant`|MUST NOT change parameter or return shape|
135
+ |`applyAiAgentOverrides(overrides)`|`@open-mercato/ai-assistant`|MUST preserve map semantics and precedence|
136
+ |`applyAiToolOverrides(overrides)`|`@open-mercato/ai-assistant`|MUST preserve map semantics and precedence|
137
+ |`applyAiAgentExtensions(extensions)`|`@open-mercato/ai-assistant`|MUST preserve append/patch semantics|
138
+ |`applyAiOverridesFromEnabledModules(modules)`|`@open-mercato/ai-assistant`|MUST keep accepting the `overrides.ai` module-entry shape|
139
+ |`prepareMutation(input, context)`|`@open-mercato/ai-assistant`|MUST NOT bypass pending-action approval semantics or change required params|
140
+ |`runAiAgentText(input)` / `runAiAgentObject(input)`|`@open-mercato/ai-assistant`|MUST NOT remove existing input fields or narrow output shape|
141
+ |`applyModuleOverridesFromEnabledModules(modules)`|`@open-mercato/shared/modules/overrides`|MUST keep dispatching `entry.overrides.<domain>` by module-load order|
142
+ |`registerModuleOverrideApplier(domain, applier)`|`@open-mercato/shared/modules/overrides`|MUST NOT change registration semantics|
143
+ |`onModulesRegistered(listener)`|`@open-mercato/shared/lib/modules/registry`|MUST keep accepting a single listener and returning an unsubscribe function; MUST keep notifying synchronously after `setGlobalModules()`; MUST stay fail-soft for a listener that throws or rejects. Full contract: [spec](.ai/specs/2026-08-12-module-registry-registration-listeners.md)|
144
+ |`apiCall` / `apiCallOrThrow` / `readApiResultOrThrow`|`@open-mercato/ui/backend/utils/apiCall`|MUST NOT change|
145
+ |`useT()`|`@open-mercato/shared/lib/i18n/context`|MUST NOT change return type|
146
+ |`resolveTranslations()`|`@open-mercato/shared/lib/i18n/server`|MUST NOT change|
147
+ |`createCrudOpenApiFactory(config)`|`@open-mercato/shared/lib/openapi/crud`|MUST NOT change|
148
+ |`collectCustomFieldValues()`|`@open-mercato/ui/backend/utils/customFieldValues`|MUST NOT change|
149
+ |`flash()`|`@open-mercato/ui`|MUST NOT change|
150
+ |`CrudForm` component props|`@open-mercato/ui/backend/crud`|MUST NOT remove existing props|
151
+ |Built-in `CrudFormGroup.id` values|any module's form-group builder (e.g. `createCompanyFormGroups`)|MUST NOT rename or remove an id a shipped form declares — `CrudForm`'s `hiddenGroupIds` addresses groups by id, and an unmatched id is ignored, so a rename makes a card the host hid silently reappear in production. Renames follow the deprecation protocol; pin a builder's ids with a guard test (pattern: `packages/core/src/modules/customers/components/__tests__/companyFormHiddenGroups.test.tsx`). MAY add new groups freely|
152
+ |`DataTable` component props|`@open-mercato/ui/backend`|MUST NOT remove existing props|
153
+ |`parseBooleanToken` / `parseBooleanWithDefault`|`@open-mercato/shared/lib/boolean`|MUST NOT change|
154
154
 
155
155
  ### 4. Import Paths (STABLE)
156
156
 
@@ -180,8 +180,6 @@ Spot IDs are the addresses where external modules inject UI. Renaming or removin
180
180
 
181
181
  ### 7. API Route URLs (STABLE)
182
182
 
183
- External tools, frontends, and integrations depend on API URL patterns.
184
-
185
183
  - MUST NOT rename or remove an existing API route URL
186
184
  - MUST NOT change the HTTP method for an existing operation
187
185
  - MUST NOT remove fields from existing response schemas
@@ -286,21 +284,21 @@ Files in `apps/mercato/.mercato/generated/` are produced by the CLI generators.
286
284
 
287
285
  ## Allowed vs Breaking Changes — Quick Reference
288
286
 
289
- | Surface | Add new | Add optional field | Remove field | Rename | Change type |
290
- |---------|---------|-------------------|-------------|--------|-------------|
291
- | Convention files | OK | OK | BREAKING | BREAKING | BREAKING |
292
- | Type interfaces | OK | OK | BREAKING | BREAKING | BREAKING (narrowing) |
293
- | Function params | OK (optional) | OK | BREAKING | BREAKING | BREAKING |
294
- | Event IDs | OK | OK (payload) | BREAKING | BREAKING | n/a |
295
- | Spot IDs | OK | OK (context) | BREAKING | BREAKING | BREAKING (context) |
296
- | API routes | OK | OK (req/res fields) | BREAKING (res fields) | BREAKING | BREAKING |
297
- | DB columns | OK (with default) | n/a | BREAKING | BREAKING | BREAKING (narrowing) |
298
- | DI names | OK | OK | BREAKING | BREAKING | BREAKING |
299
- | Feature IDs | OK | n/a | BREAKING* | BREAKING | n/a |
300
- | AI agent/tool IDs | OK | OK | BREAKING | BREAKING | BREAKING |
301
- | AI override surfaces | OK | OK | BREAKING | BREAKING | BREAKING |
302
- | Import paths | OK | n/a | BREAKING | BREAKING | n/a |
303
- | Generated registry exports | OK | OK | BREAKING | BREAKING | BREAKING |
287
+ |Surface|Add new|Add optional field|Remove field|Rename|Change type|
288
+ |---|---|---|---|---|---|
289
+ |Convention files|OK|OK|BREAKING|BREAKING|BREAKING|
290
+ |Type interfaces|OK|OK|BREAKING|BREAKING|BREAKING (narrowing)|
291
+ |Function params|OK (optional)|OK|BREAKING|BREAKING|BREAKING|
292
+ |Event IDs|OK|OK (payload)|BREAKING|BREAKING|n/a|
293
+ |Spot IDs|OK|OK (context)|BREAKING|BREAKING|BREAKING (context)|
294
+ |API routes|OK|OK (req/res fields)|BREAKING (res fields)|BREAKING|BREAKING|
295
+ |DB columns|OK (with default)|n/a|BREAKING|BREAKING|BREAKING (narrowing)|
296
+ |DI names|OK|OK|BREAKING|BREAKING|BREAKING|
297
+ |Feature IDs|OK|n/a|BREAKING*|BREAKING|n/a|
298
+ |AI agent/tool IDs|OK|OK|BREAKING|BREAKING|BREAKING|
299
+ |AI override surfaces|OK|OK|BREAKING|BREAKING|BREAKING|
300
+ |Import paths|OK|n/a|BREAKING|BREAKING|n/a|
301
+ |Generated registry exports|OK|OK|BREAKING|BREAKING|BREAKING|
304
302
 
305
303
  \* Feature ID removal requires a data migration.
306
304
 
@@ -310,11 +308,11 @@ Files in `apps/mercato/.mercato/generated/` are produced by the CLI generators.
310
308
 
311
309
  `.ai/specs/2026-05-21-email-integration-foundation.md` adds optional per-user scoping to integration credentials so two users on the same tenant can connect their own mailbox (Gmail / IMAP) without sharing one row. **All changes are additive** and pass the contract-surface checks above:
312
310
 
313
- | Surface | Change | Classification |
314
- |---------|--------|----------------|
315
- | Type interface (`IntegrationScope`) | New **optional** field `userId?: string \| null` | ✓ ADDITIVE (Type interface, optional field) |
316
- | Database schema | New nullable column `integration_credentials.user_id uuid` via additive migration `Migration20260526154136`, plus partial unique index `integration_credentials_user_lookup_idx` on `(integration_id, organization_id, tenant_id, user_id)` `WHERE user_id IS NOT NULL AND deleted_at IS NULL` | ✓ ADDITIVE (NULL default; the partial index leaves existing tenant-wide rows untouched) |
317
- | `createCredentialsService` API | `getRaw` / `resolve` / `save` / `saveField` signatures unchanged; when `scope.userId` is falsy the lookup filter pins `user_id = NULL`, reproducing the prior tenant-wide behaviour exactly | ✓ Behaviour-preserving for existing callers |
311
+ |Surface|Change|Classification|
312
+ |---|---|---|
313
+ |Type interface (`IntegrationScope`)|New **optional** field `userId?: string \|null`|✓ ADDITIVE (Type interface, optional field)|
314
+ |Database schema|New nullable column `integration_credentials.user_id uuid` via additive migration `Migration20260526154136`, plus partial unique index `integration_credentials_user_lookup_idx` on `(integration_id, organization_id, tenant_id, user_id)` `WHERE user_id IS NOT NULL AND deleted_at IS NULL`|✓ ADDITIVE (NULL default; the partial index leaves existing tenant-wide rows untouched)|
315
+ |`createCredentialsService` API|`getRaw` / `resolve` / `save` / `saveField` signatures unchanged; when `scope.userId` is falsy the lookup filter pins `user_id = NULL`, reproducing the prior tenant-wide behaviour exactly|✓ Behaviour-preserving for existing callers|
318
316
 
319
317
  **Migration path for existing tenants**: no action required. Existing integrations keep their single `user_id IS NULL` row and resolve exactly as before; only callers that pass `scope.userId` (the new per-user channels) read or write user-scoped rows.
320
318
 
@@ -326,17 +324,17 @@ Files in `apps/mercato/.mercato/generated/` are produced by the CLI generators.
326
324
 
327
325
  > **Update (2026-06-02):** the Microsoft Graph push surfaces (the two `/webhooks/microsoft/*` routes, the `…-microsoft-delta-sync` / `…-microsoft-renew-subscriptions` queues, and `OM_MICROSOFT_WEBHOOK_BASE_URL` / `OM_PUSH_RENEWAL_MICROSOFT_LEAD_HOURS`) were removed together with the `@open-mercato/channel-microsoft` provider — they never shipped in a release, so the removal is not a breaking change. The rows below reflect the Gmail-only surfaces that remain. The `client_state_encrypted` column — proposed solely for Microsoft Graph's anti-tampering nonce — was dropped from scope together with the provider before this branch's migrations were finalized; it appears in no committed migration or snapshot, so there is no schema change to reconcile.
328
326
 
329
- | Surface | Change | Classification |
330
- |---------|--------|----------------|
331
- | Adapter type interface (`ChannelAdapter`) | Three new **optional** methods: `registerPush?`, `unregisterPush?`, `applyPushNotification?` | ✓ ADDITIVE (Type interface, optional fields) |
332
- | Adapter input/output types | New exported types: `PushRegistration`, `RegisterPushInput`, `UnregisterPushInput`, `ApplyPushNotificationInput` | ✓ ADDITIVE (new types, no rename) |
333
- | Event IDs | Four new events: `communication_channels.push.{registered,failed,renewed,deactivated}` | ✓ ADDITIVE (new event IDs) |
334
- | ACL feature IDs | One new feature: `communication_channels.channel.push.manage` | ✓ ADDITIVE (new feature ID) |
335
- | API routes | Two new routes: `/webhooks/gmail`, `/channels/[id]/push/register` | ✓ ADDITIVE (new routes) |
336
- | Database schema | No change. The `client_state_encrypted` column proposed for Microsoft Graph was removed from scope before the migrations were finalized — it is absent from every committed migration and the snapshot. | ✓ No net schema change |
337
- | Queue names | Two new queues: `…-gmail-history-sync`, `…-gmail-renew-watch` | ✓ ADDITIVE |
338
- | Env vars | New optional: `OM_GMAIL_PUBSUB_TOPIC`, `OM_GMAIL_PUBSUB_AUDIENCE`, `OM_GMAIL_PUBSUB_SERVICE_ACCOUNT_EMAIL`, `OM_PUSH_RENEWAL_GMAIL_LEAD_HOURS` | ✓ ADDITIVE |
339
- | Polling cadence | `pollIntervalSeconds` flips 60 → 1800 only when `pushStatus='active'` is persisted. Non-push channels unchanged. | ✓ Behavior-preserving for existing channels |
327
+ |Surface|Change|Classification|
328
+ |---|---|---|
329
+ |Adapter type interface (`ChannelAdapter`)|Three new **optional** methods: `registerPush?`, `unregisterPush?`, `applyPushNotification?`|✓ ADDITIVE (Type interface, optional fields)|
330
+ |Adapter input/output types|New exported types: `PushRegistration`, `RegisterPushInput`, `UnregisterPushInput`, `ApplyPushNotificationInput`|✓ ADDITIVE (new types, no rename)|
331
+ |Event IDs|Four new events: `communication_channels.push.{registered,failed,renewed,deactivated}`|✓ ADDITIVE (new event IDs)|
332
+ |ACL feature IDs|One new feature: `communication_channels.channel.push.manage`|✓ ADDITIVE (new feature ID)|
333
+ |API routes|Two new routes: `/webhooks/gmail`, `/channels/[id]/push/register`|✓ ADDITIVE (new routes)|
334
+ |Database schema|No change. The `client_state_encrypted` column proposed for Microsoft Graph was removed from scope before the migrations were finalized — it is absent from every committed migration and the snapshot.|✓ No net schema change|
335
+ |Queue names|Two new queues: `…-gmail-history-sync`, `…-gmail-renew-watch`|✓ ADDITIVE|
336
+ |Env vars|New optional: `OM_GMAIL_PUBSUB_TOPIC`, `OM_GMAIL_PUBSUB_AUDIENCE`, `OM_GMAIL_PUBSUB_SERVICE_ACCOUNT_EMAIL`, `OM_PUSH_RENEWAL_GMAIL_LEAD_HOURS`|✓ ADDITIVE|
337
+ |Polling cadence|`pollIntervalSeconds` flips 60 → 1800 only when `pushStatus='active'` is persisted. Non-push channels unchanged.|✓ Behavior-preserving for existing channels|
340
338
 
341
339
  **Migration path for existing tenants**: no action required. Push is opt-in per channel — until an operator explicitly registers (via connect flow or `POST /push/register`), Gmail channels keep polling on the Spec B baseline. The new ACL feature `communication_channels.channel.push.manage` must be granted via `yarn mercato auth sync-role-acls` post-deploy for the "Re-register push" button to appear.
342
340
 
@@ -346,16 +344,16 @@ Files in `apps/mercato/.mercato/generated/` are produced by the CLI generators.
346
344
 
347
345
  `.ai/specs/2026-08-06-command-interceptor-http-status.md` lets a command interceptor's deliberate rejection carry an HTTP status and body, so a business block surfaces as (for example) `422` instead of a generic `500`. **All changes are additive** and pass the contract-surface checks above:
348
346
 
349
- | Surface | Change | Classification |
350
- |---------|--------|----------------|
351
- | Type interface (`CommandInterceptorBeforeResult`) | Two new **optional** fields: `status?: number`, `body?: Record<string, unknown>` | ✓ ADDITIVE (Type interface, optional fields) |
352
- | Function signature (`CommandInterceptorError` constructor) | New **optional** second parameter `options?: { status?, body?, cause? }` | ✓ ADDITIVE (optional parameter appended; every `new CommandInterceptorError(message)` call site compiles and behaves identically) |
353
- | Function return types (`runCommandInterceptorsBefore`, `runCommandInterceptorsBeforeUndo`) | Returned `error` widens from `{ message: string }` to `{ message: string; status?: number; body?: Record<string, unknown> }` | ✓ ADDITIVE (a widened return type is safe for readers; callers reading `.message` are unaffected) |
354
- | Import path / exports (`@open-mercato/shared/lib/commands`) | New exports: `isCommandInterceptorError`, `getCommandInterceptorHttpRejection`, `CommandInterceptorErrorOptions`, `CommandInterceptorHttpRejection`. `CommandInterceptorError` keeps its existing export | ✓ ADDITIVE (new exports, nothing removed or renamed) |
355
- | HTTP response shapes (`makeCrudRoute` handlers, `POST /api/audit_logs/audit-logs/actions/undo`) — the two transports that shipped with the original spec | A rejection **that sets a status** answers with it; a rejection that sets none keeps the byte-identical generic `500` (CRUD) / `400 Undo failed` (undo) | ✓ Behaviour-preserving for existing interceptors (regression-tested in `crud-factory.test.ts` and `undo.route.test.ts`) |
356
- | HTTP response shapes (direct `commandBus.execute` routes) — the transport rollout in [#5181](https://github.com/open-mercato/open-mercato/pull/5181) (issue [#5097](https://github.com/open-mercato/open-mercato/issues/5097)) | The same mapping now reaches every first-party transport that owns its `try/catch`: 80 branches across 67 `packages/core` route files, one inline branch in `packages/enterprise/.../security/api/profile/password`, one inline branch in `packages/channel-discord/.../api/channels/[id]/ai-auto-reply`, and six module-level error mappers (`handleCheckoutRouteError`, `handleDocumentsRouteError`, `mapSudoError`, `mapMfaError`, `mapEnforcementError`, `mapSecurityUsersError`) covering 14 further bus-calling routes in `checkout`, `enterprise`-security and `documents`. A rejection that sets **no** status keeps each route's byte-identical historical answer, as do `CrudHttpError`, `ZodError` and optimistic-lock conflicts | ✓ Behaviour-preserving for existing interceptors (pinned per response shape by behavioural tests in each affected package, and held against regression by the static guard `packages/core/src/__tests__/command-interceptor-http-coverage.test.ts`) |
357
- | HTTP response shapes — deliberately **not** covered | 17 routes call the bus where no `catch` can receive the rejection (tracked in [#5435](https://github.com/open-mercato/open-mercato/issues/5435)), and the two `eudr` batch routes (`plots/import`, `product-mappings/suggestions/apply`) keep their published `HTTP 200` + `failed[]` contract because every bus call there sits behind a per-item `catch` | ✓ No change (both exemption lists are asserted in both directions by the static guard, so neither can rot silently) |
358
- | Database schema, event IDs, ACL features, DI names, CLI commands | No change | ✓ n/a |
347
+ |Surface|Change|Classification|
348
+ |---|---|---|
349
+ |Type interface (`CommandInterceptorBeforeResult`)|Two new **optional** fields: `status?: number`, `body?: Record<string, unknown>`|✓ ADDITIVE (Type interface, optional fields)|
350
+ |Function signature (`CommandInterceptorError` constructor)|New **optional** second parameter `options?: { status?, body?, cause? }`|✓ ADDITIVE (optional parameter appended; every `new CommandInterceptorError(message)` call site compiles and behaves identically)|
351
+ |Function return types (`runCommandInterceptorsBefore`, `runCommandInterceptorsBeforeUndo`)|Returned `error` widens from `{ message: string }` to `{ message: string; status?: number; body?: Record<string, unknown> }`|✓ ADDITIVE (a widened return type is safe for readers; callers reading `.message` are unaffected)|
352
+ |Import path / exports (`@open-mercato/shared/lib/commands`)|New exports: `isCommandInterceptorError`, `getCommandInterceptorHttpRejection`, `CommandInterceptorErrorOptions`, `CommandInterceptorHttpRejection`. `CommandInterceptorError` keeps its existing export|✓ ADDITIVE (new exports, nothing removed or renamed)|
353
+ |HTTP response shapes (`makeCrudRoute` handlers, `POST /api/audit_logs/audit-logs/actions/undo`) — the two transports that shipped with the original spec|A rejection **that sets a status** answers with it; a rejection that sets none keeps the byte-identical generic `500` (CRUD) / `400 Undo failed` (undo)|✓ Behaviour-preserving for existing interceptors (regression-tested in `crud-factory.test.ts` and `undo.route.test.ts`)|
354
+ |HTTP response shapes (direct `commandBus.execute` routes) — the transport rollout in [#5181](https://github.com/open-mercato/open-mercato/pull/5181) (issue [#5097](https://github.com/open-mercato/open-mercato/issues/5097))|The same mapping now reaches every first-party transport that owns its `try/catch`: 80 branches across 67 `packages/core` route files, one inline branch in `packages/enterprise/.../security/api/profile/password`, one inline branch in `packages/channel-discord/.../api/channels/[id]/ai-auto-reply`, and six module-level error mappers (`handleCheckoutRouteError`, `handleDocumentsRouteError`, `mapSudoError`, `mapMfaError`, `mapEnforcementError`, `mapSecurityUsersError`) covering 14 further bus-calling routes in `checkout`, `enterprise`-security and `documents`. A rejection that sets **no** status keeps each route's byte-identical historical answer, as do `CrudHttpError`, `ZodError` and optimistic-lock conflicts|✓ Behaviour-preserving for existing interceptors (pinned per response shape by behavioural tests in each affected package, and held against regression by the static guard `packages/core/src/__tests__/command-interceptor-http-coverage.test.ts`)|
355
+ |HTTP response shapes — deliberately **not** covered|17 routes call the bus where no `catch` can receive the rejection (tracked in [#5435](https://github.com/open-mercato/open-mercato/issues/5435)), and the two `eudr` batch routes (`plots/import`, `product-mappings/suggestions/apply`) keep their published `HTTP 200` + `failed[]` contract because every bus call there sits behind a per-item `catch`|✓ No change (both exemption lists are asserted in both directions by the static guard, so neither can rot silently)|
356
+ |Database schema, event IDs, ACL features, DI names, CLI commands|No change|✓ n/a|
359
357
 
360
358
  **Migration path for existing modules**: no action required. The capability is opt-in per rejection — an interceptor that never sets `status` produces exactly the responses it produced before. Interceptors that want a deliberate status add `status` (and optionally `body`) to the `{ ok: false, message }` verdict they already return. First-party transports that call `commandBus.execute` inside their own `try/catch` **now do** honour the contract as of [#5181](https://github.com/open-mercato/open-mercato/pull/5181): every such route consults `getCommandInterceptorHttpRejection(err)` — directly, or through the module-level error mapper it already delegates to — immediately after its `isCrudHttpError` branch, or first in the `catch` where there is none, and the static coverage guard fails when a new bus-calling route ships without it. Third-party transports honour the same contract in the same two lines via `getCommandInterceptorHttpRejection(err)`, which validates the status is an integer in 400-599 before returning it.
361
359
 
@@ -367,13 +365,13 @@ API dispatch and API-interceptor selection now share the same matched-route iden
367
365
  This closes a policy bypass where a mixed-case or percent-encoded spelling dispatched
368
366
  to a handler but did not select its exact `before` interceptor.
369
367
 
370
- | Surface | Change | Classification |
371
- |---------|--------|----------------|
372
- | Function signature (`findApiRouteManifestMatch`) | New optional fourth parameter `request?: Request`; existing three-argument callers keep the same return value and matching behavior | ✓ ADDITIVE (optional parameter appended) |
373
- | API route URLs and handler context | No route is added, removed, or renamed; handler `params` and request query semantics are unchanged | ✓ No contract change |
374
- | Interceptor selection | Static segments use the matched manifest spelling, while matched dynamic/catch-all values stay concrete. Alternate spellings that already reached a route now run the same exact/prefix interceptors as its normal spelling; malformed percent encoding reaches no handler | ⚠️ Intentional security narrowing only (previous policy-bypass requests are denied or intercepted) |
375
- | Request cloning/reconstruction | Dispatcher identity survives `Request.clone()` and `new Request(request.url, request)`. Unknown, forged, or evicted internal continuity metadata fails closed; unbound direct handlers retain legacy URL-derived matching | ✓ Behavior-preserving for valid dispatches; intentional security narrowing for forged metadata |
376
- | Handler ordering | Authorization and interceptor `before`/`after` positions are unchanged | ✓ Behavior-preserving for normally spelled requests |
368
+ |Surface|Change|Classification|
369
+ |---|---|---|
370
+ |Function signature (`findApiRouteManifestMatch`)|New optional fourth parameter `request?: Request`; existing three-argument callers keep the same return value and matching behavior|✓ ADDITIVE (optional parameter appended)|
371
+ |API route URLs and handler context|No route is added, removed, or renamed; handler `params` and request query semantics are unchanged|✓ No contract change|
372
+ |Interceptor selection|Static segments use the matched manifest spelling, while matched dynamic/catch-all values stay concrete. Alternate spellings that already reached a route now run the same exact/prefix interceptors as its normal spelling; malformed percent encoding reaches no handler|⚠️ Intentional security narrowing only (previous policy-bypass requests are denied or intercepted)|
373
+ |Request cloning/reconstruction|Dispatcher identity survives `Request.clone()` and `new Request(request.url, request)`. Unknown, forged, or evicted internal continuity metadata fails closed; unbound direct handlers retain legacy URL-derived matching|✓ Behavior-preserving for valid dispatches; intentional security narrowing for forged metadata|
374
+ |Handler ordering|Authorization and interceptor `before`/`after` positions are unchanged|✓ Behavior-preserving for normally spelled requests|
377
375
 
378
376
  **Migration path for existing modules**: none. Keep authored `targetRoute` values.
379
377
  Callers that dispatch through the framework catch-all receive canonical binding
@@ -388,13 +386,13 @@ authored route constant directly to the interceptor runner.
388
386
 
389
387
  Deleting a user who had customised their sidebar failed on the `user_sidebar_preferences` / `sidebar_variants` foreign keys and surfaced as a generic `500`. The fix clears those rows in `auth.users.delete`, gives both FKs `ON DELETE CASCADE`, and teaches `makeCrudRoute` to recognise a Postgres foreign-key violation (SQLSTATE 23503). **All changes are additive** and pass the contract-surface checks above:
390
388
 
391
- | Surface | Change | Classification |
392
- |---------|--------|----------------|
393
- | Import path / exports (`@open-mercato/shared/lib/db/pg-errors`) | New exports `isForeignKeyViolation(err)` and `getForeignKeyViolationConstraint(err)` | ✓ ADDITIVE (new exports, nothing removed or renamed) |
394
- | HTTP response shapes (`makeCrudRoute` handlers) | A handler that throws a Postgres foreign-key violation now answers `409 { error, code: 'FOREIGN_KEY_VIOLATION', requestId }` with an `x-request-id` header, where it previously answered the generic `500 { error, message, requestId }`. The constraint name is logged and reported to telemetry but never returned to the client. Every other error class keeps its byte-identical historical answer | ⚠️ Behaviour change for one error class only. No retained response loses a field, but a client that treated the old `500` as retryable now receives a non-retryable `409`. Regression-tested in `crud-factory.test.ts` |
395
- | Database schema (`user_sidebar_preferences_user_id_foreign`, `sidebar_variants_user_id_foreign`) | Both constraints are dropped and recreated with `on update cascade on delete cascade` (`Migration20260907120000_auth`). No table or column is added, renamed, removed or retyped, and `down()` restores each constraint to its original definition | ✓ ADDITIVE-ONLY compatible (delete behaviour widened, nothing narrowed) |
396
- | Command behaviour (`auth.users.delete`, `auth.users.create` undo) | The dependent-row cascade also clears `user_sidebar_preferences` and `sidebar_variants`. Those rows are not captured by `UserUndoSnapshot`, so undoing a user delete restores the user, roles, ACLs and custom fields but not the sidebar customisation. `user_consents` is deliberately left untouched | ✓ Behaviour-preserving for every delete that succeeded before; deletes that previously failed with `500` now succeed |
397
- | Event IDs, ACL features, DI names, CLI commands | No change | ✓ n/a |
389
+ |Surface|Change|Classification|
390
+ |---|---|---|
391
+ |Import path / exports (`@open-mercato/shared/lib/db/pg-errors`)|New exports `isForeignKeyViolation(err)` and `getForeignKeyViolationConstraint(err)`|✓ ADDITIVE (new exports, nothing removed or renamed)|
392
+ |HTTP response shapes (`makeCrudRoute` handlers)|A handler that throws a Postgres foreign-key violation now answers `409 { error, code: 'FOREIGN_KEY_VIOLATION', requestId }` with an `x-request-id` header, where it previously answered the generic `500 { error, message, requestId }`. The constraint name is logged and reported to telemetry but never returned to the client. Every other error class keeps its byte-identical historical answer|⚠️ Behaviour change for one error class only. No retained response loses a field, but a client that treated the old `500` as retryable now receives a non-retryable `409`. Regression-tested in `crud-factory.test.ts`|
393
+ |Database schema (`user_sidebar_preferences_user_id_foreign`, `sidebar_variants_user_id_foreign`)|Both constraints are dropped and recreated with `on update cascade on delete cascade` (`Migration20260907120000_auth`). No table or column is added, renamed, removed or retyped, and `down()` restores each constraint to its original definition|✓ ADDITIVE-ONLY compatible (delete behaviour widened, nothing narrowed)|
394
+ |Command behaviour (`auth.users.delete`, `auth.users.create` undo)|The dependent-row cascade also clears `user_sidebar_preferences` and `sidebar_variants`. Those rows are not captured by `UserUndoSnapshot`, so undoing a user delete restores the user, roles, ACLs and custom fields but not the sidebar customisation. `user_consents` is deliberately left untouched|✓ Behaviour-preserving for every delete that succeeded before; deletes that previously failed with `500` now succeed|
395
+ |Event IDs, ACL features, DI names, CLI commands|No change|✓ n/a|
398
396
 
399
397
  **Migration path for existing modules**: no action required. A client that branched on `5xx` for foreign-key failures should treat `409` with `code: 'FOREIGN_KEY_VIOLATION'` as the same condition; it was never retryable.
400
398
 
@@ -404,13 +402,13 @@ Deleting a user who had customised their sidebar failed on the `user_sidebar_pre
404
402
 
405
403
  `TenantDataEncryptionService.encryptFields` treats "already encrypted" as "decrypts under the current DEK" — a deliberate anti-forgery choice ([#2720](https://github.com/open-mercato/open-mercato/issues/2720)). Real ciphertext sealed under a *different* key failed that check too and was encrypted a second time, producing a nested envelope that no read path can undo, plus a lookup hash computed over ciphertext ([#5951](https://github.com/open-mercato/open-mercato/issues/5951)). That write is now rejected:
406
404
 
407
- | Surface | Change | Classification |
408
- |---------|--------|----------------|
409
- | Import path / exports (`@open-mercato/shared/lib/encryption/aes`) | New export `isEncryptedPayloadShape(value)` — a key-free structural check (`<iv>:<ct>:<tag>:v1` with a 12-byte IV, 16-byte tag and non-empty ciphertext). Explicitly NOT an "is this encrypted" oracle; the shape is forgeable | ✓ ADDITIVE (new export, nothing removed or renamed) |
410
- | Function behaviour (`encryptEntityPayload` / `encryptFields`) | A field holding a structurally well-formed envelope that does not decrypt under the current DEK now raises `TenantDataEncryptionError` with code `WRONG_KEY`, where it previously returned a payload containing a nested envelope. Signature, return type and every other input keep their byte-identical historical behaviour | ⚠️ Behaviour change on one previously-corrupting path. `WRONG_KEY` was already declared in `TenantDataEncryptionErrorCode` and emitted nowhere, so no existing handler changes meaning. Regression-tested in `tenantDataEncryptionService.test.ts` |
411
- | Encryption-at-rest guarantee (#2720) | Unchanged. Nothing is ever stored verbatim: a forgery whose shape is not length-valid (the check is length-based, not content-based) still fails the structural check and is encrypted as ordinary plaintext, and a length-valid one is rejected rather than persisted | ✓ Preserved (pinned by the retained `#2720` test cases) |
412
- | CLI behaviour (`mercato entities rotate-encryption-key`, `… backfill-system-encryption`) | A row whose ciphertext opens under neither `--old-key` nor the current tenant key is reported and skipped instead of rewritten; the backfill no longer passes already-encrypted columns to the encrypt path. Rows that rotated or backfilled successfully before are unaffected | ✓ Behaviour-preserving for every row that succeeded before; a row that was previously corrupted is now skipped instead — `rotate-encryption-key --old-key` reports it in the run summary, while `backfill-system-encryption` and `rotate-encryption-key` without `--old-key` skip it silently (see UPGRADE_NOTES.md) |
413
- | DB schema, API routes, event IDs, ACL features, DI names | No change | ✓ n/a |
405
+ |Surface|Change|Classification|
406
+ |---|---|---|
407
+ |Import path / exports (`@open-mercato/shared/lib/encryption/aes`)|New export `isEncryptedPayloadShape(value)` — a key-free structural check (`<iv>:<ct>:<tag>:v1` with a 12-byte IV, 16-byte tag and non-empty ciphertext). Explicitly NOT an "is this encrypted" oracle; the shape is forgeable|✓ ADDITIVE (new export, nothing removed or renamed)|
408
+ |Function behaviour (`encryptEntityPayload` / `encryptFields`)|A field holding a structurally well-formed envelope that does not decrypt under the current DEK now raises `TenantDataEncryptionError` with code `WRONG_KEY`, where it previously returned a payload containing a nested envelope. Signature, return type and every other input keep their byte-identical historical behaviour|⚠️ Behaviour change on one previously-corrupting path. `WRONG_KEY` was already declared in `TenantDataEncryptionErrorCode` and emitted nowhere, so no existing handler changes meaning. Regression-tested in `tenantDataEncryptionService.test.ts`|
409
+ |Encryption-at-rest guarantee (#2720)|Unchanged. Nothing is ever stored verbatim: a forgery whose shape is not length-valid (the check is length-based, not content-based) still fails the structural check and is encrypted as ordinary plaintext, and a length-valid one is rejected rather than persisted|✓ Preserved (pinned by the retained `#2720` test cases)|
410
+ |CLI behaviour (`mercato entities rotate-encryption-key`, `… backfill-system-encryption`)|A row whose ciphertext opens under neither `--old-key` nor the current tenant key is reported and skipped instead of rewritten; the backfill no longer passes already-encrypted columns to the encrypt path. Rows that rotated or backfilled successfully before are unaffected|✓ Behaviour-preserving for every row that succeeded before; a row that was previously corrupted is now skipped instead — `rotate-encryption-key --old-key` reports it in the run summary, while `backfill-system-encryption` and `rotate-encryption-key` without `--old-key` skip it silently (see UPGRADE_NOTES.md)|
411
+ |DB schema, API routes, event IDs, ACL features, DI names|No change|✓ n/a|
414
412
 
415
413
  **Migration path for existing modules**: no action required. Operationally, a write touching a record whose encrypted field is sealed under a stale key now fails loudly until the rotation is finished (`mercato entities rotate-encryption-key --old-key …`) or the sealing DEK is restored — a deliberate trade of availability for integrity, since the previous outcome was silent, undetectable corruption. This change does not repair envelopes that were already nested before the upgrade.
416
414
 
@@ -420,13 +418,13 @@ Deleting a user who had customised their sidebar failed on the `user_sidebar_pre
420
418
 
421
419
  [`.ai/specs/2026-08-12-module-registry-registration-listeners.md`](.ai/specs/2026-08-12-module-registry-registration-listeners.md) adds a public subscription to the module registry so a cache derived from the module list can drop what it built from an incomplete one ([#5103](https://github.com/open-mercato/open-mercato/issues/5103)). **All changes are additive** and pass the contract-surface checks above:
422
420
 
423
- | Surface | Change | Classification |
424
- |---------|--------|----------------|
425
- | Function signatures | New export `onModulesRegistered(listener)` on `@open-mercato/shared/lib/modules/registry` | ✓ ADDITIVE (new function) |
426
- | Type definitions | New export `ModulesRegisteredListener = (modules: Module[]) => void \| PromiseLike<void>` | ✓ ADDITIVE (new type, no rename) |
427
- | `registerModules(modules)` | Signature, return type, and synchronous behavior unchanged; it now also notifies listeners after the reconciliation it already performed | ✓ Behaviour-preserving for existing callers |
428
- | Import paths | None — both exports ship from the existing registry path | ✓ No change |
429
- | Event IDs, API routes, DB schema, DI names, ACL features, notification IDs, CLI commands, generated files | No change | ✓ n/a |
421
+ |Surface|Change|Classification|
422
+ |---|---|---|
423
+ |Function signatures|New export `onModulesRegistered(listener)` on `@open-mercato/shared/lib/modules/registry`|✓ ADDITIVE (new function)|
424
+ |Type definitions|New export `ModulesRegisteredListener = (modules: Module[]) => void \|PromiseLike<void>`|✓ ADDITIVE (new type, no rename)|
425
+ |`registerModules(modules)`|Signature, return type, and synchronous behavior unchanged; it now also notifies listeners after the reconciliation it already performed|✓ Behaviour-preserving for existing callers|
426
+ |Import paths|None — both exports ship from the existing registry path|✓ No change|
427
+ |Event IDs, API routes, DB schema, DI names, ACL features, notification IDs, CLI commands, generated files|No change|✓ n/a|
430
428
 
431
429
  **Contract commitments**: listeners are notified synchronously after `setGlobalModules()` (so `getModules()` is readable inside a listener) and only when the registered set actually changed, as decided by an immutable per-registration snapshot of module ids, top-level contract keys and array-valued contract elements. Accessor-declared contracts are never invoked by that snapshot and always count as changed. The contract is fail-soft on both paths: a synchronous throw and an asynchronous rejection are each observed and logged, and neither can fail `registerModules()`. Change detection MAY become more sensitive without a deprecation cycle (over-invalidation only drops a warm cache); it MUST NOT become less sensitive, since that direction serves a stale registry.
432
430
 
@@ -436,40 +434,44 @@ Deleting a user who had customised their sidebar failed on the `user_sidebar_pre
436
434
 
437
435
  Issue #3852 removed the non-cryptographic passkey verification shape from `PasskeyProvider` in the enterprise `security` module. This is a **deliberate breaking change to a STABLE contract surface (category 7, API request shapes)** that ships under the [Emergency Security Exception](#emergency-security-exception) rather than the ordinary deprecation protocol.
438
436
 
439
- **Classification.** The removed shape was a *publicly supported* surface, not an undocumented accident: it was part of the exported `MfaProviderInterface.verifySchema` union that a third-party client could validate against, and the enterprise test suite pinned it in a case named *"supports legacy verification payload for backward compatibility"*. It is therefore a genuine STABLE-surface break, and the exception — not a claim that no contract existed — is what authorizes it.
437
+ **Classification.** This public `MfaProviderInterface.verifySchema` union shape was client-validatable and covered by an enterprise legacy-compatibility test. Its removal is a STABLE break authorized by the security exception.
440
438
 
441
439
  **Exception requirements, as met by this change:**
442
440
 
443
- | Requirement | How it is satisfied |
444
- |-------------|--------------------|
445
- | 1. Qualifying condition argued | See *Why the deprecation protocol does not apply* below — both values the removed shape compared are disclosed by the server, so accepting it *is* the bypass |
446
- | 2. Narrowest removal, no retained vulnerable branch | Only `verifyPayloadSchema` and the two non-cryptographic acceptance paths are deleted. The `{ response }` path, the challenge TTL check and the signature-counter update are untouched, and **no flag, config toggle or opt-in keeps the old shape reachable** |
447
- | 3. Steps 4 and 5 | [`UPGRADE_NOTES.md`](UPGRADE_NOTES.md) `0.6.7 → 0.7.0` (client *and* operator actions); spec [`.ai/specs/enterprise/2026-08-14-passkey-mfa-require-webauthn-assertion.md`](.ai/specs/enterprise/2026-08-14-passkey-mfa-require-webauthn-assertion.md) § Migration & Backward Compatibility |
448
- | 4. Dated entry | This section |
449
- | 5. Maintainer sign-off | PR carries the `security` label; the waiver is called out in the PR body for explicit human approval |
450
-
451
- | Surface | Change | Classification |
452
- |---------|--------|----------------|
453
- | API request shape (`POST /api/security/mfa/verify`, `POST /api/security/sudo/verify`, `methodType: 'passkey'`) | `payload` must be `{ response }` carrying a WebAuthn assertion. The `{ credentialId, challenge }` alternative is removed and now answers `401` | ✗ BREAKING (deliberate — see rationale) |
454
- | Provider contract (`MfaProviderInterface.verifySchema` for `passkey`) | `verifyPayloadSchema` narrows from a union to a single object requiring `response` | ✗ BREAKING for a caller that validated against the exported schema |
455
- | Verification behavior | A verified `verifyAuthenticationResponse` is the only route to a positive verdict; an absent verify context is a rejection rather than a `credentialId` comparison | ✗ BREAKING for a client that skipped `/api/security/mfa/prepare` |
456
- | Failure mode | A payload that fails the schema, and an assertion the verifier throws on, return `false` instead of throwing — so they answer the documented `401` and count toward the challenge attempt limit instead of logging a `500` that skipped lockout | ✓ Strictly safer (no verdict flips from negative to positive) |
457
- | API route URLs, HTTP methods, response schemas, database schema, event IDs, ACL features, DI names, CLI commands | No change | ✓ n/a |
441
+ |Requirement|How it is satisfied|
442
+ |---|---|
443
+ |1. Qualifying condition argued|See *Why the deprecation protocol does not apply* below — both values the removed shape compared are disclosed by the server, so accepting it *is* the bypass|
444
+ |2. Narrowest removal, no retained vulnerable branch|Only `verifyPayloadSchema` and the two non-cryptographic acceptance paths are deleted. The `{ response }` path, the challenge TTL check and the signature-counter update are untouched, and **no flag, config toggle or opt-in keeps the old shape reachable**|
445
+ |3. Steps 4 and 5|[`UPGRADE_NOTES.md`](UPGRADE_NOTES.md) `0.6.7 → 0.7.0` (client *and* operator actions); spec [`.ai/specs/enterprise/2026-08-14-passkey-mfa-require-webauthn-assertion.md`](.ai/specs/enterprise/2026-08-14-passkey-mfa-require-webauthn-assertion.md) § Migration & Backward Compatibility|
446
+ |4. Dated entry|This section|
447
+ |5. Maintainer sign-off|PR carries the `security` label; the waiver is called out in the PR body for explicit human approval|
448
+
449
+ |Surface|Change|Classification|
450
+ |---|---|---|
451
+ |API request shape (`POST /api/security/mfa/verify`, `POST /api/security/sudo/verify`, `methodType: 'passkey'`)|`payload` must be `{ response }` carrying a WebAuthn assertion. The `{ credentialId, challenge }` alternative is removed and now answers `401`|✗ BREAKING (deliberate — see rationale)|
452
+ |Provider contract (`MfaProviderInterface.verifySchema` for `passkey`)|`verifyPayloadSchema` narrows from a union to a single object requiring `response`|✗ BREAKING for a caller that validated against the exported schema|
453
+ |Verification behavior|A verified `verifyAuthenticationResponse` is the only route to a positive verdict; an absent verify context is a rejection rather than a `credentialId` comparison|✗ BREAKING for a client that skipped `/api/security/mfa/prepare`|
454
+ |Failure mode|A payload that fails the schema, and an assertion the verifier throws on, return `false` instead of throwing — so they answer the documented `401` and count toward the challenge attempt limit instead of logging a `500` that skipped lockout|✓ Strictly safer (no verdict flips from negative to positive)|
455
+ |API route URLs, HTTP methods, response schemas, database schema, event IDs, ACL features, DI names, CLI commands|No change|✓ n/a|
458
456
 
459
457
  **Why the deprecation protocol does not apply.** The protocol exists to give downstream authors a bridge release. Here the request shape being removed *is* the vulnerability: both values it compared are disclosed by the server, so a bridge would keep the passkey second factor bypassable for a minor version in both login MFA and sudo step-up. A security fix that leaves the hole open is not a fix.
460
458
 
461
459
  **Migration path.** Send `startAuthentication()` output as `payload.response`. The first-party `PasskeyChallengeVerify` component already does, so shipped UIs are unaffected. Credentials enrolled through the setup path's client-supplied `publicKey` shortcut are **not** reliably rendered unusable by this change — depending on what the client supplied, such a row holds either a key nobody can sign with or a keypair the enroller controls, and the second kind produces assertions this change accepts. That shortcut is a separate open surface (#5296); operator-facing remediation is in [`UPGRADE_NOTES.md`](UPGRADE_NOTES.md).
462
460
 
461
+ ## Query-index scope (2026-08-28)
462
+
463
+ [Reindex/catalogue contracts and migration](UPGRADE_NOTES.md).
464
+
463
465
  ## Data Sync Start Control Applicability (2026-09-02)
464
466
 
465
467
  [`.ai/specs/2026-09-02-data-sync-adapter-start-controls.md`](.ai/specs/2026-09-02-data-sync-adapter-start-controls.md) lets a `DataSyncAdapter` declare, per entity type, which of the Data Sync dashboard's manual-start controls apply, so the dashboard stops offering controls that cannot mean anything for the selected entity type. **All changes are additive** and pass the contract-surface checks above:
466
468
 
467
- | Surface | Change | Classification |
468
- |---------|--------|----------------|
469
- | Type definitions (§2) | New optional method `DataSyncAdapter.supportsStartControl?(control, entityType)`; new exported type `DataSyncStartControl = 'fullSync' \| 'batchSize'` | ✓ ADDITIVE (optional member, new type — same shape as the `persistsSharedCursor` and `runParameters` additions before it) |
470
- | Import paths (§4) | New module `data_sync/lib/start-controls.ts` exporting `resolveStartControlMap`, `applicableStartControls`, `StartControlMap`, `StartControlApplicability`, `DATA_SYNC_START_CONTROLS` | ✓ ADDITIVE (new path; nothing moved or re-exported) |
471
- | API route URLs (§7) | `GET /api/data_sync/options` items gain a `startControls` object; `POST /api/data_sync/run` is unchanged and keeps honouring `fullSync` and `batchSize` whatever an adapter declares | ✓ ADDITIVE (new optional response field, no request-shape change) |
472
- | Auto-discovery, function signatures, event IDs, widget spot IDs, DB schema, DI names, ACL features, notification IDs, CLI commands, generated files | No change | ✓ n/a |
469
+ |Surface|Change|Classification|
470
+ |---|---|---|
471
+ |Type definitions (§2)|New optional method `DataSyncAdapter.supportsStartControl?(control, entityType)`; new exported type `DataSyncStartControl = 'fullSync' \|'batchSize'`|✓ ADDITIVE (optional member, new type — same shape as the `persistsSharedCursor` and `runParameters` additions before it)|
472
+ |Import paths (§4)|New module `data_sync/lib/start-controls.ts` exporting `resolveStartControlMap`, `applicableStartControls`, `StartControlMap`, `StartControlApplicability`, `DATA_SYNC_START_CONTROLS`|✓ ADDITIVE (new path; nothing moved or re-exported)|
473
+ |API route URLs (§7)|`GET /api/data_sync/options` items gain a `startControls` object; `POST /api/data_sync/run` is unchanged and keeps honouring `fullSync` and `batchSize` whatever an adapter declares|✓ ADDITIVE (new optional response field, no request-shape change)|
474
+ |Auto-discovery, function signatures, event IDs, widget spot IDs, DB schema, DI names, ACL features, notification IDs, CLI commands, generated files|No change|✓ n/a|
473
475
 
474
476
  **Contract commitments**: only an explicit `false` removes a control, so an adapter that declares nothing — or whose predicate returns anything else — renders the same form and sends the same request body as before. A predicate that throws is treated as *applies*, because `api/options.ts` resolves every registered adapter in one response and one broken predicate must not take the dashboard down for the rest. The `startControls` map is sparse and keyed only by the adapter's own `supportedEntities`; a missing entry means every control applies, so a client that ignores the field behaves exactly as today. The declaration governs what the dashboard **offers**, never what the run API **accepts** — that separation MUST hold for any future change here, or an API client posting `fullSync: true` would silently stop getting a full run.
475
477
 
@@ -479,18 +481,18 @@ Issue #3852 removed the non-cryptographic passkey verification shape from `Passk
479
481
 
480
482
  Spec: [`.ai/specs/2026-09-08-error-reporting-policy.md`](.ai/specs/2026-09-08-error-reporting-policy.md). Every change is additive; no existing path emits less than it did before.
481
483
 
482
- | Surface | Change | Classification |
483
- |---------|--------|----------------|
484
- | `TelemetryProvider` | Optional `reportError?()` added, called in addition to the span/log/metric path. MUST stay optional — third parties implement this interface | ✓ ADDITIVE |
485
- | `ReportErrorContext` / `TelemetryRuntime['reportError']` context | Optional `code?: string` fingerprint added | ✓ ADDITIVE |
486
- | `data_sync.run.completed` payload | Optional `createdCount`, `updatedCount`, `skippedCount`, `failedCount` added; no existing field changed (§5 permits additive payload fields) | ✓ ADDITIVE |
487
- | `integration_logs` rows at `level: 'error'` | Also reported to the active telemetry backend (message, `code`, ids — never `payload`). With telemetry off, one global lookup and no behaviour change | ✓ ADDITIVE |
488
- | `queue` failure paths, `data_sync` engine | Existing `logger.error` lines keep their text and gain a `reportError` call with a `code` | ✓ ADDITIVE |
489
- | `reportError`'s `code` | A value that is not shaped `module.reason` is dropped rather than published, so it cannot become an unbounded, unredacted metric label. No in-repo caller passes one; a caller that did reported exactly as one passing no `code`, which is the pre-PR behaviour | ✓ ADDITIVE |
490
- | `integration_logs` message text for the payment status poller and the Stripe webhook processor | The failure cause moves from `payload` **into** the message (`Payment status polling failed: {cause}`), because the payload is deliberately never reported. `payload` keeps the same fields | ✓ ADDITIVE (row content, no schema or field change) |
491
- | `integration_logs.code` for the payment status poller | Previously `null`, now `payment_gateways.status_poll_failed`, so it groups apart from the `integrations.log_error` catch-all. The column and its API field already existed | ✓ ADDITIVE (a value where there was none) |
492
- | `IntegrationLogError` (`core:integrations`), `SyncRunPartialFailureError` (`core:data_sync`) | New exported error classes | ✓ ADDITIVE |
493
- | API route URLs, response schemas, database schema, event IDs, ACL features, DI names, CLI commands, env vars | No change — the policy adds no configuration | ✓ n/a |
484
+ |Surface|Change|Classification|
485
+ |---|---|---|
486
+ |`TelemetryProvider`|Optional `reportError?()` added, called in addition to the span/log/metric path. MUST stay optional — third parties implement this interface|✓ ADDITIVE|
487
+ |`ReportErrorContext` / `TelemetryRuntime['reportError']` context|Optional `code?: string` fingerprint added|✓ ADDITIVE|
488
+ |`data_sync.run.completed` payload|Optional `createdCount`, `updatedCount`, `skippedCount`, `failedCount` added; no existing field changed (§5 permits additive payload fields)|✓ ADDITIVE|
489
+ |`integration_logs` rows at `level: 'error'`|Also reported to the active telemetry backend (message, `code`, ids — never `payload`). With telemetry off, one global lookup and no behaviour change|✓ ADDITIVE|
490
+ |`queue` failure paths, `data_sync` engine|Existing `logger.error` lines keep their text and gain a `reportError` call with a `code`|✓ ADDITIVE|
491
+ |`reportError`'s `code`|A value that is not shaped `module.reason` is dropped rather than published, so it cannot become an unbounded, unredacted metric label. No in-repo caller passes one; a caller that did reported exactly as one passing no `code`, which is the pre-PR behaviour|✓ ADDITIVE|
492
+ |`integration_logs` message text for the payment status poller and the Stripe webhook processor|The failure cause moves from `payload` **into** the message (`Payment status polling failed: {cause}`), because the payload is deliberately never reported. `payload` keeps the same fields|✓ ADDITIVE (row content, no schema or field change)|
493
+ |`integration_logs.code` for the payment status poller|Previously `null`, now `payment_gateways.status_poll_failed`, so it groups apart from the `integrations.log_error` catch-all. The column and its API field already existed|✓ ADDITIVE (a value where there was none)|
494
+ |`IntegrationLogError` (`core:integrations`), `SyncRunPartialFailureError` (`core:data_sync`)|New exported error classes|✓ ADDITIVE|
495
+ |API route URLs, response schemas, database schema, event IDs, ACL features, DI names, CLI commands, env vars|No change — the policy adds no configuration|✓ n/a|
494
496
 
495
497
  **Operator note — terminal queue failures.** Not a contract break, but visible in an alert rule: on the **local** strategy a job's final attempt previously emitted both `queue.job_failed` and `queue.job_exhausted`; it now emits only `queue.job_exhausted`, matching the `async` strategy. An alert thresholding on `queue.job_failed` alone stops seeing terminal failures — page on `queue.job_exhausted`.
496
498
 
@@ -500,17 +502,13 @@ Spec: [`.ai/specs/2026-09-08-error-reporting-policy.md`](.ai/specs/2026-09-08-er
500
502
 
501
503
  [`.ai/specs/2026-09-16-data-sync-retry-resume-actions.md`](.ai/specs/2026-09-16-data-sync-retry-resume-actions.md) splits the Data Sync dashboard's single overloaded "Retry" button into three named operator actions — **Retry** (labelled **Resume** on a cancelled run), **Retry from the beginning**, and **Run again** — and states, on the run detail page, where a retry would resume. **All changes are additive** and pass the contract-surface checks above:
502
504
 
503
- | Surface | Change | Classification |
504
- |---------|--------|----------------|
505
- | Type definitions (§2) | New exported types `ResumePoint` (a discriminated union of `none` / `noCommittedBatch` / `resumes`) and `ResumePointRun` | ✓ ADDITIVE (new types, nothing renamed — same shape as the `StartControlMap` addition before it) |
506
- | Import paths (§4) | New module `data_sync/lib/resume-point.ts` exporting `resolveResumePoint`, `isRetryableRunStatus`, `ResumePoint`, `ResumePointRun` | ✓ ADDITIVE (new path; nothing moved or re-exported) |
507
- | API route URLs (§7) | **No change.** `POST /api/data_sync/runs/[id]/retry` and `POST /api/data_sync/run` are untouched — no new request field, no new response field, no new status code and no new error code. The UI starts sending the already-accepted `fromBeginning: true` for the first time, and reads `cursor` / `initialCursor` / `batchesCompleted`, all of which `GET /api/data_sync/runs` and `GET /api/data_sync/runs/[id]` have returned since 2026-08-12 | ✓ n/a |
508
- | Database schema (§8) | No change. No entity, column, migration or `.snapshot-open-mercato.json` update; no new run status — the vestigial `paused` status is left exactly as it was | ✓ n/a |
509
- | Auto-discovery, function signatures, event IDs, widget spot IDs, DI names, ACL features, notification IDs, CLI commands, generated files | No change | ✓ n/a |
505
+ ADDITIVE (§2/§4): `data_sync/lib/resume-point.ts` exports `resolveResumePoint`, `isRetryableRunStatus`, `ResumePoint` (`none` / `noCommittedBatch` / `resumes`) and `ResumePointRun`. Nothing is renamed, moved or re-exported. All other contract categories are unchanged, including database schema, snapshots and the vestigial `paused` status.
506
+
507
+ API (§7): `POST /api/data_sync/runs/[id]/retry` and `POST /api/data_sync/run` retain their fields, statuses and errors. The UI now sends the already-supported `fromBeginning: true` and reads existing `cursor` / `initialCursor` / `batchesCompleted` fields, returned by list/detail GET routes since 2026-08-12.
510
508
 
511
- **Contract commitments**: the retry endpoint deliberately does **not** enforce `supportsStartControl('fullSync', entityType)` before honouring `fromBeginning: true`. [§ Data Sync Start Control Applicability (2026-09-02)](#data-sync-start-control-applicability-2026-09-02) already commits that the declaration "governs what the dashboard **offers**, never what the run API **accepts**", and `fromBeginning: true` on `retry` requests the identical thing as `fullSync: true` on `run` — a `null` start cursor — so the two siblings MUST answer identically. An adapter-declared restriction hides the from-the-beginning action in the UI and nothing more; a scripted or API client keeps the documented escape hatch. Making either endpoint strict is a breaking change under §7 and needs the deprecation protocol, not a UI spec.
509
+ **Contract commitments:** `supportsStartControl('fullSync', entityType)` governs dashboard offers, never API acceptance ([existing contract](#data-sync-start-control-applicability-2026-09-02)). Retry's `fromBeginning: true` and run's `fullSync: true` both request a null start cursor and MUST behave identically. Adapter restrictions only hide the UI action; API clients retain the escape hatch. Tightening either endpoint requires §7 deprecation.
512
510
 
513
- `ResumePoint` also has **no `fromBeginning` variant, by design**. `api/runs/[id]/retry.ts` resolves a resumable retry as `previous.cursor ?? resolveStartCursor(...)`, and `resolveStartCursor` reads the shared `sync_cursors` row — state the run row does not carry — so a run that committed no batch of its own may still resume at a cursor an earlier run wrote. `noCommittedBatch` therefore means only "this run committed nothing" and MUST NOT be widened by a caller into a positional claim about where a retry starts. A future additive `retryStartCursor` response field is the only way to close that gap; it is out of scope here.
511
+ `ResumePoint` deliberately has no `fromBeginning` variant: retry resolves `previous.cursor ?? resolveStartCursor(...)`, whose fallback reads shared `sync_cursors` state absent from the run row. Even a run without committed batches may resume from an earlier run's cursor. `noCommittedBatch` MUST mean only "this run committed nothing", never a retry position. Only a future additive `retryStartCursor` field could supply that position; it remains out of scope.
514
512
 
515
513
  **Migration path for existing adapters and clients**: none. The module is new, every endpoint is unchanged, and an adapter or API client that ignores all of this behaves exactly as before.
516
514
 
@@ -518,29 +516,35 @@ Spec: [`.ai/specs/2026-09-08-error-reporting-policy.md`](.ai/specs/2026-09-08-er
518
516
 
519
517
  [`.ai/specs/2026-09-16-customers-quick-create-injection-spot-bridge.md`](.ai/specs/2026-09-16-customers-quick-create-injection-spot-bridge.md) binds the sales document form's Person/Company quick-create dialogs to the customers module's declared `crud-form:customers.person` / `…company` hosts. The dialogs previously had no `injectionSpotId`, so `CrudForm` auto-derived `crud-form:customers.customer_entity` (§6, FROZEN) there instead.
520
518
 
521
- | Surface | Change | Classification |
522
- |---------|--------|----------------|
523
- | Widget Injection Spot IDs (§6) | `CrudForm` gains an additive `legacyInjectionSpotId?: string` prop. When set, its header/body/field widgets are dual-published alongside the primary `injectionSpotId`'s — `crud-form:customers.customer_entity` stays live on these two dialogs via the bridge, so nothing that already targets it stops rendering | ✓ ADDITIVE (bridge, not a removal — see Deprecation Protocol steps 1–3) |
524
- | Widget Injection Spot IDs (§6) | The two dialogs now also publish `crud-form:customers.person` / `…company` (previously published only by the person/company detail pages) | ✓ ADDITIVE ("MAY add new spot IDs to new or existing pages") |
525
- | Context passed to widgets at `crud-form:customers.person` / `…company` | These hosts' widgets now also mount with `operation: 'create'` and no `recordId` on the two quick-create dialogs, for the first time — previously always `operation: 'update'` with a concrete `recordId` | Disclosed in [`UPGRADE_NOTES.md`](UPGRADE_NOTES.md) "Action for module authors"; not itself a contract surface change (§6 permits "new optional context fields", and `operation`/`recordId` were always part of the injection context shape) |
526
- | Type definitions (§2) | New optional `CrudForm` prop `legacyInjectionSpotId?: string` | ✓ ADDITIVE |
519
+ |Surface|Change|Classification|
520
+ |---|---|---|
521
+ |Widget Injection Spot IDs (§6)|`CrudForm` gains an additive `legacyInjectionSpotId?: string` prop. When set, its header/body/field widgets are dual-published alongside the primary `injectionSpotId`'s — `crud-form:customers.customer_entity` stays live on these two dialogs via the bridge, so nothing that already targets it stops rendering|✓ ADDITIVE (bridge, not a removal — see Deprecation Protocol steps 1–3)|
522
+ |Widget Injection Spot IDs (§6)|The two dialogs now also publish `crud-form:customers.person` / `…company` (previously published only by the person/company detail pages)|✓ ADDITIVE ("MAY add new spot IDs to new or existing pages")|
523
+ |Context passed to widgets at `crud-form:customers.person` / `…company`|These hosts' widgets now also mount with `operation: 'create'` and no `recordId` on the two quick-create dialogs, for the first time — previously always `operation: 'update'` with a concrete `recordId`|Disclosed in [`UPGRADE_NOTES.md`](UPGRADE_NOTES.md) "Action for module authors"; not itself a contract surface change (§6 permits "new optional context fields", and `operation`/`recordId` were always part of the injection context shape)|
524
+ |Type definitions (§2)|New optional `CrudForm` prop `legacyInjectionSpotId?: string`|✓ ADDITIVE|
527
525
 
528
526
  **Deprecation window.** `legacyInjectionSpotId` is scoped to these two call sites and intended for removal after at least one minor version (Deprecation Protocol step 1), tracked in the spec's Changelog and in `UPGRADE_NOTES.md`. No maintainer waiver was needed — nothing is removed by this change.
529
527
 
528
+ ### 2026-10-01 — Passkey enrollment (#6800)
529
+
530
+ STABLE `PUT /api/security/mfa/provider/passkey`: unverified keys bypass verification; a bridge preserves the exploit. [@haxiorz approved waiver/migration](https://github.com/open-mercato/open-mercato/pull/6824#issuecomment-6505351158).
531
+
532
+ Clients use WebAuthn; operators audit key provenance, re-enroll with recovery. [Spec](.ai/specs/enterprise/2026-10-01-passkey-enrollment-require-webauthn-attestation.md); [migration](UPGRADE_NOTES.md#090--091-unreleased).
533
+
530
534
  ## Atomic Auth Command Replay (2026-10-04)
531
535
 
532
536
  [`.ai/specs/2026-07-28-protected-roles-and-audit-seam.md`](.ai/specs/2026-07-28-protected-roles-and-audit-seam.md) closes the auth undo/redo transaction, authorization, and membership-phantom gaps without changing existing command handlers by default.
533
537
 
534
- | Surface | Change | Classification |
535
- |---------|--------|----------------|
536
- | Type definitions (`CommandHandler`, `CommandRuntimeContext`, `CommandExecuteResult`) | New optional `atomicReplay?: boolean` and `stabilizeReplay(...)` handler capabilities, optional `replayTransactionGuard` request guard, optional caller-owned `transactionLifetime`, and optional `replaySourceFinalized?: boolean` result signal. `TransactionLifetime` plus its observation/completion-registration helpers are new exports; lifetime creation/completion remains owned by `withAtomicFlush` | ✓ ADDITIVE (optional fields and exports; omitted handlers and contexts keep the prior flow) |
537
- | `ActionLogService` method signatures | `log`, `claimForUndo`, `releaseUndoClaim`, and `markUndone` accept an optional trailing transactional `EntityManager`; new `claimForRedo` method | ✓ ADDITIVE (optional parameters appended and a new method; existing calls retain behavior) |
538
- | `RbacService` | New `loadAclWithEntityManager`, `userHasAllFeaturesWithEntityManager`, and `getGrantedFeaturesWithEntityManager` methods bypass caches and bind every query to the supplied transaction | ✓ ADDITIVE (new methods; existing cache-backed methods are unchanged) |
539
- | Auth command replay behavior | Auth user/role handlers opt in so source-log state, domain changes, undo trace or new redo log, and redo source finalization commit or roll back together. Before the request guard or feature interceptors run, `stabilizeReplay` discovers and seals one actor/target/destination footprint and locks API keys, users, roles, tenant/organization hierarchy, and authorization children in a total order using the same transaction | ⚠️ Intentional security hardening. A race that previously could deadlock or replay with stale authority is rejected with the existing domain `409`; successful, authorized replay keeps the same response shape |
540
- | Action-log actor persistence and self replay | `actor_user_id` remains a UUID; new entries also store the canonical user or `api_key:<uuid>` subject in `context.actorSubject`. API-key list ownership, undo/redo ownership, exact-EM RBAC, locks, and latest replay queries use the canonical subject. Canonical history is selected before the legacy bare-UUID fallback, which additionally requires a coherent live `isApiKey`/`keyId`/`sub` tuple | ✓ Database-compatible additive context metadata; same-UUID user, malformed, or ambiguous ownership cannot shadow canonical key history and fails closed |
541
- | Auth authorization-state writers | First-party `UserRole`, `UserAcl`, and `RoleAcl` writers in commands, setup, CLI, execution principals, SSO, and agent orchestration now share the canonical parent-lock protocol; SSO membership and grant rows commit together | ⚠️ Intentional concurrency hardening; no request, response, schema, import-path, event, feature, or CLI contract changes |
542
- | Non-auth command replay | Handlers that omit `atomicReplay` retain the existing undo claim/release compensation and route-level redo finalization | ✓ Behavior-preserving |
543
- | API routes, response schemas, database schema, event IDs, ACL feature IDs, DI names, CLI commands, generated files | No shape or identifier change | ✓ n/a |
538
+ |Surface|Change|Classification|
539
+ |---|---|---|
540
+ |Type definitions (`CommandHandler`, `CommandRuntimeContext`, `CommandExecuteResult`)|New optional `atomicReplay?: boolean` and `stabilizeReplay(...)` handler capabilities, optional `replayTransactionGuard` request guard, optional caller-owned `transactionLifetime`, and optional `replaySourceFinalized?: boolean` result signal. `TransactionLifetime` plus its observation/completion-registration helpers are new exports; lifetime creation/completion remains owned by `withAtomicFlush`|✓ ADDITIVE (optional fields and exports; omitted handlers and contexts keep the prior flow)|
541
+ |`ActionLogService` method signatures|`log`, `claimForUndo`, `releaseUndoClaim`, and `markUndone` accept an optional trailing transactional `EntityManager`; new `claimForRedo` method|✓ ADDITIVE (optional parameters appended and a new method; existing calls retain behavior)|
542
+ |`RbacService`|New `loadAclWithEntityManager`, `userHasAllFeaturesWithEntityManager`, and `getGrantedFeaturesWithEntityManager` methods bypass caches and bind every query to the supplied transaction|✓ ADDITIVE (new methods; existing cache-backed methods are unchanged)|
543
+ |Auth command replay behavior|Auth user/role handlers opt in so source-log state, domain changes, undo trace or new redo log, and redo source finalization commit or roll back together. Before the request guard or feature interceptors run, `stabilizeReplay` discovers and seals one actor/target/destination footprint and locks API keys, users, roles, tenant/organization hierarchy, and authorization children in a total order using the same transaction|⚠️ Intentional security hardening. A race that previously could deadlock or replay with stale authority is rejected with the existing domain `409`; successful, authorized replay keeps the same response shape|
544
+ |Action-log actor persistence and self replay|`actor_user_id` remains a UUID; new entries also store the canonical user or `api_key:<uuid>` subject in `context.actorSubject`. API-key list ownership, undo/redo ownership, exact-EM RBAC, locks, and latest replay queries use the canonical subject. Canonical history is selected before the legacy bare-UUID fallback, which additionally requires a coherent live `isApiKey`/`keyId`/`sub` tuple|✓ Database-compatible additive context metadata; same-UUID user, malformed, or ambiguous ownership cannot shadow canonical key history and fails closed|
545
+ |Auth authorization-state writers|First-party `UserRole`, `UserAcl`, and `RoleAcl` writers in commands, setup, CLI, execution principals, SSO, and agent orchestration now share the canonical parent-lock protocol; SSO membership and grant rows commit together|⚠️ Intentional concurrency hardening; no request, response, schema, import-path, event, feature, or CLI contract changes|
546
+ |Non-auth command replay|Handlers that omit `atomicReplay` retain the existing undo claim/release compensation and route-level redo finalization|✓ Behavior-preserving|
547
+ |API routes, response schemas, database schema, event IDs, ACL feature IDs, DI names, CLI commands, generated files|No shape or identifier change|✓ n/a|
544
548
 
545
549
  **Migration path for existing modules**: none. Third-party commands remain on the established replay lifecycle unless they explicitly set `atomicReplay: true`. An opting-in handler must perform all replay database work through `ctx.transactionalEm`; when authorization depends on mutable domain rows it may add `stabilizeReplay` to acquire its complete footprint before guards and interceptors. The command bus supplies and owns the transaction by default. A caller deliberately composing replay inside an already-active `ctx.transactionalEm` must open that outer transaction with `withAtomicFlush(..., { transaction: true })`, obtain its exact `TransactionLifetime` inside the phase, and pass it as `ctx.transactionLifetime`; otherwise replay fails before mutation. Commit-only hooks and redo-finalization reporting follow the true outer completion. The capability does not claim that legacy non-opted-in action-log and domain writes are transactionally atomic.
546
550
 
@@ -550,26 +554,49 @@ Spec: [`.ai/specs/2026-09-08-error-reporting-policy.md`](.ai/specs/2026-09-08-er
550
554
 
551
555
  `directory.organizations.update` treated an omitted `parentId` as `null` and an omitted `childIds` as `[]`, so a partial update — notably `PUT /api/directory/organization-branding`, which sends only logo fields — detached the organization from its parent and orphaned its children. Omitted hierarchy fields are now preserved:
552
556
 
553
- | Surface | Change | Classification |
554
- |---------|--------|----------------|
555
- | Command behaviour (`directory.organizations.update`) | `parentId` is written and validated only when present in the input; children are reconciled only when `childIds` is present. Explicit `parentId: null` and `childIds: []` still clear. With `childIds` present and `parentId` omitted, listing the current parent answers `400 Child cannot equal parent` (it answered `400 Cannot assign ancestor as child`) | ⚠️ Behaviour change on a previously-corrupting path. A caller that omitted the fields to clear the hierarchy must send the explicit values. Regression-tested in `updateOrganization.partial-hierarchy.test.ts` and `TC-DIR-018` |
556
- | API routes (`PUT /api/directory/organizations`, `PUT /api/directory/organization-branding`) | Same URLs, request schema (`organizationUpdateSchema` already declares both fields optional) and response shapes | ✓ No shape change |
557
- | Database schema, event IDs, ACL features, DI names, CLI commands | No change | ✓ n/a |
557
+ |Surface|Change|Classification|
558
+ |---|---|---|
559
+ |Command behaviour (`directory.organizations.update`)|`parentId` is written and validated only when present in the input; children are reconciled only when `childIds` is present. Explicit `parentId: null` and `childIds: []` still clear. With `childIds` present and `parentId` omitted, listing the current parent answers `400 Child cannot equal parent` (it answered `400 Cannot assign ancestor as child`)|⚠️ Behaviour change on a previously-corrupting path. A caller that omitted the fields to clear the hierarchy must send the explicit values. Regression-tested in `updateOrganization.partial-hierarchy.test.ts` and `TC-DIR-018`|
560
+ |API routes (`PUT /api/directory/organizations`, `PUT /api/directory/organization-branding`)|Same URLs, request schema (`organizationUpdateSchema` already declares both fields optional) and response shapes|✓ No shape change|
561
+ |Database schema, event IDs, ACL features, DI names, CLI commands|No change|✓ n/a|
558
562
 
559
563
  **Migration path for existing modules**: send `parentId: null` / `childIds: []` where clearing is intended. Trees flattened before the upgrade are not repaired (see UPGRADE_NOTES.md).
560
564
 
561
565
  ---
562
566
 
563
- ## Staff Logout Runs Without A Valid Access Token (2026-10-13)
567
+ ## Arbitrary-Precision Money and FX Rates (2026-10-08)
564
568
 
565
- `POST /api/auth/logout` answered `401` before its handler ran once the access token expired, so the remember-me session was never revoked ([#7225](https://github.com/open-mercato/open-mercato/issues/7225)). It now declares `requireAuth: false`, like the portal logout:
569
+ [`.ai/specs/2026-10-08-arbitrary-precision-money-and-fx.md`](.ai/specs/2026-10-08-arbitrary-precision-money-and-fx.md) makes money and exchange-rate columns unconstrained `numeric` and moves money math to exact decimals (`@open-mercato/shared/lib/decimal`). Every `number` amount kept in a public contract stays and is filled with a float copy of a new `<field>Exact` decimal string.
566
570
 
567
571
  | Surface | Change | Classification |
568
572
  |---------|--------|----------------|
569
- | API route gating | `requireAuth` `true` → `false`; the handler revokes only the sessions its own cookies identify | ⚠️ Narrow relaxation: missing/unverifiable token or no cookie got `401`, now `307` (UPGRADE_NOTES.md) |
570
- | URL, method, response shape | Unchanged | ✓ n/a |
571
- | `auth.logout` event | Emitted only for a verified staff `auth_token` (now incl. MFA-pending); `session_token`-only revocation emits none | ✓ No ID or payload change |
572
- | Database schema, ACL features, DI names, CLI commands | No change | ✓ n/a |
573
+ | Database schema | About 100 money columns (sales, catalog, checkout, cart, promotions, customers, customer_groups, payment_gateways, staff, warranty_claims) plus `exchange_rates.rate` and `sales_orders.exchange_rate` widen from `numeric(p,s)` to `numeric`; new nullable `exchange_rates.metadata jsonb`. These properties use the new `ExactDecimalType` (`@open-mercato/shared/lib/db/exactDecimalType`) so changes beyond float precision are detected | ✓ ADDITIVE (widening; no table rewrite, existing values unchanged) |
574
+ | Type definitions (`sales/lib/types.ts`, `sales/lib/providers/types.ts`, `TaxCalculationService`, `shared/modules/payment_gateways/types.ts`, staff `CostEntry`/`CostProject`/`TimeRateResolver` and report types, checkout payloads) | Optional `<field>Exact` string siblings next to every money `number`; `SalesCalculationContext.amountDecimalPlaces`; `TimeRateResolver` gains an optional `resolveExact(ctx): string \| null` (`resolve` still returns `number \| null`) and `TimeRateContext` keeps `entry.rateOverrideAmount` / `project.hourlyRate` as `number \| null` with optional `rateOverrideAmountExact` / `hourlyRateExact` siblings; staff `CostEntry.rateOverrideAmount` / `CostProject.hourlyRate` (inputs to `applicableRate` / `entryAmount`) also accept a decimal string; staff report types (`ReportLine`, `ReportGroup`, `ReportTotals`, `ResolvedEntryValues`) gain optional `*Exact` fields, with new `Exact*` types for the computed results | ✓ ADDITIVE (optional fields, optional `resolveExact`, input-only widening) |
575
+ | Calculation hooks (`sales.line.calculate.*`, `sales.document.calculate.*`, registered calculators, shipping/payment providers, `sales.tax.calculate.*`) | Engine computes on the exact fields; when a hook changes only a float field, the matching `<field>Exact` is re-derived from it and rounded to the amount precision, so number-only hooks keep working; amounts are paired by line/adjustment `id`, then object identity, then position for id-less lists of equal length | ✓ Behaviour-preserving for fiat (4 decimal internal precision unchanged), except that negative halves now round away from zero |
576
+ | Exported helpers | `toNumericString` (sales, catalog) accepts strings and never emits exponent notation; `resolveCatalogPriceAmount`, `toSubmittedAmount`, `validateExchangeRateForm` (`rate`), `buildExchangeRatePayload` (input), `AdjustmentSubmitPayload` / `AdjustmentRowData` and the pay page `formatAmount` prop keep their `number` contracts, with new `resolveCatalogPriceAmountExact`, `toSubmittedAmountExact`, optional `rateExact` / `metadata`, optional `amountNetExact` / `amountGrossExact` and an optional third `exact` argument; `ConvertedSums.totalExact` and the `exact` of a valid `CatalogPriceAmountValidationResult` are optional (`ExactConvertedSums` / `ExactCatalogPriceAmountValidationResult` guarantee them); new `withExactListAmounts` (shared), `exactAmountString`, `deriveExactLineNetFromGross`, `resolveOrderPaymentTotals`, `entryAmountExact`, `sumAmountsExact`, `applicableRateExact`, `resolveTimeRateExact`, `resolveOrderAmountDueExact`, `fromCentsExact`. Existing `CaptureAmounts`, `resolveCaptureAmounts`, `assertCaptureWithinRemaining`, `reserveCaptureAmount`, `settleCapturedAmount`, `releaseCaptureAmount`, `parseAmountUnits` and `formatAmountUnits` retain their fixed four-decimal bigint contracts as deprecated bridges until no earlier than 0.11.0. The gateway service uses separate `*Exact` helpers and `ExactCaptureAmounts` | ✓ ADDITIVE (legacy bridges retained) |
577
+ | Zod validators | Parsed output types unchanged (amounts stay `number`), except the built-in provider settings schemas in `sales/lib/providers/defaultProviders.ts`, which now output decimal strings; commands read the exact digits from the raw request. Decimals with more than 1000 significant digits, more than 300 integer digits or an exponent beyond 1000 are rejected; exchange-rate `metadata` is limited to 16 KB. Payment gateway amounts and staff `rateOverrideAmount` additionally accept decimal strings; upper bounds that mirrored the old column precision (`catalog` 12/4 digits, staff 10/4 digits and `99_999_999`, customer group `numeric(16,2)`, warranty `999_999_999` on money fields, exchange rate 8 decimals) are removed. Payment gateway session/capture/refund routes now reject amounts with more decimals than the currency allows (400) | ✓ ADDITIVE (inputs widened); ⚠ currency precision errors return 400, while invalid gateway payloads (including oversized and positive-underflow amounts) return 422; these checks reject input that was accepted before |
578
+ | API responses | Routes that return money as JSON numbers add `<field>Exact` strings (sales document lists, returns, payment order totals, gateway status/capture/refund, checkout templates/links/transactions, staff report sheet/preview totals, customer deal stats, summary and aggregate, customer group terms, warranty claim settings). Routes that return raw column strings keep them; new rows are stored without scale padding (`"40"` instead of `"40.0000"`), old rows keep their stored scale. Catalog history responses retain at least four decimal places and preserve any additional digits. OpenAPI money fields that really return strings are corrected from `number` to `string` | ✓ ADDITIVE; padding change is value-preserving |
579
+ | Persisted payment operations | Capture and refund operations hash their amount as the JSON number the request carried before this change whenever the exact amount fits a number, so a retry recorded before the upgrade keeps its request hash, automatic operation id and provider idempotency key; only an amount with more digits than a number holds is hashed as its decimal string | ✓ Behaviour-preserving (replay compatible across the upgrade) |
580
+ | Rounding | Division results round half-up to `max(4, currency.decimalPlaces)` in sales/catalog (fiat unchanged), to the currency's own decimals in staff (2 for fiat, unchanged), and FX math keeps 50 decimals; every division keeps at least 17 significant digits. Catalog prices keep the entered amount exact (only the derived side is rounded). Checkout link, template and transaction amounts round to the currency's own decimals (2 for fiat, as before) | ⚠ Intentional: exact values instead of float/2-decimal truncation |
581
+ | Buyer pricing, cart, promotions | `ResolvedLinePrice` / `LinePriceTier` gain optional `amountNetExact` / `amountGrossExact`; `BuyerPricingContext` gains optional `currencyDecimalPlaces`; the cart next-tier view gains `unitAmountExact`. Promotion effect amounts keep their padded format; budget sums keep at least two decimals | ✓ ADDITIVE |
582
+ | `currencies` | `decimalPlaces` cap raised from 8 to 50; new DI service `currencyPrecisionService`; exchange rates gain `metadata`; providers may return `metadata` (NBP stores its table number) | ✓ ADDITIVE |
583
+ | UI | `CrudForm` gains builtin field type `'decimal'` (exact decimal string value); `formatCurrency` gains optional `decimalPlaces` and a `{ showAllDigits }` option, formats decimal strings exactly, rounds to the currency precision when it is known (fiat display unchanged) and shows every digit for codes without a known precision (e.g. ETH) | ✓ ADDITIVE for fiat; ⚠ amounts in non-ISO currencies now display all their digits |
584
+ | Event IDs, ACL features, CLI commands, generated files | No change | ✓ n/a |
585
+
586
+ **Migration path for existing modules**: none required. Code that only reads/writes the `number` fields keeps working with float precision; read or write the `<field>Exact` strings (and use `@open-mercato/shared/lib/decimal` for math) to support amounts beyond float precision. Clients comparing padded strings such as `"40.0000"` should compare numerically.
587
+
588
+ ---
589
+
590
+ ## Staff Logout Runs Without A Valid Access Token (2026-10-13)
591
+
592
+ `POST /api/auth/logout` answered `401` before its handler ran once the access token expired, so the remember-me session was never revoked ([#7225](https://github.com/open-mercato/open-mercato/issues/7225)). It now declares `requireAuth: false`, like the portal logout:
593
+
594
+ |Surface|Change|Classification|
595
+ |---|---|---|
596
+ |API route gating|`requireAuth` `true` → `false`; the handler revokes only the sessions its own cookies identify|⚠️ Narrow relaxation: missing/unverifiable token or no cookie got `401`, now `307` (UPGRADE_NOTES.md)|
597
+ |URL, method, response shape|Unchanged|✓ n/a|
598
+ |`auth.logout` event|Emitted only for a verified staff `auth_token` (now incl. MFA-pending); `session_token`-only revocation emits none|✓ No ID or payload change|
599
+ |Database schema, ACL features, DI names, CLI commands|No change|✓ n/a|
573
600
 
574
601
  **Migration path for existing modules**: none. A client that read a logout `401` as "already signed out" gets the redirect instead.
575
602
 
@@ -583,22 +610,86 @@ Spec: [`.ai/specs/2026-09-08-error-reporting-policy.md`](.ai/specs/2026-09-08-er
583
610
 
584
611
  [`.ai/specs/2026-10-01-oauth2-grant-lifecycle-core.md`](.ai/specs/2026-10-01-oauth2-grant-lifecycle-core.md) (parent: [`.ai/specs/2026-09-27-app-spec-oauth2-grant-lifecycle.md`](.ai/specs/2026-09-27-app-spec-oauth2-grant-lifecycle.md) §10.1) adds a tenant-level OAuth2 grant core to `integrations` that no existing integration uses yet. **All changes are additive** except the reserved `__oauth_grant` suffix, an intentional security narrowing that no first-party integration or bundle id hits. Developer guide: `apps/docs/docs/framework/modules/integrations-oauth-grants.mdx`.
585
612
 
586
- | Surface | Change | Classification |
587
- |---------|--------|----------------|
588
- | Import paths (§4) | New `@open-mercato/shared/lib/db/advisoryLock` (explicit `exports` entry); `@open-mercato/core/modules/integrations/lib/oauth/{token-endpoint,pkce,authorization,redirect,resource-challenge,descriptor,grant-service,health}` and `…/lib/oauth/testing/fakeAuthorizationServer` — exactly these files, no directory index. Every path, plus `…/lib/credentials-service`, `…/lib/log-service` and the hub's `…/communication_channels/lib/oauth-state`, is verified against the built `dist` by `scripts/check-oauth-publish-shape.mjs` in CI | ✓ ADDITIVE (new import paths) |
589
- | Type definitions (§2) | New `OAuthProviderDescriptor`, `OAuthGrantOwner`, `OAuthTokenEndpointResponse`, `OAuthClientAuthMethod`, the grant-service result and inspection types (the inspection carries no token), `AdvisoryLockOptions` (`waitDeadlineMs`, `maxConcurrentHolders`); the `FakeAuthorizationServer` handle with its options, `FakeInjection` and `FakeRotationMode`; error classes `OAuthGrantError`, `OAuthDescriptorError`, `AdvisoryLockUnavailableError` (`reason: AdvisoryLockUnavailableReason` = `'deadline' \| 'transient_db' \| 'commit_unknown'`); closed unions (`OAuthTokenFailure`, `OAuthConnectFailure`, `OAuthConnectionState`, `OAuthUnavailableReason`, …) that are additive-only, so consumers keep a default branch. `IntegrationOAuthGrantService` is a type to call, not to implement: adding a method is additive. Optional `IntegrationDetailPageConfig.connectTabId`. `CredentialsService`, `IntegrationLogService` and `IntegrationCredentialFieldOauth` are unchanged apart from `@internal` options | ✓ ADDITIVE (new types; optional fields) |
590
- | Function signatures (§3) | New `withAdvisoryXactLock`, `createPkcePair`, `buildAuthorizationUrl`, `exchangeAuthorizationCode`, `resolveOAuthRedirectUri`, `classifyResourceChallenge`, `mapInspectionToHealth` with `OAUTH_HEALTH_CODES`, `startFakeAuthorizationServer` with the methods of the handle it returns (`issueAuthorizationCode`, `inject`, `revokeAuthorization`, `reset`, `counters`, `requests`, `issuedTokens`, `close`) and the `IntegrationOAuthGrantService` methods | ✓ ADDITIVE (new functions) |
591
- | DI service names (§9) | New scoped `integrationOAuthGrantService`. Contract note: inside the grant lock the service builds its credentials and log services from the core factories, so DI overrides of `integrationCredentialsService` don't apply to grant rows | ✓ ADDITIVE |
592
- | API routes (§7) | `GET /api/integrations/:id` gains the nullable `oauthGrant: { status: 'active' \| 'invalidated' \| 'unavailable' } \| null` (always present; `null` without a live grant) and returns `integration.detailPage.connectTabId` | ✓ ADDITIVE (response fields) |
593
- | Widget injection context (§6) | Spot IDs unchanged; the `integrations.detail.v1` context gains the optional `detail.oauthGrant` and `integration.detailPage.connectTabId` | ✓ ADDITIVE (context fields) |
594
- | Log and health codes | Log codes `integrations.oauth_*` and the `OAUTH_HEALTH_CODES` values with `OAuthHealthCode` | ✓ ADDITIVE; STABLE once released, additive-only |
595
- | Persisted formats | The grant row id `<integrationId>__oauth_grant`; the blob `version`; the lock key `oauth_grant:<integrationId>:<tenantId>:<organizationId>:<userId or ->` and its mapping `pg_try_advisory_xact_lock(hashtextextended(key, 0))`; `resourceKind` `integrations.oauth_grant`; the `Symbol.for` brands `@open-mercato/shared:AdvisoryLockUnavailableError`, `@open-mercato/core:OAuthGrantError` and `@open-mercato/core:OAuthDescriptorError` that keep `instanceof` reliable across module copies. The codes `integrations.oauth_disconnected` and `integrations.oauth_revocation_{pending,confirmed,failed,unsupported,skipped_reconnected,skipped_invalidated}` with their `disconnectId` payload key are read back to derive `lastDisconnect`; the per-process holder-slot registry `globalThis.__openMercatoAdvisoryLockSlots__` is shared by every `@open-mercato/shared` instance | The lock key, its mapping and the brand keys FROZEN for every existing Grant Owner (processes of two versions must exclude each other during a rolling deploy); everything else ADDITIVE-ONLY |
596
- | External dependency | Provider routes import the hub-owned `@open-mercato/core/modules/communication_channels/lib/oauth-state`: `createOAuthState`, `verifyOAuthState`, `consumeOAuthStateOnce`, `OAuthStatePayload`, `OAuthStateConsumeStore` and `OAuthStateError` (its `code` values additive-only, `replay` included) are documented as STABLE; the path's other exports are not covered | ✓ No change to the path (now a documented STABLE import) |
597
- | Testing contract | With `OM_ENABLE_TEST_OAUTH_GRANTS` on (or outside production), a descriptor may use `http:` endpoints on a loopback host (`localhost`, `127.0.0.1`, `[::1]`), so a provider's test seam can point its descriptor at an in-process fake; otherwise endpoints are `https:` | STABLE; the flag itself enables nothing else for providers |
598
- | API routes (§7): `GET` / `PUT /api/integrations/:id/credentials` | Answer 404 for any id ending in `__oauth_grant`, also when an integration with that id is registered (I4: grant secrets never reach the admin credentials API) | ⚠️ Intentional security narrowing only (no first-party integration id ends in the suffix) |
599
- | Function behaviour (§3, §9): `resolve()` and `resolveUpdatedAt()` of `createCredentialsService` / DI `integrationCredentialsService` | Don't fall through to a `bundleId` ending in `__oauth_grant`, for every caller (integration list and detail GETs, the credentials route, the health service, data_sync); the grant service's Client Configuration read skips it too | ⚠️ Intentional security narrowing only (I4, I7; no first-party bundle id ends in the suffix) |
600
- | Explicitly not covered (`@internal`) | `createIntegrationOAuthGrantService`, `IntegrationOAuthGrantServiceDeps`, `requestTokenEndpoint`, `revokeToken`, `OAuthTokenEndpointError` with `OAuthTokenEndpointErrorKind` and its brand, `OAUTH_RESPONSE_MAX_BYTES`, `OAuthClientCredentials`, `OAuthInvalidatedReason`, `oauthProviderDescriptorSchema`, `resolveOAuthProviderDescriptor`, `AdvisoryLockOptions.onWait` with `AdvisoryLockWaitResult`, `isTransientLockDbError` (`@open-mercato/shared/lib/db/pg-errors`), the third parameter `{ kms }` of `createCredentialsService`, `CredentialsWriteOptions.ensureEncryptionMap`, `eraseIntegrationCredentials`, `readCredentialRowLayered`, `LayeredCredentialRead`, `isReservedOAuthGrantId`, `bundleFallthroughId`, `findLatestIntegrationLogsByCodes`, and every export of `lib/oauth/{grant-blob,pin-tenant-dek,error-brand}` | Not a contract surface; may change without the deprecation protocol |
601
- | Not contracts | The test-only route `POST /api/integrations/test-oauth-grants`, its helper `@open-mercato/core/helpers/integration/oauthGrantTestRoute`, the flag `OM_ENABLE_TEST_OAUTH_GRANTS` (apart from the testing contract above) and the `test_oauth_grant` integration (like `test-seed`) | n/a |
602
- | Event IDs, database schema, ACL features, notification types, AI agent and tool IDs, CLI commands | No change | ✓ n/a |
613
+ |Surface|Change|Classification|
614
+ |---|---|---|
615
+ |Import paths (§4)|New `@open-mercato/shared/lib/db/advisoryLock` (explicit `exports` entry); `@open-mercato/core/modules/integrations/lib/oauth/{token-endpoint,pkce,authorization,redirect,resource-challenge,descriptor,grant-service,health}` and `…/lib/oauth/testing/fakeAuthorizationServer` — exactly these files, no directory index. Every path, plus `…/lib/credentials-service`, `…/lib/log-service` and the hub's `…/communication_channels/lib/oauth-state`, is verified against the built `dist` by `scripts/check-oauth-publish-shape.mjs` in CI|✓ ADDITIVE (new import paths)|
616
+ |Type definitions (§2)|New `OAuthProviderDescriptor`, `OAuthGrantOwner`, `OAuthTokenEndpointResponse`, `OAuthClientAuthMethod`, the grant-service result and inspection types (the inspection carries no token), `AdvisoryLockOptions` (`waitDeadlineMs`, `maxConcurrentHolders`); the `FakeAuthorizationServer` handle with its options, `FakeInjection` and `FakeRotationMode`; error classes `OAuthGrantError`, `OAuthDescriptorError`, `AdvisoryLockUnavailableError` (`reason: AdvisoryLockUnavailableReason` = `'deadline' \|'transient_db' \|'commit_unknown'`); closed unions (`OAuthTokenFailure`, `OAuthConnectFailure`, `OAuthConnectionState`, `OAuthUnavailableReason`, …) that are additive-only, so consumers keep a default branch. `IntegrationOAuthGrantService` is a type to call, not to implement: adding a method is additive. Optional `IntegrationDetailPageConfig.connectTabId`. `CredentialsService`, `IntegrationLogService` and `IntegrationCredentialFieldOauth` are unchanged apart from `@internal` options|✓ ADDITIVE (new types; optional fields)|
617
+ |Function signatures (§3)|New `withAdvisoryXactLock`, `createPkcePair`, `buildAuthorizationUrl`, `exchangeAuthorizationCode`, `resolveOAuthRedirectUri`, `classifyResourceChallenge`, `mapInspectionToHealth` with `OAUTH_HEALTH_CODES`, `startFakeAuthorizationServer` with the methods of the handle it returns (`issueAuthorizationCode`, `inject`, `revokeAuthorization`, `reset`, `counters`, `requests`, `issuedTokens`, `close`) and the `IntegrationOAuthGrantService` methods|✓ ADDITIVE (new functions)|
618
+ |DI service names (§9)|New scoped `integrationOAuthGrantService`. Contract note: inside the grant lock the service builds its credentials and log services from the core factories, so DI overrides of `integrationCredentialsService` don't apply to grant rows|✓ ADDITIVE|
619
+ |API routes (§7)|`GET /api/integrations/:id` gains the nullable `oauthGrant: { status: 'active' \|'invalidated' \|'unavailable' } \|null` (always present; `null` without a live grant) and returns `integration.detailPage.connectTabId`|✓ ADDITIVE (response fields)|
620
+ |Widget injection context (§6)|Spot IDs unchanged; the `integrations.detail.v1` context gains the optional `detail.oauthGrant` and `integration.detailPage.connectTabId`|✓ ADDITIVE (context fields)|
621
+ |Log and health codes|Log codes `integrations.oauth_*` and the `OAUTH_HEALTH_CODES` values with `OAuthHealthCode`|✓ ADDITIVE; STABLE once released, additive-only|
622
+ |Persisted formats|The grant row id `<integrationId>__oauth_grant`; the blob `version`; the lock key `oauth_grant:<integrationId>:<tenantId>:<organizationId>:<userId or ->` and its mapping `pg_try_advisory_xact_lock(hashtextextended(key, 0))`; `resourceKind` `integrations.oauth_grant`; the `Symbol.for` brands `@open-mercato/shared:AdvisoryLockUnavailableError`, `@open-mercato/core:OAuthGrantError` and `@open-mercato/core:OAuthDescriptorError` that keep `instanceof` reliable across module copies. The codes `integrations.oauth_disconnected` and `integrations.oauth_revocation_{pending,confirmed,failed,unsupported,skipped_reconnected,skipped_invalidated}` with their `disconnectId` payload key are read back to derive `lastDisconnect`; the per-process holder-slot registry `globalThis.__openMercatoAdvisoryLockSlots__` is shared by every `@open-mercato/shared` instance|The lock key, its mapping and the brand keys FROZEN for every existing Grant Owner (processes of two versions must exclude each other during a rolling deploy); everything else ADDITIVE-ONLY|
623
+ |External dependency|Provider routes import the hub-owned `@open-mercato/core/modules/communication_channels/lib/oauth-state`: `createOAuthState`, `verifyOAuthState`, `consumeOAuthStateOnce`, `OAuthStatePayload`, `OAuthStateConsumeStore` and `OAuthStateError` (its `code` values additive-only, `replay` included) are documented as STABLE; the path's other exports are not covered|✓ No change to the path (now a documented STABLE import)|
624
+ |Testing contract|With `OM_ENABLE_TEST_OAUTH_GRANTS` on (or outside production), a descriptor may use `http:` endpoints on a loopback host (`localhost`, `127.0.0.1`, `[::1]`), so a provider's test seam can point its descriptor at an in-process fake; otherwise endpoints are `https:`|STABLE; the flag itself enables nothing else for providers|
625
+ |API routes (§7): `GET` / `PUT /api/integrations/:id/credentials`|Answer 404 for any id ending in `__oauth_grant`, also when an integration with that id is registered (I4: grant secrets never reach the admin credentials API)|⚠️ Intentional security narrowing only (no first-party integration id ends in the suffix)|
626
+ |Function behaviour (§3, §9): `resolve()` and `resolveUpdatedAt()` of `createCredentialsService` / DI `integrationCredentialsService`|Don't fall through to a `bundleId` ending in `__oauth_grant`, for every caller (integration list and detail GETs, the credentials route, the health service, data_sync); the grant service's Client Configuration read skips it too|⚠️ Intentional security narrowing only (I4, I7; no first-party bundle id ends in the suffix)|
627
+ |Explicitly not covered (`@internal`)|`createIntegrationOAuthGrantService`, `IntegrationOAuthGrantServiceDeps`, `requestTokenEndpoint`, `revokeToken`, `OAuthTokenEndpointError` with `OAuthTokenEndpointErrorKind` and its brand, `OAUTH_RESPONSE_MAX_BYTES`, `OAuthClientCredentials`, `OAuthInvalidatedReason`, `oauthProviderDescriptorSchema`, `resolveOAuthProviderDescriptor`, `AdvisoryLockOptions.onWait` with `AdvisoryLockWaitResult`, `isTransientLockDbError` (`@open-mercato/shared/lib/db/pg-errors`), the third parameter `{ kms }` of `createCredentialsService`, `CredentialsWriteOptions.ensureEncryptionMap`, `eraseIntegrationCredentials`, `readCredentialRowLayered`, `LayeredCredentialRead`, `isReservedOAuthGrantId`, `bundleFallthroughId`, `findLatestIntegrationLogsByCodes`, and every export of `lib/oauth/{grant-blob,pin-tenant-dek,error-brand}`|Not a contract surface; may change without the deprecation protocol|
628
+ |Not contracts|The test-only route `POST /api/integrations/test-oauth-grants`, its helper `@open-mercato/core/helpers/integration/oauthGrantTestRoute`, the flag `OM_ENABLE_TEST_OAUTH_GRANTS` (apart from the testing contract above) and the `test_oauth_grant` integration (like `test-seed`)|n/a|
629
+ |Event IDs, database schema, ACL features, notification types, AI agent and tool IDs, CLI commands|No change|✓ n/a|
603
630
 
604
631
  **Migration path for existing modules**: none for first-party code. Third-party modules must not register an integration or bundle id that ends in `__oauth_grant` (see `UPGRADE_NOTES.md`).
632
+
633
+ ---
634
+
635
+ ## Attachment owner access (2026-10-01, #6726)
636
+
637
+ STABLE HTTP/service BREAK (403/404/504), Documents only: org-wide files bypass sharing; bridging would retain disclosure. Discovery/schema additive. [Migration](UPGRADE_NOTES.md#documents-attachments-enforce-owner-permissions-at-host-urls-6726); [spec](.ai/specs/2026-10-01-attachment-access-resolvers.md). [@haxiorz: steps 1–3 waived; migration acknowledged](https://github.com/open-mercato/open-mercato/pull/6829#issuecomment-6505350022).
638
+
639
+ ## #7220
640
+
641
+ [Cache fix](UPGRADE_NOTES.md)
642
+
643
+ ---
644
+
645
+ ## Public pay links (2026-10-27, #7823)
646
+
647
+ STABLE API §7: `GET /api/checkout/pay/:slug` omits admin fields; retaining them preserves disclosure. Client/operator migration: [notes](UPGRADE_NOTES.md). @haxiorz [approved](https://github.com/open-mercato/open-mercato/pull/8087#issuecomment-6505348826) on 2026-10-29: steps 1–3 waived for all 18 admin fields; client/operator migration acknowledged.
648
+
649
+ ## #3805 2026-10-31
650
+
651
+ STABLE tools/execute writes bypass approval; no bridge. [Migrate](UPGRADE_NOTES.md#issue-3805)
652
+
653
+ ## SCIM rate limiting (2026-10-27)
654
+
655
+ SCIM adds 429/503 before credentials; honor Retry-After. Optional `beforeAuth: ApiRouteBeforeAuth` is additive. See [contract and migration](.ai/specs/enterprise/implemented/SPEC-ENT-004-2026-02-19-sso-directory-sync.md#migration--backward-compatibility).
656
+
657
+ ## Encrypted search contexts (#7872)
658
+
659
+ STABLE: encrypted custom fields are omitted; missing/failing resolver excludes all. A bridge preserves disclosure; human exception approval is pending. [Contract/migration](.ai/specs/2026-10-30-search-build-context-encrypted-custom-fields.md).
660
+
661
+ ## Compose encryption (2026-11-01, #7231)
662
+
663
+ STABLE: unsafe keys/HTTP Vault rejected; bridges retain exposure. [Migration](UPGRADE_NOTES.md).
664
+ Named human waiver of steps 1–3 required.
665
+
666
+ ## Encryption maintenance safety gates (2026-11-02, #6767)
667
+
668
+ CLI safety confirmations changed; stop writers and restart replicas. [Flags, migration and stable formats](UPGRADE_NOTES.md#encryption-maintenance-safety-confirmations-6767).
669
+
670
+ ## Staff Logout Uses Post/Redirect/Get (2026-11-05)
671
+
672
+ `POST /api/auth/logout` now returns `303 See Other` instead of `307`, including the cookieless branch ([#7383](https://github.com/open-mercato/open-mercato/issues/7383)). Browsers follow `Location: /login` with GET rather than repeating the logout POST. This intentionally corrects the status documented in the 2026-10-13 entry above; shared redirect helper defaults remain 307.
673
+
674
+ **Migration:** custom clients asserting 307 must accept 303 and follow the Location with GET. Session revocation, cookie expiry, route URL/method and auth events are unchanged. No schema migration is needed. See [spec](.ai/specs/2026-11-05-logout-post-redirect.md#migration--backward-compatibility) and UPGRADE_NOTES.md.
675
+
676
+ ## #7809 2026-11-06
677
+
678
+ STABLE CLI: production defaults/policy bypass preserve exposure; steps 1–3 waived by @pkarw. [Migration and approval](.ai/specs/2026-11-06-production-bootstrap-credentials.md).
679
+
680
+ ## 2026-11-07 — Private next-interaction subjects (#8888)
681
+
682
+ Surface: stable customer projection response behavior. Private email subjects and
683
+ unresolved historical linked names now become NULL in shared projections; response
684
+ keys/types, scheduling, manual names and authorized interaction readers remain
685
+ unchanged. Continuing to serve the private subject as a bridge retains the privacy
686
+ bypass. Clients use unnamed-interaction fallbacks and authorized interaction reads.
687
+ Operators apply the idempotent data repair, complete the declared query-index
688
+ rebuilds and rebuild configured search providers before reopening affected reads.
689
+ See `.ai/specs/2026-11-07-private-next-interaction-projections.md` and UPGRADE_NOTES.
690
+ Piotr Karwatka (@pkarw) acknowledged the emergency waiver of steps 1–3 on
691
+ 2026-11-13: [human approval](https://github.com/open-mercato/open-mercato/pull/8973#issuecomment-6852915966).
692
+
693
+ ## Comment authors (2026-11-12, #8759)
694
+
695
+ STABLE command/API: unrestricted attribution permits forgery; a bridge retains it. Piotr Karwatka (@pkarw) waived steps 1–3 for #8782. [Migration](UPGRADE_NOTES.md#customer-comment-update-attribution-8759).