gina 0.7.3 → 0.7.4

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 (636) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +48 -40
  3. package/ROADMAP.md +1 -0
  4. package/bin/cli +33 -4
  5. package/bin/cli-debug +37 -1
  6. package/bin/cmd +18 -0
  7. package/framework/v0.7.4/VERSION +1 -0
  8. package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/js/gina.js +1504 -621
  9. package/framework/v0.7.4/core/asset/plugin/dist/vendor/gina/js/gina.min.js +736 -0
  10. package/framework/v0.7.4/core/asset/plugin/dist/vendor/gina/js/gina.min.js.br +0 -0
  11. package/framework/v0.7.4/core/asset/plugin/dist/vendor/gina/js/gina.min.js.gz +0 -0
  12. package/framework/{v0.7.3 → v0.7.4}/core/config.js +13 -3
  13. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.js +268 -14
  14. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-json.js +9 -2
  15. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-nunjucks.js +88 -9
  16. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-swig-async.js +87 -7
  17. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-swig.js +115 -9
  18. package/framework/{v0.7.3 → v0.7.4}/core/gna.js +44 -2
  19. package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/src/form-validator.js +43 -4
  20. package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/src/main.js +847 -515
  21. package/framework/{v0.7.3 → v0.7.4}/core/router.js +139 -40
  22. package/framework/{v0.7.3 → v0.7.4}/core/server.express.js +5 -4
  23. package/framework/{v0.7.3 → v0.7.4}/core/server.isaac.js +93 -10
  24. package/framework/{v0.7.3 → v0.7.4}/core/server.js +348 -46
  25. package/framework/{v0.7.3 → v0.7.4}/helpers/context.js +47 -2
  26. package/framework/{v0.7.3 → v0.7.4}/helpers/data/src/main.js +10 -1
  27. package/framework/{v0.7.3 → v0.7.4}/helpers/prototypes.js +23 -1
  28. package/framework/v0.7.4/lib/cmd/bundle/inc/start-status.js +420 -0
  29. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/restart.js +71 -1
  30. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/start.js +207 -41
  31. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/cache/clear.js +39 -8
  32. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/cache/help.txt +3 -4
  33. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/inc/ps-titles.js +62 -6
  34. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/init.js +12 -1
  35. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/restart.js +49 -11
  36. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/status.js +23 -1
  37. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/stop.js +150 -48
  38. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/helper.js +24 -0
  39. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/run.js +6 -0
  40. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/index.js +8 -1
  41. package/framework/{v0.7.3 → v0.7.4}/lib/collection/src/main.js +373 -74
  42. package/framework/{v0.7.3 → v0.7.4}/lib/job/src/main.js +49 -5
  43. package/framework/{v0.7.3 → v0.7.4}/lib/lane/src/main.js +81 -5
  44. package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/main.js +184 -15
  45. package/framework/v0.7.4/lib/logger/src/redact.js +1003 -0
  46. package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-filters/src/main.js +118 -11
  47. package/framework/{v0.7.3 → v0.7.4}/lib/proc.js +27 -8
  48. package/framework/{v0.7.3 → v0.7.4}/lib/render-cache/src/main.js +97 -0
  49. package/framework/{v0.7.3 → v0.7.4}/lib/routing/src/main.js +140 -14
  50. package/framework/{v0.7.3 → v0.7.4}/lib/sqlite-driver.js +15 -5
  51. package/framework/{v0.7.3 → v0.7.4}/lib/swig-filters/src/main.js +123 -16
  52. package/framework/{v0.7.3 → v0.7.4}/package.json +1 -1
  53. package/gna.js +4 -4
  54. package/llms.txt +24 -22
  55. package/package.json +5 -4
  56. package/schema/settings.json +25 -1
  57. package/script/smoke_in_container.js +69 -12
  58. package/types/index.d.ts +3 -2
  59. package/utils/prototypes.js +37 -2
  60. package/framework/v0.7.3/VERSION +0 -1
  61. package/framework/v0.7.3/core/asset/plugin/dist/vendor/gina/js/gina.min.js +0 -726
  62. package/framework/v0.7.3/core/asset/plugin/dist/vendor/gina/js/gina.min.js.br +0 -0
  63. package/framework/v0.7.3/core/asset/plugin/dist/vendor/gina/js/gina.min.js.gz +0 -0
  64. package/framework/v0.7.3/lib/logger/src/redact.js +0 -391
  65. /package/framework/{v0.7.3 → v0.7.4}/AUTHORS +0 -0
  66. /package/framework/{v0.7.3 → v0.7.4}/LICENSE +0 -0
  67. /package/framework/{v0.7.3 → v0.7.4}/core/asset/html/nolayout.html +0 -0
  68. /package/framework/{v0.7.3 → v0.7.4}/core/asset/html/static.html +0 -0
  69. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/android-chrome-192x192.png +0 -0
  70. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/android-chrome-512x512.png +0 -0
  71. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/apple-touch-icon.png +0 -0
  72. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/favicon-16x16.png +0 -0
  73. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/favicon-32x32.png +0 -0
  74. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/favicon.ico +0 -0
  75. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/README.md +0 -0
  76. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/beemaster/beemaster.css +0 -0
  77. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/beemaster/beemaster.js +0 -0
  78. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/beemaster/index.html +0 -0
  79. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/css/gina.min.css +0 -0
  80. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/css/gina.min.css.br +0 -0
  81. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/css/gina.min.css.gz +0 -0
  82. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/html/statusbar.html +0 -0
  83. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/html/statusbar.html.br +0 -0
  84. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/html/statusbar.html.gz +0 -0
  85. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/have_heart_one-webfont.woff2 +0 -0
  86. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/index.html +0 -0
  87. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/inspector.css +0 -0
  88. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/inspector.js +0 -0
  89. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/logo.svg +0 -0
  90. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +0 -0
  91. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.br +0 -0
  92. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.gz +0 -0
  93. /package/framework/{v0.7.3 → v0.7.4}/core/config.requirements-anchor.js +0 -0
  94. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/ai/index.js +0 -0
  95. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/ai/lib/connector.js +0 -0
  96. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/index.js +0 -0
  97. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/connector.js +0 -0
  98. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/connector.v3.js +0 -0
  99. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/connector.v4.js +0 -0
  100. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/n1ql.js +0 -0
  101. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/session-store.js +0 -0
  102. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/session-store.v3.js +0 -0
  103. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/session-store.v4.js +0 -0
  104. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/storage-store.js +0 -0
  105. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/duckdb/index.js +0 -0
  106. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/duckdb/lib/connector.js +0 -0
  107. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/index.js +0 -0
  108. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/lib/connector.js +0 -0
  109. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/lib/job-store.js +0 -0
  110. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/lib/pipeline-loader.js +0 -0
  111. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/lib/session-store.js +0 -0
  112. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mysql/index.js +0 -0
  113. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mysql/lib/connector.js +0 -0
  114. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/param-redact.js +0 -0
  115. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/postgresql/index.js +0 -0
  116. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/postgresql/lib/connector.js +0 -0
  117. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/index.js +0 -0
  118. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/connector.js +0 -0
  119. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/job-store.js +0 -0
  120. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/kv-store.js +0 -0
  121. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/render-cache-store.js +0 -0
  122. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/session-store.js +0 -0
  123. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/scylladb/index.js +0 -0
  124. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/scylladb/lib/connector.js +0 -0
  125. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/scylladb/lib/session-store.js +0 -0
  126. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/settle-once.js +0 -0
  127. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sql-parser.js +0 -0
  128. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/index.js +0 -0
  129. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/lib/connector.js +0 -0
  130. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/lib/job-store.js +0 -0
  131. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/lib/kv-store.js +0 -0
  132. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/lib/session-store.js +0 -0
  133. /package/framework/{v0.7.3 → v0.7.4}/core/content.encoding +0 -0
  134. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.framework.js +0 -0
  135. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-nunjucks-async.js +0 -0
  136. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-stream.js +0 -0
  137. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-v1.js +0 -0
  138. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-xml.js +0 -0
  139. /package/framework/{v0.7.3 → v0.7.4}/core/controller/index.js +0 -0
  140. /package/framework/{v0.7.3 → v0.7.4}/core/controller/inline-script.js +0 -0
  141. /package/framework/{v0.7.3 → v0.7.4}/core/controller/inspector-window-emit.js +0 -0
  142. /package/framework/{v0.7.3 → v0.7.4}/core/controller/preload-hints.js +0 -0
  143. /package/framework/{v0.7.3 → v0.7.4}/core/controller/release-banner.js +0 -0
  144. /package/framework/{v0.7.3 → v0.7.4}/core/dev/index.js +0 -0
  145. /package/framework/{v0.7.3 → v0.7.4}/core/dev/lib/class.js +0 -0
  146. /package/framework/{v0.7.3 → v0.7.4}/core/dev/lib/factory.js +0 -0
  147. /package/framework/{v0.7.3 → v0.7.4}/core/dev/lib/tools.js +0 -0
  148. /package/framework/{v0.7.3 → v0.7.4}/core/locales/README.md +0 -0
  149. /package/framework/{v0.7.3 → v0.7.4}/core/locales/currency.json +0 -0
  150. /package/framework/{v0.7.3 → v0.7.4}/core/locales/dist/language/en.json +0 -0
  151. /package/framework/{v0.7.3 → v0.7.4}/core/locales/dist/language/fr.json +0 -0
  152. /package/framework/{v0.7.3 → v0.7.4}/core/locales/dist/region/en.json +0 -0
  153. /package/framework/{v0.7.3 → v0.7.4}/core/locales/dist/region/fr.json +0 -0
  154. /package/framework/{v0.7.3 → v0.7.4}/core/locales/index.js +0 -0
  155. /package/framework/{v0.7.3 → v0.7.4}/core/mime.types +0 -0
  156. /package/framework/{v0.7.3 → v0.7.4}/core/model/entity.js +0 -0
  157. /package/framework/{v0.7.3 → v0.7.4}/core/model/index.js +0 -0
  158. /package/framework/{v0.7.3 → v0.7.4}/core/model/template/entityFactory.js +0 -0
  159. /package/framework/{v0.7.3 → v0.7.4}/core/model/template/index.js +0 -0
  160. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/README.md +0 -0
  161. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/index.js +0 -0
  162. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/csrf/README.md +0 -0
  163. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/csrf/package.json +0 -0
  164. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/csrf/src/main.js +0 -0
  165. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/README.md +0 -0
  166. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coep/README.md +0 -0
  167. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coep/package.json +0 -0
  168. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coep/src/main.js +0 -0
  169. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coop/README.md +0 -0
  170. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coop/package.json +0 -0
  171. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coop/src/main.js +0 -0
  172. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/corp/README.md +0 -0
  173. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/corp/package.json +0 -0
  174. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/corp/src/main.js +0 -0
  175. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/csp/README.md +0 -0
  176. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/csp/package.json +0 -0
  177. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/csp/src/main.js +0 -0
  178. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hide-powered-by/README.md +0 -0
  179. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hide-powered-by/package.json +0 -0
  180. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hide-powered-by/src/main.js +0 -0
  181. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hsts/README.md +0 -0
  182. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hsts/package.json +0 -0
  183. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hsts/src/main.js +0 -0
  184. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/origin-agent-cluster/README.md +0 -0
  185. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/origin-agent-cluster/package.json +0 -0
  186. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/origin-agent-cluster/src/main.js +0 -0
  187. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/package.json +0 -0
  188. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/referrer-policy/README.md +0 -0
  189. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/referrer-policy/package.json +0 -0
  190. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/referrer-policy/src/main.js +0 -0
  191. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/src/main.js +0 -0
  192. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-content-type-options/README.md +0 -0
  193. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-content-type-options/package.json +0 -0
  194. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-content-type-options/src/main.js +0 -0
  195. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-dns-prefetch-control/README.md +0 -0
  196. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-dns-prefetch-control/package.json +0 -0
  197. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-dns-prefetch-control/src/main.js +0 -0
  198. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-download-options/README.md +0 -0
  199. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-download-options/package.json +0 -0
  200. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-download-options/src/main.js +0 -0
  201. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-frame-options/README.md +0 -0
  202. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-frame-options/package.json +0 -0
  203. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-frame-options/src/main.js +0 -0
  204. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-permitted-cross-domain-policies/README.md +0 -0
  205. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-permitted-cross-domain-policies/package.json +0 -0
  206. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-permitted-cross-domain-policies/src/main.js +0 -0
  207. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-xss-protection/README.md +0 -0
  208. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-xss-protection/package.json +0 -0
  209. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-xss-protection/src/main.js +0 -0
  210. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/session/README.md +0 -0
  211. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/session/package.json +0 -0
  212. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/session/src/main.js +0 -0
  213. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/storage/README.md +0 -0
  214. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/storage/build.json +0 -0
  215. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/storage/package.json +0 -0
  216. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/storage/src/main.js +0 -0
  217. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/README.md +0 -0
  218. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/build.json +0 -0
  219. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/package.json +0 -0
  220. /package/framework/{v0.7.3 → v0.7.4}/core/server.isaac.rapid-reset.js +0 -0
  221. /package/framework/{v0.7.3 → v0.7.4}/core/server.route-candidates.js +0 -0
  222. /package/framework/{v0.7.3 → v0.7.4}/core/status.codes +0 -0
  223. /package/framework/{v0.7.3 → v0.7.4}/core/template/_gitignore +0 -0
  224. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/app.json +0 -0
  225. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/connectors.json +0 -0
  226. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/routing.json +0 -0
  227. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/settings.json +0 -0
  228. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/settings.server.json +0 -0
  229. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/templates.json +0 -0
  230. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/watchers.json +0 -0
  231. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/controllers/controller.content.js +0 -0
  232. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
  233. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/controllers/setup.js +0 -0
  234. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/index.js +0 -0
  235. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/locales/en.json +0 -0
  236. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
  237. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/css/default.css +0 -0
  238. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/css/home.css +0 -0
  239. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
  240. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
  241. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/js/components/x-checklist.js +0 -0
  242. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
  243. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/manifest.webmanifest +0 -0
  244. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/readme.md +0 -0
  245. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/sw.js +0 -0
  246. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
  247. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/content/homepage.html +0 -0
  248. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +0 -0
  249. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +0 -0
  250. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/includes/x-checklist.html +0 -0
  251. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/layouts/main.html +0 -0
  252. /package/framework/{v0.7.3 → v0.7.4}/core/template/command/gina.bat.tpl +0 -0
  253. /package/framework/{v0.7.3 → v0.7.4}/core/template/command/gina.tpl +0 -0
  254. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/env.json +0 -0
  255. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/manifest.json +0 -0
  256. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/package.json +0 -0
  257. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/settings.json +0 -0
  258. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/statics.json +0 -0
  259. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/templates.json +0 -0
  260. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/client/json/401.json +0 -0
  261. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/client/json/403.json +0 -0
  262. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/client/json/404.json +0 -0
  263. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/server/html/50x.html +0 -0
  264. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/server/json/500.json +0 -0
  265. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/server/json/503.json +0 -0
  266. /package/framework/{v0.7.3 → v0.7.4}/core/template/extensions/logger/config.json +0 -0
  267. /package/framework/{v0.7.3 → v0.7.4}/helpers/console.js +0 -0
  268. /package/framework/{v0.7.3 → v0.7.4}/helpers/data/LICENSE +0 -0
  269. /package/framework/{v0.7.3 → v0.7.4}/helpers/data/README.md +0 -0
  270. /package/framework/{v0.7.3 → v0.7.4}/helpers/data/package.json +0 -0
  271. /package/framework/{v0.7.3 → v0.7.4}/helpers/dateFormat.js +0 -0
  272. /package/framework/{v0.7.3 → v0.7.4}/helpers/index.js +0 -0
  273. /package/framework/{v0.7.3 → v0.7.4}/helpers/json/LICENSE +0 -0
  274. /package/framework/{v0.7.3 → v0.7.4}/helpers/json/README.md +0 -0
  275. /package/framework/{v0.7.3 → v0.7.4}/helpers/json/package.json +0 -0
  276. /package/framework/{v0.7.3 → v0.7.4}/helpers/json/src/main.js +0 -0
  277. /package/framework/{v0.7.3 → v0.7.4}/helpers/path.js +0 -0
  278. /package/framework/{v0.7.3 → v0.7.4}/helpers/plugins/README.md +0 -0
  279. /package/framework/{v0.7.3 → v0.7.4}/helpers/plugins/package.json +0 -0
  280. /package/framework/{v0.7.3 → v0.7.4}/helpers/plugins/src/api-error.js +0 -0
  281. /package/framework/{v0.7.3 → v0.7.4}/helpers/plugins/src/main.js +0 -0
  282. /package/framework/{v0.7.3 → v0.7.4}/helpers/task.js +0 -0
  283. /package/framework/{v0.7.3 → v0.7.4}/helpers/text.js +0 -0
  284. /package/framework/{v0.7.3 → v0.7.4}/lib/admin/package.json +0 -0
  285. /package/framework/{v0.7.3 → v0.7.4}/lib/admin/src/main.js +0 -0
  286. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/README.md +0 -0
  287. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/build.json +0 -0
  288. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/package.json +0 -0
  289. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/src/dep/jszip.min.js +0 -0
  290. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/src/main.js +0 -0
  291. /package/framework/{v0.7.3 → v0.7.4}/lib/async/package.json +0 -0
  292. /package/framework/{v0.7.3 → v0.7.4}/lib/async/src/main.js +0 -0
  293. /package/framework/{v0.7.3 → v0.7.4}/lib/audit/package.json +0 -0
  294. /package/framework/{v0.7.3 → v0.7.4}/lib/audit/src/main.js +0 -0
  295. /package/framework/{v0.7.3 → v0.7.4}/lib/audit-store.js +0 -0
  296. /package/framework/{v0.7.3 → v0.7.4}/lib/authn/package.json +0 -0
  297. /package/framework/{v0.7.3 → v0.7.4}/lib/authn/src/lockout.js +0 -0
  298. /package/framework/{v0.7.3 → v0.7.4}/lib/authn/src/main.js +0 -0
  299. /package/framework/{v0.7.3 → v0.7.4}/lib/authn/src/totp.js +0 -0
  300. /package/framework/{v0.7.3 → v0.7.4}/lib/authz-gate/package.json +0 -0
  301. /package/framework/{v0.7.3 → v0.7.4}/lib/authz-gate/src/main.js +0 -0
  302. /package/framework/{v0.7.3 → v0.7.4}/lib/cache/README.md +0 -0
  303. /package/framework/{v0.7.3 → v0.7.4}/lib/cache/build.json +0 -0
  304. /package/framework/{v0.7.3 → v0.7.4}/lib/cache/package.json +0 -0
  305. /package/framework/{v0.7.3 → v0.7.4}/lib/cache/src/main.js +0 -0
  306. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/aliases.json +0 -0
  307. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/audit/arguments.json +0 -0
  308. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/audit/help.txt +0 -0
  309. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/audit/verify.js +0 -0
  310. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/add.js +0 -0
  311. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/arguments.json +0 -0
  312. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/build.js +0 -0
  313. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/copy.js +0 -0
  314. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/cp.js +0 -0
  315. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/help.js +0 -0
  316. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/help.txt +0 -0
  317. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/inc/boot-lines.js +0 -0
  318. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/inc/name-rewrite.js +0 -0
  319. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/inc/name.js +0 -0
  320. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/list.js +0 -0
  321. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/man.js +0 -0
  322. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/mcp-start.js +0 -0
  323. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/mcp.js +0 -0
  324. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/oas.js +0 -0
  325. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/openapi.js +0 -0
  326. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/remove.js +0 -0
  327. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/rename.js +0 -0
  328. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/rm.js +0 -0
  329. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/status.js +0 -0
  330. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/stop.js +0 -0
  331. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/types.js +0 -0
  332. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/cache/arguments.json +0 -0
  333. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/cache/stats.js +0 -0
  334. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/add.js +0 -0
  335. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/arguments.json +0 -0
  336. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/help.js +0 -0
  337. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/help.txt +0 -0
  338. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/infer.js +0 -0
  339. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/list.js +0 -0
  340. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/migrate.js +0 -0
  341. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/models.js +0 -0
  342. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/remove.js +0 -0
  343. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/rm.js +0 -0
  344. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/test.js +0 -0
  345. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/arguments.json +0 -0
  346. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/help.js +0 -0
  347. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/help.txt +0 -0
  348. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/man.js +0 -0
  349. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/ps.js +0 -0
  350. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/stop.js +0 -0
  351. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/add.js +0 -0
  352. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/arguments.json +0 -0
  353. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/help.txt +0 -0
  354. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/args.js +0 -0
  355. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/namespace.js +0 -0
  356. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/reference-rewrite.js +0 -0
  357. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/reference-scan.js +0 -0
  358. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/scaffold.js +0 -0
  359. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/remove.js +0 -0
  360. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/rename.js +0 -0
  361. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/rm.js +0 -0
  362. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/add.js +0 -0
  363. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/get.js +0 -0
  364. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/help.js +0 -0
  365. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/help.txt +0 -0
  366. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/inc/name.js +0 -0
  367. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/link-dev.js +0 -0
  368. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/list.js +0 -0
  369. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/remove.js +0 -0
  370. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/rm.js +0 -0
  371. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/set.js +0 -0
  372. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/unset.js +0 -0
  373. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/use.js +0 -0
  374. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/add.js +0 -0
  375. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/arguments.json +0 -0
  376. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/build.js +0 -0
  377. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/dot.js +0 -0
  378. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/get.js +0 -0
  379. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/help.js +0 -0
  380. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/help.txt +0 -0
  381. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/inc/listen-error.js +0 -0
  382. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/link-node-modules.js +0 -0
  383. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/link.js +0 -0
  384. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/list.js +0 -0
  385. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/man.js +0 -0
  386. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/msg.json +0 -0
  387. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/open.js +0 -0
  388. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/remove.js +0 -0
  389. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/reset.js +0 -0
  390. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/set.js +0 -0
  391. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/start.js +0 -0
  392. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/tail.js +0 -0
  393. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/update.js +0 -0
  394. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/version.js +0 -0
  395. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/gina-dev.1.md +0 -0
  396. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/gina-framework.1.md +0 -0
  397. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/gina.1.md +0 -0
  398. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/add.js +0 -0
  399. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/arguments.json +0 -0
  400. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/export.js +0 -0
  401. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/help.js +0 -0
  402. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/help.txt +0 -0
  403. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/import.js +0 -0
  404. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/scan.js +0 -0
  405. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/_host.js +0 -0
  406. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/arguments.json +0 -0
  407. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/build.js +0 -0
  408. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/help.js +0 -0
  409. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/help.txt +0 -0
  410. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/list.js +0 -0
  411. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/man.js +0 -0
  412. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/rm.js +0 -0
  413. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/inspector/help.js +0 -0
  414. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/inspector/help.txt +0 -0
  415. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/inspector/open.js +0 -0
  416. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/man-render.js +0 -0
  417. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/arguments.json +0 -0
  418. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/help.js +0 -0
  419. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/help.txt +0 -0
  420. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/kill.js +0 -0
  421. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/list.js +0 -0
  422. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/msg.json +0 -0
  423. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/help.js +0 -0
  424. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/help.txt +0 -0
  425. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/inc/scan.js +0 -0
  426. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/list.js +0 -0
  427. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/reset.js +0 -0
  428. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/set.js +0 -0
  429. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/add.js +0 -0
  430. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/arguments.json +0 -0
  431. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/backup.js +0 -0
  432. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/build.js +0 -0
  433. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/help.js +0 -0
  434. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/help.txt +0 -0
  435. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/import.js +0 -0
  436. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/inc/name.js +0 -0
  437. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/list.js +0 -0
  438. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/man.js +0 -0
  439. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/move.js +0 -0
  440. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/remove.js +0 -0
  441. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/rename.js +0 -0
  442. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/restart.js +0 -0
  443. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/restore.js +0 -0
  444. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/rm.js +0 -0
  445. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/start.js +0 -0
  446. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/status.js +0 -0
  447. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/stop.js +0 -0
  448. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/arguments.json +0 -0
  449. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/help.js +0 -0
  450. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/help.txt +0 -0
  451. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/list.js +0 -0
  452. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/remove.js +0 -0
  453. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/set.js +0 -0
  454. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/add.js +0 -0
  455. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/help.js +0 -0
  456. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/help.txt +0 -0
  457. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/inc/name.js +0 -0
  458. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/link-local.js +0 -0
  459. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/link-production.js +0 -0
  460. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/list.js +0 -0
  461. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/remove.js +0 -0
  462. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/rm.js +0 -0
  463. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/use.js +0 -0
  464. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/arguments.json +0 -0
  465. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/check.js +0 -0
  466. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/help.js +0 -0
  467. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/help.txt +0 -0
  468. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/scan.js +0 -0
  469. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/help.js +0 -0
  470. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/help.txt +0 -0
  471. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/list.js +0 -0
  472. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/man.js +0 -0
  473. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/start.js +0 -0
  474. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/arguments.json +0 -0
  475. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/gc.js +0 -0
  476. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/help.txt +0 -0
  477. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/stats.js +0 -0
  478. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/verify.js +0 -0
  479. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/view/add.js +0 -0
  480. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd-status-format/package.json +0 -0
  481. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd-status-format/src/main.js +0 -0
  482. /package/framework/{v0.7.3 → v0.7.4}/lib/collection/README.md +0 -0
  483. /package/framework/{v0.7.3 → v0.7.4}/lib/collection/build.json +0 -0
  484. /package/framework/{v0.7.3 → v0.7.4}/lib/collection/package.json +0 -0
  485. /package/framework/{v0.7.3 → v0.7.4}/lib/conf-view/package.json +0 -0
  486. /package/framework/{v0.7.3 → v0.7.4}/lib/conf-view/src/main.js +0 -0
  487. /package/framework/{v0.7.3 → v0.7.4}/lib/config.js +0 -0
  488. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-config/package.json +0 -0
  489. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-config/src/main.js +0 -0
  490. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-error/package.json +0 -0
  491. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-error/src/main.js +0 -0
  492. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-registry/package.json +0 -0
  493. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-registry/src/main.js +0 -0
  494. /package/framework/{v0.7.3 → v0.7.4}/lib/cron/README.md +0 -0
  495. /package/framework/{v0.7.3 → v0.7.4}/lib/cron/package.json +0 -0
  496. /package/framework/{v0.7.3 → v0.7.4}/lib/cron/src/main.js +0 -0
  497. /package/framework/{v0.7.3 → v0.7.4}/lib/domain/LICENSE +0 -0
  498. /package/framework/{v0.7.3 → v0.7.4}/lib/domain/README.md +0 -0
  499. /package/framework/{v0.7.3 → v0.7.4}/lib/domain/package.json +0 -0
  500. /package/framework/{v0.7.3 → v0.7.4}/lib/domain/src/main.js +0 -0
  501. /package/framework/{v0.7.3 → v0.7.4}/lib/dto/package.json +0 -0
  502. /package/framework/{v0.7.3 → v0.7.4}/lib/dto/src/main.js +0 -0
  503. /package/framework/{v0.7.3 → v0.7.4}/lib/dto-pipe/package.json +0 -0
  504. /package/framework/{v0.7.3 → v0.7.4}/lib/dto-pipe/src/main.js +0 -0
  505. /package/framework/{v0.7.3 → v0.7.4}/lib/dto-types/package.json +0 -0
  506. /package/framework/{v0.7.3 → v0.7.4}/lib/dto-types/src/main.js +0 -0
  507. /package/framework/{v0.7.3 → v0.7.4}/lib/duration/package.json +0 -0
  508. /package/framework/{v0.7.3 → v0.7.4}/lib/duration/src/main.js +0 -0
  509. /package/framework/{v0.7.3 → v0.7.4}/lib/error-ref/package.json +0 -0
  510. /package/framework/{v0.7.3 → v0.7.4}/lib/error-ref/src/main.js +0 -0
  511. /package/framework/{v0.7.3 → v0.7.4}/lib/generator/index.js +0 -0
  512. /package/framework/{v0.7.3 → v0.7.4}/lib/i18n/package.json +0 -0
  513. /package/framework/{v0.7.3 → v0.7.4}/lib/i18n/src/main.js +0 -0
  514. /package/framework/{v0.7.3 → v0.7.4}/lib/idempotency/package.json +0 -0
  515. /package/framework/{v0.7.3 → v0.7.4}/lib/idempotency/src/main.js +0 -0
  516. /package/framework/{v0.7.3 → v0.7.4}/lib/image-build/package.json +0 -0
  517. /package/framework/{v0.7.3 → v0.7.4}/lib/image-build/src/main.js +0 -0
  518. /package/framework/{v0.7.3 → v0.7.4}/lib/index.js +0 -0
  519. /package/framework/{v0.7.3 → v0.7.4}/lib/inherits/LICENSE +0 -0
  520. /package/framework/{v0.7.3 → v0.7.4}/lib/inherits/README.md +0 -0
  521. /package/framework/{v0.7.3 → v0.7.4}/lib/inherits/package.json +0 -0
  522. /package/framework/{v0.7.3 → v0.7.4}/lib/inherits/src/main.js +0 -0
  523. /package/framework/{v0.7.3 → v0.7.4}/lib/inspector-events/package.json +0 -0
  524. /package/framework/{v0.7.3 → v0.7.4}/lib/inspector-events/src/main.js +0 -0
  525. /package/framework/{v0.7.3 → v0.7.4}/lib/inspector-redact/package.json +0 -0
  526. /package/framework/{v0.7.3 → v0.7.4}/lib/inspector-redact/src/main.js +0 -0
  527. /package/framework/{v0.7.3 → v0.7.4}/lib/instrument/package.json +0 -0
  528. /package/framework/{v0.7.3 → v0.7.4}/lib/instrument/src/main.js +0 -0
  529. /package/framework/{v0.7.3 → v0.7.4}/lib/job/package.json +0 -0
  530. /package/framework/{v0.7.3 → v0.7.4}/lib/job-store.js +0 -0
  531. /package/framework/{v0.7.3 → v0.7.4}/lib/json-config-header/package.json +0 -0
  532. /package/framework/{v0.7.3 → v0.7.4}/lib/json-config-header/src/main.js +0 -0
  533. /package/framework/{v0.7.3 → v0.7.4}/lib/kv/package.json +0 -0
  534. /package/framework/{v0.7.3 → v0.7.4}/lib/kv/src/main.js +0 -0
  535. /package/framework/{v0.7.3 → v0.7.4}/lib/kv-store.js +0 -0
  536. /package/framework/{v0.7.3 → v0.7.4}/lib/lane/package.json +0 -0
  537. /package/framework/{v0.7.3 → v0.7.4}/lib/loading-state/package.json +0 -0
  538. /package/framework/{v0.7.3 → v0.7.4}/lib/loading-state/src/main.js +0 -0
  539. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/README.md +0 -0
  540. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/package.json +0 -0
  541. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/default/index.js +0 -0
  542. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/file/index.js +0 -0
  543. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/mq/index.js +0 -0
  544. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/mq/listener.js +0 -0
  545. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/mq/speaker.js +0 -0
  546. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/helper.js +0 -0
  547. /package/framework/{v0.7.3 → v0.7.4}/lib/maintenance/package.json +0 -0
  548. /package/framework/{v0.7.3 → v0.7.4}/lib/maintenance/src/main.js +0 -0
  549. /package/framework/{v0.7.3 → v0.7.4}/lib/math/index.js +0 -0
  550. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-dispatch/package.json +0 -0
  551. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-dispatch/src/main.js +0 -0
  552. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-http/package.json +0 -0
  553. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-http/src/main.js +0 -0
  554. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-server/package.json +0 -0
  555. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-server/src/main.js +0 -0
  556. /package/framework/{v0.7.3 → v0.7.4}/lib/merge/README.md +0 -0
  557. /package/framework/{v0.7.3 → v0.7.4}/lib/merge/package.json +0 -0
  558. /package/framework/{v0.7.3 → v0.7.4}/lib/merge/src/main.js +0 -0
  559. /package/framework/{v0.7.3 → v0.7.4}/lib/message-validator/package.json +0 -0
  560. /package/framework/{v0.7.3 → v0.7.4}/lib/message-validator/src/main.js +0 -0
  561. /package/framework/{v0.7.3 → v0.7.4}/lib/metrics/package.json +0 -0
  562. /package/framework/{v0.7.3 → v0.7.4}/lib/metrics/src/main.js +0 -0
  563. /package/framework/{v0.7.3 → v0.7.4}/lib/model.js +0 -0
  564. /package/framework/{v0.7.3 → v0.7.4}/lib/money/package.json +0 -0
  565. /package/framework/{v0.7.3 → v0.7.4}/lib/money/src/main.js +0 -0
  566. /package/framework/{v0.7.3 → v0.7.4}/lib/multipart/package.json +0 -0
  567. /package/framework/{v0.7.3 → v0.7.4}/lib/multipart/src/main.js +0 -0
  568. /package/framework/{v0.7.3 → v0.7.4}/lib/net-locality/package.json +0 -0
  569. /package/framework/{v0.7.3 → v0.7.4}/lib/net-locality/src/main.js +0 -0
  570. /package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-filters/README.md +0 -0
  571. /package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-filters/package.json +0 -0
  572. /package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-resolver/package.json +0 -0
  573. /package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-resolver/src/main.js +0 -0
  574. /package/framework/{v0.7.3 → v0.7.4}/lib/priority/package.json +0 -0
  575. /package/framework/{v0.7.3 → v0.7.4}/lib/priority/src/main.js +0 -0
  576. /package/framework/{v0.7.3 → v0.7.4}/lib/push/package.json +0 -0
  577. /package/framework/{v0.7.3 → v0.7.4}/lib/push/src/main.js +0 -0
  578. /package/framework/{v0.7.3 → v0.7.4}/lib/rate-limit/package.json +0 -0
  579. /package/framework/{v0.7.3 → v0.7.4}/lib/rate-limit/src/main.js +0 -0
  580. /package/framework/{v0.7.3 → v0.7.4}/lib/release-watch/package.json +0 -0
  581. /package/framework/{v0.7.3 → v0.7.4}/lib/release-watch/src/main.js +0 -0
  582. /package/framework/{v0.7.3 → v0.7.4}/lib/render-cache/package.json +0 -0
  583. /package/framework/{v0.7.3 → v0.7.4}/lib/render-cache-store.js +0 -0
  584. /package/framework/{v0.7.3 → v0.7.4}/lib/routing/README.md +0 -0
  585. /package/framework/{v0.7.3 → v0.7.4}/lib/routing/build.json +0 -0
  586. /package/framework/{v0.7.3 → v0.7.4}/lib/routing/package.json +0 -0
  587. /package/framework/{v0.7.3 → v0.7.4}/lib/routing-introspect/package.json +0 -0
  588. /package/framework/{v0.7.3 → v0.7.4}/lib/routing-introspect/src/main.js +0 -0
  589. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/package.json +0 -0
  590. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/backends/env.js +0 -0
  591. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/backends/exec.js +0 -0
  592. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/backends/file.js +0 -0
  593. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/declaration.js +0 -0
  594. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/env-file.js +0 -0
  595. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/main.js +0 -0
  596. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/sources.js +0 -0
  597. /package/framework/{v0.7.3 → v0.7.4}/lib/security-headers-emitter/package.json +0 -0
  598. /package/framework/{v0.7.3 → v0.7.4}/lib/security-headers-emitter/src/main.js +0 -0
  599. /package/framework/{v0.7.3 → v0.7.4}/lib/session-lifetime/package.json +0 -0
  600. /package/framework/{v0.7.3 → v0.7.4}/lib/session-lifetime/src/main.js +0 -0
  601. /package/framework/{v0.7.3 → v0.7.4}/lib/session-store.js +0 -0
  602. /package/framework/{v0.7.3 → v0.7.4}/lib/shell.js +0 -0
  603. /package/framework/{v0.7.3 → v0.7.4}/lib/sri/package.json +0 -0
  604. /package/framework/{v0.7.3 → v0.7.4}/lib/sri/src/main.js +0 -0
  605. /package/framework/{v0.7.3 → v0.7.4}/lib/state.js +0 -0
  606. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/package.json +0 -0
  607. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/local-cas.js +0 -0
  608. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/local-stream.js +0 -0
  609. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/local.js +0 -0
  610. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/main.js +0 -0
  611. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/meta-store.js +0 -0
  612. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/s3.js +0 -0
  613. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/util.js +0 -0
  614. /package/framework/{v0.7.3 → v0.7.4}/lib/storage-store.js +0 -0
  615. /package/framework/{v0.7.3 → v0.7.4}/lib/swig-filters/README.md +0 -0
  616. /package/framework/{v0.7.3 → v0.7.4}/lib/swig-filters/package.json +0 -0
  617. /package/framework/{v0.7.3 → v0.7.4}/lib/swig-resolver/package.json +0 -0
  618. /package/framework/{v0.7.3 → v0.7.4}/lib/swig-resolver/src/main.js +0 -0
  619. /package/framework/{v0.7.3 → v0.7.4}/lib/template-loaders/package.json +0 -0
  620. /package/framework/{v0.7.3 → v0.7.4}/lib/template-loaders/src/loaders/http.js +0 -0
  621. /package/framework/{v0.7.3 → v0.7.4}/lib/template-loaders/src/loaders/memory.js +0 -0
  622. /package/framework/{v0.7.3 → v0.7.4}/lib/template-loaders/src/main.js +0 -0
  623. /package/framework/{v0.7.3 → v0.7.4}/lib/url/README.md +0 -0
  624. /package/framework/{v0.7.3 → v0.7.4}/lib/url/index.js +0 -0
  625. /package/framework/{v0.7.3 → v0.7.4}/lib/url/routing.json +0 -0
  626. /package/framework/{v0.7.3 → v0.7.4}/lib/uuid/package.json +0 -0
  627. /package/framework/{v0.7.3 → v0.7.4}/lib/uuid/src/main.js +0 -0
  628. /package/framework/{v0.7.3 → v0.7.4}/lib/validator.js +0 -0
  629. /package/framework/{v0.7.3 → v0.7.4}/lib/watcher/package.json +0 -0
  630. /package/framework/{v0.7.3 → v0.7.4}/lib/watcher/src/main.js +0 -0
  631. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-framing/package.json +0 -0
  632. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-framing/src/main.js +0 -0
  633. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-query/package.json +0 -0
  634. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-query/src/main.js +0 -0
  635. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-session/package.json +0 -0
  636. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-session/src/main.js +0 -0
package/llms.txt CHANGED
@@ -358,7 +358,7 @@ var jobId = self.inferAsync([{ role: 'user', content: prompt }], { connector: 'm
358
358
  - Failed-job retry (opt-in): pass `{ maxAttempts: N }` to `create`/`startJob` — a failed attempt is retried on the CREATING process with exponential backoff (`app.json jobs.retryBackoffMs`, default 1000 ms, doubling per attempt). Between attempts the record returns to `pending` with the last error and an informational `nextRetryAt` visible, and it can never be purged by the TTL sweep (`expiresAt` stays null until terminal); `failed`/`completed` are strictly terminal and the completion webhook fires exactly once, after the final attempt. Only the origin pod retries — the deferred function exists only in the process that created the job; other pods just read the shared record. The default `maxAttempts` of 1 keeps the exact runs-once behavior.
359
359
  - Durable (connector-backed) records: set `app.json` `jobs.store` to a `connectors.json` entry name — e.g. `"jobs": { "store": "jobsDb" }` with `"jobsDb": { "connector": "sqlite", "file": "/data/jobs.db" }` (single host), `"jobsDb": { "connector": "mongodb", "host": "127.0.0.1", "port": 27017, "database": "gina_jobs" }` (multi-pod — same `uri`/`host`/`database` keys as the MongoDB session store; the `mongodb` driver is resolved from the consuming project's `node_modules`, so `npm install mongodb` there), or `"jobsRedis": { "connector": "redis", "host": "127.0.0.1", "port": 6379 }` (multi-pod — same `host`/`port`/`db`/`password`/`tls`/`cluster` keys as the Redis session store; driver `ioredis`, resolved like the session store with a project-`node_modules` fallback, so `npm install ioredis` in the project works under every install topology). Each entry follows its OWN connector's config-key conventions: for sqlite use `file` for the path — the model layer also scans every connectors.json entry at boot and treats `database` as a NAME, so a path in `database` fails the boot before the job store is built; for mongodb `database` IS the (required) name; a redis entry needs no database name at all (keys are namespaced under a `prefix`, default `jobs:`). A configured store that cannot be built (bad entry name, missing implementation, unopenable file, missing driver) aborts the boot with a clear error — never a silent fall-back to memory; an absent `jobs.store` keeps the in-memory store, unchanged. Store `get`/`list` deliberately do NOT filter expired records — expiry acts only at sweep time, matching the memory store; the MongoDB store therefore never configures server-side TTL reaping (which would purge outside the seam — and the record's epoch-ms `expiresAt` is a number the Date-indexed TTL monitor would ignore anyway), and the Redis store never sets a per-key TTL for the same reason.
360
360
  - Redis job-store design: the record rides as a JSON string at `<prefix><id>`, with per-state id SETs (`<prefix>idx:state:<state>`) and a terminal-only expiry sorted-set (`<prefix>idx:expires`, score = epoch-ms `expiresAt`) maintained atomically with every write in one MULTI — so `list({state})` reads only matching ids, `sweep` reads only already-expired ids, and neither ever SCANs the keyspace. Redis Cluster works via a hash-tagged prefix (default `{jobs}:` in cluster mode; a custom cluster prefix without a `{tag}` fails fast at construction instead of CROSSSLOT errors at runtime). Also fixed alongside: a `"connector": "redis"` connectors.json entry previously aborted the bundle boot at the model scan (the connector shipped no boot connector file) — even the documented Redis session-store configuration could not boot; the connector now includes a no-op boot connector that opens no connection and requires no driver.
361
- - Request context (#B543, `0.6.31`): a job runs inside a DETACHED copy of the request context that created it — `{ requestId, startMs, proxy, detached: true }`, captured at `create()` from `process.gina._reqALS` and never the request's `req`/`res`/`next` — for its WHOLE lifecycle (record transitions, the deferred fn, a retry it arms, its completion webhook): its log lines carry the creating request's id, `getRoute().toUrl()` builds from that request's proxy context, and an error it raises through the global `getConfig()`/`getLib()` is emerg-logged (fatal) or thrown (non-fatal), never written to a client — `helpers/context.js`'s `throwError` treats `detached: true` as authoritative (no `router`-slot fallback for a store that has no `res`; a store WITHOUT the flag keeps the #B534 fallback). Before `0.6.31` a job ran under whichever request's settle chain freed the worker slot (measured with `maxConcurrency: 1`: a job created by request B executed seeing request A's store, `res` included) — so the bleed needs a BUSY worker; an idle worker always started a job from its own creator's context. A job created outside any request runs with NO store, even when the pump that started it came from a request: `runOne()` enters `_reqALS.run(entry.context || undefined)` — `run(undefined)`, never a plain call, because a plain call inherits the pump's context, which is the defect — and the ALS is looked up at RUN time. The context lives on the in-process queue entry only, never on the record, so durable stores serialise exactly what they did. Pickup: bundle RESTART, no re-bake.
361
+ - Request context (#B543, `0.6.31`): a job runs inside a DETACHED copy of the request context that created it — `{ requestId, startMs, proxy, detached: true }`, captured at `create()` from `process.gina._reqALS` and never the request's `req`/`res`/`next` — for its WHOLE lifecycle (record transitions, the deferred fn, a retry it arms, its completion webhook): its log lines carry the creating request's id, `getRoute().toUrl()` builds from that request's proxy context, and an error it raises through the global `getConfig()`/`getLib()` is emerg-logged (fatal) or thrown (non-fatal), never written to a client — `helpers/context.js`'s `throwError` treats `detached: true` as authoritative (no `router`-slot fallback for a store that has no `res`; a store WITHOUT the flag keeps the #B534 fallback). Before `0.6.31` a job ran under whichever request's settle chain freed the worker slot (measured with `maxConcurrency: 1`: a job created by request B executed seeing request A's store, `res` included) — so the bleed needs a BUSY worker; an idle worker always started a job from its own creator's context. A job created outside any request runs with NO store, even when the pump that started it came from a request: `runOne()` enters `_reqALS.run(entry.context || undefined)` — `run(undefined)`, never a plain call, because a plain call inherits the pump's context, which is the defect — and the ALS is looked up at RUN time. The context lives on the in-process queue entry only, never on the record, so durable stores serialise exactly what they did. Pickup: bundle RESTART, no re-bake. **No render store (#B811, `0.7.4`):** the same wrapper runs a job with NO `process.gina._renderALS` store as well — `runWithoutRenderStore()`, `_renderALS.run(undefined, …)` around the request-context entry, resolved at RUN time (the first render creates that store, long after `lib/job` loaded). It is the store a render delegate enters around a render (`{ options, isProxyHost, throwError, req, res }`) and the FIRST place the template filters (`getUrl`, `getWebroot`, `t`, `tIcu`) look for their context. A job is not a render, yet from `0.4.6` through `0.7.3` it kept the render store of the async chain that started it: its creator's when it was created in a frame that carried one, else the one of the job that freed its worker slot (measured with `maxConcurrency: 1`: a job of another request, a job created outside any request and both attempts of a retried job all ran under request A's render context). A filter called in such a job resolved that request's context — `getUrl` built its URL from that request's host — even when the job had called the filter factory with a context of its own, because the render store is read before anything a factory call binds. Nothing is read off the store or copied onto the job: a filter called in a job now resolves as in a render made outside a request (the context a factory call made in the job passed, else the bundle's configuration). Rule: detaching work from ONE AsyncLocalStorage leaves every other store on its async chain in place — enumerate the stores the detached work can read. Test: `test/lib/job-render-store-b811.test.js`. Pickup: bundle RESTART, no re-bake.
362
362
 
363
363
  ---
364
364
 
@@ -838,7 +838,7 @@ Dev-mode query instrumentation captures every database query tied to the current
838
838
 
839
839
  54. **Bundle `config/*.json` shared → bundle overlay is key-level deep merge, not whole-file replace** — `core/config.js:1766` runs `merge(sharedMain, jsonFile, true)` AFTER the bundle file loads. Shared-only keys are preserved; bundle wins on conflicting keys. Applies to `connectors.json`, `env.json`, `settings.json`, and every other per-bundle config file that also has a `shared/config/<same-file>.json` sibling. Reading only the bundle file for config inspection is a silent half-picture — any CLI or tool that inspects per-bundle config must reproduce the overlay merge.
840
840
 
841
- 65. **Template engines — `lib/swig-resolver` + `lib/nunjucks-resolver` + per-request env mutation invariants** — process-cached resolver-based opt-in for both engines: `core/server.js:initSwigEngine` / `initNunjucksEngine` load via `lib.swigResolver.load()` / `lib.nunjucksResolver.load()` during bundle init; `controller.js this.render()` reads `local.options.conf.content.settings.render.engine` and dispatches to `controller.render-swig.js` (default) or `controller.render-nunjucks.js`. Both delegates receive the same `deps` object (`self`, `local`, `getData`, `hasViews`, `headersSent`, `setResources`, etc.); `process.gina._swig` / `process.gina._nunjucks` survive `refreshCoreDependencies()` evictions. Both: dev-mode mtime hot-swap on project's `package.json`, first-wins standalone-mode contract, `[<engine>-resolver]` warning logged on safety-gate fallback. **Swig**: framework fallback enabled (always-installable), version floor `DEFAULT_MIN = '2.0.0'` (bump in same commit as fork-API dependence — see global "Swig version sync" rule), three safety gates (package-name allowlist preventing CVE-2023-25345 re-entry, same-major rule, min-version floor), Phase 7 build copies upstream esbuild output to `dist/swig.min.js` (no longer Closure-compiles `bin/swig.js` — swig 2.0.0's `swig-core` lazy require breaks Closure's static analysis). **Output auto-escaping** (`settings.swig.autoescape`, boolean, default false; #B151): both `initSwigEngine` (boot) and `controller.js` per-render `setDefaults` resolve `autoescape` from `conf.content.settings.swig` (guarded to `{}`, then strict `=== true`; the per-render read goes through the REQUEST's own conf, `local.options.conf.content.settings.swig` — until 0.7.1 it went through the global no-argument `getConfig()`, whose caller walk throws under an npm install, and the surrounding `try` fell back to `false`: `autoescape: true` was silently OFF on every npm install from 0.5.25 to 0.7.0, while a checkout — every suite run — never showed it, #B695; the Tests workflow now boots a bundle from a copy of the commit placed under `node_modules/gina` to keep that install shape covered) — ABSENT ⇒ false (unchanged 0.5.x behaviour; the old dead `conf.autoescape` read never fired); a non-boolean value refuses the boot (strictly-boolean security-toggle rule); `true` ⇒ swig HTML-escapes `{{ x }}` variable output; mirrors `settings.nunjucks.autoescape` (default true) — swig's default stays OFF until 0.8.0, which makes it `true`; since 0.7.0 (#B359 prep) a bundle that renders swig (settings engine, or a `.swig` templates section) and leaves the key unset gets ONE boot warning naming 0.8.0 (an explicit `true`/`false` silences it; a nunjucks-only bundle is not warned), `gina bundle:add` scaffolds `"swig": { "autoescape": true }`, the default delegate injects its asset placeholders as `{{ page.view.stylesheets | safe }}` / `{{ page.view.scripts | safe }}` (#B690 — bare, autoescape rendered every injected `<link>`/`<script>` as visible text; a layout placing them itself writes `| safe`, as for nunjucks), and `nl2br` escapes its input and is flagged `.safe` only when the bundle escapes (never `.safe` otherwise: a `{% autoescape true %}` region would then emit its input raw); the 0.8.0 flip needs `| safe` on every variable that carries HTML on purpose, `gina.csrfInput` first (unmarked it renders as text and every POST then fails CSRF); server-side only (no dist rebuild). **Nunjucks**: NEVER framework-bundled (resolver only looks in `<projectPath>/node_modules/nunjucks/`), `load()` throws `NUNJUCKS_NOT_INSTALLED` with no fallback (bundle startup fails loud, not mid-render). `new nunjucks.Environment(loader, ...)` cached per template root on `process.gina._nunjucksEnvs`; dev-mode `FileSystemLoader({ noCache: true })` for `.njk` template hot-edit. **Render-nunjucks.js implementation invariants**: per-request `addFilter → render` mutation of cached env is safe ONLY because `env.render()` is synchronous (Node's event loop serialises requests; an async-render port needs the per-request `process.gina._renderALS` context — a per-request env does NOT fix it: the filters read a process-global `*Filters.instance._options` singleton that a fresh env does not isolate (measured, #TPL1 Tier-2/#B25)); pre-render `setResources()` + post-render `injectAssets()` cooperate via exact-substring user-placement detection (#NJ2) — pre-only loses auto-injection, post-only double-injects on opt-in templates; both wrap bodies in try/catch (must NOT 500 the page); `injectAssets` runs BEFORE `injectInspectorScripts` (Inspector payload stays last `<script>` before `</body>`); `isWithoutLayout` filters via `Collection.find({isCommon:false},{isCommon:true,name:'gina'})` on a `JSON.clone(localTemplateConf)` to keep common-gina assets while dropping common-other. Test-author traps (both resolvers): mtime collision within same wall-clock ms requires monotonic counter; macOS `os.tmpdir()` symlink requires `fs.realpathSync` for `require.cache` key parity. **Per-extension engine dispatch (#M11)**: since #M11 the effective template EXTENSION overrides the engine setting per section — `.njk`→nunjucks, `.swig`→swig, `.html`→`render.engine`; precedence: setTemplate-override ext → `templates.json` section ext → default. NO filename sniffing (an `x.njk.html` must not mis-dispatch); auto-detect-on-`.njk`-presence was measured and DROPPED — explicit per-section ext covers its only value. **#B514 (0.6.30) — the DEFAULT swig delegates entered NO render context at all, and that is the wider half of the #B25 class.** #TPL1 Tier-2 wrapped the two `-async` delegates in `_renderALS.run()` and left `controller.render-swig.js` + `controller.render-v1.js` — the path every bundle takes unless it opts into `settings.template.swig.loader` — resolving filters through the raced `SwigFilters.instance._options` singleton. Both are themselves `async` and await between the per-request `SwigFilters({…})` stamp and the template invocation (render-swig's layout read is unconditional; render-v1 awaits a `Promise.all` of two reads before its compiles), so a concurrent request's stamp lands inside the window and the resumed render emits the OTHER request's negotiated culture, webroot and proxy classification into its own response. The in-tree note asserting "on a synchronous render that's safe" was FALSE when written — the default delegate went `async` in `64b19b7b2` (2026-03-06), three months BEFORE the #B25 fix — and that wrong premise is why the default path stayed unprotected. Both delegates now call `getRenderALS().enterWith(_renderCtx)` immediately after the factory call, handing the SAME object to both so the store and the singleton cannot disagree; `enterWith` rather than `.run()` because the body is one ~1,900-line async function whose every `return` would otherwise have to move inside a callback, and the store propagates to every continuation of the current async context, which is exactly the awaited span. Measured on a built `--env=prod` release — dev MASKS this, since `lib/index.js`'s `_require` re-requires the filter module per request and no singleton is shared, so a dev repro reads clean while production bleeds: 50 of 50 concurrent request pairs carried the other request's context pre-fix, 0 of 100 post-fix, and 0 of 3 across a REUSED keep-alive connection (2 confirmed reuse events — the one shape `enterWith` could have leaked through). Structurally the rate is last-writer-wins, so for N overlapping renders N−1 read the wrong context. **`render-nunjucks.js` is the one delegate genuinely free of the window** — its singleton write (`registerGinaFilters`) and its `env.render` sit in ONE synchronous run with no await between them, which is what the per-request-env sentence above actually rests on. ✅ **Sibling limb, CLOSED in the same arc — and it was NOT surgically closable:** `controller.js`'s per-render `swig.setDefaults({loader})` on the process singleton has the identical interleave shape for `{% include %}` / `{% extends %}` basepath resolution in MERGED-PROCESS mode (several bundles, one process). A per-call `loader` handed to `swig.compile()` CANNOT fix it — measured in swig-core: `self.parse` merges per-call options into a local that never escapes the function (`engine.js:477`), while `getParentsInternal` (`:321`) and `parseFile` (`:490`) read `self.options.loader` unconditionally, and the `{% include %}` codegen emits only `resolveFrom` (`backend.js:420`); the validators at swig.js:113 and runtime.js:58 accept a per-call loader and then nothing loads through it. The only working shape is a per-bundle `new swig.Swig({ loader })` instance, and that is what `controller.js` now builds — `getDefaultSwigEngine(swigMod, templateRoot, opts)`, keyed on the bundle template root, owner-guarded against a dev swig hot-swap exactly like `_swigEngines`, handed to the delegates as `deps.swig` and pointed at by `self.engine`. That last part is load-bearing: `router.js:944` hands `controller.engine` to the bundle's `controllers/setup.js`, so a bundle's OWN filters must land on the instance that renders it — `engine.install` gives every instance fresh tag/filter maps, so they would otherwise be silently dropped. **Live-verified against a baseline**: a scaffold whose `setup.js` registers a custom filter rendered `STAMP<x>` both before and after the change. The module-level `setDefaults` is deliberately KEPT — `core/server.js` still compiles inline routing/asset strings through the module with `swig.getOptions()` — so nothing renders a bundle template through the module any more and the stamp it races is inert. ⚠️ **#B535 (0.6.30, same tree) — that instance's registrations then had to be bridged BACK to the module, because "nothing renders a bundle template through it" is not the same as "nothing compiles through it".** `engine.install` gives every `new Swig()` FRESH filter/tag/extension maps — copied from the frontend's built-in library, NOT from the module's runtime registrations — and keeps them closure-private in BOTH directions (measured on the real fork, four arms with both controls firing: a filter registered on the module BEFORE or AFTER construction never reaches an instance, and an instance's never reaches the module). So while templates stopped rendering through the module, `core/server.js:3094`/`:3352` still compile inline routing/asset strings through it, and an application's own `require('@rhinostone/swig').compile()` — an entity rendering a message outside any request — still compiles through it; every one of those silently lost the filters a bundle's `controllers/setup.js` had registered, which on 0.6.29 reached them because `self.engine` WAS the module. Reported by a consumer as a `TypeError` thrown from INSIDE a filter (so the filter was found — the diagnostic that rules out a missing-filter reading): their own module-side registration was the only one left there, and its closure had never passed the router's export block. `bridgeRegistrationsToModule(engine, swigMod)`, called on the line after the mint in `getDefaultSwigEngine`, wraps the instance's `setFilter`/`setTag`/`setExtension` to register on the INSTANCE first (its own validation throws before the module is touched) and then on the module; idempotent per (instance, module) via an `_ginaModuleBridge` marker, and the owner-guard rebuild bridges each fresh instance. The instance keeps its OWN options — the loader above all — so the include/extends isolation this entry exists for is untouched; only the registration maps are shared again, which is the state every released version had. The REVERSE direction is deliberately NOT bridged: a module-registered filter still never reaches an instance, so registering anywhere other than through `this.engine` in `setup.js` stays unsupported — and that guidance is measured-correct, not merely conventional. DEVELOP-ONLY: the defect never shipped (the `0.6.30-alpha.1` tarball carries `getDefaultSwigEngine` = 0 and the pre-#B514 `self.engine = swig;`), so no released consumer tier was affected and no advisory is owed. ⚠️ **#B538 (0.6.30, same tree) — a SIBLING of #B535, not the same defect: `self.engine.getOptions()` threw `TypeError: … is not a function` on the accessor itself, before any compile.** `controller.js` installs `swig.getOptions` on the MODULE once per request (a closure over that request's `local._swigOptions`, a `JSON.clone` of `{ autoescape, cache, loader }`), and until #B514 `self.engine` WAS the module, so the documented call shape `self.engine.compile(tpl, self.engine.getOptions())(data)` resolved; the per-bundle instance never received the accessor, and the #B535 bridge carries the three registration SETTERS, not methods. It has ZERO framework call sites — the only internal reads are `core/server.js`'s two inline routing/asset compiles, both through the module — which is why the suite stayed green: the contract is consumer-facing, documented only by the comment at the assignment site. Diagnostic worth knowing: inside an async controller callback the TypeError surfaces as an UNHANDLED REJECTION and the request is never answered, so the CALLING bundle waits out its HTTP/2 stream timeout and reports a 503 with no template error and no access line on the answering side — it presents as a proxy/network fault. The accessor cannot be copied from the module (per-REQUEST closure onto a per-BUNDLE shared instance — the cross-request-bleed shape). `exposeOptionsOnEngine(engine, opts)`, called on the line after the #B535 bridge in the mint branch, snapshots `opts` ONCE at mint (measured: neither `new Swig(opts)` nor `setDefaults(opts)` mutates the object handed in, so the snapshot equals the pre-`setDefaults` clone every released version returned) and returns a fresh `JSON.clone` of it per call — a strict HARDENING over 0.6.29, which returned one shared object by reference. `JSON.clone` is gina's own deep copy (`utils/prototypes.json_clone.js`) and PRESERVES the loader's `resolve`/`load` functions; a `JSON.parse(JSON.stringify())` stand-in — the file's own commented-out previous implementation — strips them, and swig-core REFUSES a per-call `loader: {}` (`Invalid loader option`), so any probe built on the stand-in reads a broken loader that does not exist. Measured on the real fork: `compile(tpl)` and `compile(tpl, engine.getOptions())` are IDENTICAL (a differing `autoescape` as the firing control) — the round-trip is supported for compatibility, never required. Returning `instance.options` was rejected: swig-core's merged defaults are a wider surface than any release exposed. Pickup is a bundle RESTART (the registry on `process.gina` survives hot-reload's `require.cache` eviction, so the accessor lands only on instances minted after the restart). DEVELOP-ONLY like #B535 — the published `0.6.30-alpha.1` tarball carries the pre-#B514 shape and no tag contains `0e443f83b`; no consumer tier affected, no advisory owed. ⚠️ Note the fix is structural, NOT validated against its own trigger: there is no supported CLI path to a shared port (`port:set` rejects or evicts, never shares), and the only RUNTIME-MEASURED record on file reports siblings are not served in merged mode at all, so no reachable trigger was confirmed. ⚠️ **Two naming footguns for anyone who touches merged mode:** `isStandalone === true` means MERGED — *one process serves every bundle* — which is inverted from what the name suggests (`core/config.js:719` seeds it true, `:1210` flips it FALSE the moment any bundle's port differs from the starting bundle's, and `config.js:454` describes `!isStandalone` as the non-merged case). And it is ALSO true for an ordinary single-bundle project, so it is not a merged predicate on its own: `core/server.js` gates its merged-only warn on `bundles.length > 1` for exactly that reason. Merged mode is INFERRED from `~/.gina/ports.reverse.json` (the forward `ports.json` is declared but never read at boot), never configured — which is why no CLI verb reaches it. ⚠️ Instrument trap banked from the baseline: the probe extracting the custom filter's output used `[^<]*`, and the filter's own output contains `<`, so it read EMPTY — indistinguishable from « the bundle filter was dropped ». A negative reading about a filter must be validated against a known-positive before it is believed.
841
+ 65. **Template engines — `lib/swig-resolver` + `lib/nunjucks-resolver` + per-request env mutation invariants** — process-cached resolver-based opt-in for both engines: `core/server.js:initSwigEngine` / `initNunjucksEngine` load via `lib.swigResolver.load()` / `lib.nunjucksResolver.load()` during bundle init; `controller.js this.render()` reads `local.options.conf.content.settings.render.engine` and dispatches to `controller.render-swig.js` (default) or `controller.render-nunjucks.js`. Both delegates receive the same `deps` object (`self`, `local`, `getData`, `hasViews`, `headersSent`, `setResources`, etc.); `process.gina._swig` / `process.gina._nunjucks` survive `refreshCoreDependencies()` evictions. Both: dev-mode mtime hot-swap on project's `package.json`, first-wins standalone-mode contract, `[<engine>-resolver]` warning logged on safety-gate fallback. **Swig**: framework fallback enabled (always-installable), version floor `DEFAULT_MIN = '2.0.0'` (bump in same commit as fork-API dependence — see global "Swig version sync" rule), three safety gates (package-name allowlist preventing CVE-2023-25345 re-entry, same-major rule, min-version floor), Phase 7 build copies upstream esbuild output to `dist/swig.min.js` (no longer Closure-compiles `bin/swig.js` — swig 2.0.0's `swig-core` lazy require breaks Closure's static analysis). **Output auto-escaping** (`settings.swig.autoescape`, boolean, default false; #B151): both `initSwigEngine` (boot) and `controller.js` per-render `setDefaults` resolve `autoescape` from `conf.content.settings.swig` (guarded to `{}`, then strict `=== true`; the per-render read goes through the REQUEST's own conf, `local.options.conf.content.settings.swig` — until 0.7.1 it went through the global no-argument `getConfig()`, whose caller walk throws under an npm install, and the surrounding `try` fell back to `false`: `autoescape: true` was silently OFF on every npm install from 0.5.25 to 0.7.0, while a checkout — every suite run — never showed it, #B695; the Tests workflow now boots a bundle from a copy of the commit placed under `node_modules/gina` to keep that install shape covered) — ABSENT ⇒ false (unchanged 0.5.x behaviour; the old dead `conf.autoescape` read never fired); a non-boolean value refuses the boot (strictly-boolean security-toggle rule); `true` ⇒ swig HTML-escapes `{{ x }}` variable output; mirrors `settings.nunjucks.autoescape` (default true) — swig's default stays OFF until 0.8.0, which makes it `true`; since 0.7.0 (#B359 prep) a bundle that renders swig (settings engine, or a `.swig` templates section) and leaves the key unset gets ONE boot warning naming 0.8.0 (an explicit `true`/`false` silences it; a nunjucks-only bundle is not warned), `gina bundle:add` scaffolds `"swig": { "autoescape": true }`, the default delegate injects its asset placeholders as `{{ page.view.stylesheets | safe }}` / `{{ page.view.scripts | safe }}` (#B690 — bare, autoescape rendered every injected `<link>`/`<script>` as visible text; a layout placing them itself writes `| safe`, as for nunjucks), and `nl2br` escapes its input and is flagged `.safe` only when the bundle escapes (never `.safe` otherwise: a `{% autoescape true %}` region would then emit its input raw); the 0.8.0 flip needs `| safe` on every variable that carries HTML on purpose, `gina.csrfInput` first (unmarked it renders as text and every POST then fails CSRF); server-side only (no dist rebuild). **Nunjucks**: NEVER framework-bundled (resolver only looks in `<projectPath>/node_modules/nunjucks/`), `load()` throws `NUNJUCKS_NOT_INSTALLED` with no fallback (bundle startup fails loud, not mid-render). `new nunjucks.Environment(loader, ...)` cached per template root on `process.gina._nunjucksEnvs`; dev-mode `FileSystemLoader({ noCache: true })` for `.njk` template hot-edit. **Render-nunjucks.js implementation invariants**: per-request `addFilter → render` mutation of cached env is safe ONLY because `env.render()` is synchronous (Node's event loop serialises requests; an async-render port needs the per-request `process.gina._renderALS` context — a per-request env does NOT fix it: the filters read a process-global `*Filters.instance._options` singleton that a fresh env does not isolate (measured, #TPL1 Tier-2/#B25)); pre-render `setResources()` + post-render `injectAssets()` cooperate via exact-substring user-placement detection (#NJ2) — pre-only loses auto-injection, post-only double-injects on opt-in templates; both wrap bodies in try/catch (must NOT 500 the page); `injectAssets` runs BEFORE `injectInspectorScripts` (Inspector payload stays last `<script>` before `</body>`); `isWithoutLayout` filters via `Collection.find({isCommon:false},{isCommon:true,name:'gina'})` on a `JSON.clone(localTemplateConf)` to keep common-gina assets while dropping common-other. Test-author traps (both resolvers): mtime collision within same wall-clock ms requires monotonic counter; macOS `os.tmpdir()` symlink requires `fs.realpathSync` for `require.cache` key parity. **Per-extension engine dispatch (#M11)**: since #M11 the effective template EXTENSION overrides the engine setting per section — `.njk`→nunjucks, `.swig`→swig, `.html`→`render.engine`; precedence: setTemplate-override ext → `templates.json` section ext → default. NO filename sniffing (an `x.njk.html` must not mis-dispatch); auto-detect-on-`.njk`-presence was measured and DROPPED — explicit per-section ext covers its only value. **#B514 (0.6.30) — the DEFAULT swig delegates entered NO render context at all, and that is the wider half of the #B25 class.** #TPL1 Tier-2 wrapped the two `-async` delegates in `_renderALS.run()` and left `controller.render-swig.js` + `controller.render-v1.js` — the path every bundle takes unless it opts into `settings.template.swig.loader` — resolving filters through the raced `SwigFilters.instance._options` singleton. Both are themselves `async` and await between the per-request `SwigFilters({…})` stamp and the template invocation (render-swig's layout read is unconditional; render-v1 awaits a `Promise.all` of two reads before its compiles), so a concurrent request's stamp lands inside the window and the resumed render emits the OTHER request's negotiated culture, webroot and proxy classification into its own response. The in-tree note asserting "on a synchronous render that's safe" was FALSE when written — the default delegate went `async` in `64b19b7b2` (2026-03-06), three months BEFORE the #B25 fix — and that wrong premise is why the default path stayed unprotected. Both delegates now call `getRenderALS().enterWith(_renderCtx)` immediately after the factory call, handing the SAME object to both so the store and the singleton cannot disagree; `enterWith` rather than `.run()` because the body is one ~1,900-line async function whose every `return` would otherwise have to move inside a callback, and the store propagates to every continuation of the current async context, which is exactly the awaited span. Measured on a built `--env=prod` release — dev MASKS this, since `lib/index.js`'s `_require` re-requires the filter module per request and no singleton is shared, so a dev repro reads clean while production bleeds: 50 of 50 concurrent request pairs carried the other request's context pre-fix, 0 of 100 post-fix, and 0 of 3 across a REUSED keep-alive connection (2 confirmed reuse events — the one shape `enterWith` could have leaked through). Structurally the rate is last-writer-wins, so for N overlapping renders N−1 read the wrong context. **`render-nunjucks.js` is the one delegate genuinely free of the window** — its singleton write (`registerGinaFilters`) and its `env.render` sit in ONE synchronous run with no await between them, which is what the per-request-env sentence above actually rests on. ✅ **Sibling limb, CLOSED in the same arc — and it was NOT surgically closable:** `controller.js`'s per-render `swig.setDefaults({loader})` on the process singleton has the identical interleave shape for `{% include %}` / `{% extends %}` basepath resolution in MERGED-PROCESS mode (several bundles, one process). A per-call `loader` handed to `swig.compile()` CANNOT fix it — measured in swig-core: `self.parse` merges per-call options into a local that never escapes the function (`engine.js:477`), while `getParentsInternal` (`:321`) and `parseFile` (`:490`) read `self.options.loader` unconditionally, and the `{% include %}` codegen emits only `resolveFrom` (`backend.js:420`); the validators at swig.js:113 and runtime.js:58 accept a per-call loader and then nothing loads through it. The only working shape is a per-bundle `new swig.Swig({ loader })` instance, and that is what `controller.js` now builds — `getDefaultSwigEngine(swigMod, templateRoot, opts)`, keyed on the bundle template root, owner-guarded against a dev swig hot-swap exactly like `_swigEngines`, handed to the delegates as `deps.swig` and pointed at by `self.engine` (the async-loader delegate builds an engine of its own from the swig MODULE, handed as `deps.swigModule`: from 0.6.30 to 0.7.3 it was given the instance, which has no `.Swig`, and every render of a bundle with `settings.template.swig.loader` answered 500 with `swigMod.Swig is not a constructor`, #B808; that engine never received what `setup.js` registers on the bundle's engine either — a template using a bundle filter answered `Invalid filter`, a tag `Unexpected tag` — until #B825: for a bundle with an async loader, `setOptions` wraps the bundle engine's three setters with `recordRegistrations` (into `engine._ginaRegistrations`, `rev` bumped per call, OUTSIDE `getDefaultSwigEngine` and the #B535 bridge so their pins and lifts hold), and the delegate's `replayBundleRegistrations` replays the record onto its own engine whenever `rev` changed, skipping any filter name `registerGinaFilters` registered: on the default path gina re-registers its filters at each render, after setup.js, so a same-name bundle filter loses there — measured — and must lose here too). That last part is load-bearing: `router.js:1079` hands `controller.engine` to the bundle's `controllers/setup.js`, so a bundle's OWN filters must land on the instance that renders it — `engine.install` gives every instance fresh tag/filter maps, so they would otherwise be silently dropped. **Live-verified against a baseline**: a scaffold whose `setup.js` registers a custom filter rendered `STAMP<x>` both before and after the change. The module-level `setDefaults` is deliberately KEPT — `core/server.js` still compiles inline routing/asset strings through the module with `swig.getOptions()` — so nothing renders a bundle template through the module any more and the stamp it races is inert. ⚠️ **#B535 (0.6.30, same tree) — that instance's registrations then had to be bridged BACK to the module, because "nothing renders a bundle template through it" is not the same as "nothing compiles through it".** `engine.install` gives every `new Swig()` FRESH filter/tag/extension maps — copied from the frontend's built-in library, NOT from the module's runtime registrations — and keeps them closure-private in BOTH directions (measured on the real fork, four arms with both controls firing: a filter registered on the module BEFORE or AFTER construction never reaches an instance, and an instance's never reaches the module). So while templates stopped rendering through the module, `core/server.js:3094`/`:3352` still compile inline routing/asset strings through it, and an application's own `require('@rhinostone/swig').compile()` — an entity rendering a message outside any request — still compiles through it; every one of those silently lost the filters a bundle's `controllers/setup.js` had registered, which on 0.6.29 reached them because `self.engine` WAS the module. Reported by a consumer as a `TypeError` thrown from INSIDE a filter (so the filter was found — the diagnostic that rules out a missing-filter reading): their own module-side registration was the only one left there, and its closure had never passed the router's export block. `bridgeRegistrationsToModule(engine, swigMod)`, called on the line after the mint in `getDefaultSwigEngine`, wraps the instance's `setFilter`/`setTag`/`setExtension` to register on the INSTANCE first (its own validation throws before the module is touched) and then on the module; idempotent per (instance, module) via an `_ginaModuleBridge` marker, and the owner-guard rebuild bridges each fresh instance. The instance keeps its OWN options — the loader above all — so the include/extends isolation this entry exists for is untouched; only the registration maps are shared again, which is the state every released version had. The REVERSE direction is deliberately NOT bridged: a module-registered filter still never reaches an instance, so registering anywhere other than through `this.engine` in `setup.js` stays unsupported — and that guidance is measured-correct, not merely conventional. DEVELOP-ONLY: the defect never shipped (the `0.6.30-alpha.1` tarball carries `getDefaultSwigEngine` = 0 and the pre-#B514 `self.engine = swig;`), so no released consumer tier was affected and no advisory is owed. ⚠️ **#B538 (0.6.30, same tree) — a SIBLING of #B535, not the same defect: `self.engine.getOptions()` threw `TypeError: … is not a function` on the accessor itself, before any compile.** `controller.js` installs `swig.getOptions` on the MODULE once per request (a closure over that request's `local._swigOptions`, a `JSON.clone` of `{ autoescape, cache, loader }`), and until #B514 `self.engine` WAS the module, so the documented call shape `self.engine.compile(tpl, self.engine.getOptions())(data)` resolved; the per-bundle instance never received the accessor, and the #B535 bridge carries the three registration SETTERS, not methods. It has ZERO framework call sites — the only internal reads are `core/server.js`'s two inline routing/asset compiles, both through the module — which is why the suite stayed green: the contract is consumer-facing, documented only by the comment at the assignment site. Diagnostic worth knowing: inside an async controller callback the TypeError surfaces as an UNHANDLED REJECTION and the request is never answered, so the CALLING bundle waits out its HTTP/2 stream timeout and reports a 503 with no template error and no access line on the answering side — it presents as a proxy/network fault. The accessor cannot be copied from the module (per-REQUEST closure onto a per-BUNDLE shared instance — the cross-request-bleed shape). `exposeOptionsOnEngine(engine, opts)`, called on the line after the #B535 bridge in the mint branch, snapshots `opts` ONCE at mint (measured: neither `new Swig(opts)` nor `setDefaults(opts)` mutates the object handed in, so the snapshot equals the pre-`setDefaults` clone every released version returned) and returns a fresh `JSON.clone` of it per call — a strict HARDENING over 0.6.29, which returned one shared object by reference. `JSON.clone` is gina's own deep copy (`utils/prototypes.json_clone.js`) and PRESERVES the loader's `resolve`/`load` functions; a `JSON.parse(JSON.stringify())` stand-in — the file's own commented-out previous implementation — strips them, and swig-core REFUSES a per-call `loader: {}` (`Invalid loader option`), so any probe built on the stand-in reads a broken loader that does not exist. Measured on the real fork: `compile(tpl)` and `compile(tpl, engine.getOptions())` are IDENTICAL (a differing `autoescape` as the firing control) — the round-trip is supported for compatibility, never required. Returning `instance.options` was rejected: swig-core's merged defaults are a wider surface than any release exposed. Pickup is a bundle RESTART (the registry on `process.gina` survives hot-reload's `require.cache` eviction, so the accessor lands only on instances minted after the restart). DEVELOP-ONLY like #B535 — the published `0.6.30-alpha.1` tarball carries the pre-#B514 shape and no tag contains `0e443f83b`; no consumer tier affected, no advisory owed. ⚠️ Note the fix is structural, NOT validated against its own trigger: there is no supported CLI path to a shared port (`port:set` rejects or evicts, never shares), and the only RUNTIME-MEASURED record on file reports siblings are not served in merged mode at all, so no reachable trigger was confirmed. ⚠️ **Two naming footguns for anyone who touches merged mode:** `isStandalone === true` means MERGED — *one process serves every bundle* — which is inverted from what the name suggests (`core/config.js:719` seeds it true, `:1210` flips it FALSE the moment any bundle's port differs from the starting bundle's, and `config.js:454` describes `!isStandalone` as the non-merged case). And it is ALSO true for an ordinary single-bundle project, so it is not a merged predicate on its own: `core/server.js` gates its merged-only warn on `bundles.length > 1` for exactly that reason. Merged mode is INFERRED from `~/.gina/ports.reverse.json` (the forward `ports.json` is declared but never read at boot), never configured — which is why no CLI verb reaches it. ⚠️ Instrument trap banked from the baseline: the probe extracting the custom filter's output used `[^<]*`, and the filter's own output contains `<`, so it read EMPTY — indistinguishable from « the bundle filter was dropped ». A negative reading about a filter must be validated against a known-positive before it is believed. **#B519 / #B809 (0.7.4) — the filter context is REQUEST-BOUND: inside a request the process-wide slot is neither read nor written.** #B514 closed the two default delegates and left the slot itself in place: every factory call still stamped `<Filters>.instance._options`, and every reader with no render store of its own still read it. So a template executed on a request path OUTSIDE a render delegate — an action calling `self.engine.compile(tpl)(data)` or `compileFile` — resolved the context of whichever request had rendered last on the worker (its culture, absolute URLs from its host; no concurrency needed), and a scheduled task, a worker or a WebSocket handler rendering with no context of its own read the last request's context too. The rule now: `getRenderCtx()` reads the render store first; else, when the request store `core/server.js` `handle()` opens (`process.gina._reqALS`, carrying `req`) is active, the context a factory call bound to THIS request (`store.filterCtx`), else one built from the store — the `options` and `throwError` that `controller.setOptions` registers on it (when `store.req === req`), the request's own `_ginaIsProxyHost` classification, its `req` / `res`; only with no request does it read the slot, then the first call's own context, then an empty one. The factory follows the same split: a call made inside a request binds `conf` to that request's store and writes nothing process-wide (the first call of a module instance included — the instance keeps no request context), a call made outside any request stamps the slot as before. So the slot only ever holds a context stamped outside a request, and a caller that calls the factory and then renders still resolves its own context, per request instead of per process. A job's detached copy of a request context carries no `req` and counts as outside a request. `controller.render-nunjucks.js` no longer relies on « nothing awaits between the factory call and the render »: both render calls run inside `process.gina._renderALS.run()` with the context `registerGinaFilters` returns, so every dispatched delegate enters the render store. Not changed: a render context published on `process.gina._renderALS.run(ctx, fn)` by application code still wins (the store is read first), and `lib.routing.getRoute()` keeps its own req-less chain. Server-side only (neither filter lib is browser-bundled) ⇒ pickup = bundle RESTART, no re-bake. Tests: `test/lib/filter-context-request-scope-b519.test.js` — the real filter modules under real stores shaped as `handle()`, the controller, a delegate and `lib/job` shape them, with an accessor trap counting every read and write of the slot: request arms must count 0 and resolve their own request's host, non-request arms must fire the trap; plus source pins on every delegate, `setOptions`, `handle()` and a census that the slot is named in the two filter libs only. Rule: per-request context lives on the request (a store entered per dispatch), never in a slot the next request overwrites; a process-wide fallback is for callers with no request, and must never be fed from one.
842
842
 
843
843
  72. **Supply-chain visibility — tarball enumeration, peerDependencies, security-commit bundle coupling.** Enumerate a published tarball via `npm view <pkg>@<ver> dist.tarball` + `curl` + `tar tzf` (NOT `npm pack --dry-run` — it triggers the prepare script's "Prerelease update" commit). **`peerDependencies` aggregate into the dep graph regardless of `optional: true`** — Socket / Dependabot / `npm audit` all read peerDeps unconditionally; the fix pattern is removing them entirely in favour of a lib-local version registry (gina's `lib/connector-registry/`). **Security-tagged source commits MUST rebuild the browser bundle in the same commit** (pre-commit hook + the bundle-freshness CI workflow enforce it). The vendored-deps era is CLOSED: `core/deps/` was deleted 2026-07-18 (`4c173422` require-swap + `4a8eb1e6` deletion — busboy became the `@rhinostone/busboy` npm fork; the OSV workflow now queries the fork's tracked base versions (`busboy@1.6.0`, `streamsearch@1.1.0`) explicitly via a `TRACKED_FORKS` table in the vendored-CVE scan script, which still walks any future vendored sub-manifest). If a dep is ever vendored again: its sub-`package.json` dependency edges are BY DESIGN and load-bearing for CVE visibility — never strip them (the `4a29ca0c` strip was reverted in `e5d5d0a2` for exactly this).
844
844
 
@@ -853,7 +853,9 @@ Dev-mode query instrumentation captures every database query tied to the current
853
853
  - **Two-guard `@<project>` requirement asymmetry in `lib/cmd/helper.js`** — a `project:*` command that should run without `@<project>` must be exempted in BOTH guards: the early task-shape guard (`!/^project\:(list|help|status)/`) AND the later projectName-resolution guard (`!/\:list$/.test(cmd.task)` → widened to also allow `^project:status$`). Exempting only the first leaves the second falling through to cwd-project-inference and a "No project name found" error before the handler runs. `project:list` is the working precedent that null `projectName` survives `loadAssets()`.
854
854
  - **Single-bundle CLI handlers read `cmd.name` / `self.name`, NOT `self.bundle`** — CmdHelper sets `cmd.name = cmd.bundles[0]` only when exactly one bundle positional is present (`lib/cmd/helper.js`, the `cmd.bundles.length == 1` branch); `cmd.bundles` is the array for bulk operations. There is no `self.bundle` property. Precedent: `bundle:stop` / `bundle:start` / `bundle:status` all read `self.name`. (Worked example: a sub-agent investigation reported the slot as `self.bundle`; a single read of `helper.js` refuted it before the handler shipped — verify agent-relayed property names against source.)
855
855
  - **`gina start` does not need sudo with a user-prefix install** — `npm install -g --prefix ~/.npm-global` (standard Gina setup) runs as the current user and doesn't touch `/var/run/`. The "Needs to be launched as [sudo]" comment in `lib/cmd/framework/start.js` only applies to system-wide installs.
856
- - **`gina start`'s exit code says whether the framework started (#B759 + #B760 + #B761, fixed in 0.7.3)** — `bin/gina` runs `start` / `framework:start` through `runAsSubProcess()`, which spawns `bin/cli` as a detached daemon child and exits 0 once the child prints « Framework ready for connections » or « Framework already running ». When the child ends before either line, the wrapper waits until its output is drained (`close`) and exits with the child's code: 1 when that code is 0, 128 + the signal number when a signal ended it (137 for SIGKILL). A stderr warning is printed and no longer ends the start; Debugger lines and « address already in use » still exit 1. Before 0.7.3 a start that failed early (a refused `GINA_VERSION`, a crash during boot) returned 0, and any stderr chunk matching `warning` (case-insensitive) made the wrapper exit 1 at once, after which the orphaned daemon died on its next write (EPIPE), so the start was aborted; the advice that stood here, « exits with code 1 even on success », does not reproduce (a real start returns 0). When the framework port is already in use (#B761), `bin/cmd` prints « Framework already running … [ <pid> ] » (the wrapper's exit 0) only when a pid `~/.gina/procs.json` records for the port is alive and a framework daemon, read per pid by `lib/cmd/framework/inc/ps-titles.js` `readPidTitle()` (`ps -ww -p <pid> -o stat=,command=`; `-ww` because procps-ng cuts the command to `$COLUMNS` even when piped): titled `gina-v<version>` on Node, or, on Bun, which does not show `process.title` to `ps`, still running `…/bin/cli start`; where `ps` cannot tell (Windows, busybox), the alive check decides. Otherwise `inc/listen-error.js` sends the cause, the fix (`gina framework:set --port=<port>`) and, outside Windows, an `lsof` finder to stderr and the start exits 1, which frees the MQ port; any other listen error (EACCES) exits 1 instead of hanging, and an error once the socket listens (an accept failure such as EMFILE) is only logged. Before 0.7.3 any entry for the port was trusted unchecked: a foreign listener read « already running » (« PID `null` »), a stale entry named a dead pid, and both exited 0 with a half-started daemon on the MQ port. Sibling: a `gina start` framework server left running can hang the full test suite AND bundle boot — the hang is the MQ log-listener connect left pending forever against a degraded daemon; a daemon on a non-canonical port traces to a corrupted persisted `port` in `~/.gina/<shortVersion>/settings.json`, not to `~/.gina/procs.json`, which no boot path reads (its only consumers are `gina stop`'s kill targeting and `gina start`'s held-port check). #B180 (fixed): `removeRunningProc()` deleted the registry entry under the constructing bundle's key instead of the key matched by pid, so dead `gina-*` records were rewritten back instead of removed (and a live record could be destroyed when the keys differed) — a `procs.json` written by an older framework may still carry stale dead entries; with the daemon stopped, clearing the file once is safe.
856
+ - **`gina start`'s exit code says whether the framework started (#B759 + #B760 + #B761, fixed in 0.7.3)** — `bin/gina` runs `start` / `framework:start` through `runAsSubProcess()`, which spawns `bin/cli` as a detached daemon child and exits 0 once the child prints « Framework ready for connections » or « Framework already running ». When the child ends before either line, the wrapper waits until its output is drained (`close`) and exits with the child's code: 1 when that code is 0, 128 + the signal number when a signal ended it (137 for SIGKILL). With `--inspect-gina` the child is `bin/cli-debug`, which runs the framework under `--inspect-brk` (it waits for a debugger before it runs any code) and, since 0.7.4 (#B764), ends with the framework's own code, or 128 + the signal number; it used to exit 0, so the wrapper reported « exit code 0 » for any early failure. `framework:restart` (since 0.7.4, #B780) exits with that code too when the framework does not start again, after relaying the start's output and one line, « could not start the framework v<version> again (gina start exited N) »; it used to return 0 when the failed start had already written its pid file (a fallback for the warning exit #B760 removed) and otherwise rethrew inside a timer (exit 1, the code lost). A stderr warning is printed and no longer ends the start; Debugger lines and « address already in use » still exit 1. Before 0.7.3 a start that failed early (a refused `GINA_VERSION`, a crash during boot) returned 0, and any stderr chunk matching `warning` (case-insensitive) made the wrapper exit 1 at once, after which the orphaned daemon died on its next write (EPIPE), so the start was aborted; the advice that stood here, « exits with code 1 even on success », does not reproduce (a real start returns 0). When the framework port is already in use (#B761), `bin/cmd` prints « Framework already running … [ <pid> ] » (the wrapper's exit 0) only when a pid `~/.gina/procs.json` records for the port is alive and a framework daemon, read per pid by `lib/cmd/framework/inc/ps-titles.js` `readPidTitle()` (`ps -ww -p <pid> -o stat=,command=`; `-ww` because procps-ng cuts the command to `$COLUMNS` even when piped): titled `gina-v<version>` on Node, or, on Bun, which does not show `process.title` to `ps`, still running `…/bin/cli start`; where `ps` cannot tell (Windows, busybox), the alive check decides. Otherwise `inc/listen-error.js` sends the cause, the fix (`gina framework:set --port=<port>`) and, outside Windows, an `lsof` finder to stderr and the start exits 1, which frees the MQ port; any other listen error (EACCES) exits 1 instead of hanging, and an error once the socket listens (an accept failure such as EMFILE) is only logged. Before 0.7.3 any entry for the port was trusted unchecked: a foreign listener read « already running » (« PID `null` »), a stale entry named a dead pid, and both exited 0 with a half-started daemon on the MQ port. Sibling: a `gina start` framework server left running can hang the full test suite AND bundle boot — the hang is the MQ log-listener connect left pending forever against a degraded daemon; a daemon on a non-canonical port traces to a corrupted persisted `port` in `~/.gina/<shortVersion>/settings.json`, not to `~/.gina/procs.json`, which no boot path reads (its only consumers are `gina stop`'s kill targeting, `gina start`'s held-port check and, since 0.7.4 (#B763), `framework:status`'s re-registration of a daemon whose pid file is gone). #B180 (fixed): `removeRunningProc()` deleted the registry entry under the constructing bundle's key instead of the key matched by pid, so dead `gina-*` records were rewritten back instead of removed (and a live record could be destroyed when the keys differed) — a `procs.json` written by an older framework may still carry stale dead entries; with the daemon stopped, clearing the file once is safe.
857
+ - **`gina bundle:start`'s exit code says whether the bundle started (#B851 + #B854 + #B855 + #B853 + #B856, fixed in 0.7.4)** — `bundle:start` is the one command `bin/cli` sends to the daemon (`bin/cmd`), which runs `lib/cmd/bundle/start.js` and writes text back; `bin/cli` exited 0 on every outcome (it exited when the connection ended) and ended at once on any chunk matching `/address already in use/`. The daemon now frames two records on the connection, each between two ASCII record separators (`\x1e`): a header (`gina-status:1`) as soon as it reads the command, and the exit code (`gina-exit:<n>`) just before it ends the connection (`lib/cmd/bundle/inc/start-status.js`; only a connection `bin/cmd` marks with `ginaStatusFrames` gets them). `bin/cli` strips both: with the header it exits with the trailer's code, or 1 with « the framework ended this command before it reported the outcome » when none came; without it (a daemon started before the update and not restarted) it behaves as before, early end included. The contract mirrors `gina start`'s: 0 when the bundle listens or already runs (its pid file names a running process titled `gina: <bundle>@<project>`; on Bun, which shows no title, one running the bundle's entry; where `ps` cannot tell, a live pid), in which case nothing is spawned and the command prints « is already running with PID [ n ] », so a second start no longer overwrites and then removes the running bundle's pid file (#B854); 1 when another program holds the port (« could not start: port N is held by another program, not a running gina bundle … » and, outside Windows, an `lsof` finder); the bundle's own code when it stops before it is ready (1 when that code is 0, 128 + the signal number; an exit 0 no longer waits for the 64 s watchdog); 1 on the watchdog and on a refusal; and 1 for a bulk `@<project>` start when any bundle failed. The readiness flag waits for the bind: `core/server.js` `watchBindOutcome()` ends the boot on a bind error before `'listening'` (`[ FRAMEWORK ] abort: could not listen on port <port>: <code> (…)` on stderr, exit 1; isaac only logged the error, after which `Bundle started !` printed on its 700 ms timer and the process exited 0 with nothing listening, and express had no handler), and `core/gna.js` prints `Bundle started !` only once `process.server.listening`; the `'started'` event keeps its timing. With `--inspect` and the inspector port held, node starts the bundle without the inspector: the command prints the debugger hint and still reports the start. An online refusal no longer ends the daemon (#B855): CmdHelper's `exit()` and `lib/cmd/framework/init.js`'s unknown-command and handler-throw paths end only that client with exit 1 (`bundle:start web @<unregistered>` used to stop the framework while the CLI exited 0), and `start.js` stops on `self.cmdExited`, because `isCmdConfigured()` is `async` and the Promise it returns made `if (!isCmdConfigured()) return false;` a guard that never fired. `bundle:restart` (offline, in the CLI process) fails on a non-zero start, prints what its stop and start steps said, and checks its outcome: a start that exits 0 must leave a running bundle other than the pre-stop one (« did not restart: … »); a bulk restart exits 1 when any bundle failed, not only the last (#B853). `project:start` and `service:start` no longer take `lib/cmd/index.js`'s framework-start branch (now `action == 'start' && topic == 'framework'`), which registered the CLI process as `gina-v<version>`: it overwrote the daemon's pid file, a helper removed it, and the CLI's exit removed the daemon's `procs.json` record while the daemon ran (#B856). Pickup: `bin/cli`, `restart.js` and `lib/cmd/index.js` act on the next command; `bin/cmd`, `start.js`, `helper.js` and `init.js` run in the framework daemon (`gina framework:restart`); `server.js` and `gna.js` at each bundle's next start.
858
+ - **A worker child writes no pid file (#B850, fixed in 0.7.4)** — a worker is a child process whose entry is named `child.js` / `child-*.js`, loaded with `--argv-filename=<context file>`: `core/gna.js` sets `isLoadedThroughWorker`, imports the parent's context and registers the process under the parent bundle's name. Up to 0.7.3 it registered WITH a pid file, so it overwrote `<run dir>/<bundle>@<project>.pid` with its own pid and removed the file on exit: `bundle:stop` signalled the worker, and `bundle:restart` exited 0 while the old bundle kept serving (the new start failed on the bound port, which `bundle:start` reported as a success up to 0.7.3, #B851). Now the worker branch builds `new Proc(<bundle>@<project>, process, false)` and sets `process.isMinion = true` (its exit never unlinks the bundle's mount link), and `lib/proc.js` `register()` sets the title and the signal handlers (`setPID`) for every process and writes the pid file only with `usePidFile` (`onReady()` waits for the event `save()` emits once the file is written, so it never fires without one). A worker started before the update keeps the old registration until it exits: while it runs, the first `bundle:restart` ends only that worker (the old bundle still serving; since 0.7.4 that restart exits 1, #B851) and a second one restarts the bundle.
857
859
  - **CLI reserved flags — `--port` and `--version` must be renamed in subcommands** — both consumed by the framework's global CLI parser (`utils/helper.js::filterArgs` + `bin/cli:301`) before the subcommand sees argv. Use domain-prefixed forms: `--connector-port=`, `--driver-version=`. Un-prefixed forms are silently swallowed.
858
860
  - **CLI scope grammar — positional-absence, not flags** — for commands that apply to either a single bundle or the whole project, use `[<bundle>] @<project>` and signal project-wide by omitting `<bundle>`. Never reintroduce `--scope=bundle` (`scope` is reserved for data isolation: local/beta/production/testing) or `--shared`.
859
861
  - **Scope and environment names are checked WHOLE, by two dependency-free rule modules** — `lib/cmd/scope/inc/name.js` (`isValidScopeName`, #B626) and `lib/cmd/env/inc/name.js` (`isValidEnvName`, #B639): letters, digits, `_`, `.`, `-`, the first character a lowercase letter, a digit, `_` or `.`; never `.` / `..`, and never the name of a property every object inherits (`__proto__`, `constructor`, gina's own `count` …) — the project files are indexed by these names, and an existence test such as `typeof(obj[name]) == 'undefined'` would reach the shared prototype. Environments also refuse `global`, the overlay token of `<name>.global.json`. `scope:add` / `env:add` refuse a bad name with the module's `describeInvalid…` message and write nothing; `project:add` applies both rules to `--scope=` / `--env=` before anything is written (#B640), while `project:import` skips the check — the CLI bootstrap (`framework/init.js` checkScope / checkEnv) already refuses any value the registered project does not list, and a name an older release registered must keep importing; the slot commands `scope:link-local` / `scope:link-production` / `env:link-dev` set the project's `local_scope` / `production_scope` / `dev_env` in `projects.json` (moving `def_scope` / `def_env` along when it held the old slot) and create no symlink; they check the project before looking the value up in it (#B641); they used to test the first character only, so the retired `<bundle>/<scope>` and `<bundle>/<env>` forms registered verbatim as project-wide names and `Staging` was dropped without a word. The modules live in `inc/` so the command loader never takes them for `<group>:<action>` handlers. Known residual: the shared CLI helper compiles `new RegExp(cmd.name + …)` from the raw token before any handler check, so a token with an unbalanced `(` still exits through `console.emerg` rather than the clean message. `project:add` / `project:import` read `--scope=` / `--env=` / `--path=` WHOLE — each value is everything after the FIRST `=`, and a flag counts only where its name starts the argument (#B644: `--scope=a=b` used to register `a`, and a `--path` holding `--scope=` was read as that flag); neither flag changes the project's `def_scope` / `def_env` — `scope:use` / `env:use` do. `env:add <env> @<project>` gives every bundle of the project its own ports for the new env, writes its `env.json` blocks and exits (#B643 — it used to list the env on the project only, silently); the global `env:add <env>` registers the name for every project WITHOUT ports (#B652, open), and a later `env:add <env> @<project>` gives them, leaving the other envs' ports unchanged.
@@ -867,7 +869,7 @@ Dev-mode query instrumentation captures every database query tied to the current
867
869
  - **CLI Tier 3 — project-tree relocate / archive / restore (`project:move` slice 1 `1c492241`, `project:backup` slice 2 `4fed7de8`, `project:restore` + `lib/archiver.decompress()` slice 3 `68563976`; shipped 0.5.x)** — `project:move @<p> --to=/new/path` atomically `renameSync`-moves the source tree and rewrites ONLY the registry `path` (inverse of `project:rename`); refuses while any bundle runs (no `--force` bypass), refuses cross-filesystem (`EXDEV` → use `project:import`). **THE load-bearing gotcha — `--path` is unusable as a "must-not-exist target" for ANY `project:` command:** the shared `CmdHelper` bootstrap ("Creating project location if not existing") pre-`mkdirSync`s `cmd.params.path` for every `project:` command AND points `projectLocation` at it, so a move/restore target passed via `--path` is auto-created and the handler's "target must not exist" check then refuses on the bootstrap's own dir — take the target via a flag the bootstrap never reads (`--to`), whitelisted in `project/arguments.json` (this DIRECTLY bites `project:restore`, whose help advertised `--path`). Three facts make a path-only move minimal: `ports.json` is NAME-keyed (`"<port>": "<bundle>@<project>/<env>"`), so a name-unchanged move never touches `ports*.json` (a negative `self.ports`-absence pin locks this); the `projects.json` path-derived fields (`bundles_path`/`releases_path`/…) live under `~/.<project>` (homedir, name-keyed), so only the `path` field is rewritten; use `renameSync` (atomic, symlink-preserving, throws `EXDEV` cross-fs), NOT `folder.mv` (cp+rm, dereferences symlinks). `project:backup @<p> [--out=/dump]` archives the SOURCE to `<out>/<p>-<YYYYMMDD-HHMMSS>.zip`, read-only on the registry. **THE archiver gotcha** (`lib/archiver` was COMPLETELY UNUSED before this — "compress() works" was an unverified inherited claim): the directory form `compress(dir, target)` is BROKEN for a project tree — `browse()` walks with `fs.statSync`, which FOLLOWS symlinks, so it recurses the project's absolute `node_modules/gina` symlink into the entire framework install AND leaks absolute host paths (and until #B474, 0.6.27, its top-level loop started at index 1, silently dropping the first `readdir` entry — a one-file directory archived to an EMPTY zip); use the ARRAY form `compress([{input,output},…], target, {name,method:'gzip',level:9})` (deterministic `<target>/<name>.zip`, entries at the `output` relative paths, no wrapper folder) with a self-walk that EXCLUDES `node_modules` by name and SKIPS symlinks via `dirent.isSymbolicLink()`. `--with-password` is REJECTED fail-closed — every encryption hook is an empty stub and JSZip can't make encrypted zips, so returning a plaintext archive for an encryption request is a false-security footgun. `project:restore @<name> <archive.zip> --to=/path [--force]` extracts then RE-REGISTERS so the project is immediately startable: `lib/archiver.decompress()` (was an empty stub; now JSZip-3.x — `JSZip.loadAsync` → per-entry `entry.async('nodebuffer')`, skip `entry.dir`, **zip-slip guard** rejecting any entry whose resolved dest escapes the target) → self-invoke `project:add @name --path=<to>` (self-resolved `bin/cli` via `process.execPath`, NEVER a PATH-resolved `gina`) → loop `bundle:add <b> @name --import` over `manifest.bundles` (the only path that allocates a bundle's ports — bare `project:add` allocates 0; `project:import` REFUSES an unregistered name). Uses the explicit `@<name>` CLI shape (cheaper than the no-`@` form help advertised — only the not-found guard needs a `restore` exemption vs 3 guard exemptions otherwise — and `@name` IS the rename-on-restore target). **`lib/archiver` completion contract (#B473, 0.6.27):** each `compress()`/`decompress()` call settles its own `{ onComplete }` handle EXACTLY ONCE on a per-call channel (a hoisted Promise latch behind the handle — the connectors' #B429 shape; a listener attached after settlement is still delivered, and a fire-and-forget failure stays silent, never an unhandledRejection) — before 0.6.27 every completion was ONE fixed event name emitted on the process-wide singleton, so two overlapping calls in one process both received whichever finished first (the second released early with the first's archive path, its own archive left at 0 bytes) and the array branch's implicit-global `outputStream` let one run close another's stream. The singleton STILL emits `archiver-<method>#complete` / `archiver-decompress#complete` `(err, target)` on settlement, purely for observers (documented; keep it). Errors on every stream the lib opens — input reads, the JSZip generate stream, the output write — are OWNED by the call and reach `onComplete` as the stream's error: measured before the fix, an unreadable input either CRASHED the process (unhandled 'error') or HUNG the run with a corrupt partial archive on disk — a timing race: 6 repeated runs of one sole-entry input split 4 hangs / 2 crashes, and a non-first entry hung every time (JSZip only sometimes re-surfaces a read failure on its output stream — so listening on the generate stream alone does NOT fix the hang; owning the input streams does), and an unwritable target crashed both the array and directory forms. Synchronous error paths (missing src, neither-file-nor-dir) reach the handle via the latch rather than firing before it is returned (`decompress()` keeps its explicit `process.nextTick` deferrals). Both promisify shapes work (trailing cb with a `method`-less options object; `compress(src, target, cb)` with options omitted — previously the listener was keyed `archiver-undefined#complete` / `merge()` threw writing onto the function). `options` is copied before `merge()` (which MUTATES its target; an omitted options used to alias the shared defaults object). An application callback that THROWS inside `onComplete` stays an uncaught EXCEPTION — the shim's derived promise rethrows on `process.nextTick` — never a rejection that a non-default `--unhandled-rejections` policy would swallow (the connectors' `.onComplete` shims do NOT have this guard, #B477). Server-only (fs/zlib) → no plugin rebuild; pickup = restart. Deferred, staked: an abort surface (`options.signal`) — no precedent in the tree, on-demand; **#B476 (0.6.27):** the single-file form is now the array form with one entry named by the file's basename — a real DEFLATE zip that `decompress()` reads back, at the same `<target>/<name>.zip` path (`<name>` defaults to the basename; a missing input still settles `file not found`). It used to pipe the file through a gzip codec under the `.zip` name, and a dot-prefixed segment anywhere in the input path (`.env`, or a file under a dot-directory) hit an early return placed BEFORE the streams were tracked: success reported with the INPUT path as the archive, an empty `<name>.zip` left on disk, two fds leaked per call — measured on the shipped bytes, with the directory form (which includes dotfiles) as the control. `method` validates against `gzip` alone: it names the completion event and no form selects a codec by it, so `br`/`deflate` throw synchronously again, as they did in 2019 before a `default:` switch arm silenced them. Server-only; pickup = restart. **Positive-evidence lesson:** all 26 of `project:move`'s source-pin/pure-logic tests PASSED while it was functionally BROKEN by the `--path` collision — only a live `add→move→verify` HTTP-200 smoke caught it, so a new CLI command needs a live happy-path smoke before "done". `project:rename @<old> @<new>` renames only to a FREE name — a registered name or an existing target directory is refused with exit 1 before anything moves — and renames the port entries exactly (`ports.reverse.json` keys `<bundle>@<old>`, `ports.json` values under protocol → scheme → port), never by prefix (#B651; its check used to be inverted, so the one rename it performed was onto another project).
868
870
  - **CLI Tier 3 — `framework:update` state reconcile (slice 4 `93e1798a`) + `<group>:man` inline man pages (slice 5 `ae34b7ec`); shipped 0.5.x, completes CLI Tier 3** — `framework:update [--to-version=<v>] [--fix|--apply] [--dry-run] [--format=json]` is a **state-migration** command, NOT the "npm self-update" the ROADMAP once advertised (that was declined — can't update the running process, PATH/sudo hazards; deferred behind a future `--self-update`). It reconciles `~/.gina/main.json` (`def_framework` + `frameworks[<short>]`) and `<short>/settings.json` (`version` + `def_framework`) to `GINA_VERSION` (or `--to-version`), automating the manual Post-merge state check; dry-run by default, `--fix`/`--apply` writes. **Writes MUST go through `lib.generator.createFileFromDataSync(obj, path)`** — that routes a `StateStore.isStatePath` match to `StateStore.write` → SQLite key + atomic JSON sidecar IN LOCKSTEP (so reading the sidecar via `requireJSON` while writing via `createFileFromDataSync` repairs BOTH a stale `def_framework` AND a prior `gina.db`-vs-sidecar drift in one shot); a raw `fs.writeFileSync` is the `post_install.js` bug that drifts `gina.db` behind the sidecar. No-CmdHelper handler (models `framework/set.js`/`version.js`, reads bare `GINA_HOMEDIR`/`GINA_VERSION` globals) — the right shape for a no-project framework command, and it sidesteps the `--path` bootstrap-mkdir gotcha entirely (no project arg). Never-regress guard reuses `script/version_compare.isStrictlyOlder` via `require('../../../../../script/version_compare')` (the relative depth is invariant across framework-dir renames, and `version_compare.js` ships to npm). **Is `def_framework` runtime-load-bearing? — outcome (c), runtime-read but NARROW:** `helper.js` keys `mainConfig.protocols[short]`/`schemes[short]` off it to default protocols/schemes for projects that pin no `framework` AND declare none of their own, but scopes/envs/cultures default off `GINA_SHORT_VERSION` not `def_framework`, and the drift only bites at shortVersion (0.4→0.5) not patch granularity; per-shortVersion metadata-map seeding stays `framework:init`'s job (the command WARNS when absent, locked by a negative-invariant test). **Minor-crossing migration (`init.js` `checkIfMain`, #B680/#B681, fixed in 0.7.0):** on the first run of a new short version, every per-version `main.json` dict with no entry for the release gets a copy of the previous short's entry (previous short = the highest `^\d+\.\d+$` key of `frameworks` other than the release — `latest` never qualifies). The copy fills MISSING entries only, so it is idempotent and independent of `frameworks[<release>]`: bin/cli's `bundle|project:start|restart` sync and every `bin/gina-container` boot write that key BEFORE init runs, and gating the copy on its absence (pre-0.7.0) left `def_culture[<release>]` undefined, so every later command died on `defCulture.split`. `frameworks[<release>]` is seeded from the template only when absent (a registrar's entry is kept). After its commit, `checkIfMain` deletes `main.json` from `require.cache`, so the later steps' `require()` reads the migrated file — `whisper()` returns a NEW object, the cached one is the pre-migration file, and `checkArch` threw once per crossing. The delete is bounded: init's check chain runs from `onComplete` only (once per CLI process or framework start), never per online command in the daemon (`onListen` never calls it). `gina framework:man` / `project:man` / `bundle:man` / `service:man` **runtime-render** the group's ronn `.1.md` page to the terminal (design fork over a build-time roff generator + `package.json "man"` field — no new markdown/man dependency, none is installed), falling back to that group's `help.txt` with a one-line notice when the `.1.md` is absent (only `gina-framework.1.md` exists today, so `project`/`bundle`/`service` fall back). The cross-group engine lives at `lib/cmd/man-render.js` (sibling to `helper.js`, required as `require('../man-render')` — NOT a per-group `inc/`, because it serves 4 groups; the group comes from `opt.task.topic`, so a future `<group>:man` falls back automatically), and each `lib/cmd/<group>/man.js` is a one-line `module.exports = require('../man-render')`. **Lazy `console` keeps the module require-testable** — `man-render.js` reads `getPath`/`GINA_VERSION`/`lib.logger` lazily INSIDE the handler body, never at module top, so a unit test can `require()` it to exercise the pure helpers (`substitute`/`stripRonn`/`renderMan`) without throwing `lib is not defined` (a top-level `var console = lib.logger` would).
869
871
  - **`gina version` reports the framework DEFAULT template engine only** — `version` is a context-free global command (no bundle/project config loads), so its `Template engine:` banner line (a `%engine%` msg-token read from the framework-dir engine package, try/catch-omitted when the package is absent) always names the default engine; a bundle's per-bundle opt-in engine is not visible to it. `--short` is unaffected.
870
- - **Never self-invoke the CLI via a PATH-resolved binary; assert postconditions, not a noisy err channel** — spawn the running install's OWN entry point (`process.execPath` + the self-located `bin/cli`; daemon-lifecycle commands go through the daemonizing `bin/gina` wrapper to keep detached-spawn semantics); PATH may carry no copy or a DIFFERENT install. The Shell helper reports ANY stderr output as an error, so decide success on the operation's POSTCONDITION (e.g. the created symlink exists), and route genuine failures through the error callback so the command exits non-zero. Never guard `execSync` with `instanceof Error` — it THROWS on non-zero exit and never returns an Error, so that branch is dead code; wrap in try/catch and prefer `err.stderr.toString().trim()` for the operator-facing message. Deliberate exceptions: deriving an npm install PREFIX from `which gina` (registry metadata, not an invocation) and `npm` itself (a third-party binary — PATH is the normal resolution — but it runs from an argument vector, `execFileSync('npm', [...])`, never `$(which npm)` in a shell line, which split an npm installed under a path containing a space, #B663; since #B665 S2 no runtime, bootstrap or install-script line does, and only the release scripts' `$(which npm) pkg set` / `install` calls in `script/post_publish.js` still do). **A self-invoked child is also HOME-BLIND unless the env is re-exported:** the CLI bootstrap sweeps every `GINA_*`/`VENDOR_*`/`USER_*` key out of `process.env` into the framework context (read back via `getEnvVar`), so a spawned CLI child inherits NONE of them — under a `GINA_HOMEDIR` override (CI scaffolds, isolated smokes) the child resolved the DEFAULT home, missed the just-registered project, and `project:add`'s link step failed with exit 1 after the registration itself had landed. Fix shape: the Shell helper takes an opt-in `env` option (undefined = inherit, existing callers unchanged) and the link spawn passes `Object.assign({}, process.env, { GINA_HOMEDIR })`; on a postcondition failure, append the tail of the child's captured stdout to the error — the Shell temp logs are deleted on close, so without it the child's real failure reads as an empty `error: false`. **The sweep blinds EVERY spawned CLI child — the full spawn-site set now re-exports the home:** the auto-link commands run on project/bundle start/stop/restart, the `project:start/stop/restart` bundle delegations (whose command token is substituted from the parent's own argv — already self-resolved, but the exec options carried no env), and `project:add`'s `--scope`/`--env` children. The scope/env children were doubly broken besides the blindness: they shelled out to a PATH-resolved `gina` (a second install or a bare CI PATH resolves wrong — now the self-resolved CLI), and `execSync` with inherited stdio returns null, so reading `.toString()` off that return threw INSIDE the try after the child had SUCCEEDED — every `--scope`/`--env` run misreported `could not be set`, exited 1, and never printed the success message, override or not. Measured pre-fix under a home override: the scope/env children registered the scope in the DEFAULT home's config (propagating into every project registered there), and the home-blind link children silently fabricated scaffold artifacts — a manifest/env "fix" plus node_modules links — under the default home and the invoking cwd, with exit 0. **Never through a shell string either (#B640):** those `--scope` / `--env` children spliced the value unquoted into an `execSync` command line, so shell syntax in it ran before `scope:add`'s own name check saw it; they now run `execFileSync(process.execPath, [cli, task, value])`. Any self-invocation carrying a value that is not a constant takes an argument vector. #B663 applied it to the rest of the children that carried a path: `port:reset` reads its bundle list in-process from the manifest `loadAssets()` loaded (`bundlesByProject[<project>]`, the keys `bundle:list` prints) instead of a `$(which gina) bundle:list` child, which crashed the reset (a null list, exit 1) whenever `gina` was not on PATH; `bundle:restart` runs `bundle:stop`, then `bundle:start` only once the stop succeeded, as two `execFile` calls from `process.argv[0..1]`, each flag its own argument; and the install scripts run their `npm` probes and `framework:set` calls from argument vectors and create `~/.profile` with `fs` — a home path containing a space failed a first install (a no-op `chown -R $(whoami)` on the just-created `~/.gina`, now removed, and a `source` of the profile in a bash child, which never reached the user's shell, also removed). #B665 S1 did the same for the daemon-reachable and name-fed children: the auto-link `link-node-modules` / `link` children run `execFileSync(process.execPath, [cli, task, '@' + project].concat(cmd.paramsArgv))` — `paramsArgv` is the list twin of `paramsStringified`, which a shell split on any value holding a space; `project:start/stop/restart` delegate through `execFile(argv[0], [argv[1], 'bundle:<verb>', '@' + project, ...flags])` (their joined runtime + CLI paths broke on an install path containing a space); `bundle:start`'s `node_modules` reinstall re-links with this install's own `bin/gina` under `runtimeBinary(process.execPath)` instead of `which gina`; `framework:link`'s repair step takes an argument vector; and the `ps` sweeps of `bundle:stop` / `minion:kill` run `execFileSync('ps', ['-ef'])` with a 64 MB `maxBuffer` (the listing now arrives whole, no longer pre-filtered by `grep`) and match the title in JS, escaped and ending at whitespace or the end of the line — the old substring made `api@shop` match `api@shopping`, and a slim image with no `ps` reads as no match, as before. The two never-called `restartRunningBunldes()` copies were removed. #B665 S2 took the operator-argv children the same way: `framework:status` lists only the current user's `gina-v<version>` daemons through `lib/cmd/framework/inc/ps-titles.js` (`ps -f -U <uid>` from an argument vector; it had turned ANY user's `gina-`-titled process title into a pid-file name, and `_()` normalises `..`, so `gina-v/../../x` wrote outside the run dir, #B677) and checks liveness with `process.kill(pid, 0)` (EPERM = alive), so a `ps`-less host no longer drops every live pid file; `bundle:stop` accepts only a positive integer from its pid file and signals with `process.kill` (`parseInt('-1')` made `kill -9 -1` a broadcast, #B693); `framework:restart` / `build` / `add` / `open`, `gina .`, `inspector:open`, the npm prefix fallbacks of `utils/helper.js` and `framework:init`, and isaac's boot-time `which` + brotli/gzip compressions all take argument vectors, while Windows keeps the cmd.exe lines (`start`, `where`, `npm.cmd`; #B694). #B665 S3 closed the class. A NEW project or bundle name must pass the scope/env name rule (`lib/cmd/project/inc/name.js`, `lib/cmd/bundle/inc/name.js`: `^[a-z0-9_.][A-Za-z0-9_.-]*$`, not `.`/`..`, not an inherited property name such as `constructor`), checked before anything is written: at project:add, at bundle:add (the whole list, before the first bundle), at project:rename, at bundle:copy/rename's destination, and at project:restore (before extracting). A name already registered as an own key is exempt, and project:import skips the check, so names registered before the rule keep working. Every registry lookup that builds a RegExp from a name escapes it (`escapeRegex`, `lib/cmd/bundle/inc/name-rewrite.js`), and the nine that also matched a sibling are anchored on the registry's shapes: `^<bundle>@<project>/` for values, `^<bundle>@<project>$` for reverse keys, and the value's `JSON.stringify` inside JSON text. Unanchored, `api@shop/` matched `myapi@shop/dev`, `@shop` matched `@shopping/`, and `/dev` matched `/devel`. The install scripts carry the same one-line escaper, since they cannot rely on a framework dir. **And never let two CLI processes overlap (#B647):** every gina CLI process reads and rewrites the registry files in `~/.gina`, so concurrent CLI children lose each other's writes (the state store logs `database is locked`, then a stale rewrite wins). `project:add` started its asynchronous `link` child and then ran the `scope:add` / `env:add` children alongside it, and a new scope went missing on 3/100 measured runs; `end()` now defers the link step with `setImmediate` until the synchronous scaffold (the children, `manifest.json`, `env.json`) is done — 0/100, and no lock warning. **A handler's success path must END the process** (`process.exit` / `end()`): wherever `bin/cli` runs by its own path inside a directory named `gina` (`…/node_modules/gina/bin/cli` — handler-spawned children, CI, scripts) it binds the MQ log listener, which keeps the event loop alive, so a handler that only returns hangs there while a checkout run exits (#B648, #B653); exit only after a listing's stdout write has flushed. A test for this class runs the CLI through a symlink NAMED `gina` with its own `GINA_MQ_PORT`, and asserts the listener line as a control.
872
+ - **Never self-invoke the CLI via a PATH-resolved binary; assert postconditions, not a noisy err channel** — spawn the running install's OWN entry point (`process.execPath` + the self-located `bin/cli`; daemon-lifecycle commands go through the daemonizing `bin/gina` wrapper to keep detached-spawn semantics); PATH may carry no copy or a DIFFERENT install. The Shell helper reports ANY stderr output as an error, so decide success on the operation's POSTCONDITION (e.g. the created symlink exists), and route genuine failures through the error callback so the command exits non-zero. Never guard `execSync` with `instanceof Error` — it THROWS on non-zero exit and never returns an Error, so that branch is dead code; wrap in try/catch and prefer `err.stderr.toString().trim()` for the operator-facing message. Deliberate exceptions: deriving an npm install PREFIX from `which gina` (registry metadata, not an invocation) and `npm` itself (a third-party binary — PATH is the normal resolution — but it runs from an argument vector, `execFileSync('npm', [...])`, never `$(which npm)` in a shell line, which split an npm installed under a path containing a space, #B663; since #B665 S2 no runtime, bootstrap or install-script line does, and only the release scripts' `$(which npm) pkg set` / `install` calls in `script/post_publish.js` still do). **A self-invoked child is also HOME-BLIND unless the env is re-exported:** the CLI bootstrap sweeps every `GINA_*`/`VENDOR_*`/`USER_*` key out of `process.env` into the framework context (read back via `getEnvVar`), so a spawned CLI child inherits NONE of them — under a `GINA_HOMEDIR` override (CI scaffolds, isolated smokes) the child resolved the DEFAULT home, missed the just-registered project, and `project:add`'s link step failed with exit 1 after the registration itself had landed. Fix shape: the Shell helper takes an opt-in `env` option (undefined = inherit, existing callers unchanged) and the link spawn passes `Object.assign({}, process.env, { GINA_HOMEDIR })`; on a postcondition failure, append the tail of the child's captured stdout to the error — the Shell temp logs are deleted on close, so without it the child's real failure reads as an empty `error: false`. **The sweep blinds EVERY spawned CLI child — the full spawn-site set now re-exports the home:** the auto-link commands run on project/bundle start/stop/restart, the `project:start/stop/restart` bundle delegations (whose command token is substituted from the parent's own argv — already self-resolved, but the exec options carried no env), and `project:add`'s `--scope`/`--env` children. The scope/env children were doubly broken besides the blindness: they shelled out to a PATH-resolved `gina` (a second install or a bare CI PATH resolves wrong — now the self-resolved CLI), and `execSync` with inherited stdio returns null, so reading `.toString()` off that return threw INSIDE the try after the child had SUCCEEDED — every `--scope`/`--env` run misreported `could not be set`, exited 1, and never printed the success message, override or not. Measured pre-fix under a home override: the scope/env children registered the scope in the DEFAULT home's config (propagating into every project registered there), and the home-blind link children silently fabricated scaffold artifacts — a manifest/env "fix" plus node_modules links — under the default home and the invoking cwd, with exit 0. **Never through a shell string either (#B640):** those `--scope` / `--env` children spliced the value unquoted into an `execSync` command line, so shell syntax in it ran before `scope:add`'s own name check saw it; they now run `execFileSync(process.execPath, [cli, task, value])`. Any self-invocation carrying a value that is not a constant takes an argument vector. #B663 applied it to the rest of the children that carried a path: `port:reset` reads its bundle list in-process from the manifest `loadAssets()` loaded (`bundlesByProject[<project>]`, the keys `bundle:list` prints) instead of a `$(which gina) bundle:list` child, which crashed the reset (a null list, exit 1) whenever `gina` was not on PATH; `bundle:restart` runs `bundle:stop`, then `bundle:start` only once the stop succeeded, as two `execFile` calls from `process.argv[0..1]`, each flag its own argument; and the install scripts run their `npm` probes and `framework:set` calls from argument vectors and create `~/.profile` with `fs` — a home path containing a space failed a first install (a no-op `chown -R $(whoami)` on the just-created `~/.gina`, now removed, and a `source` of the profile in a bash child, which never reached the user's shell, also removed). #B665 S1 did the same for the daemon-reachable and name-fed children: the auto-link `link-node-modules` / `link` children run `execFileSync(process.execPath, [cli, task, '@' + project].concat(cmd.paramsArgv))` — `paramsArgv` is the list twin of `paramsStringified`, which a shell split on any value holding a space; `project:start/stop/restart` delegate through `execFile(argv[0], [argv[1], 'bundle:<verb>', '@' + project, ...flags])` (their joined runtime + CLI paths broke on an install path containing a space); `bundle:start`'s `node_modules` reinstall re-links with this install's own `bin/gina` under `runtimeBinary(process.execPath)` instead of `which gina`; `framework:link`'s repair step takes an argument vector; and the `ps` sweeps of `bundle:stop` / `minion:kill` run `execFileSync('ps', ['-ef'])` with a 64 MB `maxBuffer` (the listing now arrives whole, no longer pre-filtered by `grep`) and match the title in JS, escaped and ending at whitespace or the end of the line — the old substring made `api@shop` match `api@shopping`, and a slim image with no `ps` reads as no match, as before. The two never-called `restartRunningBunldes()` copies were removed. #B665 S2 took the operator-argv children the same way: `framework:status` lists only the current user's `gina-v<version>` daemons through `lib/cmd/framework/inc/ps-titles.js` (`ps -f -U <uid>` from an argument vector; it had turned ANY user's `gina-`-titled process title into a pid-file name, and `_()` normalises `..`, so `gina-v/../../x` wrote outside the run dir, #B677) and checks liveness with `process.kill(pid, 0)` (EPERM = alive), so a `ps`-less host no longer drops every live pid file; since 0.7.4 (#B763) a daemon whose pid file is gone is found from its own `~/.gina/procs.json` record, kept only while `ps -p` shows that pid running as the framework — titled `gina-v<version>` on Node, or, on Bun, which does not show `process.title` to `ps`, still running `…/bin/cli start` (no version is read there, so the record's title is trusted) — and `framework:status` writes its pid file back while `gina stop` sends it SIGTERM; before, both missed a Bun framework without its pid file (status read « Gina is not running », `gina stop` exited 0 and left it running); since 0.7.4 (#B782) `gina stop` reads and removes only its own version's pid file `gina-v<version>.pid` (it removed every `gina-*` file, so stopping one version deregistered any other running beside it, and `framework:reset`'s pid-file check could miss them) and sends SIGTERM to the pid that file and the record both name only while `ps -p` shows it running as that framework, or cannot tell (no `ps`, busybox, Windows); before, a reused pid, or one recorded in another container's pid namespace when the run dir is shared, was signalled, the record's `fakeDaemonPid` (the `bin/gina` wrapper, which exits on the ready line) was sent SIGCONT, and « has been stopped » was printed whether or not a signal was sent; `bundle:stop` accepts only a positive integer from its pid file and signals with `process.kill` (`parseInt('-1')` made `kill -9 -1` a broadcast, #B693); `framework:restart` / `build` / `add` / `open`, `gina .`, `inspector:open`, the npm prefix fallbacks of `utils/helper.js` and `framework:init`, and isaac's boot-time `which` + brotli/gzip compressions all take argument vectors, while Windows keeps the cmd.exe lines (`start`, `where`, `npm.cmd`; #B694). #B665 S3 closed the class. A NEW project or bundle name must pass the scope/env name rule (`lib/cmd/project/inc/name.js`, `lib/cmd/bundle/inc/name.js`: `^[a-z0-9_.][A-Za-z0-9_.-]*$`, not `.`/`..`, not an inherited property name such as `constructor`), checked before anything is written: at project:add, at bundle:add (the whole list, before the first bundle), at project:rename, at bundle:copy/rename's destination, and at project:restore (before extracting). A name already registered as an own key is exempt, and project:import skips the check, so names registered before the rule keep working. Every registry lookup that builds a RegExp from a name escapes it (`escapeRegex`, `lib/cmd/bundle/inc/name-rewrite.js`), and the nine that also matched a sibling are anchored on the registry's shapes: `^<bundle>@<project>/` for values, `^<bundle>@<project>$` for reverse keys, and the value's `JSON.stringify` inside JSON text. Unanchored, `api@shop/` matched `myapi@shop/dev`, `@shop` matched `@shopping/`, and `/dev` matched `/devel`. The install scripts carry the same one-line escaper, since they cannot rely on a framework dir. **And never let two CLI processes overlap (#B647):** every gina CLI process reads and rewrites the registry files in `~/.gina`, so concurrent CLI children lose each other's writes (the state store logs `database is locked`, then a stale rewrite wins). `project:add` started its asynchronous `link` child and then ran the `scope:add` / `env:add` children alongside it, and a new scope went missing on 3/100 measured runs; `end()` now defers the link step with `setImmediate` until the synchronous scaffold (the children, `manifest.json`, `env.json`) is done — 0/100, and no lock warning. **A handler's success path must END the process** (`process.exit` / `end()`): wherever `bin/cli` runs by its own path inside a directory named `gina` (`…/node_modules/gina/bin/cli` — handler-spawned children, CI, scripts) it binds the MQ log listener, which keeps the event loop alive, so a handler that only returns hangs there while a checkout run exits (#B648, #B653); exit only after a listing's stdout write has flushed. A test for this class runs the CLI through a symlink NAMED `gina` with its own `GINA_MQ_PORT`, and asserts the listener line as a control.
871
873
  - **Port pinning beats allocation** — `port:reset` allocates alphabetically and count-sensitively, so hardcoded per-container ports DRIFT whenever the project's bundle set changes; pin each container's own bundle with `port:set <bundle> @<project> --protocol=<p> --scheme=<s> --port=<n> --env=<e> --force` (`--force` evicts the prior holder from BOTH the forward and reverse port maps; without it an in-use port still rejects, byte-identically; idempotent on re-runs; eviction-not-swap — the displaced bundle re-pins itself from its own context). `bundle:add --ignore-ports=<csv>` excludes ports from the scan — the values stay STRINGS end-to-end because the scan's skip is a string `indexOf` compare; `parseInt`-ing them silently breaks the skip.
872
874
  - **Framework-connection flags are scoped to framework-scoped commands** — `--port`/`--mq-port`/`--host-v4`/`--hostname`/`--debug-port` are hoisted + persisted into the framework's own settings ONLY for bare `start`/`stop`/`restart` and `framework:*` commands; a sub-topic command's `--port` stays on argv for that command's own parser. Pre-fix they hoisted for EVERY command, so a bundle-scoped `--port=N` corrupted the framework command-socket port (8124 → N) — and because the daemon binds the PERSISTED `settings['port'] || 8124` directly (no port-scan), clearing runtime state does NOT recover it: correct the persisted `port` key in BOTH state surfaces (JSON sidecar + its database mirror), keyed by shortVersion `major.minor`. The `--inspect`/`--debug` splice stays unconditional. Measurement lesson: instrument the WRITE (a stack-dump on the settings write) to find the real hoister — reading the hoisters mis-identified the site once.
873
875
  - **The daemon command socket accumulates-and-guard-parses** — TCP may split or coalesce the client's single JSON argv write, so the socket handler keeps a per-connection accumulator, parses inside a SILENT try/catch (a partial chunk legitimately fails until complete), and shape-guards the result (`Array.isArray`) before use; a bare `JSON.parse(chunk)` was a crash vector (SyntaxError → uncaughtException → SIGTERM daemon teardown).
@@ -917,7 +919,7 @@ Dev-mode query instrumentation captures every database query tied to the current
917
919
 
918
920
  151. **`templates.json` pre-process pass in `core/config.js` (right after the `hasViews` line, BEFORE the routing↔template GET auto-vivify) expands two additive section-key shapes once per bundle — gina-io/gina#8 comma-separated keys + #10 `_common.config`.** #8: a comma-separated section key (`"a, b": {…}`) is split on `/\s*,\s*/` (each name `.trim()`med, empty segments skipped) and the block is replicated under each named section, MERGING into any section that already exists so a section's own keys win — `merge(existing, JSON.clone(block))`, and `lib/merge` keeps its FIRST argument on a leaf collision (`override=false` default). #10: an optional `_common.config` block is `merge(_common, _common.config)`-flattened back into `_common` then deleted, so the existing `_common.*` read sites are unchanged and a direct `_common.X` overrides `_common.config.X`. **Placement is load-bearing:** the pass must run before the GET auto-vivify `files['templates'][rule.toLowerCase()] = {}` (which keys off CLEAN route names from routing.json) — otherwise a comma key leaves the real route names "missing" → empty `{}` sections get minted AND the comma key survives to produce a dead `"a, b@bundle"` route. **Both are no-ops when absent** (no comma → single-element split → identical; no `_common.config` → untouched), so existing bundles are byte-identical — verified zero comma keys across known consumer + gina fixture `templates.json` before shipping. **#7 (a Swig-like `{ "inherit": … }` directive) was closed un-shipped**, so #8 is NOT redundant: `_common` shares to ALL routes, #8 shares a chosen SUBSET — a gap nothing else fills. Collect-then-mutate (gather comma keys first) avoids changing the object mid-`for…in`. Tests: `test/core/config-templates-preprocess.test.js` (source pins incl. placement-before-auto-vivify + a real-`merge` pure-logic replica: split / union-merge / own-keys-win / trim / empty-segment / flatten / no-op). Established 2026-06-05.
919
921
 
920
- 174. **`throwError` — call signatures, status-code preservation, render-error interception, and fail-closed error-response `stack` hygiene** (replaces individual entries #10, #21, #26, #105, #110, #132) — `self.throwError` accepts four shapes: `(errorObj|Error)` 1-arg; `(code, Error|string)` 2-arg, dispatched via a function-top normalization shift that preserves the explicit code (`throwError(404, new Error('not found'))` sends 404 — earlier releases fell back to 500, and the `new Error(...)` wrapping workaround from that era still works unchanged); `(code, errorObj)` 2-arg, intentionally NOT shifted — it flows through the `arguments.length < 3` branch, which reaches the explicit code — that branch passes an OBJECT through untouched (so the errorObj resolution inside the JSON branch below can unpack it; collapsing it there silently disables the #CE1 transient-503 upgrade, measured) and validates a SCALAR, and including errorObj in the shift detection would break exactly that case; `(res, code, string|Error)` 3-arg (explicit code preserved). Always `return self.throwError(...)` immediately in a controller action — it is a terminal response, and any later response-API call runs against a released response (guarded to warn + no-op since 0.5.1-alpha.2 instead of crashing the bundle). Calling `self.render(err)` with a non-2xx `data.page.data.status` and a defined `data.page.data.error` is intercepted before template rendering and routed through `throwError` automatically; object-valued `error`/`message` fields are normalised to strings first (no `[object Object]`), and the same normalized string feeds the server-side `console.error('[render] ...')` log, so wire and log carry identical readable text. Error responses are scope-gated FAIL-CLOSED: unless `NODE_SCOPE_IS_LOCAL` is explicitly `true`, the server-side `stack` is stripped from BOTH the JSON error body AND the fallback HTML error page's `<pre class="stack">` block — the gate is strip-unless-local, not strip-only-if-prod, so an unset scope on a fresh deployment still strips and internals (file paths, frames, library versions) never leak; local scope keeps the stack on the wire for the dev toolbar's data-xhr panel. Custom error templates remain consumer-owned (a view rendering the error object's `stack` is the consumer's call). A stack passed AS the message gets the same scope treatment since #B670 (0.7.0): `throwError(res, 500, err.stack)`, `throwError(500, err.stack)`, or an errorObj whose `title` / `message` / `error` holds one used to reach the client whole — in `message` (or `error` for the 1-arg errorObj), and on the fallback HTML page — because only the `stack` FIELD was stripped. Outside local scope such a value now keeps its first line on the JSON body, the fallback page and the data a custom error page receives (`page.data`, `req.params.errorObject`); the detector is #B131's `/\n\s+at\s/`, so a human message with a line starting `at ` is cut too, nested objects are not walked, and text built from raw V8 CallSite objects (the `__stack` global, whose `toString()` carries no `at ` prefix) is NOT recognised — write such frames V8-style (`' at ' + callSite`), as `redirect()` now does. The full text goes to the #ERRREF line, which on the HTML path now logs the error's own text instead of the throwError CALLSITE and also fires for the `(res, code, errorObj)` shape (it emitted no line for that ref before). A caller's `msg` object is cut on a copy; an errorObj the build merges into (`lib/merge` returns its first argument) is edited in place, as the `stack` strip already did. Local scope is unchanged on the wire. **The sibling `renderJSON()` status surface had an HTTP/2-only hole (#B172, fixed 2026-07-30): the `status` key in the payload correctly resolves onto `response.statusCode`, but the HTTP/2 body path hand-builds its header frame for the raw `stream.respond()` and hardcoded `':status': 200` — and the pending-header merge below can never supply the real code, since `setHeader(':status', …)` throws ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED — so every `renderJSON({status: 4xx})` on a genuine HTTP/2 stream was served as 200 with the error payload in the body (HTTP/1.1, the HEAD branch, and the HTML delegates were already correct). Fixed to `':status': response.statusCode || 200`, matching the HEAD branch. The `errno` half of the status branch is now guarded like the swig/v1 delegates (enter only when `statusCodes[jsonObj.status]` is defined): an `errno`-only payload used to assign `statusCode = undefined`, which HTTP/1.1's `response.end()` rejects with the throw swallowed by an empty catch (the response was never sent — the client hangs) and HTTP/2's compat setter rejects at assignment (→ 500); guarded, such a payload is served as a normal 200 with the payload in the body — measured wire-identical to dropping the errno clause on every input. Rule: any hand-built HTTP/2 header frame must carry `response.statusCode || 200`, never a literal — the compat layer's pending-header merge structurally cannot repair a pseudo-header. Tests: `render-json.test.js §07-§08` (extract-and-execute on the real branch bytes).** **#B749 (fixed for 0.7.2) — the converse: a raw HTTP/2 answer must also give the compat response the code its frame carries.** `stream.respond()` never touches `res.statusCode`, and the #B562 shim swallows `writeHead(code)`, so this server-level throwError's HTTP/2 errors reached the metrics `finish` hook as `200` (`route="__no_route__"`) while the client got the real code. Both raw send helpers (`__ginaSendErrJSON`, `__ginaSendErrHTML`) now run `try { res.statusCode = code; } catch (e) {}` before the respond: the setter throws on an invalid code (undefined among them) that `respond()` still sends as 200, and the send must not depend on it. The same class outside throwError (16 raw isaac answers, 3 more in server.js) is staked as #B755, unfixed. Tests: `test/core/h2-raw-send-b749-b750.test.js §03`. **Body field semantics — which key carries the human sentence (docs-corrected 2026-07-30): on a known status code `error` carries the STATUS TEXT (`statusCodes[code]`) and the caller's text lands in `message` (the Error argument's `.message`, or the trailing string), so a client wanting the sentence reads `message`, NOT `error`; only for an unknown status code (warned) can the caller's text land in `error` instead. The sibling `ApiError` + `renderJSON` path cannot carry a message on the wire AT ALL: the server-error forms (`new ApiError(msg)`, `new ApiError(msg, code)`) return a real `Error` whose `message` is a non-enumerable own property that `renderJSON`'s single `JSON.stringify` skips (readable server-side, absent from the body — and reassigning `e.message` does NOT make it enumerable, only `defineProperty` would), while the field forms (`new ApiError(msg, field)`, `new ApiError(msg, field, code)`, the array form) return a PLAIN OBJECT built by `merge({tag,fields,path}, e)`, which copies enumerable properties only — so `message` is absent outright there and the text travels in `fields[field]` (those bodies also carry `tag` + `path`). To place a sentence in the body use `throwError` or hand-build the payload.** **The custom-error-PAGE path had the same inert-status class (#B190, fixed 2026-08-01): `renderCustomError` — the `req.routing.param.error` / `errorFiles` path — never set the response status; the swig and v1 delegates recompute it downstream from `data.page.data.status`, but the nunjucks and both async delegates only read the already-set `res.statusCode || 200` at their write sites, so a configured custom error page was served as HTTP 200 there (live-measured on the same fixture: nunjucks 200 vs swig 500 pre-fix; nunjucks 500 post-fix). Fixed with a guarded stamp in `renderCustomError` immediately before the render dispatch — `res.statusCode = data.status`, gated on `!res.headersSent` + `statusCodes[data.status]` membership, mirroring the swig delegate's own downstream semantics — so every delegate serves the configured page with its real status, and a transient-failure 503 upgrade (#CE1) rides this path with a meaningful `Retry-After`. Tests: `test/core/controller-custom-error-status.test.js` (source pins + behavioral drive of the real bytes via `createTestInstance` with a stubbed `render()`; red-first).** **The same path could DISCARD its resolved template outright (#B191, fixed 2026-08-01, consumer-reported against 0.6.0): `renderCustomError` built its `errOptions` only under the `isLocalOptionResetNeeded` flag, but the server-side throwError twin sets `param.file` WITHOUT that flag (and the flag rode a shared routing object the dispatch mutated per error), so a falsy read left `errOptions` null and the swig delegate fell back to the FAILING route's own `file` — a bare, un-rooted `<file>.html` ENOENT plus a "check the following rule in your routing.json" dump naming a rule that was correct by construction (an upstream outage misread as a routing misconfiguration; the built-in fallback page still served, so end users saw an error page throughout). Fixed threefold: the resolved `param.file` now reaches `errOptions` unconditionally (with `path: null` so the namespace stays ignored — heals nunjucks too, which read the same `localOptions.file`); the controller-side dispatch works on a `JSON.clone` of the injected route instead of mutating `content.routing[<rule>]` (lib/routing `getRoute()` already clones for the server twin, which is also why a clean router dispatch self-rescued); and render-swig's template-not-found diagnostic, when rendering a custom error page, names the custom error template and hands off to throwError's re-entry guard (built-in page, no loop) — never the routing-rule dump. Rule: anything the error dispatch resolves must not depend on optional dispatch flags, and the dispatch must never mutate shared routing state. Tests: `test/core/controller-custom-error-options.test.js` (source pins + real-bytes behavioral for BOTH the file channel and the shared-config non-mutation; red-first validated on pre-fix bytes in a detached worktree).** **Every status the method resolves is VALIDATED before it can reach `writeHead` (#B466, 2026-09-04): an unvalidated status previously reached `res.writeHead()` verbatim, so a payload whose top-level `status` was a domain string (`{status:'draft', error:'…'}` — a field name any page vocabulary may legitimately own) threw `RangeError [ERR_HTTP_INVALID_STATUS_CODE]` and replaced the intended error page with an unhandled 500. The failure was invisible on every SUCCESS render (the swig success path already guarded with a 200 fallback) and fatal only on the error path, i.e. exactly when the error page was needed. The guard is a module-level `_isValidHttpStatus` predicate encoding node's OWN rule — integer 100-999 — deliberately NOT `statusCodes` membership (that table carries a `_comment` key, so a membership test accepts the status `"_comment"`) and NOT `/^\d{3}$/` (it accepts `"099"`, which node rejects; both measured). The `statusCodes` lookup stays as the `[ ApiValidator ]` diagnostic warn — table for diagnosis, range for correctness. A numeric `status` still sets the HTTP status exactly as documented; an invalid one now degrades to a 500 error page instead of throwing. Tests: `test/core/throwerror-status-validation.test.js` (15; red-first 6/13 → green, driven through `createTestInstance` against real bytes).** **The same method's five `writeHead` EGRESS sites had a headers-argument twin (#B467, 2026-09-04): two of them — the MSIE override and the no-`user-agent` else branch — passed the literal string `"content-type"` as node's statusMessage (`writeHead(statusCode, statusMessage, headers)`), so the MIME string landed in the headers slot, while the two sibling branches beside them already used the correct 2-arg object form. Node does NOT throw on this — measured on both transports: over HTTP/1.1 it iterates `Object.keys()` of the MIME STRING, so the response carries ~10-31 junk headers named `"0"`,`"1"`,… , a reason phrase reading `content-type`, and NO content-type at all; over HTTP/2 the headers argument is dropped and a one-time `UnsupportedWarning` (status message unsupported, RFC 7540 §8.1.2.4) is emitted. So the defect is SILENT corruption of the error response, never a crash — nothing appears in logs. Reachability was measured by driving the real method, not inferred: the else branch fires for any caller that sends no `user-agent` header at all, the common shape for machine callers. Both sites now pass an object, and the MSIE branch declares `'text/plain; charset='+ bundleConf.encoding` rather than a bare `text/plain` — every branch here ends at `res.end(JSON.stringify(errorObject))`, whose caller-supplied `error`/`message` text goes out as UTF-8 (`JSON.stringify` does not escape non-ASCII), so a charset-less `text/plain` invites a single-byte guess that corrupts it (`refusé` → `refusé`, measured); this matches the `'text/plain' + '; charset='+ conf.encoding` form the same file already builds on its text-render path. Rule: `writeHead`'s 2nd POSITIONAL argument is a statusMessage, never a header name — headers go in an object. Tests: `test/core/throwerror-writehead-headers.test.js` (13; red-first 6/13 → green; both defective branches driven through `createTestInstance`, both correct siblings pinned as controls, and every source pin validated red against the pre-fix bytes).** **A custom-error render shares the request's template object and re-seeds its per-response accumulators (#B497, 0.6.28):** the render delegates resolve their view config as `errOptions || local.options` and read `localOptions.template.h2Links` (the final-200 `link` preload prefix, render-swig) and `localOptions.template.externalPlugins` (the head) through it, while `getNodeRes()` writes both to `local.options.template`. `renderCustomError` built `errOptions` with `lib/merge`, which grafts `template` as a NEW shallow copy (scalars, empty arrays and arrays of primitives are copied — only arrays of objects are shared, measured), so a custom error page had never carried the config-declared preloads nor — with `javascriptsDeferEnabled: false`, the only mode in which external plugins are injected into the head — its `isExternalPlugin` scripts. Live (isolated prod http/2 boots, pre-fix bytes as the control): an action throwing before render answered 500 with NO `link` header and no plugin tag, and now carries the same 319-byte header and one tag as the 200; a route whose template fails to compile, with the share but WITHOUT the re-seed, carried every preload twice and the plugin tag four times (the head-injection loop inserts the whole array once per entry — #B501), and once each with the fix. Since 0.6.28 `renderCustomError` points `errOptions.template` at `local.options.template` and re-seeds `h2Links = ''` (only where the router seeded it, i.e. http/2) and `externalPlugins = []` before dispatching: a custom-error render is a SECOND top-level render on the same response, and an error struck after the failing route's `setResources()` ran (a template compilation error) would otherwise `+=` a second copy of every preload and splice every plugin twice. (On a route whose template fails to compile, two 103 responses go out — one per render; measured identically on the pre-fix bytes, so this fix neither introduces nor changes it.) Scope as measured: the only live 200-header reader of `h2Links` is render-swig (`render-v1` is unreachable from `render()`; nunjucks and the async delegates emit no final-200 `link` header and rely on the 103). Test: `test/core/controller-custom-error-preload.test.js` (16 arms; 10 red-first against the pre-fix bytes). **The `helpers/context.js` twin answered the WRONG REQUEST under concurrency (#B534, 0.6.30).** That twin — the one behind the implicit-global `getConfig()` / `getLib()`, reachable from request code whenever either throws — resolved its response through `getContext('router')`, a PROCESS-WIDE slot `core/router.js` fills on every routed request and NEVER clears (1 writer, 1 reader, measured). So with request A in flight and B routed behind it, A's callback resuming after an await read B's response, wrote A's failure to B's client and returned — leaving A unanswered until the caller's timeout, which presents as an upstream fault rather than a render error. The #ERRREF pairing line made diagnosis WORSE, not better: it derived `_req` from `res.req`, i.e. from that same wrong response, so it printed B's request id beside A's incident ref — a confidently mislabelled correlation line, which is worse than an absent one, since the ref exists precisely to correlate. Fixed by preferring the per-request `process.gina._reqALS` store (`server.js handle()` establishes it for EVERY request on both engines and it propagates across `await`; the store literal now carries `req`/`res`/`next` alongside `requestId`/`startMs`/`proxy` — purely additive, nothing in the tree enumerates an ALS store and `_renderALS` already carried a `req`/`res` pair), with `res` and `next` taken from the SAME source so a store response is never paired with the slot's stale `next`, and `_req` re-derived alongside `res`. The slot REMAINS as the fallback for a caller with no store at all — boot, CLI, cron, worker — which is what it was for; ⚠️ that fallback still answers a stranger for a boot-armed timer invoking application code (`lib/cron` calls arbitrary bundle code and `getConfig`'s catch writes the wire then returns normally, so the cron's own try/catch never sees it), tracked separately as the residual. Rule: a process-wide slot holding per-request state is a concurrency bug waiting for its second request — resolve per-request state from the request's own ALS store and keep the global only for callers that genuinely have none. Server-side only, NO dist rebuild. Test: `test/core/context-throwerror-request-scope-b534.test.js` (10; a two-interleaved-context drive plus a frozen PRE-FIX copy through the SAME scene as the subtract control, which must still answer B and mislabel the line — without that arm the passing assertions could not be distinguished from a harness that never reproduced the defect). **Every value the built-in error pages render is HTML-ESCAPED (#B554, 2026-09-18 — SECURITY; reflected XSS in every released version).** `redirect()` USED TO treat a request-supplied `error` key as an instruction to `throwError` (in `SuperController::redirect`, reading `req[method]` i.e. the parsed query/body), so `GET /<any-route-whose-action-redirects>?error=<img src=x onerror=…>` answered a 500 whose body carried the tag RAW and executed it in the application's origin — DRIVEN on a booted bundle (`content-type: text/html`, payload present, `&lt;img` absent) and **not scope-gated**: only the two `stack` blocks carry `_isLocalScope`, which is the control for its absence on the others. ⚠️ **A 1-arg call whose PAYLOAD is FALSY is not a late call (#B560, 2026-09-18, own commit).** The `#B44` guard bails on `!res`, written for the 2-arg/3-arg shapes where `res` IS a possibly-released `local.res`; but in the 1-arg `throwError(err)` shape that slot holds the CALLER'S payload, so `''`, `null`, `undefined`, `0` and `false` were all read as late calls and SWALLOWED — no writeHead, no end, request never answered, and the only trace a warning claiming the response had been released followed by NO error text (its interpolation reads `msg`/`code`, never `res`). Reachable from CONSUMER code, not just the framework: an app calling `self.throwError(err)` with a falsy err hung that request. Fixed by normalising a falsy 1-arg payload to a minimal errorObj BEFORE the guard. ⛔ Do NOT 'simplify' that to `arguments.length !== 1` on the bail itself: the errorObject build derefs `res.error`/`res.message` unguarded, so letting a null through turns a silent hang into a TypeError crash. Genuine 2-arg/3-arg late calls and 0-arg calls still bail unchanged; measured red-first, `''`/`null`/`0` went `ret=false`+no-egress → `writeHead:500`+`end`, with a non-empty payload egressing on BOTH sides as the control. Twins measured UNAFFECTED: `core/server.js`'s has no bare `!res` bail, and `helpers/context.js`'s shifts by ARITY, never truthiness. **That gate is now DELETED (#B559, 2026-09-18 — SECURITY, present in every released version back to `v0.1.6`):** a request parameter must not steer control flow. `req[method]` is CLIENT-populated (`server.js` assigns `request.get = request.query`, and `request.post` from the parsed body), so ANY unauthenticated request to ANY route whose action redirects could force a 500 by adding the key — both engines, no route opt-in — and an EMPTY value was worse: the empty string is falsy, so throwError's `#B44` late-call guard mistook it for a call on an already-released response, logged `ignoring late error:` with NOTHING after the colon, and returned with NO egress, leaving the request UNANSWERED for as long as the client held the socket; nothing reaps that (`server.timeout` defaults to 0, deliberately, so SSE/WS are not cut off), and the hang limb needs that guard so it dates from `v0.5.3`. DRIVEN live before/after on a booted bundle, every arm paired with a control that had to keep its pre-fix value: GET `?error=X` 500→302, GET `?error=` HANG→302, POST body `error=X` 500→303, POST body `error=` HANG→303, while plain GET stayed 302 and plain POST stayed 303. The key is now an ordinary parameter and rides `inheritedData` like every other one — which is what the published `controller.md` "carrying request data across the redirect" example always documented; that example could NOT work as written while the gate stood, since it assigns the key on the request and redirects one line later. Origin: no design — the condition was written in 2021 to `delete` the key so it would not ride the target URL, was removed, and came back in 2022 with a `throwError` where the `delete` had been, inside an unrelated omnibus commit with no comment. ⚠️ Cite this by SYMBOL, never by line: the original `controller.js:3540-3543` citation rotted ~33 lines inside a single release and misdirected a later session. Reach is narrower than "any URL" and was measured: the route must EXIST and its action must call `redirect()` (a 404, a different query key, and a non-redirecting 200 route all reflect nothing), but a newly scaffolded bundle declares no `errorFiles` (`core/template/boilerplate/bundle/config/templates.json`) so it hits precisely this inline page. Fixed by escaping at the emission point — `& < > " '`, null/undefined ⇒ `''` — across ALL SEVEN `msgString` sites in `controller.js` (the five non-stack plus both gated `stack` blocks, gates untouched), BOTH transports of the engine-attached twin in `core/server.js` (whose `msg` its 404/403/500 callers build from `req.url` / `headers[':path']` — raw for any client that can send a literal `<`, which a browser cannot in a URL, so that half is hardening rather than a driven vector), and the THREE error-document fallbacks in `controller.render-nunjucks.js` (`_absErrTemplate`, `readErr.message`, `renderErr.message`, plus each `<title>` status, which #B466 showed can be a caller-supplied value). Three byte-identical `_escapeHtml` local copies, the deliberate `_mintErrorRef` duplication discipline (controller.js is evicted per request in dev, so a shared home would churn), pinned identical by the test. **Consumer-visible behaviour change:** an application that deliberately passed HTML in an error title/message now sees it escaped — that reflection WAS the vulnerability, so there is no opt-out; of 196 framework-side `throwError(` call sites in `core/`, zero pass markup (needle validated against a synthetic positive). ⚠️ A consumer custom error template rendering `{{ data.message }}` remains a SEPARATE unescaped sink, because `settings.swig.autoescape` defaults to false — consumer-owned, unchanged by this fix. Server-side only, NO dist rebuild (measured: none of the three files appears in the browser `build.json`, controls `lib/merge`/`lib/routing` at 1 each; pickup is a bundle restart). Tests: `test/core/throwerror-html-escape-b554.test.js` (14 arms — source pins across all three files + the helper executed as shipped bytes + the page DRIVEN through `createTestInstance`; red-first 11/3). Two authoring traps this paid for, both documented shapes firing on the fix's OWN comments: the replace-code `// was:` lines reproduced the `\n\nref '+ ref +'` tail that `error-ref.test.js` counts over raw source expecting exactly 2 (own-comment trap ⇒ the comments elide the unchanged tail), and a 5-line note pushed two message literals outside `render-engine-dispatch.test.js`' 700/500-char distance windows (⇒ the in-window notes are one line each).
922
+ 174. **`throwError` — call signatures, status-code preservation, render-error interception, and fail-closed error-response `stack` hygiene** (replaces individual entries #10, #21, #26, #105, #110, #132) — `self.throwError` accepts four shapes: `(errorObj|Error)` 1-arg; `(code, Error|string)` 2-arg, dispatched via a function-top normalization shift that preserves the explicit code (`throwError(404, new Error('not found'))` sends 404 — earlier releases fell back to 500, and the `new Error(...)` wrapping workaround from that era still works unchanged); `(code, errorObj)` 2-arg, intentionally NOT shifted — it flows through the `arguments.length < 3` branch, which reaches the explicit code — that branch passes an OBJECT through untouched (so the errorObj resolution inside the JSON branch below can unpack it; collapsing it there silently disables the #CE1 transient-503 upgrade, measured) and validates a SCALAR, and including errorObj in the shift detection would break exactly that case; `(res, code, string|Error)` 3-arg (explicit code preserved). Always `return self.throwError(...)` immediately in a controller action — it is a terminal response, and any later response-API call runs against a released response (guarded to warn + no-op since 0.5.1-alpha.2 instead of crashing the bundle). Calling `self.render(err)` with a non-2xx `data.page.data.status` and a defined `data.page.data.error` is intercepted before template rendering and routed through `throwError` automatically; object-valued `error`/`message` fields are normalised to strings first (no `[object Object]`), and the same normalized string feeds the server-side `console.error('[render] ...')` log, so wire and log carry identical readable text. Error responses are scope-gated FAIL-CLOSED: unless `NODE_SCOPE_IS_LOCAL` is explicitly `true`, the server-side `stack` is stripped from BOTH the JSON error body AND the fallback HTML error page's `<pre class="stack">` block — the gate is strip-unless-local, not strip-only-if-prod, so an unset scope on a fresh deployment still strips and internals (file paths, frames, library versions) never leak; local scope keeps the stack on the wire for the dev toolbar's data-xhr panel. Custom error templates remain consumer-owned (a view rendering the error object's `stack` is the consumer's call). A stack passed AS the message gets the same scope treatment since #B670 (0.7.0): `throwError(res, 500, err.stack)`, `throwError(500, err.stack)`, or an errorObj whose `title` / `message` / `error` holds one used to reach the client whole — in `message` (or `error` for the 1-arg errorObj), and on the fallback HTML page — because only the `stack` FIELD was stripped. Outside local scope such a value now keeps its first line on the JSON body, the fallback page and the data a custom error page receives (`page.data`, `req.params.errorObject`); the detector is #B131's `/\n\s+at\s/`, so a human message with a line starting `at ` is cut too, nested objects are not walked, and text built from raw V8 CallSite objects (the `__stack` global, whose `toString()` carries no `at ` prefix) is NOT recognised — write such frames V8-style (`' at ' + callSite`), as `redirect()` now does. The full text goes to the #ERRREF line, which on the HTML path now logs the error's own text instead of the throwError CALLSITE and also fires for the `(res, code, errorObj)` shape (it emitted no line for that ref before). A caller's `msg` object is cut on a copy; an errorObj the build merges into (`lib/merge` returns its first argument) is edited in place, as the `stack` strip already did. Local scope is unchanged on the wire. **The sibling `renderJSON()` status surface had an HTTP/2-only hole (#B172, fixed 2026-07-30): the `status` key in the payload correctly resolves onto `response.statusCode`, but the HTTP/2 body path hand-builds its header frame for the raw `stream.respond()` and hardcoded `':status': 200` — and the pending-header merge below can never supply the real code, since `setHeader(':status', …)` throws ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED — so every `renderJSON({status: 4xx})` on a genuine HTTP/2 stream was served as 200 with the error payload in the body (HTTP/1.1, the HEAD branch, and the HTML delegates were already correct). Fixed to `':status': response.statusCode || 200`, matching the HEAD branch. The `errno` half of the status branch is now guarded like the swig/v1 delegates (enter only when `statusCodes[jsonObj.status]` is defined): an `errno`-only payload used to assign `statusCode = undefined`, which HTTP/1.1's `response.end()` rejects with the throw swallowed by an empty catch (the response was never sent — the client hangs) and HTTP/2's compat setter rejects at assignment (→ 500); guarded, such a payload is served as a normal 200 with the payload in the body — measured wire-identical to dropping the errno clause on every input. Rule: any hand-built HTTP/2 header frame must carry `response.statusCode || 200`, never a literal — the compat layer's pending-header merge structurally cannot repair a pseudo-header. Tests: `render-json.test.js §07-§08` (extract-and-execute on the real branch bytes).** **#B749 (fixed for 0.7.2) — the converse: a raw HTTP/2 answer must also give the compat response the code its frame carries.** `stream.respond()` never touches `res.statusCode`, and the #B562 shim swallows `writeHead(code)`, so this server-level throwError's HTTP/2 errors reached the metrics `finish` hook as `200` (`route="__no_route__"`) while the client got the real code. Both raw send helpers (`__ginaSendErrJSON`, `__ginaSendErrHTML`) now run `try { res.statusCode = code; } catch (e) {}` before the respond: the setter throws on an invalid code (undefined among them) that `respond()` still sends as 200, and the send must not depend on it. The same class outside throwError (16 raw isaac answers, 3 more in server.js) is staked as #B755, unfixed. Tests: `test/core/h2-raw-send-b749-b750.test.js §03`. **Body field semantics — which key carries the human sentence (docs-corrected 2026-07-30; the one-argument form corrected with #B518): in the `(code, err)` and `(res, code, err)` forms, on a known status code `error` carries the STATUS TEXT (`statusCodes[code]`) and the caller's text lands in `message` (the Error argument's `.message`, or the trailing string), so a client wanting the sentence reads `message`, NOT `error`; only for an unknown status code (warned) can the caller's text land in `error` instead. In the one-argument form `throwError(err)`, `error` carries the object's own `error`, else its `message` (an Error's message included), else the status text — and `message` carries its `message` there too since #B518. The sibling `ApiError` + `renderJSON` path cannot carry a message on the wire AT ALL: the server-error forms (`new ApiError(msg)`, `new ApiError(msg, code)`) return a real `Error` whose `message` is a non-enumerable own property that `renderJSON`'s single `JSON.stringify` skips (readable server-side, absent from the body — and reassigning `e.message` does NOT make it enumerable, only `defineProperty` would), while the field forms (`new ApiError(msg, field)`, `new ApiError(msg, field, code)`, the array form) return a PLAIN OBJECT built by `merge({tag,fields,path}, e)`, which copies enumerable properties only — so `message` is absent outright there and the text travels in `fields[field]` (those bodies also carry `tag` + `path`). To place a sentence in the body use `throwError` or hand-build the payload.** **The custom-error-PAGE path had the same inert-status class (#B190, fixed 2026-08-01): `renderCustomError` — the `req.routing.param.error` / `errorFiles` path — never set the response status; the swig and v1 delegates recompute it downstream from `data.page.data.status`, but the nunjucks and both async delegates only read the already-set `res.statusCode || 200` at their write sites, so a configured custom error page was served as HTTP 200 there (live-measured on the same fixture: nunjucks 200 vs swig 500 pre-fix; nunjucks 500 post-fix). Fixed with a guarded stamp in `renderCustomError` immediately before the render dispatch — `res.statusCode = data.status`, gated on `!res.headersSent` + `statusCodes[data.status]` membership, mirroring the swig delegate's own downstream semantics — so every delegate serves the configured page with its real status, and a transient-failure 503 upgrade (#CE1) rides this path with a meaningful `Retry-After`. Tests: `test/core/controller-custom-error-status.test.js` (source pins + behavioral drive of the real bytes via `createTestInstance` with a stubbed `render()`; red-first).** **The same path could DISCARD its resolved template outright (#B191, fixed 2026-08-01, consumer-reported against 0.6.0): `renderCustomError` built its `errOptions` only under the `isLocalOptionResetNeeded` flag, but the server-side throwError twin sets `param.file` WITHOUT that flag (and the flag rode a shared routing object the dispatch mutated per error), so a falsy read left `errOptions` null and the swig delegate fell back to the FAILING route's own `file` — a bare, un-rooted `<file>.html` ENOENT plus a "check the following rule in your routing.json" dump naming a rule that was correct by construction (an upstream outage misread as a routing misconfiguration; the built-in fallback page still served, so end users saw an error page throughout). Fixed threefold: the resolved `param.file` now reaches `errOptions` unconditionally (with `path: null` so the namespace stays ignored — heals nunjucks too, which read the same `localOptions.file`); the controller-side dispatch works on a `JSON.clone` of the injected route instead of mutating `content.routing[<rule>]` (lib/routing `getRoute()` already clones for the server twin, which is also why a clean router dispatch self-rescued); and render-swig's template-not-found diagnostic, when rendering a custom error page, names the custom error template and hands off to throwError's re-entry guard (built-in page, no loop) — never the routing-rule dump. Rule: anything the error dispatch resolves must not depend on optional dispatch flags, and the dispatch must never mutate shared routing state. Tests: `test/core/controller-custom-error-options.test.js` (source pins + real-bytes behavioral for BOTH the file channel and the shared-config non-mutation; red-first validated on pre-fix bytes in a detached worktree).** **Every status the method resolves is VALIDATED before it can reach `writeHead` (#B466, 2026-09-04): an unvalidated status previously reached `res.writeHead()` verbatim, so a payload whose top-level `status` was a domain string (`{status:'draft', error:'…'}` — a field name any page vocabulary may legitimately own) threw `RangeError [ERR_HTTP_INVALID_STATUS_CODE]` and replaced the intended error page with an unhandled 500. The failure was invisible on every SUCCESS render (the swig success path already guarded with a 200 fallback) and fatal only on the error path, i.e. exactly when the error page was needed. The guard is a module-level `_isValidHttpStatus` predicate encoding node's OWN rule — integer 100-999 — deliberately NOT `statusCodes` membership (that table carries a `_comment` key, so a membership test accepts the status `"_comment"`) and NOT `/^\d{3}$/` (it accepts `"099"`, which node rejects; both measured). The `statusCodes` lookup stays as the `[ ApiValidator ]` diagnostic warn — table for diagnosis, range for correctness. A numeric `status` still sets the HTTP status exactly as documented; an invalid one now degrades to a 500 error page instead of throwing. Tests: `test/core/throwerror-status-validation.test.js` (15; red-first 6/13 → green, driven through `createTestInstance` against real bytes).** **The same method's five `writeHead` EGRESS sites had a headers-argument twin (#B467, 2026-09-04): two of them — the MSIE override and the no-`user-agent` else branch — passed the literal string `"content-type"` as node's statusMessage (`writeHead(statusCode, statusMessage, headers)`), so the MIME string landed in the headers slot, while the two sibling branches beside them already used the correct 2-arg object form. Node does NOT throw on this — measured on both transports: over HTTP/1.1 it iterates `Object.keys()` of the MIME STRING, so the response carries ~10-31 junk headers named `"0"`,`"1"`,… , a reason phrase reading `content-type`, and NO content-type at all; over HTTP/2 the headers argument is dropped and a one-time `UnsupportedWarning` (status message unsupported, RFC 7540 §8.1.2.4) is emitted. So the defect is SILENT corruption of the error response, never a crash — nothing appears in logs. Reachability was measured by driving the real method, not inferred: the else branch fires for any caller that sends no `user-agent` header at all, the common shape for machine callers. Both sites now pass an object, and the MSIE branch declares `'text/plain; charset='+ bundleConf.encoding` rather than a bare `text/plain` — every branch here ends at `res.end(JSON.stringify(errorObject))`, whose caller-supplied `error`/`message` text goes out as UTF-8 (`JSON.stringify` does not escape non-ASCII), so a charset-less `text/plain` invites a single-byte guess that corrupts it (`refusé` → `refusé`, measured); this matches the `'text/plain' + '; charset='+ conf.encoding` form the same file already builds on its text-render path. Rule: `writeHead`'s 2nd POSITIONAL argument is a statusMessage, never a header name — headers go in an object. Tests: `test/core/throwerror-writehead-headers.test.js` (13; red-first 6/13 → green; both defective branches driven through `createTestInstance`, both correct siblings pinned as controls, and every source pin validated red against the pre-fix bytes).** **A custom-error render shares the request's template object and re-seeds its per-response accumulators (#B497, 0.6.28):** the render delegates resolve their view config as `errOptions || local.options` and read `localOptions.template.h2Links` (the final-200 `link` preload prefix, render-swig) and `localOptions.template.externalPlugins` (the head) through it, while `getNodeRes()` writes both to `local.options.template`. `renderCustomError` built `errOptions` with `lib/merge`, which grafts `template` as a NEW shallow copy (scalars, empty arrays and arrays of primitives are copied — only arrays of objects are shared, measured), so a custom error page had never carried the config-declared preloads nor — with `javascriptsDeferEnabled: false`, the only mode in which external plugins are injected into the head — its `isExternalPlugin` scripts. Live (isolated prod http/2 boots, pre-fix bytes as the control): an action throwing before render answered 500 with NO `link` header and no plugin tag, and now carries the same 319-byte header and one tag as the 200; a route whose template fails to compile, with the share but WITHOUT the re-seed, carried every preload twice and the plugin tag four times (the head-injection loop inserts the whole array once per entry — #B501), and once each with the fix. Since 0.6.28 `renderCustomError` points `errOptions.template` at `local.options.template` and re-seeds `h2Links = ''` (only where the router seeded it, i.e. http/2) and `externalPlugins = []` before dispatching: a custom-error render is a SECOND top-level render on the same response, and an error struck after the failing route's `setResources()` ran (a template compilation error) would otherwise `+=` a second copy of every preload and splice every plugin twice. (On a route whose template fails to compile, two 103 responses go out — one per render; measured identically on the pre-fix bytes, so this fix neither introduces nor changes it.) Scope as measured: the only live 200-header reader of `h2Links` is render-swig (`render-v1` is unreachable from `render()`; nunjucks and the async delegates emit no final-200 `link` header and rely on the 103). Test: `test/core/controller-custom-error-preload.test.js` (16 arms; 10 red-first against the pre-fix bytes). **The `helpers/context.js` twin answered the WRONG REQUEST under concurrency (#B534, 0.6.30).** That twin — the one behind the implicit-global `getConfig()` / `getLib()`, reachable from request code whenever either throws — resolved its response through `getContext('router')`, a PROCESS-WIDE slot `core/router.js` fills on every routed request and NEVER clears (1 writer, 1 reader, measured). So with request A in flight and B routed behind it, A's callback resuming after an await read B's response, wrote A's failure to B's client and returned — leaving A unanswered until the caller's timeout, which presents as an upstream fault rather than a render error. The #ERRREF pairing line made diagnosis WORSE, not better: it derived `_req` from `res.req`, i.e. from that same wrong response, so it printed B's request id beside A's incident ref — a confidently mislabelled correlation line, which is worse than an absent one, since the ref exists precisely to correlate. Fixed by preferring the per-request `process.gina._reqALS` store (`server.js handle()` establishes it for EVERY request on both engines and it propagates across `await`; the store literal now carries `req`/`res`/`next` alongside `requestId`/`startMs`/`proxy` — purely additive, nothing in the tree enumerates an ALS store and `_renderALS` already carried a `req`/`res` pair), with `res` and `next` taken from the SAME source so a store response is never paired with the slot's stale `next`, and `_req` re-derived alongside `res`. The slot REMAINS as the fallback for a caller with no store at all — boot, CLI, cron, worker — which is what it was for; ⚠️ that fallback still answers a stranger for a boot-armed timer invoking application code (`lib/cron` calls arbitrary bundle code and `getConfig`'s catch writes the wire then returns normally, so the cron's own try/catch never sees it), tracked separately as the residual. Rule: a process-wide slot holding per-request state is a concurrency bug waiting for its second request — resolve per-request state from the request's own ALS store and keep the global only for callers that genuinely have none. Server-side only, NO dist rebuild. Test: `test/core/context-throwerror-request-scope-b534.test.js` (10; a two-interleaved-context drive plus a frozen PRE-FIX copy through the SAME scene as the subtract control, which must still answer B and mislabel the line — without that arm the passing assertions could not be distinguished from a harness that never reproduced the defect). **Every value the built-in error pages render is HTML-ESCAPED (#B554, 2026-09-18 — SECURITY; reflected XSS in every released version).** `redirect()` USED TO treat a request-supplied `error` key as an instruction to `throwError` (in `SuperController::redirect`, reading `req[method]` i.e. the parsed query/body), so `GET /<any-route-whose-action-redirects>?error=<img src=x onerror=…>` answered a 500 whose body carried the tag RAW and executed it in the application's origin — DRIVEN on a booted bundle (`content-type: text/html`, payload present, `&lt;img` absent) and **not scope-gated**: only the two `stack` blocks carry `_isLocalScope`, which is the control for its absence on the others. ⚠️ **A 1-arg call whose PAYLOAD is FALSY is not a late call (#B560, 2026-09-18, own commit).** The `#B44` guard bails on `!res`, written for the 2-arg/3-arg shapes where `res` IS a possibly-released `local.res`; but in the 1-arg `throwError(err)` shape that slot holds the CALLER'S payload, so `''`, `null`, `undefined`, `0` and `false` were all read as late calls and SWALLOWED — no writeHead, no end, request never answered, and the only trace a warning claiming the response had been released followed by NO error text (its interpolation reads `msg`/`code`, never `res`). Reachable from CONSUMER code, not just the framework: an app calling `self.throwError(err)` with a falsy err hung that request. Fixed by normalising a falsy 1-arg payload to a minimal errorObj BEFORE the guard. ⛔ Do NOT 'simplify' that to `arguments.length !== 1` on the bail itself: the errorObject build derefs `res.error`/`res.message` unguarded, so letting a null through turns a silent hang into a TypeError crash. Genuine 2-arg/3-arg late calls and 0-arg calls still bail unchanged; measured red-first, `''`/`null`/`0` went `ret=false`+no-egress → `writeHead:500`+`end`, with a non-empty payload egressing on BOTH sides as the control. Twins measured UNAFFECTED: `core/server.js`'s has no bare `!res` bail, and `helpers/context.js`'s shifts by ARITY, never truthiness. **That gate is now DELETED (#B559, 2026-09-18 — SECURITY, present in every released version back to `v0.1.6`):** a request parameter must not steer control flow. `req[method]` is CLIENT-populated (`server.js` assigns `request.get = request.query`, and `request.post` from the parsed body), so ANY unauthenticated request to ANY route whose action redirects could force a 500 by adding the key — both engines, no route opt-in — and an EMPTY value was worse: the empty string is falsy, so throwError's `#B44` late-call guard mistook it for a call on an already-released response, logged `ignoring late error:` with NOTHING after the colon, and returned with NO egress, leaving the request UNANSWERED for as long as the client held the socket; nothing reaps that (`server.timeout` defaults to 0, deliberately, so SSE/WS are not cut off), and the hang limb needs that guard so it dates from `v0.5.3`. DRIVEN live before/after on a booted bundle, every arm paired with a control that had to keep its pre-fix value: GET `?error=X` 500→302, GET `?error=` HANG→302, POST body `error=X` 500→303, POST body `error=` HANG→303, while plain GET stayed 302 and plain POST stayed 303. The key is now an ordinary parameter and rides `inheritedData` like every other one — which is what the published `controller.md` "carrying request data across the redirect" example always documented; that example could NOT work as written while the gate stood, since it assigns the key on the request and redirects one line later. Origin: no design — the condition was written in 2021 to `delete` the key so it would not ride the target URL, was removed, and came back in 2022 with a `throwError` where the `delete` had been, inside an unrelated omnibus commit with no comment. ⚠️ Cite this by SYMBOL, never by line: the original `controller.js:3540-3543` citation rotted ~33 lines inside a single release and misdirected a later session. Reach is narrower than "any URL" and was measured: the route must EXIST and its action must call `redirect()` (a 404, a different query key, and a non-redirecting 200 route all reflect nothing), but a newly scaffolded bundle declares no `errorFiles` (`core/template/boilerplate/bundle/config/templates.json`) so it hits precisely this inline page. Fixed by escaping at the emission point — `& < > " '`, null/undefined ⇒ `''` — across ALL SEVEN `msgString` sites in `controller.js` (the five non-stack plus both gated `stack` blocks, gates untouched), BOTH transports of the engine-attached twin in `core/server.js` (whose `msg` its 404/403/500 callers build from `req.url` / `headers[':path']` — raw for any client that can send a literal `<`, which a browser cannot in a URL, so that half is hardening rather than a driven vector), and the THREE error-document fallbacks in `controller.render-nunjucks.js` (`_absErrTemplate`, `readErr.message`, `renderErr.message`, plus each `<title>` status, which #B466 showed can be a caller-supplied value). Three byte-identical `_escapeHtml` local copies, the deliberate `_mintErrorRef` duplication discipline (controller.js is evicted per request in dev, so a shared home would churn), pinned identical by the test. **Consumer-visible behaviour change:** an application that deliberately passed HTML in an error title/message now sees it escaped — that reflection WAS the vulnerability, so there is no opt-out; of 196 framework-side `throwError(` call sites in `core/`, zero pass markup (needle validated against a synthetic positive). ⚠️ A consumer custom error template rendering `{{ data.message }}` remains a SEPARATE unescaped sink, because `settings.swig.autoescape` defaults to false — consumer-owned, unchanged by this fix. Server-side only, NO dist rebuild (measured: none of the three files appears in the browser `build.json`, controls `lib/merge`/`lib/routing` at 1 each; pickup is a bundle restart). Tests: `test/core/throwerror-html-escape-b554.test.js` (14 arms — source pins across all three files + the helper executed as shipped bytes + the page DRIVEN through `createTestInstance`; red-first 11/3). Two authoring traps this paid for, both documented shapes firing on the fix's OWN comments: the replace-code `// was:` lines reproduced the `\n\nref '+ ref +'` tail that `error-ref.test.js` counts over raw source expecting exactly 2 (own-comment trap ⇒ the comments elide the unchanged tail), and a 5-line note pushed two message literals outside `render-engine-dispatch.test.js`' 700/500-char distance windows (⇒ the in-window notes are one line each). **A `fallback` on the error is answered by a redirect, never dropped (#B783, 0.7.4).** For an XHR request, or a route that renders no template, throwError hands an error carrying `fallback` (a URL string, or a route object from `lib.routing.getRoute()`) to `redirect()`. `redirect()` answers an XHR request that carries params, or a popin request, with the `isXhrRedirect` JSON through `renderJSON()`, and `renderJSON()` writes nothing while the controller is marked as processing an error (`isProcessingError`), a mark throwError had already set — so that request was never answered and its client waited until its own timeout (measured live: POST, PUT and GET XHR requests with params, and a popin request; non-XHR requests and XHR requests without params got their 301/303). throwError now clears the mark before the hand-off. Test: `test/integration/container-boot-throwerror-fallback-b783.test.js` (a source pin plus a booted bundle; red-first 5 failing / 7 passing on the pre-fix tree). **A route-object fallback, and any `self.redirect()` to an absolute URL on a dot-less host, now redirect (#B794, 0.7.4).** redirect() decides whether its target is an absolute URL or a route name with a test that required a dot in the host, so `http://localhost:<port>/…`, a single-label host or a bracketed IPv6 address was taken for a route name and answered 404 naming the CURRENT url — which is what a route-object fallback's `toUrl()` returns on a bundle served from `localhost`. The test now also accepts any `scheme://host[:port]` followed by a path, a query, a fragment or the end (anchored, so route names and relative paths are still refused, and every value the old test accepted still is). **A one-argument error object keeps its `message` and its `ref` (#B518, 0.7.4).** The one-argument build kept only `status` and `error` of a plain object, and only `message` and `stack` of an Error, so a plain object's sentence reached neither the JSON body, the fallback page nor the #ERRREF line (which logged only the status text), and a `ref` on either was re-minted, while the two- and three-argument forms carried both. The visible victim was the relay between bundles: `self.query()` hands its callback the upstream's JSON error body as a PLAIN OBJECT `{ status, error, message, ref }`, so `return self.throwError(err)` answered without the upstream's sentence, under a ref that matched no upstream log line. The build now copies a non-empty string `message` and any `ref` it did not already set (after the ApiError merge `errorObject` IS the caller's object, so nothing is written there); the ref still passes the relay-safe check where it is minted, a stack-bearing message is still cut outside local scope (#B670), and `error` is unchanged. Where `error` and `message` carry the same text the fallback page shows it twice, as a one-argument Error already did. The fast lane's `ctx.error()` mirrors the rule (lib/lane `buildErrorObject`; its parity is pinned by `test/lib/lane-writers.test.js` §05). Tests: `test/integration/container-boot-throwerror-plain-object-b518.test.js` (a booted bundle, the `self.query()` relay included; red-first 5 of 12) and `test/core/throwerror-plain-object-b518.test.js` (the page, the cut outside local scope, the pairing line, the lane; red-first 12 of 19). **The custom error page is dispatched at most once per request (#B842, 0.7.4).** On an HTML request the server-side `throwError()` (core/server.js) dispatches the bundle's error page through `router.route()`; when building the error-page controller raised, the router's catch (`serverInstance.throwError(response, 500, err.stack)`) re-entered `throwError()` for the same request, which dispatched again: a synchronous cycle until the call stack overflowed, no answer, and the bundle exited (code 143) on Node 22, 24, 25 and 26 (measured with test doubles over the request-data parse; no real input is known to raise there). The render-time guard (`isRenderingCustomError`) never fired: the raise precedes render. The dispatch now sets `_req._ginaErrorPageDispatched = true` on the line before `router.route()`, and its test reads `!hasMiddlewareException && !_req._ginaErrorPageDispatched`; a marked request falls through to the existing built-in page, answered under the ref of the call that answers (its pairing line carries the dispatch failure, and the first error's line carries the same request id). The mark is a PROPERTY of the request object `throwError` already resolves (`res.req`, else the request slot), because `test/core/server-throwerror-request-scope-b806.test.js` builds `throwError` with `new Function` and a FIXED parameter list, where a new closure identifier would fail; and it is never cleared: at most one error-page dispatch per request, which also bounds a later call after the dispatch returned. The controller-side twin is unchanged: it calls `renderCustomError` directly, not through the router, and that method sets `local.options.isRenderingCustomError` at its start. Tests: `test/core/server-throwerror-reentry-b842.test.js` (the extracted function with a router stub that raises and re-enters; red-first 6 of 10, 50 dispatches at the stub's cap) and `test/integration/container-boot-error-page-reentry-b842.test.js` (a booted views bundle: POST form, POST JSON and PATCH form cells answered 500 with the built-in page, beside a control still served the custom page; red-first 3 of 5 on Node 22, 24, 25 and 26); on Express 5.3.0 (Node 25, the #B793 driver) the same cells read no answer and exit 143 before the fix and the built-in page after it.
921
923
 
922
924
  175. **Dev-mode hot-reload & module lifecycle — what reloads, what doesn't, and the `require.cache` poisoning antipattern** (replaces individual entries #22, #25, #28, #34, #104) — in dev mode (`NODE_ENV_IS_DEV` set; `isCacheless()` true) the framework hot-reloads code via two functions with DIFFERENT triggers: `refreshCoreDependencies()` (`core/router.js`) evicts and re-requires the controller pair ONLY when the dev watcher has marked a watched file dirty (`__hotReload` flags; watched: `controller.js`, `controller.render-swig.js`, and the bundle's `controllers/` directory; falls back to per-request eviction when the watcher context is absent), while `refreshCore()` (`core/server.isaac.js`, isaac engine only) re-exports core-path modules and re-requires `lib/index.js` + `plugins/index.js` on EVERY request. Consequence for controllers: module-level state (`var store = {}`) resets whenever a watched file changes (not per request) — for in-process state that survives hot-reloads (but resets on `bundle:restart`) attach to `global` (`if (!global.__myStore) global.__myStore = {}; var store = global.__myStore;`); for durable state use a database or file. NOT hot-reloaded (a full `gina bundle:stop` + `bundle:start` or `docker restart` is required): `server.js` / `server.isaac.js` / `server.express.js` (loaded once at process start, never evicted); connector code (`core/connectors/*/index.js`, loaded once via entity registration, outside the refresh scope); and bundle-registered plugin middleware — the `onInitialize` → `app.use(gina.plugins.X(...))` factories run ONCE at bootstrap, so a plugin config change needs a bundle restart in BOTH dev and prod, despite the misleading per-request refresh cue. Correctness invariant for any eviction code: `require.cache[path]` must hold a `Module` instance — `require.cache[path] = require(path)` poisons the slot by storing the bare exports object (no `.exports` key), so the next plain `require()` of that path returns `undefined`, surfacing as `Cannot read properties of undefined (reading '<X>')` after a hot reload; use `delete require.cache[require.resolve(path)]` + the `require()` return value, or swap `require.cache[c].exports = require(path)` on the existing Module — never the bare assignment. **The eviction cycles also leaked the whole module graph (#B32, folds former #173):** Node pushes every cache-miss require's fresh Module onto the REQUIRING module's `children` array and dedupes only on cache hits, so the per-request delete-and-re-require cycles accumulated one dead Module per eviction on long-lived parents — each pinning its entire evaluated exports graph (~1.8 MB post-GC live heap per request on a minimal dev bundle; heap-limit OOM/SIGABRT at ~2400 requests, presenting upstream as HTTP/2 PING timeouts, then ECONNREFUSED, then a supervisor respawn loop that keeps every process cold). Fixed by a `pruneDeadModuleChildren()` sweep at the end of BOTH eviction cycles — `children` is diagnostic metadata (nothing in Node resolution reads it), so pruning never unloads a module still referenced elsewhere; prod was never affected (no eviction + cache-hit dedup). The sweep walks `require.cache` keys ONLY, so a second residual of the same class existed OFF-cache: hot-evicted leaf/singleton libs captured at gen-0 by load-once modules and re-required per request pushed dead children onto the evicted-but-retained gen-0 parent, prune-blind — those libs are plain-`require`d now (never evicted → cache-hit → children deduped), and a completeness audit closed the gen-0-binding class. Rules: any new delete-`require.cache` + re-require cycle in a long-lived process must end with the prune sweep; a hot-evicted lib captured as a gen-0 binding by a load-once module leaks PAST the prune — plain-require leaf/singleton libs that don't need hot reload. **`requireJSON` has NO cache in ANY mode** — every call is `fs.readFileSync` + comment strip + `JSON.parse` (its dev-mode `require.cache` eviction touches a cache it never fills), so never call it per request in bundle code; read a config once at module load or in `onReady`. The framework's own env template (`core/template/conf/env.json`) is parsed once per process and shared read-only by every `Config` instance since #B610 (0.6.33) — before that, `new Config()` (which runs three times per request) re-read it twice per construction, six disk reads per request.
923
925
 
@@ -929,23 +931,23 @@ Dev-mode query instrumentation captures every database query tied to the current
929
931
 
930
932
  184. **`~/.gina` state files must be written ATOMICALLY (temp + rename) — a truncate-in-place `fs.writeFileSync` lets a concurrent boot read a torn/empty file and crash (#B43, 2026-06-14, commit `519788ea`).** The five state files (`main.json`/`projects.json`/`settings.json`/`env.json`/`locals.json`) were written with a bare in-place `fs.writeFileSync(target, data)` at the two write sites — the StateStore JSON sidecar (`lib/state.js` `this.write`) and the legacy fallback (`lib/generator/index.js` `createFileFromDataSync`, the single chokepoint for all ~150 state-file writes). `writeFileSync` opens with `O_TRUNC` (target → 0 bytes) then streams, so a concurrent reader catches either an EMPTY file (the post-truncate window, payload-size-independent) or a PARTIAL one (mid-`write()`, widening with file size). Every state-file READ path is FATAL on a parse failure: `requireJSON` does `console.emerg` + `process.exit(1)` for non-`/controllers/` paths, and the more common plain `require('*.json')` boot reads (`gna.js`, `config.js`, framework `start.js`, six `init.js` sites) throw an uncaught `SyntaxError` → process death. So a concurrent fleet boot (many bundles/containers booting against one `~/.gina`) intermittently crashed when a reader caught a writer mid-write; the supervisor respawned and a later non-concurrent read succeeded, presenting as an intermittent crash. MEASURED with a concurrent reader/writer race on the exact `fs.writeFileSync` primitive (empty + partial reads → `JSON.parse` `SyntaxError`; the empty-read window is always present, the partial window widens with file size). Fix: both sites write a same-dir temp (`<target>.<pid>.<seq>.tmp`) then `fs.renameSync` — `rename(2)` is atomic within a filesystem, so a reader sees the complete old file or the complete new one, never a torn one; `chmod` the temp before rename, unlink-on-failure + rethrow. The SQLite `INSERT` was already atomic — only the JSON sidecar that readers consume was torn. Because `createFileFromDataSync` is the single write chokepoint, the two edits close the window for ALL readers (`requireJSON`, plain `require`, `gina-container`'s raw `JSON.parse`). A reader-side retry in `requireJSON` was DECLINED — it covers only the `requireJSON` minority (not the plain-`require` majority), defends a window the write fix already closes, and pollutes the hot general-purpose helper while masking genuine corruption. Rule: any `~/.gina` state-file write goes through the atomic temp+rename, never a bare in-place `writeFileSync`. Tests: `test/lib/state-atomic-write.test.js` (block-scoped source pins on both sites + fs-spy behavioural on the real generator legacy + StateStore sidecar paths + the deterministic torn-read consequence).
931
933
 
932
- 189. **A render delegate must hold ALL per-request state FUNCTION-scoped — in prod the delegate module is a shared singleton across concurrent requests, and any module-scoped capture races (#INS10 `8674c514` 2026-06-17; sweep completed by #B61/#B62/#B63 `1b3abd97`/`2a838c1b`/`1bd0bcf1`, 2026-07-03).** Module-scoped deps are reassigned by every incoming call, and two overlapping renders BOTH suspend at their first await before either resumes, so the first deterministically resumes with the second's bindings. #INS10 function-scoped `self`/`local` in the swig delegate (the post-await Inspector emit carried the other request's `_queryLog`/`_timeline`) but deliberately left getData/hasViews/setResources/SwigFilters/headersSent/cachePath module-scoped, claiming they are "read before the first await" — MEASURED FALSE: the setResources call and the `merge(data, getData())` restore run AFTER the template-read await, so request A's resume executed request B's closures and gap-filled B's page data (session card included) into A's render context (#B61; the engine ref was also an implicit global). The streaming delegate's fire-and-forget IIFE read module `self`/`local` after its `for await`: a finishing stream nulled the CONCURRENT request's `local.req/res/next` mid-stream (routing its later renders into the released-response guards) while never releasing its own, and reported stream errors through the wrong controller (#B62). The JSON delegate's writeCache resumed from its writeFile await reading module `self`, routing a cache-config error through the concurrent request's controller (#B63 — writeCache now takes `req`/`res`/`cacheIsEnabled`/`throwError` as parameters, the same threaded shape as the swig cache writer, and the write-only module `cachePath` is removed as dead). All live delegates are now free of module-scoped per-request state (nunjucks + the async ALS variants always were; the legacy v1 delegate keeps the old pattern but is dead code — never dispatched); each delegate's test file pins the discipline (module prefix declares no per-request vars) plus an interleaved-replica subtract reproducing the measured asymmetry. All three server-side only — no dist rebuild. Rule: in a shared-singleton delegate, per-request state is function-scoped, PERIOD — never adjudicate per-variable "only read pre-await" inertness (that claim rotted once and measured wrong); module-level helpers take render-scoped values as parameters. Sibling render-cache discipline (folds former #96): the dev-mode per-template layout cache primes with ATOMIC temp+rename at BOTH cache-write sites — the old delete-then-rewrite opened a window where a concurrent render of the same URL caught an absent file (intermittent ENOENT 500s on parallel bursts to one URL; production unaffected — cached mode skips the delete). Any "delete then rewrite a shared file under concurrent renders" pattern takes the same fix; per-process unique temp names avoid TOCTOU on the temp itself. Tests: `render-swig.test.js` §21, `render-stream.test.js` §12, `render-json.test.js` §04, `render-xml.test.js` §10.
934
+ 189. **A render delegate must hold ALL per-request state FUNCTION-scoped — in prod the delegate module is a shared singleton across concurrent requests, and any module-scoped capture races (#INS10 `8674c514` 2026-06-17; sweep completed by #B61/#B62/#B63 `1b3abd97`/`2a838c1b`/`1bd0bcf1`, 2026-07-03).** Module-scoped deps are reassigned by every incoming call, and two overlapping renders BOTH suspend at their first await before either resumes, so the first deterministically resumes with the second's bindings. #INS10 function-scoped `self`/`local` in the swig delegate (the post-await Inspector emit carried the other request's `_queryLog`/`_timeline`) but deliberately left getData/hasViews/setResources/SwigFilters/headersSent/cachePath module-scoped, claiming they are "read before the first await" — MEASURED FALSE: the setResources call and the `merge(data, getData())` restore run AFTER the template-read await, so request A's resume executed request B's closures and gap-filled B's page data (session card included) into A's render context (#B61; the engine ref was also an implicit global). The streaming delegate's fire-and-forget IIFE read module `self`/`local` after its `for await`: a finishing stream nulled the CONCURRENT request's `local.req/res/next` mid-stream (routing its later renders into the released-response guards) while never releasing its own, and reported stream errors through the wrong controller (#B62). The JSON delegate's writeCache resumed from its writeFile await reading module `self`, routing a cache-config error through the concurrent request's controller (#B63 — writeCache now takes `req`/`res`/`cacheIsEnabled`/`throwError` as parameters, the same threaded shape as the swig cache writer, and the write-only module `cachePath` is removed as dead). All live delegates are now free of module-scoped per-request state (nunjucks + the async ALS variants always were; the legacy v1 delegate keeps the old pattern but is dead code — never dispatched); each delegate's test file pins the discipline (module prefix declares no per-request vars) plus an interleaved-replica subtract reproducing the measured asymmetry. All three server-side only — no dist rebuild. Rule: in a shared-singleton delegate, per-request state is function-scoped, PERIOD — never adjudicate per-variable "only read pre-await" inertness (that claim rotted once and measured wrong); module-level helpers take render-scoped values as parameters. Sibling render-cache discipline (folds former #96): the dev-mode per-template layout cache primes with ATOMIC temp+rename at BOTH cache-write sites — the old delete-then-rewrite opened a window where a concurrent render of the same URL caught an absent file (intermittent ENOENT 500s on parallel bursts to one URL; production unaffected — cached mode skips the delete). Any "delete then rewrite a shared file under concurrent renders" pattern takes the same fix; per-process unique temp names avoid TOCTOU on the temp itself. Tests: `render-swig.test.js` §21, `render-stream.test.js` §12, `render-json.test.js` §04, `render-xml.test.js` §10. **#B833 (0.7.4) — the template path is confined against a REQUEST-supplied `..`:** render-swig's CVE-2023-25345 guard only inspected `file.charAt(0)`, so a `..` in the MIDDLE of a `param.file` resolved outside the bundle template root (arbitrary `.html` read, CWE-22), and the namespace branch had no guard at all. The fix is at the fill site, engine-agnostic: `lib/routing` checkRouteParams substitutes a placeholder value from `request[method]` (query+body merged) into `param.file`/`.path`/`.namespace` AFTER the URL-segment requirement matched, so a query value of the same name overrode a requirement-validated segment — a request value that would escape as a path component (a `..` segment or a leading separator) is now rejected (throws the `[CVE-2023-25345]` block) before it fills a filesystem-path param. Developer-authored static `../` prefixes in `param.file` are not request values and are untouched. Pinned by `test/integration/container-boot-param-file-traversal-b833.test.js` (red-first: the query vector leaks on the pre-fix tree). **#B867 (0.7.4) — confined again at the render boundary, for the paths the fill never sees:** a controller passing a request value to `self.setTemplate()` or writing `req.routing.param.file` in its action. Both sync delegates now resolve the path they are about to read and refuse one outside the section's `template.html` root (500, `[CVE-2023-25345] Path traversal attempt blocked: the template path of route …` — the message names the rule, never the request value), separator-anchored and lexical (a symlinked `bundles/<b>` prefix is shared by both sides, so never `realpath` only one): render-swig checks the FINAL `path`, after `_()` and the ext append (`_()` normalises BEFORE turning `\` into `/`, so a `%5C`-separated `..` used to survive to the read; for a leading `.` the old first-character check validated one path but read another, relative to the cwd) and also refuses a path still holding a `..` segment (one that survives `_()` came from a backslash-separated value, and the read resolves it AFTER following a symlink inside the root — `linked\..\x` passed the lexical comparison and read the symlink target's parent), and render-nunjucks checks `path.resolve(root, rel)` before its existence pre-flight (nunjucks 3.2.4's loader tests `indexOf(root) === 0` with no separator, so a sibling `html2/` passed). Custom error pages are exempt on the OPTIONS flag renderCustomError sets (they live in `<sharedPath>/errors`), never on a render-data flag; the async delegates were already confined by `lib/template-loaders`' segment check. A bundle that renders templates outside `html` widens `html` (e.g. `${templatesPath}`). Pinned by `test/integration/container-boot-template-containment-b867.test.js` (red-first: its escape arms leak on the pre-fix tree, and with the `..`-segment rule removed only the symlink arm leaks).
933
935
 
934
936
  205. **AI token streams surface live in the dev Inspector via a per-request signal threaded through the query-attribution ALS, delivered both live (`inspector#token` SSE/WS) and as an end-of-request snapshot (`user.aiStream`), and shown in a new SPA "AI stream" tab (#AISTREAM, 2026-06-24).** The AI connector's `getModel('<name>').stream(messages, options)` — a fresh EventEmitter per call (ordered `start`/`delta`/`done`/`error` + an `.onComplete(cb)` shim; `infer()` stays byte-identical) — gained a gated instrumentation layer that, under `NODE_ENV_IS_DEV` OR an open `process.gina._inspectorWindowUntil`, grabs the request's `_devAiLog` buffer (a SIBLING of `_devQueryLog` on the SAME `process.gina._queryALS` store, seeded at `controller.js` `setOptions`), pushes one entry, and attaches emitter listeners that mutate it via closure AND `process.emit('inspector#token', frame)` per phase — keeping the provider paths + `infer()` pure. Delivery: a `server.isaac.js` SSE forwarder (`event: token`) + a `server.js` WS forwarder (`{event:'token', data:frame}`), both deregistered on close; the `user.aiStream` snapshot is attached at 5 render sites (render-json + inspector-window-emit on `_gdUser`, render-swig cache-hit/miss + render-nunjucks on `data.page.aiStream`). The SPA tab (`inspector.js`): a NEW `appendTokenDelta(frame)` accumulates a SINGLE-SLOT module buffer keyed by `frame.id` (reset on a new id — the snapshot carries every stream of the request, so the live tail only needs the current one), wired at all 3 agent receive sites (the WS `onmessage` reads `frame.data` directly; the two SSE paths `JSON.parse(ev.data)`); a `renderTab` `case 'stream':` renders the snapshot, and the `!ginaData` early-return is special-cased so the live buffer still renders before any snapshot exists. **Three carry-forward rules:** (1) untrusted model output (live frames AND the snapshot's `prompt`/`text`) is rendered via `.textContent`, NEVER `.innerHTML` — XSS-safe by construction, no escHtml; (2) `token` is the SSE/WS event NAME, never a payload KEY — `lib/inspector-redact` wholesale-redacts a bare `token` key, so counts ride as `outputTokens`/`promptTokens` and chunk text as `deltaText`; (3) the prompt + chunk text ride the wire ONLY when `settings.inspector.ai.captureText` is true (default off, seeded onto `process.gina._inspectorAiCaptureText` at boot) — metadata is always captured. Inspector SPA files are COPIED verbatim to `dist/` (no minify, no `.br`/`.gz`) so an inspector-only src edit cannot drift `gina.min.*`; rebuild prod with the CI sass/csso/rjs flags and the dist diff is just `inspector/{inspector.js,index.html}`. Adding a tab means updating the 3 `TAB_LAYOUTS` presets — which trips the §44 exact-tab-set pins (now 7 tabs) — and the SPA-side `tryAgentWS` token branch shifts §77's fixed `wsFnBlk()` window (converted to an end-anchor on the next function). Tests: `test/core/ai-stream-inspection.test.js` (§07 SPA wiring + §08 markup/dist propagation) + `ai-connector.test.js §08-§11`.
935
937
 
936
938
  206. **Observable application events surface in the dev Inspector via a per-request signal that mirrors #AISTREAM — `self.emitEvent(name, metadata)` (controller) or `lib/inspector-events.emit()` (model/service code) pushes a `{type:'event',id,name,t[,meta]}` entry and emits a live `inspector#event` frame, delivered as an `event: event` SSE/WS frame plus a `user.events` end-of-request snapshot, shown in a new SPA "Events" tab (#EVTBUS, 2026-06-29).** The per-request buffer `_devEventLog` is a THIRD key on the shared `process.gina._queryALS` store (sibling of `_devQueryLog`/`_devAiLog`, seeded at `controller.js` `setOptions`); `emit()` reaches it via `getStore()` so the snapshot is captured from any code in the request's async context (outside one — a background job / lifecycle hook — the live frame still fires but no snapshot is pushed, per Slice 2b below; a closed gate or invalid name is a no-op). Capture is gated on `NODE_ENV_IS_DEV` OR an open `process.gina._inspectorWindowUntil` (identical to the query/AI gates). The event NAME + framework stamps always ride the wire; the caller's `metadata` VALUES ride ONLY when `settings.inspector.events.captureArgs` is true (default off, seeded onto `process.gina._inspectorEventsCaptureArgs` at boot) — `lib/inspector-redact` matches secret-NAMED keys only and cannot sanitise arbitrary arg VALUES, so the gate + opt-in + authenticated channel are the protection, never redaction (same contract as #AISTREAM `captureText`). Delivery: a `server.isaac.js` SSE forwarder (`event: event`) + a `server.js` WS forwarder (`{event:'event'}`), registered/deregistered beside the data/log/token listeners; the `user.events` snapshot is attached at the SAME 5 render sites as `user.aiStream` (render-json + inspector-window-emit on `_gdUser`, render-swig cache-hit/miss + render-nunjucks on `data.page.events`), gated on `local._eventLog.length`. **Three carry-forward facts:** (1) the SPA `appendAppEvent` ACCUMULATES a capped rolling buffer (NOT single-slot-reset like `appendTokenDelta` — events are discrete, not one token stream), renders via `.textContent` (untrusted app text), and the `renderTab` `case 'events':` prefers the live buffer then falls back to the request snapshot; (2) the live `event: event` frame rides isaac-SSE + server.js-WS, and (#AISTREAM/#EVTBUS parity gap CLOSED 2026-06-29) the server.js HTTP/1 SSE `/_gina/agent` handler now forwards token + event too via `response.write` (mirroring isaac's `_agWrite` shape) — all three live transports now carry all four frame types and `event-inspection.test.js §08` is a positive pin; (3) `event` is NOT an EventSource-reserved name (unlike open/message/error) so `event: event` is collision-free. Adding the 8th SPA tab updates the 3 `TAB_LAYOUTS` presets → trips `inspector.test.js §44`'s exact-tab-set pins (now 8 tabs, updated with approval). `lib/inspector-events` registered via `_require` (stateless). There are zero pre-existing app/domain events in the framework (the only `process.emit` namespaces are `inspector#`/`logger#`/`gina#`, all internal), so the emit API is the headline — without it the signal surfaces nothing. Slice 2a (SHIPPED 2026-06-29): a curated allow-list (`settings.inspector.events.topics`, default `[]`) bridges entity-trigger emits onto the live signal via a gated block in `entity.js`'s `emit` chokepoint — skips `error`, gated on a non-empty allow-list FIRST (the opt-in IS the flood control), ships a framework-controlled `{ok,error}` summary (never raw rows; captureArgs-gated like all metadata — name+source always ride, the `{ok,error}` summary reaches the wire only when captureArgs is on, default off) tagged `source:'framework'` (a new optional 3rd arg to `inspector-events.emit` + an exported `matchTopics` helper: exact / single leading-or-trailing `*`); reached via `require('lib/inspector-events')`; request-scoped so it reuses the MVP live+snapshot delivery (no new transport/ALS key/tab). The chokepoint catches every entity emit with ZERO per-instance `.on()` / `ENTITY_MAX_LISTENERS` use (the original deferred note had conflated flood with listener-exhaustion). Only the couchbase connector emits named CRUD (`N1QL:<entity>#<method>`); the other 5 don't, and CRUD is largely redundant with the Query tab — so 2a's genuinely-new value is custom (non-query) entity methods. Slice 2b (SHIPPED 2026-06-29): an emit refactor SPLITS the store-gated buffer push from an always-on live emit — once the gate passes the live `inspector#event` frame fires store-or-not (a no-store background-job / lifecycle caller now reaches the stream; only the per-request snapshot needs a store), return `true`⟺live-frame-emitted / `false` only for gate-closed or invalid-name; this flipped §01 (`:58-63`) and CHANGED the no-op-outside-request contract, deliberately diverging from #AISTREAM (whose live `inspector#token` emit is itself store-gated at `ai/index.js` `if(_aiLog)`). On top of it a connector-lifecycle bridge surfaces a connector's recurring `ready` emit (re-fired on every reconnect) via a single additive `connector.on('ready')` at the construct-once site in `core/model/index.js this.connect` (attached once in the cache-miss branch → no per-reconnect accumulation; the existing `onReady` consumer is a one-shot `once('ready')`; couchbase is the only connector emitting `ready` today, the other 5 use a direct onReady callback; redis session-store connect/disconnect — the only other recurring pair — has no framework seam so it is deferred), live-only (lifecycle events have no request context → no snapshot, exactly the no-store path the refactor unblocked), reusing the same `_inspectorEventTopics` allow-list + `matchTopics` + `source:'framework'` tag + `{ok,error}` summary (no new config key). Tests: `test/core/event-inspection.test.js` (§01 real-module behaviour incl. the no-store live-emit, §02-§09 server wiring, §10-§11 SPA + dist propagation, §12-§14 Slice 2a: source/matchTopics + entity-bridge source-pins/replica + topics seed, §15 Slice 2b connector-lifecycle bridge: model/index.js source-pins + replica). Slices A1a `b2157113` / A1b `bb3103f1` / A1c `4f844bd6`; Slice 2b emit refactor `ea55a489` + connector-lifecycle bridge. Slices 2a + the 2b always-on-emit substrate LIVE-VERIFIED e2e 2026-06-30 (entity op → `inspector#event` frame + `user.events` snapshot; a no-store background emit → live frame), which also corrected the captureArgs note above; the couchbase-specific `couchbase#ready` reconnect→frame e2e is source + unit-replica only (no self-controlled couchbase env).
937
939
 
938
- 209. **FormValidator — engine disambiguation, string inputs, a11y reflection, and live-check message visibility (consolidates former #42/#130/#150/#186/#197).** The live form/data rule engine is `core/plugins/lib/validator/src/form-validator.js` (single source, `isGFFCtx`-branched: runs server-side via `backendInit` AND compiled into the browser bundle) with the client orchestration in `validator/src/main.js` — `framework/v*/lib/validator.js` is a DEAD standalone fluent validator with overlapping `is*` rule names; never edit it for form-rule work (tell them apart fast: the live engine's `isRequired` rejects whitespace-only input, the dead one passes it). Rule bodies must handle STRING inputs — the two DECLARATIVE contexts feed strings (`.value` + urlencoded bodies) — so a typed/numeric rule coerces or parses explicit components, never assumes a typed JS value; but "always a string" is NOT true of every path, and reading it that way shipped #B198 (see below): a JSON request body keeps real Numbers (`JSON.parse` → `req.body`/`req.post`, which the `validator::{}` routing path MERGES into the validated data before spreading array bounds through `apply()`), and `toInteger` leaves `Math.round()`'s real Number on `this.value`, so a `toInteger` → `is*` chain hands the next rule a Number even in the browser — a rule must therefore be correct for a typed value too, not merely tolerant of strings: `isFloat` coerces via `Number()` (#B46); `isDate` builds from explicit mask components + a round-trip check so non-ISO slash masks aren't US-misparsed and impossible dates still reject (#B47); `isDate` returns the FIELD again on its valid path (#B48, 0.5.4 — parsed `Date` preserved on the field's `.value`, the `isDate(mask).format(...)` idiom unchanged), so rule chaining works. ⚠️ **The FIELD keeps the `Date`; the PAYLOAD takes a `yyyy-mm-dd` string, always (#B558, 0.6.32-alpha.2).** Every validator normalises the payload to the validated canonical form (`isEmail` lowercases, `isBoolean` → boolean, `isNumber` → `Number`), so `isDate` normalising is consistent — but `Date` is the one normalised type that does NOT round-trip through JSON: `JSON.stringify` renders it via `toISOString()`, a UTC **instant**, and local midnight at any positive UTC offset is the PREVIOUS day in UTC. So a browser in Paris submitting `2026-09-18` sent `2026-09-17T22:00:00.000Z` and every reader that sliced the date part stored the 17th — silent (the instant is well-formed) and invisible to a server or CI running in UTC. The written shape is mask-INDEPENDENT: the mask governs INPUT parsing, while both `requirementToSchema()` and `dto.date()` already published the field as `{type:'string', format:'date'}` (RFC 3339 full-date, explicitly NOT `date-time`), so the payload now matches the schema gina was already advertising. Consumer-visible: `req.body.<field>` is a string, not a `Date`, and `new Date('2026-09-18')` on a date-only string is UTC midnight, not local midnight. An empty value is adjudicated by `isRequired` ALONE (#B78): the per-rule empty-bypass became unconditional on empty (`if (this.value == '')`, its old `!errors['isRequired']` gate dropped) for `isEmail`/`isJsonWebToken`/`isFloat`/`isInList` — each regating `this.valid = isValid && !errors['isRequired']` — and `isString` keeps the field invalid without recording a second message, so a required-empty field shows ONE message (`is required`) not two, optional empty fields still pass, a filled-but-invalid value still reports its own error, and custom `is` was deliberately excluded by #B78 and re-declined by #B82 — an exclusion REVERSED by #B233 (2026-08-03, 0.6.3, `307721f2`): `is` now carries the same canonical strict bypass (`if ( this.value === '' ) { isValid = true; }`) and the same regate, taking the Shape-A population from four rules to FIVE, so a required+EMPTY field carrying an `is` condition records `isRequired` ALONE instead of also collecting a second `Condition not satisfied`. `isBoolean` joined the same contract at #B235 (2026-08-03, 0.6.3, `aa1c2035`), taking that population to SIX: its pre-switch rescue `errors['isRequired'] && this.value == false` was LOOSE (`'' == false`), so a required+EMPTY boolean field LOST its isRequired error and reported `Must be a valid boolean` instead of `Cannot be left empty`; the rule now takes the canonical strict `=== ''` self-pass, and the rescue moves AFTER the accept-set switch gated on the value having been ACCEPTED (`val !== null`) — which keeps the documented unchecked-but-required-toggle case working, since a recognized `false`/`0` is a present answer, while emptiness returns to `isRequired` alone. Paired in the same commit with #B236, the SERVER-side half: the plugin's `getCastedValue` funneled EVERY value on an isBoolean-ruled field through `/^true$/i ? true : false` BEFORE the engine ran (client AND server — `validate` calls `formatFields` unconditionally), so on the server auto path junk validated CLEAN and PERSISTED as `false` — `nope`, the HTML checkbox default `on` (a CHECKED box storing UNchecked), the strings `1`/`0`, `TRUE`/`True` — and the NUMBER 1 stored `false` where the engine reads it as `true`. The pre-cast now survives ONLY in dynamised-rules mode, where a referenced boolean field must splice into a stringified `is` condition as an unquoted operand (measured NECESSARY: deleting it outright breaks a server `$flag === true` condition); the ENGINE is the single adjudicator on every surface, which is what the routing `validator::` surface always enforced and what the published reference already promised. Disclosed both directions: values that silently stored `false` now ERROR, the number 1 flips its stored value `false`→`true` on a verdict that was already valid, an optional blank boolean field now PASSES instead of erroring, and a required blank field's message changes from isBoolean to isRequired. A sibling server-path crash in the same plugin is fixed by #B234 (2026-08-03, 0.6.3, `7c56565d`): `getDynamisedRules` substitutes in two passes, and the SECOND is a DOM fallback re-deriving each splice value from the live element (`$fields[...].value`) — which `backendInit` calls with `$fields = null`, so it threw `TypeError: Cannot read properties of null` on its FIRST iteration for ANY `$` surviving pass 1: a regex end-anchor in an `is` condition, a `$` inside a human-readable message string, or a `$` in any array-rule element after the first. Plain cross-field `$peer === $me` never crashed, because pass 1 consumes tokens that NAME fields. The loop is now gated `$fields && ...`, joining the #B127 precedent one function later; `validate`'s same-text gate is deliberately left UNGUARDED, being reachable only with a live DOM. Residual, disclosed — and since FIXED (#B239): a `$` token in an ARRAY rule's FIRST argument that names no field (`isInList: ['$100']`) threw one site later at `checkFieldAgainstRules`' `d[<token>].value` — NOT DOM-dependent, so it reached the client too. The substitution is now gated on the token resolving to a REAL field (an existing `d` key with a defined `.value` — two clauses, both load-bearing: an engine-METHOD-name collision like `'$isValid'` resolves to a defined key with no `.value`, and pre-fix spliced the string "undefined" into the rule for a silent wrong verdict rather than a crash); anything else stays LITERAL so strict comparison applies (`'$100'` matches its own literal, rejects non-members with the rule's own error; bare-`$` and mixed elements covered). `$` is therefore the engine's RESERVED cross-field sigil: whether an authored `$` stays literal depends on a runtime field-name collision — a token naming a sibling field is consumed UPSTREAM by getDynamisedRules loop 1, substituted with quoting fit for `is`-condition splices, not array elements (`"yes"` with quotes can never match `yes`), so real cross-field refs in array-rule elements are always-invalid, fail-closed, never-worked, undocumented (the reference scopes `$name` to `is` expressions) — tracked as #B240 (demand-gated; the fix is relocating array-element substitution into checkFieldAgainstRules, whose guarded loop is deliberately preserved as the substrate). This reserved-sigil model is also the #DTO2 `$` guard's CURRENT rationale (the crash rationale is retired — deterministic literal semantics are impossible for any `$`, so toRules() refuses at boot rather than validate collision-dependently). The reversal is measured rather than re-argued: the old bypass was gated on `!errors['isRequired']` — off exactly when #B78 wants it on — beside a two-disjunct guard that was DEAD CODE (`x == '' && x != 0` has no witness), optional+empty ALREADY self-passed through the live else-if, and on required+empty the condition is VERDICT-IRRELEVANT (form validity is `getErrors().count()` and `isRequired` has already errored), so form validity and the request payload are identical in both directions and only the message list changes; the "coercion-sensitive" premise had already been retired by #B199's strict test, which leaves `0`/`false`/`null` as operands that still evaluate the condition. #B82 is neither regressed nor retired — its root `getCastedValue` quoting and its `is()` grammar guard stay necessary and reachable with a FILLED host; #B233 only closes that crash path a second time for an empty HOST, whose condition is no longer compiled at all. Same commit drops the dead `_defaultErrorLabels['isApiError']` entry (zero consult sites: the API path assigns the server's message directly and never calls `replace()`) - but a cross-field `is` (`"$a === $b"`) no longer THROWS when the referenced field is empty (#B82): the client dynamised-rules substitution (`getCastedValue` in `main.js`) now renders an empty referenced operand as a quoted `""` (it was spliced RAW, leaving a dangling `"7654321" === ` that `is()`'s binary-comparison grammar `_SCS_BINARY_RE` rejected -> an uncaught throw that aborted the whole-form validity pass and left the submit trigger ungated on an invalid form, breaking the documented `is`+`isRequired` value-confirmation pattern while the confirm field was blank), mirroring `getDynamisedRules`' own sibling substitution default (`: '\"\"'`); `null`/`undefined` stay raw (already valid operands). Hardening: `is()`'s grammar mismatch now FAILS-THE-FIELD (`console.warn`+`isValid=false`) instead of throwing, so a per-keystroke live check can never abort the gate on a residually-unparseable condition (e.g. a field literally valued `"NaN"`, which the root fix leaves raw). Browser-bundled -> prod dist rebuilt; the `#SCS1e`/`#SCS1h` eval-safety pins target the untouched `_SCS_BINARY_RE`/`_scsParseOperand`/regex-literal constructs, so the hardening flips none of them. **The splice itself was UNESCAPED until #B600-#B602 (gh#77, 0.6.33):** `getDynamisedRules` pastes every referenced value into the STRINGIFIED rule set and parses it back, so a `"`, `\` or control character in a referenced value (a textarea, a password) threw out of the whole pass (client: dead submit; server: the error escaped the plugin), at FOUR sites - `getCastedValue`'s string return AND its number-rule branch, the loop-1 default for a referenced field with no rule, the loop-2 DOM default - each through a STRING replacement that also expanded `$&`/`$'`/`$$`. Every splice is now `quoteForDynamisedRules(v)`, i.e. an escaped quote + `escapeForJsonString(escapeForJsonString(v))` + an escaped quote (the escaper touches ONLY `"`, `\` and U+0000-U+001F, so the splice is byte-identical to the old one for every value that did not throw), through function replacers, with the closing parse guarded (fallback: the rules as declared, which `is()` resolves or fails closed). A number-ruled referenced value splices raw only when it IS a number (typed, or text matching `/^ *-?\d+(?:\.\d+)? *$/` - the padding keeps `" 12"` vs `12` valid as before); other text compares as a string. Note the engine's `isNumber` is LENIENT (`parseInt`: `1"2` and `12abc` pass as the leading number), so a number field's own verdict never discriminates such values - compare `1"2` vs `1"3` instead. `is()`: the string operand is `"(?:[^"\\]|\\.)*"`, decoded with `JSON.parse` (an AUTHORED literal that is not valid JSON, `"C:\dir"`, is read verbatim as before; one that cannot be read at all fails the field, never throws); its own `$` substitution splices `JSON.stringify(value)` through a function replacer; the `(`/`)`/`return` strip runs OUTSIDE string literals only (#B601 - it made `ab(cd` equal `ab)cd`, also on route requirements); and a condition no longer needs an ASCII alphanumeric run to be evaluated (#B602 - `!!!`/`é€` never matched; through `$` tokens the gate saw the token NAMES, so it bit the plugin path and literal conditions only). The client `query` body: a late-resolved token splices twice-escaped and `decodeSplicedQuotes()` restores each spliced literal instead of deleting every escaped quote - byte-identical for any body whose strings carry no backslash (token-wise, so key order survives); an AUTHORED quoted segment holding a valid JSON escape is the one divergence (decoded). **One `$`-token grammar at every site (0.6.33, #B603/#B604/#B606):** `FormValidatorUtil.substituteFieldTokens(text, names, resolve)` — a token is `$` + a field name in scope, the LONGEST name wins in one pass over the original text, a token ends where its name ends provided the next character is outside `[A-Za-z0-9_-]` (so `($a) === ($b)`, `$a===$b`, `$a,` resolve while `$passwordX` leaves `password` alone), names are case-sensitive and RegExp-escaped (`$pw[0]`, `$a+b` resolve), a replacement is never scanned again, and a `$` naming no field stays literal. Before it: the plugin's `getDynamisedRules` replaced one name at a time and re-read the text after each splice, so a value holding `$<otherField>` was substituted twice (#B603 — and the two-argument `is` form re-read the resolved condition through the array-rule scan, which now skips `is`/`is<N>`); its DOM-fallback second loop, which could only act on a `$` a spliced value carried in, is retired with #B234's gate; the engine's `is()` resolved a token only when whitespace or the end followed it and interpolated names unescaped (#B604) — it now resolves OUTSIDE string literals only and never inside a regex-literal condition, so the plugin path's already-spliced literals are not resolved a second time; the client `query` body scanned `\$[-_\[\]a-z 0-9]+` — lowercase-only with a space in the class — so `$passwordConfirm` resolved `$password` + `Confirm` (another field's value on the wire), a prefix pair resolved by body order, and an unknown `$` was sent as the string `null` (#B606). Value semantics per site are unchanged (`getCastedValue`/`quoteForDynamisedRules`, `JSON.stringify`, the twice-escaped `query` splice). The form's validity comes from `getErrors().count()` (the surviving `isRequired` error), never the per-field `.valid` flag (whose only error-dropping reader, `setErrors`, is dead). Length bounds are ARITY-sensitive, and the source JSDoc was WRONG about it until 0.6.3: `"isString": [N]` (same for `isInteger`/`isNumber`) supplies `minLength` ONLY — identical in effect to the scalar `N` — because the exact-length branch fires only when `minLength === maxLength`, so an exact length needs `[N, N]`; the stale comment had propagated verbatim into the published reference page, so correct BOTH surfaces when one is found. Those bounds measure the value's STRING FORM (`val.toString().length`) — until 0.6.3 `isInteger` alone measured a bare `val.length`, which is `undefined` on a real Number, so BOTH its bounds were silently inert on every numeric value: no error, no warn, field left `valid` (#B198, a fail-OPEN bypass reachable from a JSON body, a `validator::{}` requirement, or a preceding `toInteger` — the browser included). `isString` reads the same bare `val.length` at two sites and is CORRECT there because a `typeof(val) == 'string'` guard precedes it, so this class of fix is line-scoped: a whole-file replace of the bound expression hits four sites, two of which must not change. One consequence of measuring the string form, intended: a negative number counts its sign toward the length (parity with the same value arriving as a string). The zero-swallow residual #B198 initially left open is CLOSED by #B199 (0.6.3): loose `== ''` emptiness tests conflated `0`/`-0`/`false`/`[]` with the empty string at FIVE sites — the isInteger/isNumber bounds gates AND the isEmail/isJsonWebToken/isFloat empty-bypasses, where a JSON body's `{"email": 0}` validated as a correct email — all five now compare strictly, so only the literal `''` bypasses (the designed empty-is-adjudicated-by-isRequired contract, preserved byte-exactly); `isString` stays loose behind its typeof guard (operators identical for strings), `isInList` was already strict, and `isDate`'s broader `!val` swallow (a silent half-state: `valid` false, NO error recorded, so the form passes) is deliberately untouched. STILL OPEN sibling (#B200): a TRUTHY non-string in an isEmail/isJsonWebToken field (`{"email": 123}`) hits an unguarded `.toLowerCase()` and the rule driver RE-THROWS, killing the whole validation run — the falsy/truthy non-string space is partitioned between the fixed bug and this one. Custom validators (`bundle/validators/<name>/main.js`) are a BROWSER-ONLY affordance, NEVER a server-side guarantee: the server gate reads `getContext('gina').forms` while the loop it guards reads a bare `gina` that is undefined in Node, so a custom rule never attaches server-side and the engine then silently skips the unknown rule name with no warn — re-validate such constraints in the action. (Publishing that context without also fixing the loop would make EVERY validator construction throw, including for bundles shipping no custom validators.) Since #M21d (2026-09-26) the browser compiles a custom validator as an inline `<script>` — `gina.forms.compiledValidators[<name>]`, one compile per validator per page, carrying the page's CSP nonce when one is set, `//# sourceURL=<name>.js` in DevTools — with NO `eval`, NO `Function` and no `'unsafe-eval'` needed; the scope contract is unchanged (the spliced prologue hands the body `self`/`local`/`isGFFCtx`/`replace` through `this.getValidationContext()`), a file the browser cannot compile throws `[UserFormValidator] Could not evaluate` pointing at the console's SyntaxError, and server-side a FUNCTION registered on the context is attached as it is while a source-shaped one is refused naming the browser-only contract. The bundle build (`core/asset/plugin/lib/js/no-dynamic-code.js`, run by `build` after r.js and again after Closure) also rewrites the two unreachable vendored calls the r.js output inlines — RequireJS `req.exec` (the `load.fromText` transpiler-plugin path) and engine.io-client's `Function("return this")()` global shim — by EXACT match, failing the build if a dependency bump moves them, so the published bundle carries no dynamic-code call at all: Socket's `Uses eval` verdict, which flipped the package score 62 ↔ 42 on identical bytes, has nothing left to fire on (pinned by `test/lib/validator-m21d.test.js` + `test/core/bundle-no-dynamic-code.test.js`). A rule-body edit needs a prod dist rebuild AND flips the section-locked characterization tests by design. Editing trap: `form-validator.js` embeds hidden NO-BREAK SPACE bytes (U+00A0) where a normal space appears inside several `||`/ternary sequences, so a literal-space find/replace spanning one silently fails — patch such regions with a byte-scoped script over clean-ASCII substrings, not a space-spanning match. The blur-time global validation pass sets submit-button state but renders errors ONLY for the touched field — untouched invalid fields stay quiet until interacted-with or submit. Accessibility (#A11Y1): the rule-agnostic chokepoint `handleErrorsDisplay` reflects committed errors into `aria-invalid="true"` (gated on committed-not-warning; `"false"` on clear mirrors native `ValidityState` so it agrees with `:user-invalid`; hidden fields skipped), auto-wires `aria-errormessage` to a gina-owned message div UNLESS the consumer provided their own, focuses the first DOM-order invalid field on a failed submit, and announces blur-time errors via a per-form visually-hidden `aria-live="polite"` region; the per-field aria passes fire only under live-check — the always-on submit pass covers every bound form regardless. Live-region LIFECYCLE (#A11Y2): creation is split out of the announcer into `ensureA11yLiveRegion($form)` and called from `bindForm` — the chokepoint every registration path funnels through — so the region is in the a11y tree from BIND time. It previously created, inserted AND populated the region in one synchronous tick, which reaches assistive tech as a single mutation batch on a node it has never observed, so the FIRST announcement per form (the one that matters most) was the one least likely to be spoken while every later one worked. The region is a CHILD OF THE FORM on purpose: a popin renders its form inside a native `<dialog>` opened with `showModal()`, which leaves everything outside the top layer inert, so a body-level region would go unspoken for exactly the forms that live in popins — the placement is an accessibility constraint, not a convenience. The price of that choice is that a subtree replacement (`$el.innerHTML =` on a popin re-render, a nav fragment swap) destroys it, so `ensureA11yLiveRegion` is create-OR-RECOVER and also re-homes a region whose form node was replaced; any region created or re-homed at announce time is marked fresh and defers its first write one macrotask, so insertion and mutation land in different ticks — that deferral is what stops a recovery from silently repeating the defect, and it is load-bearing because a re-render does NOT always re-bind (`validateFormById` early-returns on an already-registered id, and a multi-form popin's teardown loop splices while iterating so it skips every odd-indexed form). An already-bound region writes synchronously, unchanged; while a deferred write is pending a newer error replaces the pending text so the LATEST message wins, and the timer re-enters the announcer, keeping exactly ONE `textContent` write site. Rule: a live region must be observable BEFORE it is written — separate creation from announcement, and when the same call must do both, put a tick between them. **Submit LIFECYCLE exposure (#A11Y4):** the accessibility signals for an in-flight submit hang off the request window inside `send()` — the only place reached once an XHR genuinely exists — and that placement is the fix for a timing trap, not an accident: the loading state (`data-gina-loading`) is armed at CLICK time, BEFORE validation runs, so a signal hung there would arm-then-disarm on every rejected submit and announce a spurious busy/not-busy pair. Three effects, all scoped to that window. (1) The trigger's focus is captured before gina natively disables it and restored once the request settles: a natively `disabled` control cannot hold focus, so the browser drops focus to `<body>` and re-enabling does NOT bring it back (both measured), which silently cost every keyboard submit its place. The restore is deliberately conservative — only when focus is still on `<body>` and the trigger is still in the document — so a response that opened a popin, redirected, or focused the first invalid field keeps its own focus decision; gina restores what gina took, never more. The `<a>` branch is excluded from the capture: an anchor gets `aria-disabled` from the in-flight lock (since #B312 the framework's only `aria-disabled` write), which does not blur (measured control). (2) The trigger carries `aria-busy` for the request's duration — on the TRIGGER, never the form, because the live region is a CHILD of the form and an ancestor marked busy MAY be treated as "defer announcements in this subtree", which would silence the very channel used to announce; ARIA 1.2 defines no normative behaviour here, so that is a cheap hedge, and the same reading is why `aria-busy` can never substitute for an announcement (it produces none of its own). ⚠️ **Do NOT restate this as "assistive tech commonly defers"** — that wording shipped once and was WRONG: measured 2026-08-05 on VoiceOver/Chrome, an announcement made from inside an `aria-busy="true"` ancestor was spoken normally, so at least that pairing does not defer. The placement costs nothing and still guards ATs that might, but it is a precaution, never a claim about implementations. (3) The start is announced ONCE through the #A11Y2 region; completion announces NOTHING by design, because an errored response is already announced field-by-field by `handleErrorsDisplay` and a second status write over the same polite region in the same beat can truncate it. Announced strings are the framework's own, so they resolve through `gina.config.a11y` with English defaults (e.g. `{ submitting: 'Envoi…' }`) — deliberately separate from `setErrorLabels`, which is keyed by RULE name and owns rule messages. Rule: put a state signal where the state actually begins; a signal armed on intent rather than on the operation announces work that may never happen. **Error-association integrity (#A11Y5):** three fixes sharing one theme — an ARIA assertion is only worth what its target is worth. (a) Hiding the message div used gina's `.hidden` helper (`display: none !important`), which removes it from the accessibility tree entirely — fine for a soft warning, wrong at the TWO hide paths that coexist with an asserted `aria-invalid` (`refreshWarning`'s focus-driven hide, and the refresh re-create), where the field was announced invalid while `aria-errormessage` pointed at an unreachable target. Both now CLIP instead: inline declarations that hide visually but keep the node in the tree, with `display` carrying `!important` because that is what outranks the class's own `!important` (measured — a plain inline `display:block` loses to it); the class is deliberately left in place so consumer CSS keyed on `.hidden` keeps matching. (b) A polite region is announced on CHANGE, so re-writing byte-identical text is commonly not spoken — which is precisely the repeat-error case (blur a field that still fails the same rule). A trailing no-break space now makes the content differ without altering what is read out, and it self-cancels on the next write. NOTE this half is source-derived: the string demonstrably changes, but no assistive-technology pass has confirmed the re-announcement. ⚠️ The same caveat NO LONGER applies to #A11Y2's first-announcement fix — **V1 was CONFIRMED 2026-08-05 on VoiceOver/Chrome** by an A/B whose two arms differ only by a `setTimeout(0)`: the same-tick create-and-write was NOT spoken, the deferred write WAS. So the deferral is load-bearing in practice, not merely defensible in theory; the region-lifecycle discipline above is measured, not inferred. (c) `focusFirstInvalidField` (and its deliberately-duplicated inline twin) gated focusability on `typeof $field.focus == 'function'`, which is TRUE for every HTMLElement — a custom element with neither `tabindex` nor `delegatesFocus` passes it and its `focus()` is a silent no-op (measured), so a failed submit whose first invalid control was such a host focused nothing AND stopped searching. Both loops now confirm `document.activeElement` actually moved before stopping, which is also what makes the JSDoc's "skips unfocusable controls" claim true rather than aspirational. Rule: a capability probe (`typeof x.focus == 'function'`, `'foo' in el`) tests the API's PRESENCE, never its EFFECT — when the effect is what matters, assert the resulting state. Error-MESSAGE visibility has THREE write paths (create / refreshWarning's un-hide / the refresh re-create) and the re-create runs LAST in the live-check pass, so it owns the steady state: it is focus-aware — message hidden while the edited field is the active element, revealed on blur (soft warning border while typing). Rule: when an element is written by multiple paths in a single validation pass, guard the LAST writer — an earlier-writer fix is silently overridden. #B319 (0.6.5-alpha.2): the focus-driven hide is EXEMPT during the framework's own ANSWER focus — both refused-submit paths (the #B246/#B308 display-only reveal via `focusFirstInvalidField`, and the `validate.<id>` failure branch's inline focus twin) render errors then focus the first invalid field, and that focus's synchronous `focusin` re-entered the live-check listener and hid the just-rendered message: a refused submit explained itself only to a screen reader (the #A11Y5 clip kept the node resolvable) while sighted users saw nothing — despite the render itself being VISIBLE (no fieldName ⇒ the live-check branch is skipped, and activeElement is still the trigger/BODY at render time), which is also why an async `query` rule in a repro is incidental (the suppressing dispatch is synchronous inside `focus()`). Fix: a one-shot module flag raised around BOTH focus loops (try/finally, cleared on every exit) gates the focusin arm's `refreshWarning` call; the message stays visible with the hard `form-item-error` styling, aria state untouched, and the first later keystroke re-engages the mid-typing suppression unchanged (in that answered-then-typed configuration the border stays `form-item-error` — the answer focus re-registered the field so `lastFocused` reads it twice and the isWarning heuristic keeps the hard border while the active-element ternary hides the message; the hidden message is the contract, the border there is heuristic). Behavioral lock: `test/e2e/validator-submit-answer-visibility.spec.js` (4 arms, red-first against the pre-fix bundle); browserless pins: `test/core/validator-answer-focus.test.js`. #B387 (shipped in 0.6.11): the one-shot flag covers only that synchronous window — on an async-`query` form with a committed error, a refused submit whose click lands inside the UNDRAINED completion tail of the previous settle had its answer delivered, focused, then re-hidden ~0.2ms later: a stale live-check waiter (woken inside the click's cascade by the reveal pass's deferred release) or the trailing silent global re-validation ran the display-refresh pair AFTER the flag's `finally` had cleared it, and BOTH hide sites key on the same heuristic — "the field is the active element, so the user is editing it" — which cannot tell answer-placed focus from user-placed focus (`refreshWarning`'s error→warning downgrade appends ` hidden`; `handleErrorsDisplay`'s refresh branch re-creates the message born-hidden via its active-element ternary; the occurrence gate is click-inside-the-tail, which is why full-suite/CI runs flaked ~1/20 while standalone runs stayed green). Fix: focus PROVENANCE — a single module slot `answerFocusHold` ({formId, elName}; one slot is exact, only one active element exists) recorded at both confirmed answer-focus points (inside the #B319 windows), consulted by BOTH hide sites for ANY caller however late (provenance beats a pass-staleness latch: the trailing re-validation is a FRESH pass spawned inside the click cascade and would sail through any staleness check), and released on the first genuine user interaction — any TRUSTED native event reaching one of the seven form proxy handlers while the one-shot flag is down (framework `triggerEvent` dispatches are untrusted and cannot release it; the answer's own trusted synchronous focusin is excluded by the flag) — so the deliberate mid-typing suppression re-engages the moment the user actually edits; no timers. Locked by `test/core/validator-answer-focus-hold.test.js` (17 — source pins on every edit site, comment-stripped extracted-real-bytes behavioral arms for both hide sites + the release helper, red-first against the pre-fix bytes; gina.js dist pins) and the §02 e2e arm (25/25 post-fix vs the ~1/20 pre-fix CI red whose signature was `Received: 1` + msgClass `hidden` — a recurrence of that signature is a NEW defect, not #B387). #B348 (shipped in 0.6.11): `revealValidationState`'s completion STARVED on any form whose async `query` field was not declared last — the reveal pass is un-latched, writes neither `isSubmitting` nor `isValidating`, and on a valid form its verdict is clean, so its waiter completion matched NO dispatch branch (terminal errors>0 / the latched dispatch / last-field / the display-only live-check arm): `onDisabledTriggerReveal` never ran, the stale `data-gina-form-submit-gated` marker never re-synced, and a fully valid form ate every later click until reload (measured live: 2 post-settle clicks, 0 POSTs — field declaration order decided whether the documented self-heal worked). Fix: the reveal's callback carries a completion identity (`onDisabledTriggerReveal.isRevealCompletion = true`, the engine's own `cb._data`/`cb._errors` property idiom) and the waiter chain gains ONE else-if chained after the display-only arm, gated on the SAME terminal condition the errors>0 block uses (`hasParsedAllRules && asyncCount <= 0` — the guard that stops a multi-query-field early wake, where the first waiter fires at asyncCount 1): a terminal reveal completion that matched no other branch dispatches `validated.<formId>` with its own cb. Every previously-working shape is byte-identical (errored reveals keep completing via the terminal branch, query-last via last-field, latched submits via the latched dispatch, live-check stays display-only), and the un-latched programmatic-submit starve (#B347) is deliberately untouched — its cb carries no marker and its fix is gated on its own repro. Known residual, pre-existing on EVERY branch: a query field whose own rule object continues past `query` never sets the terminal flag and still starves — same guard as the existing dispatch, no new asymmetry. Locked by `test/e2e/validator-reveal-starve.spec.js` (red-first: the starve arm failed on the pre-fix bundle while the query-LAST control arm passed on the same bytes, pinning the defect to field order; the scene manufactures [valid values + stale gate + stale committed error] deterministically via a prototype-setter silent fill after an errored reveal, with every precondition an explicit expect so an impossible scene voids loudly) and `test/core/validator-reveal-completion.test.js` (9 — stamp/consult/placement pins, extracted-real-bytes reveal arm asserting the stamp as a runtime value, gina.js verbatim pins AND a gina.min.js exact-count pin — unlike a local flag, the property name survives Closure). The not-ready submit trigger is marked `data-gina-form-submit-gated="true"` + the class `gina-form-submit-disabled` (#B312 retired `aria-disabled` from this marker — its contract says not-operable while the #B246 gate deliberately answers the click with the error reveal; authored `aria-disabled` remains enforced by the gates and is never auto-cleared), NEVER native `disabled` (#B76 — a natively-disabled button emits no click, so the validate-render-focus guard could never run); `isValid()` is the real send gate, and **the framework now ships a default not-ready look (cursor `not-allowed` + dim; deliberately no `pointer-events`, which would swallow the click the reveal answers) that consumer CSS overrides**. Form-associated custom elements (FACEs) participate in binding + live-check (#CC2 — hyphenated members of `form.elements`; their own `.value` accessor is honoured, live-check rides the composed bubbling `change`; author contract: `static formAssociated`, a `name` attribute, a `.value` getter, composed `change` on commit). **Radio-group collection (#B221):** an unchecked non-boolean radio group whose rule declares a truthy `isRequired` is collected as an EMPTY value by BOTH collectors (`getFormValidationInfos` + the native-submit inline copy) so `isRequired` adjudicates it via the standard emptiness test — pre-fix no collection arm admitted the shape (each required `.checked`, a `true|false`-shaped value, or an `isBoolean` rule), the DOM handle was held in `$fields` but the VALUE never entered `fields`, so no rule ran against the group and a radio-group-only form short-circuited BOTH submit guards (field count 0 reads as nothing-to-validate → synthetic `isValid() === true`) and submitted its XHR with zero client-side validation. Other unchecked groups stay absent-when-unchecked (native parity: no rule / `isRequired: false` unchanged; `isBoolean`-declared groups keep the force-false arm), checked members post exactly as before, and on the auto path a required-empty form is invalid and never sends — so the wire only changes for the newly-gated shape. Enforcement-tightening: forms that silently submitted with nothing picked now gate on the pick (trigger marked not-ready at bind under default-on live-check — `data-gina-form-submit-gated` + class since #B312 — message on submit attempt, re-enabled after picking). **The re-enable is real only since #B228:** the radio live-check listener was registered under a `changed.<id>` event name nothing dispatches on a user pick — the form-level click proxy short-circuits into the radio state updater (which never dispatches any gina event), and the change proxy dispatches ONLY names present in the event registry, which radios never registered (checkboxes have that registration via their state-updater relay; radios' equivalent relay is keyed on the bare element id, which nothing triggers) — so the whole-form silent pass never re-ran after a pick and the trigger kept its bind-time disabled state indefinitely, while submit-time validation (a separate call chain) accepted the checked group and let the click-guard send: flows completed, only the trigger state was wrong (announced disabled to assistive tech; automation actionability checks refuse `aria-disabled`). Radios now ALSO register the proxy-dispatched `change.<id>` name alongside `changed.<id>` — the handler's radio arm accepted `change.`-typed events all along, so one registration line closes the loop: mouse, label and keyboard picks all re-run the field + whole-form passes (single delivery per pick — native `change` fires only on real state changes; the legacy `changed.<id>` name stays registered for the relay/programmatic path; checkboxes byte-identical). Latent since the live-check's introduction, invisible until #B221 armed it. **A field that DRIVES its own conditional block lost its BASE rules until #B229:** `forEachField`'s per-field tail read `if (isInCase || caseName == field) continue;`, and `caseName` is assigned inside the `_case_` scan loop that re-runs in full on EVERY field iteration, so it always held the LAST scanned `_case_` key's driver name — when the iterated field WAS that driver the `continue` skipped the rest of the iteration, base-rule check included. A rule shape `{ "group": { "isRequired": true }, "_case_group": { "conditions": [...] } }` therefore never adjudicated `group`'s own `isRequired` on the bind pass, the live-check global pass OR the submit pass: the form never gated and an empty submit went out with zero client-side validation — the silent-submit class above, resurfacing for the self-driving shape and structurally DOWNSTREAM of the collection fix (the group IS collected as `''`; only adjudication was missing). The tail is now split: `isInCase` keeps its own `continue` (it is dead code — never assigned truthy — and is preserved as such), and the `caseName == field` arm runs the base-rule check before continuing, restoring the driver's collected value around the call (the check deletes the field from the object it is handed, and that object is where the scan block re-reads the case VALUE on every later field iteration; a deleted entry re-seeds from the DOM, which for a radio group is the FIRST member's value regardless of `.checked`). Which conditions apply is unchanged — the direct-case block is never entered for a self-driving case, pre- or post-fix (measured) — and the fix is order-independent: a driver declared BEFORE another `_case_` block was already adjudicated (the tail's comparison never matched it), so the post-fix union is every driver carrying base rules. Client-only: the server form-body path throws earlier on any `_case_`-bearing rule set (conditional rules are unsupported there). Enforcement-tightening: a form built on this shape starts gating where it silently submitted. Known interplay, pre-existing: on a rule set with NO `$` tokens, a pick whose value matches a `_case_` condition lets the case machinery PERSISTENTLY replace injected fields' rules in the live store (the site-B replacement), so a later `reBind()` can re-arm the gate from the mutated store — `$`-bearing rule sets are immune (the dynamised-rules path clones). **A conditional driver's collected VALUE survives every full-form pass since #B230:** the base-rule check deletes each adjudicated field from the object it is handed, and until #B230 only the last-declared driver's entry was restored (the #B229 arm above) — any OTHER field that both carries base rules and drives a `_case_` lost its stored case value the moment its own rules were adjudicated, so later field iterations re-read it from the DOM (a radio group's FIRST member regardless of `.checked`) and matched conditions against a value the user never picked — spuriously requiring the wrong flow's fields (a correctly-completed picked flow could not submit), or with excluding condition rules under-validating the picked flow — while the driver's own direct-case block read `undefined` in the same pass and matched nothing. The entry is now backed up and restored around the base-rule check for any field driving a `_case_` in the live rules OR the pass-entry rule clone; the union matters because inside a direct-case recursion the pass's rule set is the condition's own rules, which carry no `_case_` keys, so the live-rules test alone is blind there. Non-driver fields keep the deletion untouched (the condition pull-in gate, the direct-case exclude injection and the async-`query` re-validation input all read those absences today), and a driver with no rules of its own is byte-identical — including the legitimate first-scan DOM seed for rule-less unchecked groups, which is preserved. **`setFlash` `[null, "message"]` works client-side since #B226 (the form the reference documents):** it previously lost its custom message in the browser ONLY — `lib/merge` classified a `null` array element as an object (`typeof null`) and dropped it on every no-override merge, and the client rules path re-merges the whispered rules (the `data-gina-form-rule` bind merge, the `gina.hasValidator` instance re-merge, the `_case_` merges), so the engine received a one-element array, bound the message to the ignored first `regex` argument, and rendered the built-in label; `["", "message"]` always survived (empty strings, `false` and `0` are primitives — `null` was the only casualty), and the server was unaffected (it reads the boot-loaded rules without those hops). The fix is in `lib/merge` itself, so no-override merges now preserve `null` array elements as VALUES framework-wide (and the index-merge branch stops manufacturing `{}` from a `null` source element) — a merge consumer relying on the silent compaction sees the `null` slots preserved. **Bracket-notation and nested-authored rule KEYS enforce on the SERVER form-body path since #B241:** the rule parser canonicalizes every rule key to a dotted path (`account[username]` becomes `account.username`; a nested rule tree flattens to its dotted leaves) while the server's fields map kept the RAW posted keys, so such rules never joined — the field was silently skipped with no warning, fail-open for every rule-keyed directive alike: checks (`isRequired`, `isEmail`, ...), the `exclude` drop, and value transforms — on BOTH production wire shapes (flat bracket keys: the client posts its name-keyed data as JSON and the JSON body path deliberately does no bracket expansion; and nested objects: the multipart and urlencoded parsers expand bracket names). The server now synthesizes dotted-canon field aliases ALONGSIDE the raw keys (originals kept, so `$name` cross-field tokens keep resolving off the raw posted names, and an all-flat payload synthesizes nothing — byte-identical behaviour), then folds alias outcomes back at egress: error keys return under the DOM-name bracket form the client renders against, and the validated data output keeps its materialized shape with exclusions and transforms applied (a parent object emptied by an exclusion is pruned along that alias's path only — a posted empty object survives). The client join was always bracket-on-both-sides (a named rule set passes through with its authored keys; nested-authored sets are reconstructed to bracket names at bind time), so this brings the server to parity — quirks included: a caller that posts the dotted key form keeps its own addressing, and the no-rules path still returns the payload verbatim. Behaviour change by design: a bracket-keyed or nested-authored rule that never fired before now enforces — anything relying on the old silent skip starts rejecting or dropping those fields. **Upload previews carry a text alternative (#A11Y7/U1, 0.6.4).** The staged-upload client layer builds its preview `<img>` in two MUTUALLY EXCLUSIVE branches of `onUpload` — one for a file with no server-side `preview` object, one for a returned preview variant — and neither set `alt` at all (not even `alt=""`), so assistive tech fell back to reading the temp URI aloud, once per staged file (WCAG 1.1.1). Both now set `alt` from `files[f].originalFilename`: the name the USER chose, deliberately NOT the sibling `files[f][key].originalFilename` of the preview variant, which is a server-generated artefact that means nothing to the person listening — the same distinction the adjacent `data-upload-original-filename` / `data-upload-preview-original-filename` pair already encodes. The fallback is `''` (a properly ignored image) rather than letting a missing name be spoken as a placeholder. The preview is INFORMATIVE, not decorative: it is the only signal telling a user which file is staged, and everything else in the upload layer is still silent — progress is attribute+`textContent` with no `role="progressbar"`/`aria-value*`, upload errors are an `innerHTML` write with no `role="alert"` that never calls the polite region the plugin already owns, and the reset control is an `<a href="#">` (U2/U3/U5, tracked in the accessibility audit, not fixed here). Maintainer gotcha: the two branches are per-file exclusive, so a one-site fix silently misses every upload whose server returns a preview object — fix both or neither. **A not-ready submit trigger really refuses the send — and its marker is aria-free (#B246 + #B312, 0.6.5).** `updateSubmitTriggerState()` marks an invalid form's trigger with `data-gina-form-submit-gated="true"` + the `gina-form-submit-disabled` class and deliberately never native-`disabled` (a natively-disabled button emits no click at all, so nothing could tell the user WHY it is dead) — and, since #B312, never `aria-disabled`: the gate ANSWERS the click with the error reveal, which that contract forbids for a control announced disabled, so the attribute belongs to consumers (authored marks the gates enforce and never auto-clear) and to the anchor in-flight lock. #B246's origin: NOTHING READ the marker — a click ran the entire submit cycle (collect → validate → `validate.<id>`) and only the `isValid()` gate stopped the send: the trigger was inert in appearance ONLY. `clickProxyHandler` now intercepts a disabled-or-gated trigger BEFORE the `submit.<id>` dispatch — so `bindSubmitEl`'s handler never runs, `isSubmitting` is never latched, and no send path is reachable by construction — and answers the click with a display-only `revealValidationState()` pass that renders every invalid field, focuses the first, and re-syncs the trigger state so a STALE not-ready marker on a form that has since become valid heals itself — the heal touches only the marker + class; authored `aria-disabled` and the in-flight lock survive it (#B313 closed by construction). The predicate `isTriggerDisabled()` reads the CLICKED element rather than `$formInstance.submitTrigger` (a form may carry several submit buttons while only one registers) and mirrors the popin plugin's existing trigger gate on the shared channels (authored `aria-disabled` + native `disabled`), so both subsystems agree there; since #B312 it ALSO fires on the validator-owned not-ready marker `data-gina-form-submit-gated="true"`. **#B293 (0.6.5) NARROWED that predicate: the native `disabled` ATTRIBUTE now counts only where `disabled` is not a real IDL property (`!('disabled' in $el)`).** As first shipped it accepted native `disabled` on ANY element, which silently killed the near-universal double-submit guard: a click listener on the submit button that sets `disabled` to block a second submit is bound to the button and therefore runs BEFORE gina's delegated form-level proxy reaches the gate, so the gate saw the attribute, cancelled the click, and `send()` never ran — then the consumer's own handler cleared the attribute again, leaving NOTHING marked, a normal-looking button, and every subsequent click equally dead. Measured: a natively-disabled `<button>` delivers **no click to JS at all** (the browser suppresses it), so on a real form control that arm could only ever fire on an attribute set DURING the dispatch — it protected nothing and cost everything; on an `<a>` or a custom element the browser enforces nothing, so there the attribute is still the only honest signal and is still read (`'disabled' in $el` measured: button/input `true`, anchor/custom-element/span `false`). Regression cover is an **e2e** (`test/e2e/validator-submit-native-disabled.spec.js`, 4 arms), deliberately NOT a replica: the defect is an ordering interaction between a consumer's own listener and gina's delegated proxy, which only the real bundle handling a real click can exhibit — `test/core/validator-submit-trigger-state.test.js` covers the same gate with replicas and stayed GREEN throughout, including two tests named as controls for the working case. Gotcha for maintainers: `focusFirstInvalidField()` deliberately DUPLICATES the inline focus loop inside the `validate.<id>` guard — that inline shape (`_a11yErrs` / `_aField`) is locked by source pins, so collapsing the two would break tests unrelated to this fix; keep them in step by hand if the focus rule ever changes. **Staged uploads speak (#A11Y7/U2+U3+U5, 0.6.4).** Three defects in one client layer, fixed together because they share one plumbing change. (a) `updateUploadProgressIndicator` wrote `textContent` plus two `data-gina-upload-progress*` attributes and NO ARIA, so any indicator that is not a native `<progress>` was unlabelled text; it now carries `role="progressbar"` + `aria-valuemin="0"` / `aria-valuemax="100"` / `aria-valuenow`, with `aria-valuenow` tracking the percent attribute EXACTLY — absent while `preparing`/`indeterminate` and on `error`, because an absent value is how a progressbar signals "unknown" while a stale or zeroed one reads as real, stalled progress. `reset` strips the ARIA too (it strips everything this layer ever set); `processing` advances the state only, preserving the last value so a determinate bar stays full through the server-side window. A native `<progress>` is deliberately untouched — it already exposes all of this, and an explicit role risks overriding the implicit one. (b) The TRANSITIONS are announced through the polite region `bindForm` already stands up: `uploadStarted` at the selection kickoff — deliberately NOT gated on the indicator being present, since opt-in-by-presence is right for a visual and wrong for an announcement — and `uploadComplete` in the success branch only. Per-tick progress is NEVER announced: `aria-live="polite"` coalesces but does not throttle, so one announcement per `onprogress` event would bury every other message on the page. There is deliberately NO generic `uploadError` key, because the error path announces the server's own message and a generic second write in the same beat would clobber it (the region is latest-wins — the same reasoning that keeps `releaseSubmitA11y` silent). (c) The upload error container is written via `innerHTML` while `display:none` and revealed only by a fade-in — exactly where a `role="alert"` on it is unreliable — so the error routes through that same region, announcing `$error.textContent` (the RENDERED text: a message can carry markup, and the url-action checker substitutes `<br>`). Note the container being consumer-owned is NOT the discriminator: the progress indicator is equally consumer-supplied and gina already writes attributes into both; the hidden-then-revealed shape is what rules out `alert`. (d) The generated reset control was `<a href="#">Reset</a>` — announced as a link, not activatable with Space, and identical across every staged file. It now carries `role="button"` plus an `aria-label` of `<visible label> <filename>`, the visible label kept as a PREFIX so the accessible name still contains it (WCAG 2.5.3 Label in Name) and reusing the consumer's own `data-gina-form-upload-reset-label` so it is translated wherever that already is. The role is stamped ONLY on an anchor (strict `/^a$/i`, unlike the loose `/a/i` guarding `href` a few lines above, which also matches TEXTAREA/CANVAS/LABEL), so a consumer supplying their own `<button>` keeps its implicit role. A `role="button"` that cannot be operated by Space would be worse than no role at all, so the binder adds a `keydown` handler mapping Space to the removal — anchors only, since a native button already fires click on Space and would otherwise run the removal twice. (e) That control is REMOVED from the DOM while holding focus (`$resetLink.remove()`, which its own comment requires be last so the click listener dies with the node). The finding described this as a `display:none`; both happen, and the removal is the decisive one — a fix aimed only at the hide would not have worked. Focus now moves to the file input BEFORE the removal, guarded on the control actually holding focus (a programmatic reset must not steal focus from elsewhere) and CONFIRMED afterwards rather than assumed, since `typeof focus == 'function'` is true for every HTMLElement and `focus()` is a silent no-op on one that cannot take it. The removal is then announced (`fileRemoved`, default `'%s removed'`) using a FUNCTION replacer — never a string — because a file name may contain `$` and a string replacement would expand `$&`/`$1` patterns inside it. All three new strings live in `A11Y_LABELS`, so `gina.config.a11y` overrides them. **Maintainer gotcha worth the line:** `test/core/validator-upload-reset-delete.test.js`'s `fnSlice` takes a FIXED 12000-char window from its declaration anchor, and this fix grew `onUploadResetOrDelete` by ~2.6k chars — pushing the `#R8` strip and the callback dispatch outside it and reddening four pins whose code was present and correctly ordered the whole time. Widened to 16000 (the function ends ~14.2k past its anchor), but it is still a fixed window and will bite again; the durable fix is to brace-walk to the real function end, as the sibling `validator-upload-progress.test.js` already does. **Not verified against assistive technology** — source-derived plus a served-bytes check, like the rest of this arc. **#B295 (2026-08-06) — an async `query` rule left the form's validity state STALE once it settled.** `onasyncCompleted` derives its verdict from `d.getErrors(field)`, which `form-validator.js` scopes to a SINGLE field, so its `isFormValid` means "this field passed", never "the form is valid" — and the entire update block sits behind `if (!isFormValid && …)`. A form that had just become valid therefore received NO update: `updateSubmitTriggerState` was never called, so the bind-time not-ready mark (then `aria-disabled="true"`; the `data-gina-form-submit-gated` marker since #B312) survived on a valid form and `$forms[id].errors` kept listing the field. Cosmetic until #B246 made the click gate read that marker — then the first click after the query settled was silently eaten, and only the second went through (`revealValidationState`'s re-sync self-heals it). Fixed by handing the verdict to the fresh whole-form pass the same function ALREADY runs for the not-last-field case (`needsGlobalReValidation`), whose unconditional `updateSubmitTriggerState($currentForm, gResult.isValid())` settles the marker while its `handleErrorsDisplay` empty-errors branch clears the stale record; measured to add NO extra round-trip, because the query rule's already-registered-listener guard short-circuits the re-run. **The measurement that CHOSE the fix, and the reason the two cheaper shapes are wrong:** with a second required field left invalid, that fresh pass reports its error while BOTH the field-scoped `cb._errors` AND the in-pass `d.getErrors()` report none — so un-gating the existing call, or letting `handleErrorsDisplay`'s empty-errors branch auto-enable via its own `updateSubmitTriggerState(..., true)`, would each have ENABLED submit on an invalid form and re-opened #B246's hole. Both were rejected on that arm, not on reading. Covered by `test/e2e/validator-async-query-revalidation.spec.js` (4 arms, red-first: 01+02 RED on the pre-fix dist, 03 "another field invalid ⇒ still blocked" and 04 "no query rule ⇒ sends" GREEN throughout); arm 01 deliberately waits on the QUERY settling rather than polling the trigger's not-ready marker, because polling the guard is exactly what let the pre-existing FACE e2e stay green through #B293. Browser-bundled ⇒ consumer pickup is restart AND re-bake. **#B294 (2026-08-06) — a submit trigger whose DOM NODE is REPLACED after binding (the AJAX / popin re-render shape) was PERMANENTLY and SILENTLY dead.** Submit binding is **two-stage and only the first stage is delegated**: the native click proxy is registered on the FORM (`:8090`, "Form-level proxies: capture bubbled events from in-tree controls") and survives any re-render, but the listener that does the work is attached to the trigger NODE by `bindSubmitEl` (`:8231`). `gina.events` is a **name → id-STRING** registry (`utils/events.js:42`), so the `submit.<id>` key outlives the node: after a `cloneNode(true)`+`replaceChild` the `:8037` dispatch gate still passes, `cancelEvent` suppresses the native submit, and `triggerEvent` fires at a node with no listener — so the form does not even fall back to a normal submit. Nothing self-heals (`bindForm` latches `binded` at `:8580` behind `:585`, cleared only by `unbindForm`; there is no `MutationObserver` and no `isConnected` check in the bind/dispatch path). **Pre-existing, NOT a 0.6.4 regression** — measured identically on published 0.6.3. Fixed by marking the bound node with a **JS expando** (`__ginaSubmitBoundFor`) and re-binding the live node at the dispatch gate when the marker is absent — measured: `cloneNode(true)` copies `data-*` attributes but NOT expandos, which is exactly why the inherited `dataset.ginaFormSubmitTriggerFor` is useless as a fresh-node test and was a red herring in the original filing. **The rejected alternative is worth recording:** delegating the custom `submit.<id>` event to the form also fixes it (measured), but was measured to RETAIN the `gina.events` key past `unbind` (`registryKeyDeleted:false` vs stock `true`), which would force an edit inside `unbindForm`'s removal loop — six guard variants all keyed on `gina.events[name] == element.id`. Covered by `test/e2e/validator-submit-trigger-rebind.spec.js` (4 arms, red-first: 01 single replacement and 03 double replacement RED pre-fix; 02 untouched-sends and 04 replaced-but-invalid-still-refuses GREEN throughout, so re-binding provably does not bypass validation). **Diagnostic reflex for any "it stopped working after we re-rendered" report: the question is not whether the click listener survived — it did, it is on the form — but whether the node carrying the stage-2 listener is still the node in the document.** Browser-bundled ⇒ restart AND re-bake. **The submit proxy's gesture gate reads the LIVE trigger (#B308, 0.6.5).** The per-form `submit` proxy enforced its disabled gate on a DOMParser copy of the form's innerHTML, testing only native `.disabled` on the copy — blind to the gate's own marker (then `aria-disabled`, `data-gina-form-submit-gated` since #B312, written by `updateSubmitTriggerState`) while SIGHTED on a native `disabled` written mid-dispatch by a double-submit guard (the exact attribute #B293 ruled must not count on a real control — so wrapped-label + double-submit guard was a dead submit, the #B293 signature alive on the submit path). A gated trigger's trusted gesture therefore ran the full collect → validate cycle and SENT whenever the values validated. Now an `e.isTrusted` submit on a form whose REGISTERED trigger is `isTriggerDisabled()` is cancelled and answered with the same display-only `revealValidationState()` as the #B246 click path (errors rendered, first invalid field focused, stale marker re-synced); programmatic `$forms[id].submit()` arrives untrusted (triggerEvent CustomEvent) and deliberately keeps the fresh-validate path — a programmatic submit is not operating the control, the fresh pass is the honest gate there, and cancelling on a cached marker would break fill-then-submit flows. Two gesture shapes reach this gate (probe-measured, Chromium): a wrapped-label click (`<button type="submit"><span>` — the span has no `.type`, so the click proxy never fires and the gesture surfaces as a native submit event), and Enter in a form with NO native submit button (e.g. an `<a data-gina-form-submit="true">` trigger — implicit submission fires a DIRECT trusted submit; with a native button present, Enter instead synthesizes a click on the default button that the #B246 CLICK guard already refuses while the marker stands, so that shape never needed this gate). Covered by `test/e2e/validator-submit-proxy-disabled-gate.spec.js` (5 arms, red-first BOTH directions via the committed `B308_PREFIX_BUNDLE` route-swap hook: label-click and A-tag-Enter RED pre-fix on an EVENT discriminator — the pre-fix cycle fires `validate.<id>` from the no-`on('submit')` branch, while the post-fix reveal is display-only and fires nothing; POSTs cannot discriminate, since an invalid form never sends on either side). Scene lesson for e2e authors: stale-marker scenes are racy BY CONSTRUCTION — a page-level `.value =` write on a bound field is heard SYNCHRONOUSLY (the value property is instrumented and the silent live validation repairs the marker inside the write), and a delayed global silent pass can heal a protocol-level fill's stale marker mid-arm — so pin gate behaviour on a genuinely-invalid form and discriminate on event emission. Browser-bundled ⇒ restart AND re-bake. **The anchor in-flight lock owns `aria-disabled` alone; the settle releases remove it unconditionally (#B309 → #B312, 0.6.5).** On an `<a data-gina-form-submit="true">` trigger send()'s in-flight lock and the not-ready gate historically SHARED `aria-disabled` with opposite lifecycles — the settle releases (the `loadend` fail-safe + the readyState-4 twin) removed it unconditionally, so a mid-flight gate re-mark was silently erased at settle (#B309), and the reveal's valid-form heal erased the LOCK mid-flight the same way (#B313). #B312's single-writer split dissolves the class structurally: the gate writes only `data-gina-form-submit-gated` + the class, the lock is the sole framework `aria-disabled` writer on anchors (buttons lock via native `disabled`), both settle releases are back to the plain unconditional `removeAttribute` (the interim #B309 verdict-stamp replay retired unreleased, its 18-test file with it), and the reveal's show branch never touches aria — so authored `aria-disabled` survives every framework pass (enforced by the gates, never auto-cleared: consumers relying on the old auto-clear-on-valid must migrate) and #B313 is closed by construction. Scene fact that shaped the design: live-check is DELIBERATELY quiet during a real in-flight submit (the #B192 valid branch holds the submit latch until settle), so keystrokes cannot re-mark mid-flight — the reachable mid-flight writer was the #B246/#B308 reveal itself. Covered by `test/core/validator-submit-gated-marker.test.js` (17 — block-scoped single-writer negatives immune to right-extension, authored-aria + lock survival behaviour, the shipped `isTriggerDisabled` EXTRACTED and EXECUTED, terminator-anchored release-shape pins, dist-fidelity pins validated red-first across the rebuild). Browser-bundled ⇒ restart AND re-bake. **isRequired's emptiness is anchored at both ends, and trim strips both sides (#B245, 0.6.5).** The emptiness conjunct was `!/^\s+/.test(value)` — leading-anchor only — so ANY leading-whitespace-padded value read as empty (" x" rejected, "x " accepted), and under the documented isRequired-first ordering a paired `trim` healed `local.data` AFTER the error was recorded: a rejected field carried the trimmed non-empty value in the same result. Now `/^\s+$/`: whitespace-ONLY is empty, padded values pass, all-whitespace and the empty string still fail. Same fix: `trim`'s replace gained its missing `g` flag (first-match-only rewriting left the trailing run whenever a leading run matched — " x " → "x "). The validation-rules reference is corrected (it had documented the leading-space rejection as intended while prescribing the isRequired-then-trim pairing that could not work under it). Covered by `test/core/validator-required-whitespace-trim.test.js` (block-scoped comment-stripped source pins + the heal matrix on the REAL plugin over the server auto path + dist-fidelity counts red-first across the rebuild). Browser-bundled ⇒ restart AND re-bake. #B345 (issue #59, shipped in 0.6.7): the #SCS1e paren/`return` strip used to run BEFORE the regex-vs-comparison branch split, so a parenthesized `is` regex literal compiled from MANGLED text — groups destroyed and anchors rebound (`/^(a|b)$/` behaved as `/^a|b$/`: substring-permissive for middle alternatives), quantified groups requantified (`(#TAG)?` → literal `#TA` + optional `G`), and a literal `return` inside a pattern deleted — all silent, since the stripped text still compiled as a valid regex (the `Invalid regex literal` throw structurally cannot catch it). The strip now lives inside the binary-comparison branch only (grammar lock + authored-paren tolerance unchanged — `("a") === ("a")` still strips to a valid comparison); a regex literal compiles exactly as authored, that branch never evaluating the condition as JS. Behavior change (changelog ACTION REQUIRED): paren-carrying `is` patterns now match as authored, i.e. stricter; and the paren-wrapped-regex edge `(/foo/)` now fails closed in the comparison branch instead of being unwrapped into the regex branch. Locked by `test/lib/validator-is-regex-parens.test.js` (14 — red-first source ORDER pins, the reported reproduction, anchors/quantifier/`return` arms, comparison-branch controls, gina.js + wrap-immune gina.min.js order pins). #B389 (gh issue #63, shipped in 0.6.11): the Safari-autocomplete keydown interception (`handleAutoComplete` — REAL-Safari-only per #B135; preventDefault + programmatic value rebuild behind a transient readonly) restored the caret only two setTimeout(0) hops after each rebuild, while a `.value` assignment parks the selection at the END of the field (measured on WebKit AND Chromium) — so a fast second keystroke read a stale `selectionStart` and composed scrambled text ("AXB" where the user typed "ABX"; deterministic whenever two keydowns share one task, which live-check work between keystrokes makes routine). Fixed with a synchronous caret commit after every rebuild (`commitCaret` — measured to stick, and to survive the readonly toggle, on both engines) plus an element-recorded desired-caret tracker (`_ginaAcCaret`/`_ginaAcPending`) the handler trusts while a restore is in flight; the deferred restore (`queueCaretRestore` — the autofill-suppression readonly dance, mechanism-identical) re-asserts the LATEST committed position instead of its own stale capture, and arrows commit through the same tracker so a pending restore cannot undo them. By-catches in the same switch, all fixed to native behavior: #B390 Backspace at position 0 deleted the FIRST character (native no-op), #B391 Delete with a selection starting at 0 ate one char MORE than the selection, #B392 ArrowLeft at position 0 wrapped `setSelectionRange(-1)` to the unsigned maximum and teleported the caret to the END (now floored at 0). Browser-bundled ⇒ pickup is bundle restart AND re-bake. Tests: `test/core/validator-autocomplete-caret.test.js` (red-first: extraction controls, source pins, extracted-real-bytes behavioral arms on a caret-to-end element model, dist pins) + the webkit-only e2e `test/e2e/validator-autocomplete-caret.spec.js` (full-stack real-WebKit reproduction, red-first "AXB" → green "ABX"; chromium/firefox skip — #B135 gates them out; runs in the on-demand cross-engine job). **#B200 (shipped in 0.6.12): a NON-STRING field value no longer aborts the whole validation pass.** `isEmail` and `isJsonWebToken` opened with a TRUTHY-only coercion (`(this.value) ? this.value.toLowerCase() : this.value`), so a truthy non-string — `123` / `true` / `[]` from a JSON body, or a checkbox boolean on the client — reached `.toLowerCase()` and threw; `trim` was WIDER still, its type guard present but COMMENTED OUT and no truthy guard either, so EVERY non-string threw, a falsy `0` included. In all three the rule driver's catch RE-THROWS (`[ ginaFormValidator ] could not evaluate …`), so one bad field kills every remaining one: server-side the request goes unvalidated, client-side the boot-time binding loop dies and later forms silently lose validation AND CSRF injection. Fixed by type-guarding each site against a precedent already in the file — the #B87 `query` coercion for the two rules, isFloat's identical guarded `.replace()` for `trim`. **Measured, and the load-bearing check: the guard does NOT open a #B199-style silent bypass** — a non-string passes through untouched and the rule's own regex then rejects it, so `isEmail`/`isJsonWebToken` record a normal rule-keyed error (`isValid === false`), while `trim`, being a transform, leaves it untransformed (the #B245 both-ends strip on real strings is unchanged). **Reusable rule: type-guard BEFORE a string coercion, never truthy-guard** — a truthy check admits every non-string except the falsy ones (the authn.md §4 lesson, and the same split that sent falsy values to #B199 and truthy ones here). Deliberately NOT fixed in that pass: `isDate` (its throw is a purpose-built catch — an error-contract design call, #B397). `toFloat`/`format` — plus the same-family `set` — were later fixed by #B398 (context-safe rules; `test/core/validator-context-safe-rules.test.js`): `toFloat` reads the live DOM value only when one is reachable and otherwise uses the submitted `this.value` (server-side that IS the raw value, so the rule is fully functional in both contexts; the missing comma that leaked `isFloatingWithCommas` as an implicit global is fixed with it); `set` assigns the value everywhere and guards its DOM write (`isGFFCtx && target`); `format` always worked in BOTH contexts after `isDate` — the filed "dateFormat prototype extension absent server-side" mechanism was REFUTED by measurement (helpers/index installs `Date.prototype.format` unconditionally, server included) — and a non-Date value now throws a NAMED authoring error (`apply isDate(mask) before format(mask)`) instead of the opaque `val.format is not a function` (`toFloat`/`format` were first misread as this same class by a probe whose STRING CONTROL also threw, which is what exposed them). Browser-bundled ⇒ pickup is bundle restart AND re-bake. Tests: `test/core/validator-nonstring-value-guards.test.js` (comment-stripped source pins red-first vs the pre-fix blob, behavioural arms asserting the VERDICT not merely the absence of a throw, wrap-agnostic dist pins red-first vs the pre-fix artifact, plus untouched-rule controls incl. one labelled INVARIANT because it cannot go red). **The form-level keydown proxy defers the native-cancel decision to the namespaced handler (#B444, gh issue #67):** `addListener(gina, $el, 'keydown.<id>', fn)` registers a CUSTOM event type a native keydown can never fire; the form-level `keydownProxyHandler` bridges the two by re-dispatching - and it used to `cancelEvent()` the NATIVE keydown unconditionally BEFORE that dispatch, so on real-Safari UAs (where the autocomplete interception registers exactly such a handler) EVERY modifier chord on a live-checked autocomplete-suppressed field was dead - paste, select-all, copy, cut, undo - with NO paste/beforeinput event observable anywhere (preventDefault on a native keydown suppresses the browser editing command itself), while the interception handler's own chord bail sat one layer too low to help. The proxy now dispatches FIRST and cancels the native keydown only when the handler prevented the synthetic event (which the interception already does on the paths it re-implements and already does not on chords); `triggerEvent` returns the dispatched event to make that decision readable, undefined on the element-less path - treated fail-open to native. The keyup proxy is untouched (no `keyup.<id>` registrar exists). Measured live on WebKit: chords restored, typing interception + caret integrity + autofill suppression unchanged. Tests: `test/core/validator-keydown-proxy.test.js` (extract-and-execute on both changed functions) + `test/e2e/validator-autocomplete-paste.spec.js` (webkit project, cross-engine job). **#FIN4 (`isIban` / `isBic`, 0.6.x):** IBAN and BIC join the built-in rule set. `isIban` validates ISO 13616 in three ordered checks - shape (`^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$`), official per-country length via the constructor-scope `_ibanLengths` registry (87 countries; unknown country codes deliberately pass on shape + checksum so a registry gap never hard-fails a well-formed IBAN), and the ISO 7064 MOD 97-10 checksum folded modulo 97 in <=7-digit chunks of plain Number math (no BigInt in bundled source - build-chain constraint). Tolerant read: validation runs on an uppercased copy with spaces/hyphens stripped; the stored value and the DOM are NEVER mutated (unlike `isEmail`'s lowercase write-back). The type guard folds into `isValid` (`typeof(candidate) == 'string' && rgx.test(...)`) so a toString-spoofing object records an invalid instead of throwing into the rule driver (#B200 posture, tightened). `isBic` validates the ISO 9362 8/11-char shape case-insensitively by regex - no case mutation. Both follow Shape A (`this.valid = isValid && !errors['isRequired']`), the strict #B199 empty bypass, and register English defaults in `_defaultErrorLabels` ('A valid IBAN is required' / 'A valid BIC is required'), culture-localisable like every built-in label. Behavioral + pin coverage: `test/lib/validator-isiban-isbic.test.js` (real-engine; fixtures verified against an independent BigInt oracle). **Autofill signal (#B478, 0.6.27):** the live check re-runs only on the proxied native `change`/`keyup`/`focusin`/`focusout`, and a browser or password-manager fill produces NONE of them - on Chrome not even at fill time, and the filled VALUE stays withheld from script (`.value` reads `''` while `:-webkit-autofill` matches) until the first trusted gesture, which then releases it and fires a keydown/input/change/keyup burst per field (measured, Chrome 152 - which is also why a "gated" trigger always submitted on the first click). So a form filled without keystrokes kept its bind-time gated look on a visibly complete form, and an autofilled INVALID value showed no error. Fix: the default stylesheet (`src/vendor/gina/autofill/sass/autofill.scss`, FUNCTIONAL so deliberately outside `@layer gina`; its keyframe carries a declaration because csso strips an EMPTY `@keyframes` block) gives every `:autofill` / `:-webkit-autofill` control a 1ms keyframe named `gina-autofill-start`; the validator's form-level `animationstart` proxy (`autofillProxyHandler`, also on reassociated controls) dispatches the field's own `change.<id>` live check when the value is readable, and calls `revalidateSilently()` when the browser withholds it. `excludeWithheldAutofill()` narrows the five LIVE-CHECK collectors (bind-time, live global, select global, reveal, silent) so a withheld field neither gates nor renders a false "required" error; the SUBMIT collectors stay strict, so `isValid()` still refuses to post a withheld (empty) credential. A consumer rule setting `animation-name` on those pseudo-classes replaces the hook - keep `gina-autofill-start`. Pins: `test/core/validator-autofill-livecheck.test.js` (extract-and-execute, dist + stylesheet contract) and `test/e2e/validator-autofill.spec.js` (the served keyframe applied through a harness class - real autofill is invisible to automation and to fresh CI profiles). **Honest label for a withheld autofill at submit (#B341, 0.6.27):** the submit collectors are strict by design, so a control the browser autofilled but still withholds fails `isRequired` at click time; that verdict is right, but the plain required label named a problem the user could not see. `isRequired` now consults the plugin's single withheld predicate (exported as `gina.validator.isAutofillValueWithheld`) and, when true, composes the message from the new built-in key `isRequiredAutofill` (default `Filled in by your browser: click the field to confirm it`) - the errors key stays `isRequired`, the verdict and the gate are untouched - and marks the control `data-gina-form-autofill-withheld="true"` until its next adjudication (a CSS/JS hook and the locale-agnostic test signal). `_labelAliasFill` copies an app-supplied `isRequired` onto `isRequiredAutofill`, so a localized catalog keeps its own wording until it translates the new key: never key a test on the English text. Pins: `test/core/validator-autofill-honest-label.test.js` (the rule, `replace()` and the alias fill executed from the shipped engine bytes; red-first through `GINA_FORM_VALIDATOR`) + `test/e2e/validator-autofill-honest-label.spec.js` (chromium + webkit; the plain label read off the page first, the honest render asserted to differ and to carry the marker). **Same-name pairs with a hidden twin (#B510, 0.6.29):** the painter walks `$form.elements` in document order and, on the per-field path, exits on the first control whose name matches — and a BARE `type="hidden"` control (no `form-item-wrapper`) can never be painted (every paint gate skips it). It used to consume the error anyway (box class set, no message, no `aria-invalid`, walk stopped), so the recommended disabled-control shape — a visible control plus a hidden twin carrying `"exclude": false` — lost its server-side field error whenever the hidden twin came first; on a shared box the pre-marked class blocked the visible twin's first-error branch even without the exit. A bare hidden control is now skipped when another control of the same name can be painted (`hasPaintableTwin`); a lone bare hidden keeps the former behaviour, a wrapped hidden is still painted after its wrapper. Browser-bundled: pickup is a bundle restart AND a re-bake. Tests: `test/e2e/validator-hidden-first-paint.spec.js` (real bytes, seven shapes) + `test/core/validator-hidden-first-paint.test.js`. **Binding scope (#B549, 2026-09-17):** the boot scan binds ONLY opted-in forms — a `data-gina-form-*` attribute, an existing id naming a registered rule (`-` read as `.`), or a virtual `gina-upload-*` id; any other `<form>` is left untouched (no minted id, no `$forms` entry, no submit proxy) even on a rules-bearing page, matching the forms guide. Explicit `validateFormById()` / `getFormById()` stay ungated opt-ins. Before the fix the scan's `else` arm bound every form after minting it a generated id, so declaring ONE rule file turned every plain login/signup form on the site into an always-XHR submit — and on isaac HTTP/2 that XHR-answered `req.login()` then lost its session cookie (#B550). **Staged-upload failure paths (gh#83, #B724/#B725/#B727/#B728/#B731, 0.7.2):** (a) #B727 — `onUpload` writes a staging error into the `-error` element as `textContent` inside a created `<p>`, never `innerHTML`: a non-2xx non-JSON body is kept verbatim as `result.message`, so a proxy/WAF HTML page or a reflected filename used to be parsed as live markup (the sink dated from 0.1.1). (b) #B724 — a status-0 settle reports `{status:408, transportError:true, reason, error: a11yLabel('transportError')}`; the text is 'Transport failure: the request did not complete' (a proxy 413 mid-send over HTTP/2 and a navigation abort both DID reach the server), overridable through `gina.config.a11y.transportError`; `reason` is `'unload'` while a `pagehide` is in effect, else `'transport'` — #B728 resets that flag on `pageshow`, because a back-forward-cache restore keeps the page's JS state. (c) #B725 — both payload collectors (`getFormValidationInfos` and the submit proxy's inline loop) skip a `type=file` control carrying `data-gina-form-upload-action`: it stays in `$fields` for rule evaluation, but its `.value` (`C:\fakepath\<name>`) never rides the payload. ⚠️ The default error render runs ALONGSIDE a declared `data-gina-form-upload-on-error` callback (element first, then `error.<vid>` and the callback), so a callback cannot suppress it. (d) #B731 — the error element is OPTIONAL: without it the message is announced through the form's live region (`announceA11yError`, when non-empty), a dev-mode `[FormValidator] upload … no error element` warning names the missing id, and `error.<vid>` and the callback still run; `onUpload` used to `throw new Error(errMsg)` there, with `errMsg` undefined outside the rendering branch, BEFORE either dispatch, so the callback never ran, for an HTTP error and a status-0 failure alike. The slot id is read ONCE, from the file input (`data-gina-form-upload-error`, default `<input id>-error`): it was recomputed for every `<input>` of the real form and kept the LAST one's, so a custom slot was honoured only when the file input was the form's last input. Residual: the bind-time `checkUploadUrlActions` still looks its errors up only at `<id>-error`. Pin: e2e `validator-upload-error-slot-b731.spec.js` (5 arms, red-first on the pre-fix dist).
940
+ 209. **FormValidator — engine disambiguation, string inputs, a11y reflection, and live-check message visibility (consolidates former #42/#130/#150/#186/#197).** The live form/data rule engine is `core/plugins/lib/validator/src/form-validator.js` (single source, `isGFFCtx`-branched: runs server-side via `backendInit` AND compiled into the browser bundle) with the client orchestration in `validator/src/main.js` — `framework/v*/lib/validator.js` is a DEAD standalone fluent validator with overlapping `is*` rule names; never edit it for form-rule work (tell them apart fast: the live engine's `isRequired` rejects whitespace-only input, the dead one passes it). Rule bodies must handle STRING inputs — the two DECLARATIVE contexts feed strings (`.value` + urlencoded bodies) — so a typed/numeric rule coerces or parses explicit components, never assumes a typed JS value; but "always a string" is NOT true of every path, and reading it that way shipped #B198 (see below): a JSON request body keeps real Numbers (`JSON.parse` → `req.body`/`req.post`, which the `validator::{}` routing path MERGES into the validated data before spreading array bounds through `apply()`), and `toInteger` leaves `Math.round()`'s real Number on `this.value`, so a `toInteger` → `is*` chain hands the next rule a Number even in the browser — a rule must therefore be correct for a typed value too, not merely tolerant of strings: `isFloat` coerces via `Number()` (#B46); `isDate` builds from explicit mask components + a round-trip check so non-ISO slash masks aren't US-misparsed and impossible dates still reject (#B47); `isDate` returns the FIELD again on its valid path (#B48, 0.5.4 — parsed `Date` preserved on the field's `.value`, the `isDate(mask).format(...)` idiom unchanged), so rule chaining works. ⚠️ **The FIELD keeps the `Date`; the PAYLOAD takes a `yyyy-mm-dd` string, always (#B558, 0.6.32-alpha.2).** Every validator normalises the payload to the validated canonical form (`isEmail` lowercases, `isBoolean` → boolean, `isNumber` → `Number`), so `isDate` normalising is consistent — but `Date` is the one normalised type that does NOT round-trip through JSON: `JSON.stringify` renders it via `toISOString()`, a UTC **instant**, and local midnight at any positive UTC offset is the PREVIOUS day in UTC. So a browser in Paris submitting `2026-09-18` sent `2026-09-17T22:00:00.000Z` and every reader that sliced the date part stored the 17th — silent (the instant is well-formed) and invisible to a server or CI running in UTC. The written shape is mask-INDEPENDENT: the mask governs INPUT parsing, while both `requirementToSchema()` and `dto.date()` already published the field as `{type:'string', format:'date'}` (RFC 3339 full-date, explicitly NOT `date-time`), so the payload now matches the schema gina was already advertising. Consumer-visible: `req.body.<field>` is a string, not a `Date`, and `new Date('2026-09-18')` on a date-only string is UTC midnight, not local midnight. An empty value is adjudicated by `isRequired` ALONE (#B78): the per-rule empty-bypass became unconditional on empty (`if (this.value == '')`, its old `!errors['isRequired']` gate dropped) for `isEmail`/`isJsonWebToken`/`isFloat`/`isInList` — each regating `this.valid = isValid && !errors['isRequired']` — and `isString` keeps the field invalid without recording a second message, so a required-empty field shows ONE message (`is required`) not two, optional empty fields still pass, a filled-but-invalid value still reports its own error, and custom `is` was deliberately excluded by #B78 and re-declined by #B82 — an exclusion REVERSED by #B233 (2026-08-03, 0.6.3, `307721f2`): `is` now carries the same canonical strict bypass (`if ( this.value === '' ) { isValid = true; }`) and the same regate, taking the Shape-A population from four rules to FIVE, so a required+EMPTY field carrying an `is` condition records `isRequired` ALONE instead of also collecting a second `Condition not satisfied`. `isBoolean` joined the same contract at #B235 (2026-08-03, 0.6.3, `aa1c2035`), taking that population to SIX: its pre-switch rescue `errors['isRequired'] && this.value == false` was LOOSE (`'' == false`), so a required+EMPTY boolean field LOST its isRequired error and reported `Must be a valid boolean` instead of `Cannot be left empty`; the rule now takes the canonical strict `=== ''` self-pass, and the rescue moves AFTER the accept-set switch gated on the value having been ACCEPTED (`val !== null`) — which keeps the documented unchecked-but-required-toggle case working, since a recognized `false`/`0` is a present answer, while emptiness returns to `isRequired` alone. Paired in the same commit with #B236, the SERVER-side half: the plugin's `getCastedValue` funneled EVERY value on an isBoolean-ruled field through `/^true$/i ? true : false` BEFORE the engine ran (client AND server — `validate` calls `formatFields` unconditionally), so on the server auto path junk validated CLEAN and PERSISTED as `false` — `nope`, the HTML checkbox default `on` (a CHECKED box storing UNchecked), the strings `1`/`0`, `TRUE`/`True` — and the NUMBER 1 stored `false` where the engine reads it as `true`. The pre-cast now survives ONLY in dynamised-rules mode, where a referenced boolean field must splice into a stringified `is` condition as an unquoted operand (measured NECESSARY: deleting it outright breaks a server `$flag === true` condition); the ENGINE is the single adjudicator on every surface, which is what the routing `validator::` surface always enforced and what the published reference already promised. Disclosed both directions: values that silently stored `false` now ERROR, the number 1 flips its stored value `false`→`true` on a verdict that was already valid, an optional blank boolean field now PASSES instead of erroring, and a required blank field's message changes from isBoolean to isRequired. A sibling server-path crash in the same plugin is fixed by #B234 (2026-08-03, 0.6.3, `7c56565d`): `getDynamisedRules` substitutes in two passes, and the SECOND is a DOM fallback re-deriving each splice value from the live element (`$fields[...].value`) — which `backendInit` calls with `$fields = null`, so it threw `TypeError: Cannot read properties of null` on its FIRST iteration for ANY `$` surviving pass 1: a regex end-anchor in an `is` condition, a `$` inside a human-readable message string, or a `$` in any array-rule element after the first. Plain cross-field `$peer === $me` never crashed, because pass 1 consumes tokens that NAME fields. The loop is now gated `$fields && ...`, joining the #B127 precedent one function later; `validate`'s same-text gate is deliberately left UNGUARDED, being reachable only with a live DOM. Residual, disclosed — and since FIXED (#B239): a `$` token in an ARRAY rule's FIRST argument that names no field (`isInList: ['$100']`) threw one site later at `checkFieldAgainstRules`' `d[<token>].value` — NOT DOM-dependent, so it reached the client too. The substitution is now gated on the token resolving to a REAL field (an existing `d` key with a defined `.value` — two clauses, both load-bearing: an engine-METHOD-name collision like `'$isValid'` resolves to a defined key with no `.value`, and pre-fix spliced the string "undefined" into the rule for a silent wrong verdict rather than a crash); anything else stays LITERAL so strict comparison applies (`'$100'` matches its own literal, rejects non-members with the rule's own error; bare-`$` and mixed elements covered). `$` is therefore the engine's RESERVED cross-field sigil: whether an authored `$` stays literal depends on a runtime field-name collision — a token naming a sibling field is consumed UPSTREAM by getDynamisedRules loop 1, substituted with quoting fit for `is`-condition splices, not array elements (`"yes"` with quotes can never match `yes`), so real cross-field refs in array-rule elements are always-invalid, fail-closed, never-worked, undocumented (the reference scopes `$name` to `is` expressions) — tracked as #B240 (demand-gated; the fix is relocating array-element substitution into checkFieldAgainstRules, whose guarded loop is deliberately preserved as the substrate). This reserved-sigil model is also the #DTO2 `$` guard's CURRENT rationale (the crash rationale is retired — deterministic literal semantics are impossible for any `$`, so toRules() refuses at boot rather than validate collision-dependently). The reversal is measured rather than re-argued: the old bypass was gated on `!errors['isRequired']` — off exactly when #B78 wants it on — beside a two-disjunct guard that was DEAD CODE (`x == '' && x != 0` has no witness), optional+empty ALREADY self-passed through the live else-if, and on required+empty the condition is VERDICT-IRRELEVANT (form validity is `getErrors().count()` and `isRequired` has already errored), so form validity and the request payload are identical in both directions and only the message list changes; the "coercion-sensitive" premise had already been retired by #B199's strict test, which leaves `0`/`false`/`null` as operands that still evaluate the condition. #B82 is neither regressed nor retired — its root `getCastedValue` quoting and its `is()` grammar guard stay necessary and reachable with a FILLED host; #B233 only closes that crash path a second time for an empty HOST, whose condition is no longer compiled at all. Same commit drops the dead `_defaultErrorLabels['isApiError']` entry (zero consult sites: the API path assigns the server's message directly and never calls `replace()`) - but a cross-field `is` (`"$a === $b"`) no longer THROWS when the referenced field is empty (#B82): the client dynamised-rules substitution (`getCastedValue` in `main.js`) now renders an empty referenced operand as a quoted `""` (it was spliced RAW, leaving a dangling `"7654321" === ` that `is()`'s binary-comparison grammar `_SCS_BINARY_RE` rejected -> an uncaught throw that aborted the whole-form validity pass and left the submit trigger ungated on an invalid form, breaking the documented `is`+`isRequired` value-confirmation pattern while the confirm field was blank), mirroring `getDynamisedRules`' own sibling substitution default (`: '\"\"'`); `null`/`undefined` stay raw (already valid operands). Hardening: `is()`'s grammar mismatch now FAILS-THE-FIELD (`console.warn`+`isValid=false`) instead of throwing, so a per-keystroke live check can never abort the gate on a residually-unparseable condition (e.g. a field literally valued `"NaN"`, which the root fix leaves raw). Browser-bundled -> prod dist rebuilt; the `#SCS1e`/`#SCS1h` eval-safety pins target the untouched `_SCS_BINARY_RE`/`_scsParseOperand`/regex-literal constructs, so the hardening flips none of them. **The splice itself was UNESCAPED until #B600-#B602 (gh#77, 0.6.33):** `getDynamisedRules` pastes every referenced value into the STRINGIFIED rule set and parses it back, so a `"`, `\` or control character in a referenced value (a textarea, a password) threw out of the whole pass (client: dead submit; server: the error escaped the plugin), at FOUR sites - `getCastedValue`'s string return AND its number-rule branch, the loop-1 default for a referenced field with no rule, the loop-2 DOM default - each through a STRING replacement that also expanded `$&`/`$'`/`$$`. Every splice is now `quoteForDynamisedRules(v)`, i.e. an escaped quote + `escapeForJsonString(escapeForJsonString(v))` + an escaped quote (the escaper touches ONLY `"`, `\` and U+0000-U+001F, so the splice is byte-identical to the old one for every value that did not throw), through function replacers, with the closing parse guarded (fallback: the rules as declared, which `is()` resolves or fails closed). A number-ruled referenced value splices raw only when it IS a number (typed, or text matching `/^ *-?\d+(?:\.\d+)? *$/` - the padding keeps `" 12"` vs `12` valid as before); other text compares as a string. Note the engine's `isNumber` is LENIENT (`parseInt`: `1"2` and `12abc` pass as the leading number), so a number field's own verdict never discriminates such values - compare `1"2` vs `1"3` instead. `is()`: the string operand is `"(?:[^"\\]|\\.)*"`, decoded with `JSON.parse` (an AUTHORED literal that is not valid JSON, `"C:\dir"`, is read verbatim as before; one that cannot be read at all fails the field, never throws); its own `$` substitution splices `JSON.stringify(value)` through a function replacer; the `(`/`)`/`return` strip runs OUTSIDE string literals only (#B601 - it made `ab(cd` equal `ab)cd`, also on route requirements); and a condition no longer needs an ASCII alphanumeric run to be evaluated (#B602 - `!!!`/`é€` never matched; through `$` tokens the gate saw the token NAMES, so it bit the plugin path and literal conditions only). The client `query` body: a late-resolved token splices twice-escaped and `decodeSplicedQuotes()` restores each spliced literal instead of deleting every escaped quote - byte-identical for any body whose strings carry no backslash (token-wise, so key order survives); an AUTHORED quoted segment holding a valid JSON escape is the one divergence (decoded). **One `$`-token grammar at every site (0.6.33, #B603/#B604/#B606):** `FormValidatorUtil.substituteFieldTokens(text, names, resolve)` — a token is `$` + a field name in scope, the LONGEST name wins in one pass over the original text, a token ends where its name ends provided the next character is outside `[A-Za-z0-9_-]` (so `($a) === ($b)`, `$a===$b`, `$a,` resolve while `$passwordX` leaves `password` alone), names are case-sensitive and RegExp-escaped (`$pw[0]`, `$a+b` resolve), a replacement is never scanned again, and a `$` naming no field stays literal. Before it: the plugin's `getDynamisedRules` replaced one name at a time and re-read the text after each splice, so a value holding `$<otherField>` was substituted twice (#B603 — and the two-argument `is` form re-read the resolved condition through the array-rule scan, which now skips `is`/`is<N>`); its DOM-fallback second loop, which could only act on a `$` a spliced value carried in, is retired with #B234's gate; the engine's `is()` resolved a token only when whitespace or the end followed it and interpolated names unescaped (#B604) — it now resolves OUTSIDE string literals only and never inside a regex-literal condition, so the plugin path's already-spliced literals are not resolved a second time; the client `query` body scanned `\$[-_\[\]a-z 0-9]+` — lowercase-only with a space in the class — so `$passwordConfirm` resolved `$password` + `Confirm` (another field's value on the wire), a prefix pair resolved by body order, and an unknown `$` was sent as the string `null` (#B606). Value semantics per site are unchanged (`getCastedValue`/`quoteForDynamisedRules`, `JSON.stringify`, the twice-escaped `query` splice). The form's validity comes from `getErrors().count()` (the surviving `isRequired` error), never the per-field `.valid` flag (whose only error-dropping reader, `setErrors`, is dead). Length bounds are ARITY-sensitive, and the source JSDoc was WRONG about it until 0.6.3: `"isString": [N]` (same for `isInteger`/`isNumber`) supplies `minLength` ONLY — identical in effect to the scalar `N` — because the exact-length branch fires only when `minLength === maxLength`, so an exact length needs `[N, N]`; the stale comment had propagated verbatim into the published reference page, so correct BOTH surfaces when one is found. Those bounds measure the value's STRING FORM (`val.toString().length`) — until 0.6.3 `isInteger` alone measured a bare `val.length`, which is `undefined` on a real Number, so BOTH its bounds were silently inert on every numeric value: no error, no warn, field left `valid` (#B198, a fail-OPEN bypass reachable from a JSON body, a `validator::{}` requirement, or a preceding `toInteger` — the browser included). `isString` reads the same bare `val.length` at two sites and is CORRECT there because a `typeof(val) == 'string'` guard precedes it, so this class of fix is line-scoped: a whole-file replace of the bound expression hits four sites, two of which must not change. One consequence of measuring the string form, intended: a negative number counts its sign toward the length (parity with the same value arriving as a string). The zero-swallow residual #B198 initially left open is CLOSED by #B199 (0.6.3): loose `== ''` emptiness tests conflated `0`/`-0`/`false`/`[]` with the empty string at FIVE sites — the isInteger/isNumber bounds gates AND the isEmail/isJsonWebToken/isFloat empty-bypasses, where a JSON body's `{"email": 0}` validated as a correct email — all five now compare strictly, so only the literal `''` bypasses (the designed empty-is-adjudicated-by-isRequired contract, preserved byte-exactly); `isString` stays loose behind its typeof guard (operators identical for strings), `isInList` was already strict, and `isDate`'s broader `!val` swallow (a silent half-state: `valid` false, NO error recorded, so the form passes) is deliberately untouched. STILL OPEN sibling (#B200): a TRUTHY non-string in an isEmail/isJsonWebToken field (`{"email": 123}`) hits an unguarded `.toLowerCase()` and the rule driver RE-THROWS, killing the whole validation run — the falsy/truthy non-string space is partitioned between the fixed bug and this one. Custom validators (`bundle/validators/<name>/main.js`) are a BROWSER-ONLY affordance, NEVER a server-side guarantee: the server gate reads `getContext('gina').forms` while the loop it guards reads a bare `gina` that is undefined in Node, so a custom rule never attaches server-side and the engine then silently skips the unknown rule name with no warn — re-validate such constraints in the action. (Publishing that context without also fixing the loop would make EVERY validator construction throw, including for bundles shipping no custom validators.) Since #M21d (2026-09-26) the browser compiles a custom validator as an inline `<script>` — `gina.forms.compiledValidators[<name>]`, one compile per validator per page, carrying the page's CSP nonce when one is set, `//# sourceURL=<name>.js` in DevTools — with NO `eval`, NO `Function` and no `'unsafe-eval'` needed; the scope contract is unchanged (the spliced prologue hands the body `self`/`local`/`isGFFCtx`/`replace` through `this.getValidationContext()`), a file the browser cannot compile throws `[UserFormValidator] Could not evaluate` pointing at the console's SyntaxError, and server-side a FUNCTION registered on the context is attached as it is while a source-shaped one is refused naming the browser-only contract. The bundle build (`core/asset/plugin/lib/js/no-dynamic-code.js`, run by `build` after r.js and again after Closure) also rewrites the two unreachable vendored calls the r.js output inlines — RequireJS `req.exec` (the `load.fromText` transpiler-plugin path) and engine.io-client's `Function("return this")()` global shim — by EXACT match, failing the build if a dependency bump moves them, so the published bundle carries no dynamic-code call at all: Socket's `Uses eval` verdict, which flipped the package score 62 ↔ 42 on identical bytes, has nothing left to fire on (pinned by `test/lib/validator-m21d.test.js` + `test/core/bundle-no-dynamic-code.test.js`). A rule-body edit needs a prod dist rebuild AND flips the section-locked characterization tests by design. Editing trap: `form-validator.js` embeds hidden NO-BREAK SPACE bytes (U+00A0) where a normal space appears inside several `||`/ternary sequences, so a literal-space find/replace spanning one silently fails — patch such regions with a byte-scoped script over clean-ASCII substrings, not a space-spanning match. The blur-time global validation pass sets submit-button state but renders errors ONLY for the touched field — untouched invalid fields stay quiet until interacted-with or submit. For a `<select>`, the touched field is the select whose `change` started the check: before 0.7.4 its live check (`updateSelect`) read the global `event`, which inside the whole-form pass's callback is that pass's own `validated.<form-id>` event on the form, so the lookup used the form's `name` and the select's whole-form error was never displayed; it now reads the element it is given (#B781). Accessibility (#A11Y1): the rule-agnostic chokepoint `handleErrorsDisplay` reflects committed errors into `aria-invalid="true"` (gated on committed-not-warning; `"false"` on clear mirrors native `ValidityState` so it agrees with `:user-invalid`; hidden fields skipped), auto-wires `aria-errormessage` to a gina-owned message div UNLESS the consumer provided their own, focuses the first DOM-order invalid field on a failed submit, and announces blur-time errors via a per-form visually-hidden `aria-live="polite"` region; the per-field aria passes fire only under live-check — the always-on submit pass covers every bound form regardless. Live-region LIFECYCLE (#A11Y2): creation is split out of the announcer into `ensureA11yLiveRegion($form)` and called from `bindForm` — the chokepoint every registration path funnels through — so the region is in the a11y tree from BIND time. It previously created, inserted AND populated the region in one synchronous tick, which reaches assistive tech as a single mutation batch on a node it has never observed, so the FIRST announcement per form (the one that matters most) was the one least likely to be spoken while every later one worked. The region is a CHILD OF THE FORM on purpose: a popin renders its form inside a native `<dialog>` opened with `showModal()`, which leaves everything outside the top layer inert, so a body-level region would go unspoken for exactly the forms that live in popins — the placement is an accessibility constraint, not a convenience. The price of that choice is that a subtree replacement (`$el.innerHTML =` on a popin re-render, a nav fragment swap) destroys it, so `ensureA11yLiveRegion` is create-OR-RECOVER and also re-homes a region whose form node was replaced; any region created or re-homed at announce time is marked fresh and defers its first write one macrotask, so insertion and mutation land in different ticks — that deferral is what stops a recovery from silently repeating the defect, and it is load-bearing because a re-render does NOT always re-bind (`validateFormById` early-returns on an already-registered id, and a multi-form popin's teardown loop splices while iterating so it skips every odd-indexed form). An already-bound region writes synchronously, unchanged; while a deferred write is pending a newer error replaces the pending text so the LATEST message wins, and the timer re-enters the announcer, keeping exactly ONE `textContent` write site. Rule: a live region must be observable BEFORE it is written — separate creation from announcement, and when the same call must do both, put a tick between them. **Submit LIFECYCLE exposure (#A11Y4):** the accessibility signals for an in-flight submit hang off the request window inside `send()` — the only place reached once an XHR genuinely exists — and that placement is the fix for a timing trap, not an accident: the loading state (`data-gina-loading`) is armed at CLICK time, BEFORE validation runs, so a signal hung there would arm-then-disarm on every rejected submit and announce a spurious busy/not-busy pair. Three effects, all scoped to that window. (1) The trigger's focus is captured before gina natively disables it and restored once the request settles: a natively `disabled` control cannot hold focus, so the browser drops focus to `<body>` and re-enabling does NOT bring it back (both measured), which silently cost every keyboard submit its place. The restore is deliberately conservative — only when focus is still on `<body>` and the trigger is still in the document — so a response that opened a popin, redirected, or focused the first invalid field keeps its own focus decision; gina restores what gina took, never more. The `<a>` branch is excluded from the capture: an anchor gets `aria-disabled` from the in-flight lock (since #B312 the framework's only `aria-disabled` write), which does not blur (measured control). (2) The trigger carries `aria-busy` for the request's duration — on the TRIGGER, never the form, because the live region is a CHILD of the form and an ancestor marked busy MAY be treated as "defer announcements in this subtree", which would silence the very channel used to announce; ARIA 1.2 defines no normative behaviour here, so that is a cheap hedge, and the same reading is why `aria-busy` can never substitute for an announcement (it produces none of its own). ⚠️ **Do NOT restate this as "assistive tech commonly defers"** — that wording shipped once and was WRONG: measured 2026-08-05 on VoiceOver/Chrome, an announcement made from inside an `aria-busy="true"` ancestor was spoken normally, so at least that pairing does not defer. The placement costs nothing and still guards ATs that might, but it is a precaution, never a claim about implementations. (3) The start is announced ONCE through the #A11Y2 region; completion announces NOTHING by design, because an errored response is already announced field-by-field by `handleErrorsDisplay` and a second status write over the same polite region in the same beat can truncate it. Announced strings are the framework's own, so they resolve through `gina.config.a11y` with English defaults (e.g. `{ submitting: 'Envoi…' }`) — deliberately separate from `setErrorLabels`, which is keyed by RULE name and owns rule messages. Rule: put a state signal where the state actually begins; a signal armed on intent rather than on the operation announces work that may never happen. **Error-association integrity (#A11Y5):** three fixes sharing one theme — an ARIA assertion is only worth what its target is worth. (a) Hiding the message div used gina's `.hidden` helper (`display: none !important`), which removes it from the accessibility tree entirely — fine for a soft warning, wrong at the TWO hide paths that coexist with an asserted `aria-invalid` (`refreshWarning`'s focus-driven hide, and the refresh re-create), where the field was announced invalid while `aria-errormessage` pointed at an unreachable target. Both now CLIP instead: inline declarations that hide visually but keep the node in the tree, with `display` carrying `!important` because that is what outranks the class's own `!important` (measured — a plain inline `display:block` loses to it); the class is deliberately left in place so consumer CSS keyed on `.hidden` keeps matching. (b) A polite region is announced on CHANGE, so re-writing byte-identical text is commonly not spoken — which is precisely the repeat-error case (blur a field that still fails the same rule). A trailing no-break space now makes the content differ without altering what is read out, and it self-cancels on the next write. NOTE this half is source-derived: the string demonstrably changes, but no assistive-technology pass has confirmed the re-announcement. ⚠️ The same caveat NO LONGER applies to #A11Y2's first-announcement fix — **V1 was CONFIRMED 2026-08-05 on VoiceOver/Chrome** by an A/B whose two arms differ only by a `setTimeout(0)`: the same-tick create-and-write was NOT spoken, the deferred write WAS. So the deferral is load-bearing in practice, not merely defensible in theory; the region-lifecycle discipline above is measured, not inferred. (c) `focusFirstInvalidField` (and its deliberately-duplicated inline twin) gated focusability on `typeof $field.focus == 'function'`, which is TRUE for every HTMLElement — a custom element with neither `tabindex` nor `delegatesFocus` passes it and its `focus()` is a silent no-op (measured), so a failed submit whose first invalid control was such a host focused nothing AND stopped searching. Both loops now confirm `document.activeElement` actually moved before stopping, which is also what makes the JSDoc's "skips unfocusable controls" claim true rather than aspirational. Rule: a capability probe (`typeof x.focus == 'function'`, `'foo' in el`) tests the API's PRESENCE, never its EFFECT — when the effect is what matters, assert the resulting state. Error-MESSAGE visibility has THREE write paths (create / refreshWarning's un-hide / the refresh re-create) and the re-create runs LAST in the live-check pass, so it owns the steady state: it is focus-aware — message hidden while the edited field is the active element, revealed on blur (soft warning border while typing). Rule: when an element is written by multiple paths in a single validation pass, guard the LAST writer — an earlier-writer fix is silently overridden. #B319 (0.6.5-alpha.2): the focus-driven hide is EXEMPT during the framework's own ANSWER focus — both refused-submit paths (the #B246/#B308 display-only reveal via `focusFirstInvalidField`, and the `validate.<id>` failure branch's inline focus twin) render errors then focus the first invalid field, and that focus's synchronous `focusin` re-entered the live-check listener and hid the just-rendered message: a refused submit explained itself only to a screen reader (the #A11Y5 clip kept the node resolvable) while sighted users saw nothing — despite the render itself being VISIBLE (no fieldName ⇒ the live-check branch is skipped, and activeElement is still the trigger/BODY at render time), which is also why an async `query` rule in a repro is incidental (the suppressing dispatch is synchronous inside `focus()`). Fix: a one-shot module flag raised around BOTH focus loops (try/finally, cleared on every exit) gates the focusin arm's `refreshWarning` call; the message stays visible with the hard `form-item-error` styling, aria state untouched, and the first later keystroke re-engages the mid-typing suppression unchanged (in that answered-then-typed configuration the border stays `form-item-error` — the answer focus re-registered the field so `lastFocused` reads it twice and the isWarning heuristic keeps the hard border while the active-element ternary hides the message; the hidden message is the contract, the border there is heuristic). Behavioral lock: `test/e2e/validator-submit-answer-visibility.spec.js` (4 arms, red-first against the pre-fix bundle); browserless pins: `test/core/validator-answer-focus.test.js`. #B387 (shipped in 0.6.11): the one-shot flag covers only that synchronous window — on an async-`query` form with a committed error, a refused submit whose click lands inside the UNDRAINED completion tail of the previous settle had its answer delivered, focused, then re-hidden ~0.2ms later: a stale live-check waiter (woken inside the click's cascade by the reveal pass's deferred release) or the trailing silent global re-validation ran the display-refresh pair AFTER the flag's `finally` had cleared it, and BOTH hide sites key on the same heuristic — "the field is the active element, so the user is editing it" — which cannot tell answer-placed focus from user-placed focus (`refreshWarning`'s error→warning downgrade appends ` hidden`; `handleErrorsDisplay`'s refresh branch re-creates the message born-hidden via its active-element ternary; the occurrence gate is click-inside-the-tail, which is why full-suite/CI runs flaked ~1/20 while standalone runs stayed green). Fix: focus PROVENANCE — a single module slot `answerFocusHold` ({formId, elName}; one slot is exact, only one active element exists) recorded at both confirmed answer-focus points (inside the #B319 windows), consulted by BOTH hide sites for ANY caller however late (provenance beats a pass-staleness latch: the trailing re-validation is a FRESH pass spawned inside the click cascade and would sail through any staleness check), and released on the first genuine user interaction — any TRUSTED native event reaching one of the seven form proxy handlers while the one-shot flag is down (framework `triggerEvent` dispatches are untrusted and cannot release it; the answer's own trusted synchronous focusin is excluded by the flag) — so the deliberate mid-typing suppression re-engages the moment the user actually edits; no timers. Locked by `test/core/validator-answer-focus-hold.test.js` (17 — source pins on every edit site, comment-stripped extracted-real-bytes behavioral arms for both hide sites + the release helper, red-first against the pre-fix bytes; gina.js dist pins) and the §02 e2e arm (25/25 post-fix vs the ~1/20 pre-fix CI red whose signature was `Received: 1` + msgClass `hidden` — a recurrence of that signature is a NEW defect, not #B387). #B348 (shipped in 0.6.11): `revealValidationState`'s completion STARVED on any form whose async `query` field was not declared last — the reveal pass is un-latched, writes neither `isSubmitting` nor `isValidating`, and on a valid form its verdict is clean, so its waiter completion matched NO dispatch branch (terminal errors>0 / the latched dispatch / last-field / the display-only live-check arm): `onDisabledTriggerReveal` never ran, the stale `data-gina-form-submit-gated` marker never re-synced, and a fully valid form ate every later click until reload (measured live: 2 post-settle clicks, 0 POSTs — field declaration order decided whether the documented self-heal worked). Fix: the reveal's callback carries a completion identity (`onDisabledTriggerReveal.isRevealCompletion = true`, the engine's own `cb._data`/`cb._errors` property idiom) and the waiter chain gains ONE else-if chained after the display-only arm, gated on the SAME terminal condition the errors>0 block uses (`hasParsedAllRules && asyncCount <= 0` — the guard that stops a multi-query-field early wake, where the first waiter fires at asyncCount 1): a terminal reveal completion that matched no other branch dispatches `validated.<formId>` with its own cb. Every previously-working shape is byte-identical (errored reveals keep completing via the terminal branch, query-last via last-field, latched submits via the latched dispatch, live-check stays display-only), and the un-latched programmatic-submit starve (#B347) is deliberately untouched — its cb carries no marker and its fix is gated on its own repro. Known residual, pre-existing on EVERY branch: a query field whose own rule object continues past `query` never sets the terminal flag and still starves — same guard as the existing dispatch, no new asymmetry. Locked by `test/e2e/validator-reveal-starve.spec.js` (red-first: the starve arm failed on the pre-fix bundle while the query-LAST control arm passed on the same bytes, pinning the defect to field order; the scene manufactures [valid values + stale gate + stale committed error] deterministically via a prototype-setter silent fill after an errored reveal, with every precondition an explicit expect so an impossible scene voids loudly) and `test/core/validator-reveal-completion.test.js` (9 — stamp/consult/placement pins, extracted-real-bytes reveal arm asserting the stamp as a runtime value, gina.js verbatim pins AND a gina.min.js exact-count pin — unlike a local flag, the property name survives Closure). The not-ready submit trigger is marked `data-gina-form-submit-gated="true"` + the class `gina-form-submit-disabled` (#B312 retired `aria-disabled` from this marker — its contract says not-operable while the #B246 gate deliberately answers the click with the error reveal; authored `aria-disabled` remains enforced by the gates and is never auto-cleared), NEVER native `disabled` (#B76 — a natively-disabled button emits no click, so the validate-render-focus guard could never run); `isValid()` is the real send gate, and **the framework now ships a default not-ready look (cursor `not-allowed` + dim; deliberately no `pointer-events`, which would swallow the click the reveal answers) that consumer CSS overrides**. Form-associated custom elements (FACEs) participate in binding + live-check (#CC2 — hyphenated members of `form.elements`; their own `.value` accessor is honoured, live-check rides the composed bubbling `change`; author contract: `static formAssociated`, a `name` attribute, a `.value` getter, composed `change` on commit). **Radio-group collection (#B221):** an unchecked non-boolean radio group whose rule declares a truthy `isRequired` is collected as an EMPTY value by BOTH collectors (`getFormValidationInfos` + the native-submit inline copy) so `isRequired` adjudicates it via the standard emptiness test — pre-fix no collection arm admitted the shape (each required `.checked`, a `true|false`-shaped value, or an `isBoolean` rule), the DOM handle was held in `$fields` but the VALUE never entered `fields`, so no rule ran against the group and a radio-group-only form short-circuited BOTH submit guards (field count 0 reads as nothing-to-validate → synthetic `isValid() === true`) and submitted its XHR with zero client-side validation. Other unchecked groups stay absent-when-unchecked (native parity: no rule / `isRequired: false` unchanged; `isBoolean`-declared groups keep the force-false arm), checked members post exactly as before, and on the auto path a required-empty form is invalid and never sends — so the wire only changes for the newly-gated shape. Enforcement-tightening: forms that silently submitted with nothing picked now gate on the pick (trigger marked not-ready at bind under default-on live-check — `data-gina-form-submit-gated` + class since #B312 — message on submit attempt, re-enabled after picking). **The re-enable is real only since #B228:** the radio live-check listener was registered under a `changed.<id>` event name nothing dispatches on a user pick — the form-level click proxy short-circuits into the radio state updater (which never dispatches any gina event), and the change proxy dispatches ONLY names present in the event registry, which radios never registered (checkboxes have that registration via their state-updater relay; radios' equivalent relay is keyed on the bare element id, which nothing triggers) — so the whole-form silent pass never re-ran after a pick and the trigger kept its bind-time disabled state indefinitely, while submit-time validation (a separate call chain) accepted the checked group and let the click-guard send: flows completed, only the trigger state was wrong (announced disabled to assistive tech; automation actionability checks refuse `aria-disabled`). Radios now ALSO register the proxy-dispatched `change.<id>` name alongside `changed.<id>` — the handler's radio arm accepted `change.`-typed events all along, so one registration line closes the loop: mouse, label and keyboard picks all re-run the field + whole-form passes (single delivery per pick — native `change` fires only on real state changes; the legacy `changed.<id>` name stays registered for the relay/programmatic path; checkboxes byte-identical). Latent since the live-check's introduction, invisible until #B221 armed it. **A field that DRIVES its own conditional block lost its BASE rules until #B229:** `forEachField`'s per-field tail read `if (isInCase || caseName == field) continue;`, and `caseName` is assigned inside the `_case_` scan loop that re-runs in full on EVERY field iteration, so it always held the LAST scanned `_case_` key's driver name — when the iterated field WAS that driver the `continue` skipped the rest of the iteration, base-rule check included. A rule shape `{ "group": { "isRequired": true }, "_case_group": { "conditions": [...] } }` therefore never adjudicated `group`'s own `isRequired` on the bind pass, the live-check global pass OR the submit pass: the form never gated and an empty submit went out with zero client-side validation — the silent-submit class above, resurfacing for the self-driving shape and structurally DOWNSTREAM of the collection fix (the group IS collected as `''`; only adjudication was missing). The tail is now split: `isInCase` keeps its own `continue` (it is dead code — never assigned truthy — and is preserved as such), and the `caseName == field` arm runs the base-rule check before continuing, restoring the driver's collected value around the call (the check deletes the field from the object it is handed, and that object is where the scan block re-reads the case VALUE on every later field iteration; a deleted entry re-seeds from the DOM, which for a radio group is the FIRST member's value regardless of `.checked`). Which conditions apply is unchanged — the direct-case block is never entered for a self-driving case, pre- or post-fix (measured) — and the fix is order-independent: a driver declared BEFORE another `_case_` block was already adjudicated (the tail's comparison never matched it), so the post-fix union is every driver carrying base rules. Client-only: the server form-body path throws earlier on any `_case_`-bearing rule set (conditional rules are unsupported there). Enforcement-tightening: a form built on this shape starts gating where it silently submitted. Known interplay, pre-existing: on a rule set with NO `$` tokens, a pick whose value matches a `_case_` condition lets the case machinery PERSISTENTLY replace injected fields' rules in the live store (the site-B replacement), so a later `reBind()` can re-arm the gate from the mutated store — `$`-bearing rule sets are immune (the dynamised-rules path clones). **A conditional driver's collected VALUE survives every full-form pass since #B230:** the base-rule check deletes each adjudicated field from the object it is handed, and until #B230 only the last-declared driver's entry was restored (the #B229 arm above) — any OTHER field that both carries base rules and drives a `_case_` lost its stored case value the moment its own rules were adjudicated, so later field iterations re-read it from the DOM (a radio group's FIRST member regardless of `.checked`) and matched conditions against a value the user never picked — spuriously requiring the wrong flow's fields (a correctly-completed picked flow could not submit), or with excluding condition rules under-validating the picked flow — while the driver's own direct-case block read `undefined` in the same pass and matched nothing. The entry is now backed up and restored around the base-rule check for any field driving a `_case_` in the live rules OR the pass-entry rule clone; the union matters because inside a direct-case recursion the pass's rule set is the condition's own rules, which carry no `_case_` keys, so the live-rules test alone is blind there. Non-driver fields keep the deletion untouched (the condition pull-in gate, the direct-case exclude injection and the async-`query` re-validation input all read those absences today), and a driver with no rules of its own is byte-identical — including the legitimate first-scan DOM seed for rule-less unchecked groups, which is preserved. **`setFlash` `[null, "message"]` works client-side since #B226 (the form the reference documents):** it previously lost its custom message in the browser ONLY — `lib/merge` classified a `null` array element as an object (`typeof null`) and dropped it on every no-override merge, and the client rules path re-merges the whispered rules (the `data-gina-form-rule` bind merge, the `gina.hasValidator` instance re-merge, the `_case_` merges), so the engine received a one-element array, bound the message to the ignored first `regex` argument, and rendered the built-in label; `["", "message"]` always survived (empty strings, `false` and `0` are primitives — `null` was the only casualty), and the server was unaffected (it reads the boot-loaded rules without those hops). The fix is in `lib/merge` itself, so no-override merges now preserve `null` array elements as VALUES framework-wide (and the index-merge branch stops manufacturing `{}` from a `null` source element) — a merge consumer relying on the silent compaction sees the `null` slots preserved. **Bracket-notation and nested-authored rule KEYS enforce on the SERVER form-body path since #B241:** the rule parser canonicalizes every rule key to a dotted path (`account[username]` becomes `account.username`; a nested rule tree flattens to its dotted leaves) while the server's fields map kept the RAW posted keys, so such rules never joined — the field was silently skipped with no warning, fail-open for every rule-keyed directive alike: checks (`isRequired`, `isEmail`, ...), the `exclude` drop, and value transforms — on BOTH production wire shapes (flat bracket keys: the client posts its name-keyed data as JSON and the JSON body path deliberately does no bracket expansion; and nested objects: the multipart and urlencoded parsers expand bracket names). The server now synthesizes dotted-canon field aliases ALONGSIDE the raw keys (originals kept, so `$name` cross-field tokens keep resolving off the raw posted names, and an all-flat payload synthesizes nothing — byte-identical behaviour), then folds alias outcomes back at egress: error keys return under the DOM-name bracket form the client renders against, and the validated data output keeps its materialized shape with exclusions and transforms applied (a parent object emptied by an exclusion is pruned along that alias's path only — a posted empty object survives). The client join was always bracket-on-both-sides (a named rule set passes through with its authored keys; nested-authored sets are reconstructed to bracket names at bind time), so this brings the server to parity — quirks included: a caller that posts the dotted key form keeps its own addressing, and the no-rules path still returns the payload verbatim. Behaviour change by design: a bracket-keyed or nested-authored rule that never fired before now enforces — anything relying on the old silent skip starts rejecting or dropping those fields. **Upload previews carry a text alternative (#A11Y7/U1, 0.6.4).** The staged-upload client layer builds its preview `<img>` in two MUTUALLY EXCLUSIVE branches of `onUpload` — one for a file with no server-side `preview` object, one for a returned preview variant — and neither set `alt` at all (not even `alt=""`), so assistive tech fell back to reading the temp URI aloud, once per staged file (WCAG 1.1.1). Both now set `alt` from `files[f].originalFilename`: the name the USER chose, deliberately NOT the sibling `files[f][key].originalFilename` of the preview variant, which is a server-generated artefact that means nothing to the person listening — the same distinction the adjacent `data-upload-original-filename` / `data-upload-preview-original-filename` pair already encodes. The fallback is `''` (a properly ignored image) rather than letting a missing name be spoken as a placeholder. The preview is INFORMATIVE, not decorative: it is the only signal telling a user which file is staged, and everything else in the upload layer is still silent — progress is attribute+`textContent` with no `role="progressbar"`/`aria-value*`, upload errors are an `innerHTML` write with no `role="alert"` that never calls the polite region the plugin already owns, and the reset control is an `<a href="#">` (U2/U3/U5, tracked in the accessibility audit, not fixed here). Maintainer gotcha: the two branches are per-file exclusive, so a one-site fix silently misses every upload whose server returns a preview object — fix both or neither. **A not-ready submit trigger really refuses the send — and its marker is aria-free (#B246 + #B312, 0.6.5).** `updateSubmitTriggerState()` marks an invalid form's trigger with `data-gina-form-submit-gated="true"` + the `gina-form-submit-disabled` class and deliberately never native-`disabled` (a natively-disabled button emits no click at all, so nothing could tell the user WHY it is dead) — and, since #B312, never `aria-disabled`: the gate ANSWERS the click with the error reveal, which that contract forbids for a control announced disabled, so the attribute belongs to consumers (authored marks the gates enforce and never auto-clear) and to the anchor in-flight lock. #B246's origin: NOTHING READ the marker — a click ran the entire submit cycle (collect → validate → `validate.<id>`) and only the `isValid()` gate stopped the send: the trigger was inert in appearance ONLY. `clickProxyHandler` now intercepts a disabled-or-gated trigger BEFORE the `submit.<id>` dispatch — so `bindSubmitEl`'s handler never runs, `isSubmitting` is never latched, and no send path is reachable by construction — and answers the click with a display-only `revealValidationState()` pass that renders every invalid field, focuses the first, and re-syncs the trigger state so a STALE not-ready marker on a form that has since become valid heals itself — the heal touches only the marker + class; authored `aria-disabled` and the in-flight lock survive it (#B313 closed by construction). The predicate `isTriggerDisabled()` reads the CLICKED element rather than `$formInstance.submitTrigger` (a form may carry several submit buttons while only one registers) and mirrors the popin plugin's existing trigger gate on the shared channels (authored `aria-disabled` + native `disabled`), so both subsystems agree there; since #B312 it ALSO fires on the validator-owned not-ready marker `data-gina-form-submit-gated="true"`. **#B293 (0.6.5) NARROWED that predicate: the native `disabled` ATTRIBUTE now counts only where `disabled` is not a real IDL property (`!('disabled' in $el)`).** As first shipped it accepted native `disabled` on ANY element, which silently killed the near-universal double-submit guard: a click listener on the submit button that sets `disabled` to block a second submit is bound to the button and therefore runs BEFORE gina's delegated form-level proxy reaches the gate, so the gate saw the attribute, cancelled the click, and `send()` never ran — then the consumer's own handler cleared the attribute again, leaving NOTHING marked, a normal-looking button, and every subsequent click equally dead. Measured: a natively-disabled `<button>` delivers **no click to JS at all** (the browser suppresses it), so on a real form control that arm could only ever fire on an attribute set DURING the dispatch — it protected nothing and cost everything; on an `<a>` or a custom element the browser enforces nothing, so there the attribute is still the only honest signal and is still read (`'disabled' in $el` measured: button/input `true`, anchor/custom-element/span `false`). Regression cover is an **e2e** (`test/e2e/validator-submit-native-disabled.spec.js`, 4 arms), deliberately NOT a replica: the defect is an ordering interaction between a consumer's own listener and gina's delegated proxy, which only the real bundle handling a real click can exhibit — `test/core/validator-submit-trigger-state.test.js` covers the same gate with replicas and stayed GREEN throughout, including two tests named as controls for the working case. Gotcha for maintainers: `focusFirstInvalidField()` deliberately DUPLICATES the inline focus loop inside the `validate.<id>` guard — that inline shape (`_a11yErrs` / `_aField`) is locked by source pins, so collapsing the two would break tests unrelated to this fix; keep them in step by hand if the focus rule ever changes. **Staged uploads speak (#A11Y7/U2+U3+U5, 0.6.4).** Three defects in one client layer, fixed together because they share one plumbing change. (a) `updateUploadProgressIndicator` wrote `textContent` plus two `data-gina-upload-progress*` attributes and NO ARIA, so any indicator that is not a native `<progress>` was unlabelled text; it now carries `role="progressbar"` + `aria-valuemin="0"` / `aria-valuemax="100"` / `aria-valuenow`, with `aria-valuenow` tracking the percent attribute EXACTLY — absent while `preparing`/`indeterminate` and on `error`, because an absent value is how a progressbar signals "unknown" while a stale or zeroed one reads as real, stalled progress. `reset` strips the ARIA too (it strips everything this layer ever set); `processing` advances the state only, preserving the last value so a determinate bar stays full through the server-side window. A native `<progress>` is deliberately untouched — it already exposes all of this, and an explicit role risks overriding the implicit one. (b) The TRANSITIONS are announced through the polite region `bindForm` already stands up: `uploadStarted` at the selection kickoff — deliberately NOT gated on the indicator being present, since opt-in-by-presence is right for a visual and wrong for an announcement — and `uploadComplete` in the success branch only. Per-tick progress is NEVER announced: `aria-live="polite"` coalesces but does not throttle, so one announcement per `onprogress` event would bury every other message on the page. There is deliberately NO generic `uploadError` key, because the error path announces the server's own message and a generic second write in the same beat would clobber it (the region is latest-wins — the same reasoning that keeps `releaseSubmitA11y` silent). (c) The upload error container is written via `innerHTML` while `display:none` and revealed only by a fade-in — exactly where a `role="alert"` on it is unreliable — so the error routes through that same region, announcing `$error.textContent` (the RENDERED text: a message can carry markup, and the url-action checker substitutes `<br>`). Note the container being consumer-owned is NOT the discriminator: the progress indicator is equally consumer-supplied and gina already writes attributes into both; the hidden-then-revealed shape is what rules out `alert`. (d) The generated reset control was `<a href="#">Reset</a>` — announced as a link, not activatable with Space, and identical across every staged file. It now carries `role="button"` plus an `aria-label` of `<visible label> <filename>`, the visible label kept as a PREFIX so the accessible name still contains it (WCAG 2.5.3 Label in Name) and reusing the consumer's own `data-gina-form-upload-reset-label` so it is translated wherever that already is. The role is stamped ONLY on an anchor (strict `/^a$/i`, unlike the loose `/a/i` guarding `href` a few lines above, which also matches TEXTAREA/CANVAS/LABEL), so a consumer supplying their own `<button>` keeps its implicit role. A `role="button"` that cannot be operated by Space would be worse than no role at all, so the binder adds a `keydown` handler mapping Space to the removal — anchors only, since a native button already fires click on Space and would otherwise run the removal twice. (e) That control is REMOVED from the DOM while holding focus (`$resetLink.remove()`, which its own comment requires be last so the click listener dies with the node). The finding described this as a `display:none`; both happen, and the removal is the decisive one — a fix aimed only at the hide would not have worked. Focus now moves to the file input BEFORE the removal, guarded on the control actually holding focus (a programmatic reset must not steal focus from elsewhere) and CONFIRMED afterwards rather than assumed, since `typeof focus == 'function'` is true for every HTMLElement and `focus()` is a silent no-op on one that cannot take it. The removal is then announced (`fileRemoved`, default `'%s removed'`) using a FUNCTION replacer — never a string — because a file name may contain `$` and a string replacement would expand `$&`/`$1` patterns inside it. All three new strings live in `A11Y_LABELS`, so `gina.config.a11y` overrides them. **Maintainer gotcha worth the line:** `test/core/validator-upload-reset-delete.test.js`'s `fnSlice` takes a FIXED 12000-char window from its declaration anchor, and this fix grew `onUploadResetOrDelete` by ~2.6k chars — pushing the `#R8` strip and the callback dispatch outside it and reddening four pins whose code was present and correctly ordered the whole time. Widened to 16000 (the function ends ~14.2k past its anchor), but it is still a fixed window and will bite again; the durable fix is to brace-walk to the real function end, as the sibling `validator-upload-progress.test.js` already does. **Not verified against assistive technology** — source-derived plus a served-bytes check, like the rest of this arc. **#B295 (2026-08-06) — an async `query` rule left the form's validity state STALE once it settled.** `onasyncCompleted` derives its verdict from `d.getErrors(field)`, which `form-validator.js` scopes to a SINGLE field, so its `isFormValid` means "this field passed", never "the form is valid" — and the entire update block sits behind `if (!isFormValid && …)`. A form that had just become valid therefore received NO update: `updateSubmitTriggerState` was never called, so the bind-time not-ready mark (then `aria-disabled="true"`; the `data-gina-form-submit-gated` marker since #B312) survived on a valid form and `$forms[id].errors` kept listing the field. Cosmetic until #B246 made the click gate read that marker — then the first click after the query settled was silently eaten, and only the second went through (`revealValidationState`'s re-sync self-heals it). Fixed by handing the verdict to the fresh whole-form pass the same function ALREADY runs for the not-last-field case (`needsGlobalReValidation`), whose unconditional `updateSubmitTriggerState($currentForm, gResult.isValid())` settles the marker while its `handleErrorsDisplay` empty-errors branch clears the stale record; measured to add NO extra round-trip, because the query rule's already-registered-listener guard short-circuits the re-run. **The measurement that CHOSE the fix, and the reason the two cheaper shapes are wrong:** with a second required field left invalid, that fresh pass reports its error while BOTH the field-scoped `cb._errors` AND the in-pass `d.getErrors()` report none — so un-gating the existing call, or letting `handleErrorsDisplay`'s empty-errors branch auto-enable via its own `updateSubmitTriggerState(..., true)`, would each have ENABLED submit on an invalid form and re-opened #B246's hole. Both were rejected on that arm, not on reading. Covered by `test/e2e/validator-async-query-revalidation.spec.js` (4 arms, red-first: 01+02 RED on the pre-fix dist, 03 "another field invalid ⇒ still blocked" and 04 "no query rule ⇒ sends" GREEN throughout); arm 01 deliberately waits on the QUERY settling rather than polling the trigger's not-ready marker, because polling the guard is exactly what let the pre-existing FACE e2e stay green through #B293. Browser-bundled ⇒ consumer pickup is restart AND re-bake. **#B294 (2026-08-06) — a submit trigger whose DOM NODE is REPLACED after binding (the AJAX / popin re-render shape) was PERMANENTLY and SILENTLY dead.** Submit binding is **two-stage and only the first stage is delegated**: the native click proxy is registered on the FORM (`:8090`, "Form-level proxies: capture bubbled events from in-tree controls") and survives any re-render, but the listener that does the work is attached to the trigger NODE by `bindSubmitEl` (`:8231`). `gina.events` is a **name → id-STRING** registry (`utils/events.js:42`), so the `submit.<id>` key outlives the node: after a `cloneNode(true)`+`replaceChild` the `:8037` dispatch gate still passes, `cancelEvent` suppresses the native submit, and `triggerEvent` fires at a node with no listener — so the form does not even fall back to a normal submit. Nothing self-heals (`bindForm` latches `binded` at `:8580` behind `:585`, cleared only by `unbindForm`; there is no `MutationObserver` and no `isConnected` check in the bind/dispatch path). **Pre-existing, NOT a 0.6.4 regression** — measured identically on published 0.6.3. Fixed by marking the bound node with a **JS expando** (`__ginaSubmitBoundFor`) and re-binding the live node at the dispatch gate when the marker is absent — measured: `cloneNode(true)` copies `data-*` attributes but NOT expandos, which is exactly why the inherited `dataset.ginaFormSubmitTriggerFor` is useless as a fresh-node test and was a red herring in the original filing. **The rejected alternative is worth recording:** delegating the custom `submit.<id>` event to the form also fixes it (measured), but was measured to RETAIN the `gina.events` key past `unbind` (`registryKeyDeleted:false` vs stock `true`), which would force an edit inside `unbindForm`'s removal loop — six guard variants all keyed on `gina.events[name] == element.id`. Covered by `test/e2e/validator-submit-trigger-rebind.spec.js` (4 arms, red-first: 01 single replacement and 03 double replacement RED pre-fix; 02 untouched-sends and 04 replaced-but-invalid-still-refuses GREEN throughout, so re-binding provably does not bypass validation). **Diagnostic reflex for any "it stopped working after we re-rendered" report: the question is not whether the click listener survived — it did, it is on the form — but whether the node carrying the stage-2 listener is still the node in the document.** Browser-bundled ⇒ restart AND re-bake. **The submit proxy's gesture gate reads the LIVE trigger (#B308, 0.6.5).** The per-form `submit` proxy enforced its disabled gate on a DOMParser copy of the form's innerHTML, testing only native `.disabled` on the copy — blind to the gate's own marker (then `aria-disabled`, `data-gina-form-submit-gated` since #B312, written by `updateSubmitTriggerState`) while SIGHTED on a native `disabled` written mid-dispatch by a double-submit guard (the exact attribute #B293 ruled must not count on a real control — so wrapped-label + double-submit guard was a dead submit, the #B293 signature alive on the submit path). A gated trigger's trusted gesture therefore ran the full collect → validate cycle and SENT whenever the values validated. Now an `e.isTrusted` submit on a form whose REGISTERED trigger is `isTriggerDisabled()` is cancelled and answered with the same display-only `revealValidationState()` as the #B246 click path (errors rendered, first invalid field focused, stale marker re-synced); programmatic `$forms[id].submit()` arrives untrusted (triggerEvent CustomEvent) and deliberately keeps the fresh-validate path — a programmatic submit is not operating the control, the fresh pass is the honest gate there, and cancelling on a cached marker would break fill-then-submit flows. Two gesture shapes reach this gate (probe-measured, Chromium): a wrapped-label click (`<button type="submit"><span>` — the span has no `.type`, so the click proxy never fires and the gesture surfaces as a native submit event), and Enter in a form with NO native submit button (e.g. an `<a data-gina-form-submit="true">` trigger — implicit submission fires a DIRECT trusted submit; with a native button present, Enter instead synthesizes a click on the default button that the #B246 CLICK guard already refuses while the marker stands, so that shape never needed this gate). Covered by `test/e2e/validator-submit-proxy-disabled-gate.spec.js` (5 arms, red-first BOTH directions via the committed `B308_PREFIX_BUNDLE` route-swap hook: label-click and A-tag-Enter RED pre-fix on an EVENT discriminator — the pre-fix cycle fires `validate.<id>` from the no-`on('submit')` branch, while the post-fix reveal is display-only and fires nothing; POSTs cannot discriminate, since an invalid form never sends on either side). Scene lesson for e2e authors: stale-marker scenes are racy BY CONSTRUCTION — a page-level `.value =` write on a bound field is heard SYNCHRONOUSLY (the value property is instrumented and the silent live validation repairs the marker inside the write), and a delayed global silent pass can heal a protocol-level fill's stale marker mid-arm — so pin gate behaviour on a genuinely-invalid form and discriminate on event emission. Browser-bundled ⇒ restart AND re-bake. **The anchor in-flight lock owns `aria-disabled` alone; the settle releases remove it unconditionally (#B309 → #B312, 0.6.5).** On an `<a data-gina-form-submit="true">` trigger send()'s in-flight lock and the not-ready gate historically SHARED `aria-disabled` with opposite lifecycles — the settle releases (the `loadend` fail-safe + the readyState-4 twin) removed it unconditionally, so a mid-flight gate re-mark was silently erased at settle (#B309), and the reveal's valid-form heal erased the LOCK mid-flight the same way (#B313). #B312's single-writer split dissolves the class structurally: the gate writes only `data-gina-form-submit-gated` + the class, the lock is the sole framework `aria-disabled` writer on anchors (buttons lock via native `disabled`), both settle releases are back to the plain unconditional `removeAttribute` (the interim #B309 verdict-stamp replay retired unreleased, its 18-test file with it), and the reveal's show branch never touches aria — so authored `aria-disabled` survives every framework pass (enforced by the gates, never auto-cleared: consumers relying on the old auto-clear-on-valid must migrate) and #B313 is closed by construction. Scene fact that shaped the design: live-check is DELIBERATELY quiet during a real in-flight submit (the #B192 valid branch holds the submit latch until settle), so keystrokes cannot re-mark mid-flight — the reachable mid-flight writer was the #B246/#B308 reveal itself. Covered by `test/core/validator-submit-gated-marker.test.js` (17 — block-scoped single-writer negatives immune to right-extension, authored-aria + lock survival behaviour, the shipped `isTriggerDisabled` EXTRACTED and EXECUTED, terminator-anchored release-shape pins, dist-fidelity pins validated red-first across the rebuild). Browser-bundled ⇒ restart AND re-bake. **isRequired's emptiness is anchored at both ends, and trim strips both sides (#B245, 0.6.5).** The emptiness conjunct was `!/^\s+/.test(value)` — leading-anchor only — so ANY leading-whitespace-padded value read as empty (" x" rejected, "x " accepted), and under the documented isRequired-first ordering a paired `trim` healed `local.data` AFTER the error was recorded: a rejected field carried the trimmed non-empty value in the same result. Now `/^\s+$/`: whitespace-ONLY is empty, padded values pass, all-whitespace and the empty string still fail. Same fix: `trim`'s replace gained its missing `g` flag (first-match-only rewriting left the trailing run whenever a leading run matched — " x " → "x "). The validation-rules reference is corrected (it had documented the leading-space rejection as intended while prescribing the isRequired-then-trim pairing that could not work under it). Covered by `test/core/validator-required-whitespace-trim.test.js` (block-scoped comment-stripped source pins + the heal matrix on the REAL plugin over the server auto path + dist-fidelity counts red-first across the rebuild). Browser-bundled ⇒ restart AND re-bake. #B345 (issue #59, shipped in 0.6.7): the #SCS1e paren/`return` strip used to run BEFORE the regex-vs-comparison branch split, so a parenthesized `is` regex literal compiled from MANGLED text — groups destroyed and anchors rebound (`/^(a|b)$/` behaved as `/^a|b$/`: substring-permissive for middle alternatives), quantified groups requantified (`(#TAG)?` → literal `#TA` + optional `G`), and a literal `return` inside a pattern deleted — all silent, since the stripped text still compiled as a valid regex (the `Invalid regex literal` throw structurally cannot catch it). The strip now lives inside the binary-comparison branch only (grammar lock + authored-paren tolerance unchanged — `("a") === ("a")` still strips to a valid comparison); a regex literal compiles exactly as authored, that branch never evaluating the condition as JS. Behavior change (changelog ACTION REQUIRED): paren-carrying `is` patterns now match as authored, i.e. stricter; and the paren-wrapped-regex edge `(/foo/)` now fails closed in the comparison branch instead of being unwrapped into the regex branch. Locked by `test/lib/validator-is-regex-parens.test.js` (14 — red-first source ORDER pins, the reported reproduction, anchors/quantifier/`return` arms, comparison-branch controls, gina.js + wrap-immune gina.min.js order pins). #B389 (gh issue #63, shipped in 0.6.11): the Safari-autocomplete keydown interception (`handleAutoComplete` — REAL-Safari-only per #B135; preventDefault + programmatic value rebuild behind a transient readonly) restored the caret only two setTimeout(0) hops after each rebuild, while a `.value` assignment parks the selection at the END of the field (measured on WebKit AND Chromium) — so a fast second keystroke read a stale `selectionStart` and composed scrambled text ("AXB" where the user typed "ABX"; deterministic whenever two keydowns share one task, which live-check work between keystrokes makes routine). Fixed with a synchronous caret commit after every rebuild (`commitCaret` — measured to stick, and to survive the readonly toggle, on both engines) plus an element-recorded desired-caret tracker (`_ginaAcCaret`/`_ginaAcPending`) the handler trusts while a restore is in flight; the deferred restore (`queueCaretRestore` — the autofill-suppression readonly dance, mechanism-identical) re-asserts the LATEST committed position instead of its own stale capture, and arrows commit through the same tracker so a pending restore cannot undo them. By-catches in the same switch, all fixed to native behavior: #B390 Backspace at position 0 deleted the FIRST character (native no-op), #B391 Delete with a selection starting at 0 ate one char MORE than the selection, #B392 ArrowLeft at position 0 wrapped `setSelectionRange(-1)` to the unsigned maximum and teleported the caret to the END (now floored at 0). Browser-bundled ⇒ pickup is bundle restart AND re-bake. Tests: `test/core/validator-autocomplete-caret.test.js` (red-first: extraction controls, source pins, extracted-real-bytes behavioral arms on a caret-to-end element model, dist pins) + the webkit-only e2e `test/e2e/validator-autocomplete-caret.spec.js` (full-stack real-WebKit reproduction, red-first "AXB" → green "ABX"; chromium/firefox skip — #B135 gates them out; runs in the on-demand cross-engine job). **#B200 (shipped in 0.6.12): a NON-STRING field value no longer aborts the whole validation pass.** `isEmail` and `isJsonWebToken` opened with a TRUTHY-only coercion (`(this.value) ? this.value.toLowerCase() : this.value`), so a truthy non-string — `123` / `true` / `[]` from a JSON body, or a checkbox boolean on the client — reached `.toLowerCase()` and threw; `trim` was WIDER still, its type guard present but COMMENTED OUT and no truthy guard either, so EVERY non-string threw, a falsy `0` included. In all three the rule driver's catch RE-THROWS (`[ ginaFormValidator ] could not evaluate …`), so one bad field kills every remaining one: server-side the request goes unvalidated, client-side the boot-time binding loop dies and later forms silently lose validation AND CSRF injection. Fixed by type-guarding each site against a precedent already in the file — the #B87 `query` coercion for the two rules, isFloat's identical guarded `.replace()` for `trim`. **Measured, and the load-bearing check: the guard does NOT open a #B199-style silent bypass** — a non-string passes through untouched and the rule's own regex then rejects it, so `isEmail`/`isJsonWebToken` record a normal rule-keyed error (`isValid === false`), while `trim`, being a transform, leaves it untransformed (the #B245 both-ends strip on real strings is unchanged). **Reusable rule: type-guard BEFORE a string coercion, never truthy-guard** — a truthy check admits every non-string except the falsy ones (the authn.md §4 lesson, and the same split that sent falsy values to #B199 and truthy ones here). Deliberately NOT fixed in that pass: `isDate` (its throw is a purpose-built catch — an error-contract design call, #B397). `toFloat`/`format` — plus the same-family `set` — were later fixed by #B398 (context-safe rules; `test/core/validator-context-safe-rules.test.js`): `toFloat` reads the live DOM value only when one is reachable and otherwise uses the submitted `this.value` (server-side that IS the raw value, so the rule is fully functional in both contexts; the missing comma that leaked `isFloatingWithCommas` as an implicit global is fixed with it); `set` assigns the value everywhere and guards its DOM write (`isGFFCtx && target`); `format` always worked in BOTH contexts after `isDate` — the filed "dateFormat prototype extension absent server-side" mechanism was REFUTED by measurement (helpers/index installs `Date.prototype.format` unconditionally, server included) — and a non-Date value now throws a NAMED authoring error (`apply isDate(mask) before format(mask)`) instead of the opaque `val.format is not a function` (`toFloat`/`format` were first misread as this same class by a probe whose STRING CONTROL also threw, which is what exposed them). Browser-bundled ⇒ pickup is bundle restart AND re-bake. Tests: `test/core/validator-nonstring-value-guards.test.js` (comment-stripped source pins red-first vs the pre-fix blob, behavioural arms asserting the VERDICT not merely the absence of a throw, wrap-agnostic dist pins red-first vs the pre-fix artifact, plus untouched-rule controls incl. one labelled INVARIANT because it cannot go red). **The form-level keydown proxy defers the native-cancel decision to the namespaced handler (#B444, gh issue #67):** `addListener(gina, $el, 'keydown.<id>', fn)` registers a CUSTOM event type a native keydown can never fire; the form-level `keydownProxyHandler` bridges the two by re-dispatching - and it used to `cancelEvent()` the NATIVE keydown unconditionally BEFORE that dispatch, so on real-Safari UAs (where the autocomplete interception registers exactly such a handler) EVERY modifier chord on a live-checked autocomplete-suppressed field was dead - paste, select-all, copy, cut, undo - with NO paste/beforeinput event observable anywhere (preventDefault on a native keydown suppresses the browser editing command itself), while the interception handler's own chord bail sat one layer too low to help. The proxy now dispatches FIRST and cancels the native keydown only when the handler prevented the synthetic event (which the interception already does on the paths it re-implements and already does not on chords); `triggerEvent` returns the dispatched event to make that decision readable, undefined on the element-less path - treated fail-open to native. The keyup proxy is untouched (no `keyup.<id>` registrar exists). Measured live on WebKit: chords restored, typing interception + caret integrity + autofill suppression unchanged. Tests: `test/core/validator-keydown-proxy.test.js` (extract-and-execute on both changed functions) + `test/e2e/validator-autocomplete-paste.spec.js` (webkit project, cross-engine job). **#FIN4 (`isIban` / `isBic`, 0.6.x):** IBAN and BIC join the built-in rule set. `isIban` validates ISO 13616 in three ordered checks - shape (`^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$`), official per-country length via the constructor-scope `_ibanLengths` registry (87 countries; unknown country codes deliberately pass on shape + checksum so a registry gap never hard-fails a well-formed IBAN), and the ISO 7064 MOD 97-10 checksum folded modulo 97 in <=7-digit chunks of plain Number math (no BigInt in bundled source - build-chain constraint). Tolerant read: validation runs on an uppercased copy with spaces/hyphens stripped; the stored value and the DOM are NEVER mutated (unlike `isEmail`'s lowercase write-back). The type guard folds into `isValid` (`typeof(candidate) == 'string' && rgx.test(...)`) so a toString-spoofing object records an invalid instead of throwing into the rule driver (#B200 posture, tightened). `isBic` validates the ISO 9362 8/11-char shape case-insensitively by regex - no case mutation. Both follow Shape A (`this.valid = isValid && !errors['isRequired']`), the strict #B199 empty bypass, and register English defaults in `_defaultErrorLabels` ('A valid IBAN is required' / 'A valid BIC is required'), culture-localisable like every built-in label. Behavioral + pin coverage: `test/lib/validator-isiban-isbic.test.js` (real-engine; fixtures verified against an independent BigInt oracle). **Autofill signal (#B478, 0.6.27):** the live check re-runs only on the proxied native `change`/`keyup`/`focusin`/`focusout`, and a browser or password-manager fill produces NONE of them - on Chrome not even at fill time, and the filled VALUE stays withheld from script (`.value` reads `''` while `:-webkit-autofill` matches) until the first trusted gesture, which then releases it and fires a keydown/input/change/keyup burst per field (measured, Chrome 152 - which is also why a "gated" trigger always submitted on the first click). So a form filled without keystrokes kept its bind-time gated look on a visibly complete form, and an autofilled INVALID value showed no error. Fix: the default stylesheet (`src/vendor/gina/autofill/sass/autofill.scss`, FUNCTIONAL so deliberately outside `@layer gina`; its keyframe carries a declaration because csso strips an EMPTY `@keyframes` block) gives every `:autofill` / `:-webkit-autofill` control a 1ms keyframe named `gina-autofill-start`; the validator's form-level `animationstart` proxy (`autofillProxyHandler`, also on reassociated controls) dispatches the field's own `change.<id>` live check when the value is readable, and calls `revalidateSilently()` when the browser withholds it. `excludeWithheldAutofill()` narrows the five LIVE-CHECK collectors (bind-time, live global, select global, reveal, silent) so a withheld field neither gates nor renders a false "required" error; the SUBMIT collectors stay strict, so `isValid()` still refuses to post a withheld (empty) credential. A consumer rule setting `animation-name` on those pseudo-classes replaces the hook - keep `gina-autofill-start`. Pins: `test/core/validator-autofill-livecheck.test.js` (extract-and-execute, dist + stylesheet contract) and `test/e2e/validator-autofill.spec.js` (the served keyframe applied through a harness class - real autofill is invisible to automation and to fresh CI profiles). **Honest label for a withheld autofill at submit (#B341, 0.6.27):** the submit collectors are strict by design, so a control the browser autofilled but still withholds fails `isRequired` at click time; that verdict is right, but the plain required label named a problem the user could not see. `isRequired` now consults the plugin's single withheld predicate (exported as `gina.validator.isAutofillValueWithheld`) and, when true, composes the message from the new built-in key `isRequiredAutofill` (default `Filled in by your browser: click the field to confirm it`) - the errors key stays `isRequired`, the verdict and the gate are untouched - and marks the control `data-gina-form-autofill-withheld="true"` until its next adjudication (a CSS/JS hook and the locale-agnostic test signal). `_labelAliasFill` copies an app-supplied `isRequired` onto `isRequiredAutofill`, so a localized catalog keeps its own wording until it translates the new key: never key a test on the English text. Pins: `test/core/validator-autofill-honest-label.test.js` (the rule, `replace()` and the alias fill executed from the shipped engine bytes; red-first through `GINA_FORM_VALIDATOR`) + `test/e2e/validator-autofill-honest-label.spec.js` (chromium + webkit; the plain label read off the page first, the honest render asserted to differ and to carry the marker). **Same-name pairs with a hidden twin (#B510, 0.6.29):** the painter walks `$form.elements` in document order and, on the per-field path, exits on the first control whose name matches — and a BARE `type="hidden"` control (no `form-item-wrapper`) can never be painted (every paint gate skips it). It used to consume the error anyway (box class set, no message, no `aria-invalid`, walk stopped), so the recommended disabled-control shape — a visible control plus a hidden twin carrying `"exclude": false` — lost its server-side field error whenever the hidden twin came first; on a shared box the pre-marked class blocked the visible twin's first-error branch even without the exit. A bare hidden control is now skipped when another control of the same name can be painted (`hasPaintableTwin`); a lone bare hidden keeps the former behaviour, a wrapped hidden is still painted after its wrapper. Browser-bundled: pickup is a bundle restart AND a re-bake. Tests: `test/e2e/validator-hidden-first-paint.spec.js` (real bytes, seven shapes) + `test/core/validator-hidden-first-paint.test.js`. **Binding scope (#B549, 2026-09-17):** the boot scan binds ONLY opted-in forms — a `data-gina-form-*` attribute, an existing id naming a registered rule (`-` read as `.`), or a virtual `gina-upload-*` id; any other `<form>` is left untouched (no minted id, no `$forms` entry, no submit proxy) even on a rules-bearing page, matching the forms guide. Explicit `validateFormById()` / `getFormById()` stay ungated opt-ins. Before the fix the scan's `else` arm bound every form after minting it a generated id, so declaring ONE rule file turned every plain login/signup form on the site into an always-XHR submit — and on isaac HTTP/2 that XHR-answered `req.login()` then lost its session cookie (#B550). **Staged-upload failure paths (gh#83, #B724/#B725/#B727/#B728/#B731, 0.7.2):** (a) #B727 — `onUpload` writes a staging error into the `-error` element as `textContent` inside a created `<p>`, never `innerHTML`: a non-2xx non-JSON body is kept verbatim as `result.message`, so a proxy/WAF HTML page or a reflected filename used to be parsed as live markup (the sink dated from 0.1.1). (b) #B724 — a status-0 settle reports `{status:408, transportError:true, reason, error: a11yLabel('transportError')}`; the text is 'Transport failure: the request did not complete' (a proxy 413 mid-send over HTTP/2 and a navigation abort both DID reach the server), overridable through `gina.config.a11y.transportError`; `reason` is `'unload'` while a `pagehide` is in effect, else `'transport'` — #B728 resets that flag on `pageshow`, because a back-forward-cache restore keeps the page's JS state. (c) #B725 — both payload collectors (`getFormValidationInfos` and the submit proxy's inline loop) skip a `type=file` control carrying `data-gina-form-upload-action`: it stays in `$fields` for rule evaluation, but its `.value` (`C:\fakepath\<name>`) never rides the payload. ⚠️ The default error render runs ALONGSIDE a declared `data-gina-form-upload-on-error` callback (element first, then `error.<vid>` and the callback), so a callback cannot suppress it. (d) #B731 — the error element is OPTIONAL: without it the message is announced through the form's live region (`announceA11yError`, when non-empty), a dev-mode `[FormValidator] upload … no error element` warning names the missing id, and `error.<vid>` and the callback still run; `onUpload` used to `throw new Error(errMsg)` there, with `errMsg` undefined outside the rendering branch, BEFORE either dispatch, so the callback never ran, for an HTTP error and a status-0 failure alike. The slot id is read ONCE, from the file input (`data-gina-form-upload-error`, default `<input id>-error`): it was recomputed for every `<input>` of the real form and kept the LAST one's, so a custom slot was honoured only when the file input was the form's last input. Residual: the bind-time `checkUploadUrlActions` still looks its errors up only at `<id>-error`. Pin: e2e `validator-upload-error-slot-b731.spec.js` (5 arms, red-first on the pre-fix dist).
939
941
 
940
- 210. **Multipart upload config is ENFORCED — groups, destination, limits, text-field capture + caps, terminal states (consolidates former #187/#188/#228/#230's server half; #B49/#B50/#B51/#B92-adjacent/#B93/#B97).** Every uploaded file must map to a CONFIGURED upload group: the resolved group (no/empty → the default `untagged`) must exist in `settings.json upload.groups` or the request is rejected 400 BEFORE the temp file is created, and `untagged` obeys its own config like any named group (pre-#B50 the checks ran only for defined non-`untagged` groups — an allow-list bypass; the shipped `untagged` default is `allowedExtensions: '*'` + `isMultipleAllowed: true`, so configure `untagged` restrictively or a client can route around a named group's allow-list). Destination + limits honoured: files stream to `uploadDir || tmpPath || os.tmpdir()` with a per-group `path` override and mkdir-if-missing before `createWriteStream` (the mkdir itself crash-guarded → 500, #B145); `maxFields` caps the per-request file COUNT (400 past the cap; 0/unset disables); `maxFieldsSize` parses its unit suffix (B/KB/MB/GB; bare number = MB) as the whole-body cap (431). **The staged on-disk FILENAME is server-generated and opaque, never the client's (#B419, 0.6.16):** `crypto.randomBytes(16).toString('hex') + '.part'`, minted once per part and used at BOTH path-construction sites — the write stream AND `req.files[].path`, which are built independently and must never diverge. Pre-fix the destination was `<fileUploadDir>/<client basename>` with NO per-part component, so two parts sharing a name — within ONE request or across concurrent requests — opened two write streams on ONE path with independent file offsets and INTERLEAVED their bytes into a single hybrid matching neither source, while the framework answered `storeErr:false` + 200 (measured live pre-fix: 12 concurrent same-named uploads → 0/12 clean, one hybrid file; one request with two same-named parts → one 500000-byte file of {B:417353,A:82647}; post-fix 12/12 clean, each byte-exact). The parse precedes routing and all middleware, so an UNAUTHENTICATED POST to ANY url reaches it — an unrouted one answers 404 to the client and still writes the file. A CSPRNG rather than the `Math.random()` used by `movefiles` (V8's is xorshift128+, so staging paths would be predictable, and a group `path` is operator-configurable into a served root); a RANDOM name rather than `filename + <suffix>` (keeps attacker-controlled bytes off the filesystem — RTL-override display spoofing, control chars, reserved device names — and cannot overflow NAME_MAX=255 into an ENAMETOOLONG 500 for a long-but-legal client filename); no interpretable extension, so a misconfigured static-serve of the staging dir cannot hand back an executable type. This is the multer ("a random name that doesn't include any file extension") and formidable (`newFilename` hexoid) convention. `req.files[].originalFilename` still carries the client's name and is what `store()` publishes the file under (`controller.js:4061`) and what a storage driver receives as `originalName`, so the documented "keeping each file's original name" contract is UNCHANGED — only `req.files[].path`'s BASENAME differs, and that field is documented as the temporary file's path. Server-side ⇒ pickup is a bundle restart, no re-bake. **Staged-part lifecycle + orphan reclaim (#B469):** a staged part has exactly TWO reclaim paths — the `movefiles()` unlink when `self.store()` publishes it, and the per-upload `autoTmpCleanupTimeout` deletion timer (`false`/0/empty disables it — the shipped default, and removing staged files is then the operator's own job). The timer is IN-PROCESS: a restart strands every part it was holding, and a part that never reaches `store()` (a request failing AFTER the multipart parse — the parse precedes routing, so auth/validation/quota failures have already staged; or an app consuming the staged file without `store()`) then has NO reclaim path at all. So an ARMED timer also arms a boot-time sweep at server init: each configured landing dir (the resolved global + every group `path`, deduped) is swept NON-recursively for `<32 lowercase hex>.part` REGULAR files (lstat, symlinks never followed; a client-named orphan predating the opaque staged naming is indistinguishable from an application file and is left alone — ⛔ that name gate is LOAD-BEARING, never widen it: `_sweepDirs` includes every group `path`, and a group `path` is ALSO the PERMANENT destination, so on a deployment whose group path is a permanent publicly-served storage root the pattern is the only discriminator protecting real user files; the mtime gate cannot help there, since permanent files are old by definition) older than max(timeout, 1h) — the floor keeps a SIBLING live process's in-flight part on a shared staging dir safe, since its mtime stays fresh while chunks land; ENOENT at any step is not an error (a sibling bundle sweeping the same dir, or the app unlinking its own part). The sweep REPORTS at `info` only when it removed something or hit errors (`upload orphan sweep: removed N staged part(s) across M staging dir(s)`) and at `debug` when it found nothing — so at the default `info` level a silent boot means no staged part was older than the gate, NOT that the sweep did not run; an operator expecting the line after a restart that had nothing left to reclaim (the boot that did the reclaiming having gone with its logs) will otherwise read a healthy no-op as a missing line. Disabled timer = NO sweep — the documented operator-owns-cleanup contract is unchanged. An application MAY unlink `req.files[].path` itself: `movefiles()` tolerates a vanished source (ENOENT) by design, and the armed timer already requires that tolerance. Rule: a group `path` is the PARSE-TIME LANDING (staging) directory, never where published files live — `store(targetDir)` or the group's storage `driver` owns final placement, and one key must never carry both meanings. **Multipart TEXT fields are captured** — a real busboy `'field'` listener (busboy silently SKIPS all non-file parts when none is registered) exposes them on `req.body` + `req[method]` (POST/PUT/PATCH only), values VERBATIM (no url-decode, no `"true"/"false"/"on"/"null"` coercion — the JSON body contract, deliberately: otherwise the same client `send(fd)` call would change value TYPES with file presence), bracket-notation names nested through the urlencoded path's own layer, duplicate plain names last-wins; caps `upload.maxTextFields` (default 1000) + `upload.maxTextFieldSize` (default 1MB, unit-aware, explicit 0 = no limit) answer 400 on breach instead of busboy's silent skip/truncation. **A multipart request with no successfully-parsed file part reaches a TERMINAL state:** fields-only → the request resumes; malformed/empty → 400 via `busboy.on('error')` with a double-response guard (busboy terminates in exactly `finish` XOR `error`; pre-#B93/#B97 both were unauthenticated pre-routing DoS holes — an eternal hang, and an uncaughtException → SIGTERM bundle kill). Rules: a per-group restriction is only a control if the UNCONFIGURED/default case is denied or constrained, never waved through; a documented config key is only real if a code path reads it — grep the consumer before assuming a setting works; any stream/parser whose SUCCESS path drives a request's continuation must ALSO handle its error/empty terminals. Since #STO1 slice 1 a group may also carry driver: '<name>', routing its self.store() step through settings.storage (entry #300; the parse/staging path above is unchanged). Server-side only. Tests: `test/core/upload-groups.test.js` + `upload-config.test.js` + `multipart-nonfile-terminal.test.js` + `multipart-field-capture.test.js` + `upload-concurrent-staging.test.js` + `upload-orphan-sweep.test.js` (+ the client `send(FormData)` half: `validator-send-formdata-multipart-fields.test.js`). **Server-path integrity + terminal-state hardening (former #263/#267/#268/#270 — #B103/#B142/#B143/#B144/#B145/#B223, 0.5.22-0.5.24):** a multipart body stays RAW end-to-end — `request.isMultipart` is computed ONCE at the request prologue and gates the request-stream `setEncoding` (a multipart stream reaches busboy as raw Buffers, its documented input; the decode remains for the text-body branches), write-pipeline chunks pass through VERBATIM, and `req.files[].size` counts BYTES, never a decoded string's length (#B103 — pure-ASCII surviving both old decode layers is why text uploads always worked while every real binary corrupted on every native multipart client: a PNG's 0x89 magic landed as 0xFD). The per-file `size` is finalized in the liner Transform's `_flush` (#B142 — the source-'end' record ran one pipe hop UPSTREAM of the byte counter with 16-object high-water marks still queued, under-counting ~25% on a 1.5MB file while md5 stayed perfect: the bytes were intact, only the number lied; `_flush` runs after the last `_transform` and strictly before the write stream can emit 'finish', both interleavings measured exact), and BOTH write-stream terminal listeners arm AT STREAM CREATION in the 'file' handler (#B143 — arming inside `busboy.on('finish')` lost the race for any early-finishing small file: Node never replays 'finish' for a late listener, so a throttled two-file upload hung deterministically, ~1 in 13 unthrottled; unauthenticated, both engines). Resume fires on `busboyDone && pending === 0`, whichever event lands last (the zero-pending branch still covers the fields-only #B93 terminal), and a mid-stream write error (missing dir, disk full) gets a guarded 500 instead of the historical unhandled-'error' uncaughtException SIGTERM. Downstream, `Controller.store()`'s mover streams each file to a temp sibling and publishes with an ATOMIC rename (a reader never observes a partial file; a pre-existing destination is replaced only on success), propagates the REAL filesystem Error (previously masked as `No file to upload`), and never settles the callback twice (#B223). Since #B227 the SAME semantics govern the general-purpose byte-writer in `helpers/path.js` behind `_().cp()` / `PathObject.mv()` (which CLI copy/build/rename paths ride): temp sibling in the destination's own directory + atomic rename (a pre-existing destination is no longer unlinked BEFORE the copy — its content survives a failed copy), a source-stream error listener (was an unhandled `error` event → process kill), a settled latch (a destination-side failure previously settled twice, the second time as a success, forking `browseCopy`'s directory recursion), and a real `Error` instead of the former plain string (`Error on Path.cp(...): Not found ...`) — so caller `err.stack` prints stop logging `undefined` (on Bun too, which reports such an error without a stack: the helper gives it one, #B654), and a failed copy's temp sibling is removed only once its stream has closed, before the callback — its creation can finish after the failure is reported (#B649); `Controller.store()`'s mover does not have this reap yet — its failure path still checks for the temp sibling and settles at once (#B657, open, code-read). The destination mkdir is crash-guarded (#B145): a group whose custom `path` has a read-only/EACCES/EROFS parent answers a guarded 500 naming group + path — a server CONFIG problem is 500 (the #B50 unconfigured-group 400 stays upstream and unchanged), and pre-fix `fs.mkdirSync` threw SYNCHRONOUSLY inside the parser callback → uncaughtException → SIGTERM, an unauthenticated single-request bundle kill (the multipart parse precedes routing and all middleware, both engines). A per-group `simulateWriteError: true` flag (#B144) lets a consumer deterministically fire the guarded-500 write-error path OUTSIDE production scope only (`!NODE_SCOPE_IS_PRODUCTION`): the 'file' handler creates the REAL write stream, arms the REAL terminal listeners, then synthetically `destroy()`s it — the exact terminal semantics of a real ENOSPC/EIO (an errored stream never emits 'finish', so the request stays terminal at the 500), N destroyed parts collapsing to exactly ONE 500 via throwError's `!res.headersSent` guard; a boot warn scans `upload.groups` for the flag in both scopes (production: "IGNORED — remove before shipping"; else "PROBE active"); nothing ships active. The `group="…"` tag rides a Content-Disposition PARAMETER that `curl -F` / browser FormData cannot emit (the `@rhinostone/busboy` fork parses it into `info.dispositionParams.group`), so a faithful probe HAND-BUILDS the multipart body. **The staged upload client layer (`data-gina-form-upload-*`, lives in the validator plugin — browser-bundled ⇒ consumers RE-BAKE at pickup; former #269/#271/#272/#274 — #R8 slices 1-2, #B146/#B147/#B148/#B149):** the staging POST body is assembled as a `Blob` with each File object embedded RAW (#B148 — the historical `FileReader`/`ab2str` DOMString concatenation UTF-8-inflated every byte >= 0x80 on the wire, ×1.49 measured, a PNG's 0x89 arriving as 0xC2 0x89; the corruption only STARTED at 0.5.22 because the pre-#B103 server's two since-removed decode layers EXACTLY reversed the inflation — two wrongs cancelling — so the #B103 server fix is what exposed the client defect). Multipart FRAMING is byte-identical (same boundary delimiters, same `name=`/`group=`/`filename=` disposition-parameter set, values percent-escaped for CR/LF/double-quote per RFC 7578 §5.1.1); a fixed client must pair with a server >= 0.5.22 (an older server's decode layers would corrupt the now-raw bytes — the #B103 corruption in reverse); files corrupted by the defect are LOSSLESSLY recoverable (the stored bytes are exactly the UTF-8 encoding of the originals: decode utf8 → re-encode latin1). **`send()` reads nothing from the event being dispatched (#B758, 0.7.3):** a staged file's `group=` comes from the file input its virtual upload form stages for (`uploadProperties.uploadTriggerId` → that input's `data-gina-form-upload-group`, `untagged` when unset). It was read from the implicit global `event.currentTarget`, right only inside the input's own change dispatch (picker, dropzone), so a direct `$forms[<virtual id>].send(formData)` outside a dispatch threw (reported as a staging error, while the request still went out with no boundary and no group) and inside an unrelated dispatch took that element's group, silently; a no-data `send()` now sends an empty body instead of reading `event.detail.data` and throwing after `isSending` was claimed. e2e `validator-upload-send-b758.spec.js` (5 arms, red-first). **Upload progress (#R8 slice 1):** `send()` assigns `xhr.upload.onprogress` FRESH on every send (the module-scoped XHR was reused across sends — a stale handler replays the previous send's closure with the wrong id), dispatching the REGISTERED event `uploadProgress.<uploadFormId>` (the events-array registration is required — `on()` validates names against the plugin registry) with `{ status: 100, progress: <int 0-100 | null when lengthComputable is false>, loaded, total, lengthComputable, files: [names] }` — a per-REQUEST aggregate (ONE staging XHR carries every file of a selection; per-file wire progress is not separable). Consumer surfaces: `data-gina-form-upload-on-progress` (bare window identifier, the -on-success convention) + a declarative indicator `data-gina-form-upload-progress="<elId>"` defaulting to `<fieldId>-progress`, opt-in by element presence. The updater feature-detects the target: a native `<progress>` tracks value=loaded/max=total (indeterminate = the value attribute REMOVED for the native animation; error = value 0, NEVER indeterminate — that animation would read as still working); any other element gets percent textContent + `data-gina-upload-progress`/`data-gina-upload-progress-state` styling hooks (preparing|uploading|indeterminate|processing|complete|error) with NO hardcoded wording (i18n-neutral — label via CSS on the state attribute). Lifecycle: `preparing` at selection (covers the FileReader/assembly phase), `uploading` per frame, `processing` at `xhr.upload.onloadend` (the browser finished SENDING — advances the state attribute ONLY, leaving value/percent as the last frame left them so a determinate bar stays visually full), `complete`/`error` finalized in onUpload (one chokepoint covers success and every error/timeout path), reset/delete strips the indicator. The response-side download channel `progress.<id>` is byte-untouched (it also serves attachment downloads). **Drag-and-drop (#R8 slice 2):** a file input carrying `data-gina-form-upload-dropzone="<elementId>"` gets drag listeners bound on the named element at form-bind time; dropped files are assigned to the input (`input.files = dataTransfer.files`) and the input's `change` is re-fired synthetically, so the ENTIRE staging pipeline — group tagging, virtual form, staging POST, previews, hidden metadata fields, reset/delete, upload progress — runs with zero duplicated logic (the change handler reads only `currentTarget`, so a synthetic dispatch is indistinguishable from a trusted one on this path). Contract: EXPLICIT-id-only (deliberately NO `<fieldId>-dropzone` default — auto-binding a coincidentally-named element would attach drag semantics to markup that may carry its own drop handling; absent attribute = inert, missing element = console.warn + inert); the zone is stamped `data-gina-upload-dropzone` (value = owner input id — the first-wins guard: one zone serves one input) and `data-gina-upload-dropzone-state` (`idle` → `over` on a file-drag hover, DEPTH-COUNTED so child-boundary crossings never flicker → `dropped` → back to `idle` at the same onUpload chokepoint that finalizes progress, and at reset/delete) — pure CSS hooks, no hardcoded wording. Only FILE drags react (`dataTransfer.types` must carry `Files`; text/link drags fall through untouched, never preventDefault'd); a multi-file drop on a non-`multiple` input keeps the FIRST file only (console.warn) — configured groups still enforce `isMultipleAllowed` server-side; a bare file input already accepts native browser drops through the same change handler — the attribute exists to delegate a larger/styled element. **Action/preview/bind fixes (#B146/#B147/#B149):** `checkUploadUrlActions`'s default-route fallback writes the attribute ACTUALLY being checked (`setAttribute(action, …)` — it used to hardcode the staging attribute and silently repoint a staging POST at the resolved reset/delete default route, compounding to a SILENT failure when `toUrl()`'s absolute origin tripped a CORS preflight → XHR status-0 → the commented-out status-0 branch); the preview-container guard uses the typeof-null pattern (`&& previewContainer` — `getElementById` returns element|null and `typeof null === 'object'`, so a preview-element MISS used to TypeError the success handler at `.id`); an upload-only input binds QUIETLY — `-delete-action` deliberately has no framework default (it removes an already-saved file, an app-specific endpoint), so a no-default absent action is a single `console.debug` + early return (a WITH-default action that genuinely fails to resolve still errors; the delete requirement stays enforced lazily at `onUploadResetOrDelete`). **Generated hidden fields — the `preview` slot (#B459, 2026-09-08):** the client writes one hidden input per `mandatoryFields` entry (`name`, `group`, `originalFilename`, `ext`, `encoding`, `size`, `height`, `width`, `location`, `mime`, `preview`) into the real form, auto-creating any the form did not declare — and `preview` was auto-created like the others although its value is an OBJECT (`{location, uri, tmpUri, width, height}`), so a form declaring no `[preview][...]` sub-fields got a flat `<prefix>[i][preview]` input, the fill loop's shared assignment string-coerced the staging response's preview object into it, and the real form's submit posted the literal `[object Object]` — a GARBAGE-VALUED field, not an absent one, so a data audit keyed on the field's absence reads the opposite of the truth (key on the value). The trigger is a CONJUNCTION — an undeclared form AND a response carrying a `preview` key; with no key the skip clause fires and the flat input was removed, which is why the documented response shape (no `preview`) never showed it. Since #B459 the auto-create loop seeds that slot with an EMPTY sub-field map instead of an input — so the fill loop still visits the key (the nested thumbnail is rendered from inside it) and posts nothing for it, the documented field set — and the shared assignment never targets the preview slot. Declaring `<prefix>[i][preview][location|uri|width|height]` hidden inputs is the opt-in for persisting the preview: the name parser is last-bracket-only, nesting is decided by a separate `/\[preview\]/i` test on the full name, so declared sub-fields fill from the response's nested object and post as a real nested structure — unchanged by the fix. A deliberately declared FLAT `[preview]` input is filed under the map (`preview.preview`), never as the slot itself, so the coercion path had exactly one entrance. Server code that keyed on the PRESENCE of a `preview` field for an undeclared form must key on its value: garbage before, absent now. Browser-bundled ⇒ pickup is restart AND re-bake. Tests: `validator-upload-preview-slot.test.js` (11: source pins, the auto-create loop extracted from the shipped bytes and executed on jsdom forms, dist fidelity — 9/11 red-first through the `GINA_VALIDATOR_MAIN`/`GINA_PLUGIN_DIST` seams) + e2e `validator-upload-preview-fields.spec.js` (arm 02 red on the pre-fix bundle through its `B459_PREFIX_BUNDLE` route lever, both thumbnails pinned as the constraint). Tests: `upload-binary-integrity.test.js` / `upload-size-accuracy.test.js` (11) / `multipart-multifile-resume.test.js` (15) / `upload-write-error-probe.test.js` / `upload-config.test.js §07` / `validator-upload-progress.test.js` (46) / `validator-upload-binary-wire.test.js` / `validator-upload-action-guard.test.js` — all red-first-validated with control-gated extractions of the shipped bytes. **The store() fluent form is restored (#B420, 0.6.16):** `self.store(target).onComplete(cb)` returns its `{onComplete}` handle synchronously as documented -- an accidental `async` on the declaration had wrapped the handle in a Promise on every stable from v0.6.0 to v0.6.15, so the fluent form (the upload guide entry-point example) threw `TypeError` while the 3-arg callback form worked throughout; the body was await-free, nothing anywhere awaits `store()`, and dropping the keyword is the whole fix (types now declare the fluent return shape). **Per-call since #B475 (2026-09-05):** the fluent handle used to register `self.on('uploaded', cb)` and never remove it, so a second `store()` on the same controller — sequential or overlapping — re-invoked every earlier `onComplete` callback with the later result; it now delivers through the callback path (`start(target, files, cb)`), one delivery per call, with the same arguments and the same synchronous timing on the empty-upload and released-response paths. The `'uploaded'` event no longer fires from `store()` at all: since #B475 the fluent form delivers through the callback, and since #B480 the fluent guard mints the handle for ANY non-function `cb` — `null` included, mirroring `query()`'s `typeof(callback) != 'function'` guard — so `store(target, files, null)` returns the handle instead of starting an upload whose outcome was emitted to nobody; `onComplete()` throws a `TypeError` synchronously when given a non-function (fail-fast at the caller rather than an uncaughtException inside an fs callback), and the seven unreachable `else emit('uploaded')` arms are removed together with the undocumented event (nothing in-tree ever listened to it, and it was never a `@fires`). **`query()`'s fluent `onComplete()` carries the same registration guard since #B485 (0.6.28)** — it minted a deliverer for any argument, so `.onComplete(null)` / `.onComplete('oops')` registered silently and the `TypeError` fired at settle INSIDE the delivery wrapper's own try/catch, surfacing as a misleading « Controller Query Exception while catching back » 500 that blamed the application callback (measured on a real instance — not the uncaughtException first assumed); now a `TypeError` naming `Controller::query` at the caller's line, the call-argument minting guard (`typeof(callback) != 'function'`) unchanged, so `query(options, data, null)` still returns the handle. The other 22 unguarded `onComplete` registration sites (connector `.then` shims, emitter-`once` helpers) are censused under #B491 — query()'s was the only one whose throw was swallowed. Test: `test/core/controller-store-null-callback.test.js` (9: source pins censused on a comment-stripped copy with raw-text controls, plus behavioural arms on a real instance, all red-first validated).
942
+ 210. **Multipart upload config is ENFORCED — groups, destination, limits, text-field capture + caps, terminal states (consolidates former #187/#188/#228/#230's server half; #B49/#B50/#B51/#B92-adjacent/#B93/#B97).** Every uploaded file must map to a CONFIGURED upload group: the resolved group (no/empty → the default `untagged`) must exist in `settings.json upload.groups` or the request is rejected 400 BEFORE the temp file is created, and `untagged` obeys its own config like any named group (pre-#B50 the checks ran only for defined non-`untagged` groups — an allow-list bypass; the shipped `untagged` default is `allowedExtensions: '*'` + `isMultipleAllowed: true`, so configure `untagged` restrictively or a client can route around a named group's allow-list). Destination + limits honoured: files stream to `uploadDir || tmpPath || os.tmpdir()` with a per-group `path` override and mkdir-if-missing before `createWriteStream` (the mkdir itself crash-guarded → 500, #B145); `maxFields` caps the per-request file COUNT (400 past the cap; 0/unset disables); `maxFieldsSize` parses its unit suffix (B/KB/MB/GB; bare number = MB) as the whole-body cap (431). **The staged on-disk FILENAME is server-generated and opaque, never the client's (#B419, 0.6.16):** `crypto.randomBytes(16).toString('hex') + '.part'`, minted once per part and used at BOTH path-construction sites — the write stream AND `req.files[].path`, which are built independently and must never diverge. Pre-fix the destination was `<fileUploadDir>/<client basename>` with NO per-part component, so two parts sharing a name — within ONE request or across concurrent requests — opened two write streams on ONE path with independent file offsets and INTERLEAVED their bytes into a single hybrid matching neither source, while the framework answered `storeErr:false` + 200 (measured live pre-fix: 12 concurrent same-named uploads → 0/12 clean, one hybrid file; one request with two same-named parts → one 500000-byte file of {B:417353,A:82647}; post-fix 12/12 clean, each byte-exact). The parse precedes routing and all middleware, so an UNAUTHENTICATED POST to ANY url reaches it — an unrouted one answers 404 to the client and still writes the file. A CSPRNG rather than the `Math.random()` used by `movefiles` (V8's is xorshift128+, so staging paths would be predictable, and a group `path` is operator-configurable into a served root); a RANDOM name rather than `filename + <suffix>` (keeps attacker-controlled bytes off the filesystem — RTL-override display spoofing, control chars, reserved device names — and cannot overflow NAME_MAX=255 into an ENAMETOOLONG 500 for a long-but-legal client filename); no interpretable extension, so a misconfigured static-serve of the staging dir cannot hand back an executable type. This is the multer ("a random name that doesn't include any file extension") and formidable (`newFilename` hexoid) convention. `req.files[].originalFilename` still carries the client's name and is what `store()` publishes the file under (`controller.js:4061`) and what a storage driver receives as `originalName`, so the documented "keeping each file's original name" contract is UNCHANGED — only `req.files[].path`'s BASENAME differs, and that field is documented as the temporary file's path. Server-side ⇒ pickup is a bundle restart, no re-bake. **Staged-part lifecycle + orphan reclaim (#B469):** a staged part has exactly TWO reclaim paths — the `movefiles()` unlink when `self.store()` publishes it, and the per-upload `autoTmpCleanupTimeout` deletion timer (`false`/0/empty disables it — the shipped default, and removing staged files is then the operator's own job). The timer is IN-PROCESS: a restart strands every part it was holding, and a part that never reaches `store()` (a request failing AFTER the multipart parse — the parse precedes routing, so auth/validation/quota failures have already staged; or an app consuming the staged file without `store()`) then has NO reclaim path at all. So an ARMED timer also arms a boot-time sweep at server init: each configured landing dir (the resolved global + every group `path`, deduped) is swept NON-recursively for `<32 lowercase hex>.part` REGULAR files (lstat, symlinks never followed; a client-named orphan predating the opaque staged naming is indistinguishable from an application file and is left alone — ⛔ that name gate is LOAD-BEARING, never widen it: `_sweepDirs` includes every group `path`, and a group `path` is ALSO the PERMANENT destination, so on a deployment whose group path is a permanent publicly-served storage root the pattern is the only discriminator protecting real user files; the mtime gate cannot help there, since permanent files are old by definition) older than max(timeout, 1h) — the floor keeps a SIBLING live process's in-flight part on a shared staging dir safe, since its mtime stays fresh while chunks land; ENOENT at any step is not an error (a sibling bundle sweeping the same dir, or the app unlinking its own part). The sweep REPORTS at `info` only when it removed something or hit errors (`upload orphan sweep: removed N staged part(s) across M staging dir(s)`) and at `debug` when it found nothing — so at the default `info` level a silent boot means no staged part was older than the gate, NOT that the sweep did not run; an operator expecting the line after a restart that had nothing left to reclaim (the boot that did the reclaiming having gone with its logs) will otherwise read a healthy no-op as a missing line. Disabled timer = NO sweep — the documented operator-owns-cleanup contract is unchanged. An application MAY unlink `req.files[].path` itself: `movefiles()` tolerates a vanished source (ENOENT) by design, and the armed timer already requires that tolerance. Rule: a group `path` is the PARSE-TIME LANDING (staging) directory, never where published files live — `store(targetDir)` or the group's storage `driver` owns final placement, and one key must never carry both meanings. **Multipart TEXT fields are captured** — a real busboy `'field'` listener (busboy silently SKIPS all non-file parts when none is registered) exposes them on `req.body` + `req[method]` (POST/PUT/PATCH only), values VERBATIM (no url-decode, no `"true"/"false"/"on"/"null"` coercion — the JSON body contract, deliberately: otherwise the same client `send(fd)` call would change value TYPES with file presence), bracket-notation names nested through the urlencoded path's own layer, duplicate plain names last-wins; caps `upload.maxTextFields` (default 1000) + `upload.maxTextFieldSize` (default 1MB, unit-aware, explicit 0 = no limit) answer 400 on breach instead of busboy's silent skip/truncation. **A multipart request with no successfully-parsed file part reaches a TERMINAL state:** fields-only → the request resumes; malformed/empty → 400 via `busboy.on('error')` with a double-response guard (busboy terminates in exactly `finish` XOR `error`; pre-#B93/#B97 both were unauthenticated pre-routing DoS holes — an eternal hang, and an uncaughtException → SIGTERM bundle kill). Rules: a per-group restriction is only a control if the UNCONFIGURED/default case is denied or constrained, never waved through; a documented config key is only real if a code path reads it — grep the consumer before assuming a setting works; any stream/parser whose SUCCESS path drives a request's continuation must ALSO handle its error/empty terminals. Since #STO1 slice 1 a group may also carry driver: '<name>', routing its self.store() step through settings.storage (entry #300; the parse/staging path above is unchanged). Server-side only. Tests: `test/core/upload-groups.test.js` + `upload-config.test.js` + `multipart-nonfile-terminal.test.js` + `multipart-field-capture.test.js` + `upload-concurrent-staging.test.js` + `upload-orphan-sweep.test.js` (+ the client `send(FormData)` half: `validator-send-formdata-multipart-fields.test.js`). **Server-path integrity + terminal-state hardening (former #263/#267/#268/#270 — #B103/#B142/#B143/#B144/#B145/#B223, 0.5.22-0.5.24):** a multipart body stays RAW end-to-end — `request.isMultipart` is computed ONCE at the request prologue and gates the request-stream `setEncoding` (a multipart stream reaches busboy as raw Buffers, its documented input; the decode remains for the text-body branches), write-pipeline chunks pass through VERBATIM, and `req.files[].size` counts BYTES, never a decoded string's length (#B103 — pure-ASCII surviving both old decode layers is why text uploads always worked while every real binary corrupted on every native multipart client: a PNG's 0x89 magic landed as 0xFD). The per-file `size` is finalized in the liner Transform's `_flush` (#B142 — the source-'end' record ran one pipe hop UPSTREAM of the byte counter with 16-object high-water marks still queued, under-counting ~25% on a 1.5MB file while md5 stayed perfect: the bytes were intact, only the number lied; `_flush` runs after the last `_transform` and strictly before the write stream can emit 'finish', both interleavings measured exact), and BOTH write-stream terminal listeners arm AT STREAM CREATION in the 'file' handler (#B143 — arming inside `busboy.on('finish')` lost the race for any early-finishing small file: Node never replays 'finish' for a late listener, so a throttled two-file upload hung deterministically, ~1 in 13 unthrottled; unauthenticated, both engines). Resume fires on `busboyDone && pending === 0`, whichever event lands last (the zero-pending branch still covers the fields-only #B93 terminal), and a mid-stream write error (missing dir, disk full) gets a guarded 500 instead of the historical unhandled-'error' uncaughtException SIGTERM. Downstream, `Controller.store()`'s mover streams each file to a temp sibling and publishes with an ATOMIC rename (a reader never observes a partial file; a pre-existing destination is replaced only on success), propagates the REAL filesystem Error (previously masked as `No file to upload`), and never settles the callback twice (#B223). Since #B227 the SAME semantics govern the general-purpose byte-writer in `helpers/path.js` behind `_().cp()` / `PathObject.mv()` (which CLI copy/build/rename paths ride): temp sibling in the destination's own directory + atomic rename (a pre-existing destination is no longer unlinked BEFORE the copy — its content survives a failed copy), a source-stream error listener (was an unhandled `error` event → process kill), a settled latch (a destination-side failure previously settled twice, the second time as a success, forking `browseCopy`'s directory recursion), and a real `Error` instead of the former plain string (`Error on Path.cp(...): Not found ...`) — so caller `err.stack` prints stop logging `undefined` (on Bun too, which reports such an error without a stack: the helper gives it one, #B654), and a failed copy's temp sibling is removed only once its stream has closed, before the callback — its creation can finish after the failure is reported (#B649); `Controller.store()`'s mover does not have this reap yet — its failure path still checks for the temp sibling and settles at once (#B657, open, code-read). The destination mkdir is crash-guarded (#B145): a group whose custom `path` has a read-only/EACCES/EROFS parent answers a guarded 500 naming group + path — a server CONFIG problem is 500 (the #B50 unconfigured-group 400 stays upstream and unchanged), and pre-fix `fs.mkdirSync` threw SYNCHRONOUSLY inside the parser callback → uncaughtException → SIGTERM, an unauthenticated single-request bundle kill (the multipart parse precedes routing and all middleware, both engines). A per-group `simulateWriteError: true` flag (#B144) lets a consumer deterministically fire the guarded-500 write-error path OUTSIDE production scope only (`!NODE_SCOPE_IS_PRODUCTION`): the 'file' handler creates the REAL write stream, arms the REAL terminal listeners, then synthetically `destroy()`s it — the exact terminal semantics of a real ENOSPC/EIO (an errored stream never emits 'finish', so the request stays terminal at the 500), N destroyed parts collapsing to exactly ONE 500 via throwError's `!res.headersSent` guard; a boot warn scans `upload.groups` for the flag in both scopes (production: "IGNORED — remove before shipping"; else "PROBE active"); nothing ships active. The `group="…"` tag rides a Content-Disposition PARAMETER that `curl -F` / browser FormData cannot emit (the `@rhinostone/busboy` fork parses it into `info.dispositionParams.group`), so a faithful probe HAND-BUILDS the multipart body. **The staged upload client layer (`data-gina-form-upload-*`, lives in the validator plugin — browser-bundled ⇒ consumers RE-BAKE at pickup; former #269/#271/#272/#274 — #R8 slices 1-2, #B146/#B147/#B148/#B149):** the staging POST body is assembled as a `Blob` with each File object embedded RAW (#B148 — the historical `FileReader`/`ab2str` DOMString concatenation UTF-8-inflated every byte >= 0x80 on the wire, ×1.49 measured, a PNG's 0x89 arriving as 0xC2 0x89; the corruption only STARTED at 0.5.22 because the pre-#B103 server's two since-removed decode layers EXACTLY reversed the inflation — two wrongs cancelling — so the #B103 server fix is what exposed the client defect). Multipart FRAMING is byte-identical (same boundary delimiters, same `name=`/`group=`/`filename=` disposition-parameter set, values percent-escaped for CR/LF/double-quote per RFC 7578 §5.1.1); a fixed client must pair with a server >= 0.5.22 (an older server's decode layers would corrupt the now-raw bytes — the #B103 corruption in reverse); files corrupted by the defect are LOSSLESSLY recoverable (the stored bytes are exactly the UTF-8 encoding of the originals: decode utf8 → re-encode latin1). **`send()` reads nothing from the event being dispatched (#B758, 0.7.3):** a staged file's `group=` comes from the file input its virtual upload form stages for (`uploadProperties.uploadTriggerId` → that input's `data-gina-form-upload-group`, `untagged` when unset). It was read from the implicit global `event.currentTarget`, right only inside the input's own change dispatch (picker, dropzone), so a direct `$forms[<virtual id>].send(formData)` outside a dispatch threw (reported as a staging error, while the request still went out with no boundary and no group) and inside an unrelated dispatch took that element's group, silently; a no-data `send()` now sends an empty body instead of reading `event.detail.data` and throwing after `isSending` was claimed. e2e `validator-upload-send-b758.spec.js` (5 arms, red-first). **Upload progress (#R8 slice 1):** `send()` assigns `xhr.upload.onprogress` FRESH on every send (the module-scoped XHR was reused across sends — a stale handler replays the previous send's closure with the wrong id), dispatching the REGISTERED event `uploadProgress.<uploadFormId>` (the events-array registration is required — `on()` validates names against the plugin registry) with `{ status: 100, progress: <int 0-100 | null when lengthComputable is false>, loaded, total, lengthComputable, files: [names] }` — a per-REQUEST aggregate (ONE staging XHR carries every file of a selection; per-file wire progress is not separable). Consumer surfaces: `data-gina-form-upload-on-progress` (bare window identifier, the -on-success convention) + a declarative indicator `data-gina-form-upload-progress="<elId>"` defaulting to `<fieldId>-progress`, opt-in by element presence. The updater feature-detects the target: a native `<progress>` tracks value=loaded/max=total (indeterminate = the value attribute REMOVED for the native animation; error = value 0, NEVER indeterminate — that animation would read as still working); any other element gets percent textContent + `data-gina-upload-progress`/`data-gina-upload-progress-state` styling hooks (preparing|uploading|indeterminate|processing|complete|error) with NO hardcoded wording (i18n-neutral — label via CSS on the state attribute). Lifecycle: `preparing` at selection (covers the FileReader/assembly phase), `uploading` per frame, `processing` at `xhr.upload.onloadend` (the browser finished SENDING — advances the state attribute ONLY, leaving value/percent as the last frame left them so a determinate bar stays visually full), `complete`/`error` finalized in onUpload (one chokepoint covers success and every error/timeout path), reset/delete strips the indicator. The response-side download channel `progress.<id>` is byte-untouched (it also serves attachment downloads). **Drag-and-drop (#R8 slice 2):** a file input carrying `data-gina-form-upload-dropzone="<elementId>"` gets drag listeners bound on the named element at form-bind time; dropped files are assigned to the input (`input.files = dataTransfer.files`) and the input's `change` is re-fired synthetically, so the ENTIRE staging pipeline — group tagging, virtual form, staging POST, previews, hidden metadata fields, reset/delete, upload progress — runs with zero duplicated logic (the change handler reads only `currentTarget`, so a synthetic dispatch is indistinguishable from a trusted one on this path). Contract: EXPLICIT-id-only (deliberately NO `<fieldId>-dropzone` default — auto-binding a coincidentally-named element would attach drag semantics to markup that may carry its own drop handling; absent attribute = inert, missing element = console.warn + inert); the zone is stamped `data-gina-upload-dropzone` (value = owner input id — the first-wins guard: one zone serves one input) and `data-gina-upload-dropzone-state` (`idle` → `over` on a file-drag hover, DEPTH-COUNTED so child-boundary crossings never flicker → `dropped` → back to `idle` at the same onUpload chokepoint that finalizes progress, and at reset/delete) — pure CSS hooks, no hardcoded wording. Only FILE drags react (`dataTransfer.types` must carry `Files`; text/link drags fall through untouched, never preventDefault'd); a multi-file drop on a non-`multiple` input keeps the FIRST file only (console.warn) — configured groups still enforce `isMultipleAllowed` server-side; a bare file input already accepts native browser drops through the same change handler — the attribute exists to delegate a larger/styled element. **Action/preview/bind fixes (#B146/#B147/#B149):** `checkUploadUrlActions`'s default-route fallback writes the attribute ACTUALLY being checked (`setAttribute(action, …)` — it used to hardcode the staging attribute and silently repoint a staging POST at the resolved reset/delete default route, compounding to a SILENT failure when `toUrl()`'s absolute origin tripped a CORS preflight → XHR status-0 → the commented-out status-0 branch); the preview-container guard uses the typeof-null pattern (`&& previewContainer` — `getElementById` returns element|null and `typeof null === 'object'`, so a preview-element MISS used to TypeError the success handler at `.id`); an upload-only input binds QUIETLY — `-delete-action` deliberately has no framework default (it removes an already-saved file, an app-specific endpoint), so a no-default absent action is a single `console.debug` + early return (a WITH-default action that genuinely fails to resolve still errors; the delete requirement stays enforced lazily at `onUploadResetOrDelete`). **Generated hidden fields — the `preview` slot (#B459, 2026-09-08):** the client writes one hidden input per `mandatoryFields` entry (`name`, `group`, `originalFilename`, `ext`, `encoding`, `size`, `height`, `width`, `location`, `mime`, `preview`) into the real form, auto-creating any the form did not declare — and `preview` was auto-created like the others although its value is an OBJECT (`{location, uri, tmpUri, width, height}`), so a form declaring no `[preview][...]` sub-fields got a flat `<prefix>[i][preview]` input, the fill loop's shared assignment string-coerced the staging response's preview object into it, and the real form's submit posted the literal `[object Object]` — a GARBAGE-VALUED field, not an absent one, so a data audit keyed on the field's absence reads the opposite of the truth (key on the value). The trigger is a CONJUNCTION — an undeclared form AND a response carrying a `preview` key; with no key the skip clause fires and the flat input was removed, which is why the documented response shape (no `preview`) never showed it. Since #B459 the auto-create loop seeds that slot with an EMPTY sub-field map instead of an input — so the fill loop still visits the key (the nested thumbnail is rendered from inside it) and posts nothing for it, the documented field set — and the shared assignment never targets the preview slot. Declaring `<prefix>[i][preview][location|uri|width|height]` hidden inputs is the opt-in for persisting the preview: the name parser is last-bracket-only, nesting is decided by a separate `/\[preview\]/i` test on the full name, so declared sub-fields fill from the response's nested object and post as a real nested structure — unchanged by the fix. A deliberately declared FLAT `[preview]` input is filed under the map (`preview.preview`), never as the slot itself, so the coercion path had exactly one entrance. Server code that keyed on the PRESENCE of a `preview` field for an undeclared form must key on its value: garbage before, absent now. **#B791 (next 0.7.x) finished #B459 for EDIT forms:** #B459 fixed only the UNDECLARED case; a form DECLARING `[preview][*]` sub-fields still kept the REPLACED file's values when the replacement's staging response carried no (or a partial) `preview`, because the fill loop's skip branch removed the slot by `getElementById(.id)` — a no-op on the `.id`-less sub-field map. The skip branch now detects the slot by SHAPE (an element has a `tagName`, the map does not) and CLEARS every declared sub-field the response omits (the documented 'left empty' contract), with a matching pre-pass for a partial preview; flat `height`/`width` removal is unchanged. Browser-bundled ⇒ pickup is restart AND re-bake. Tests: `validator-upload-preview-clear-b791.test.js` (4: red arm + full/partial/flat controls, the extracted fill loop on jsdom) + `validator-upload-preview-slot.test.js` (11: source pins, the auto-create loop extracted from the shipped bytes and executed on jsdom forms, dist fidelity — 9/11 red-first through the `GINA_VALIDATOR_MAIN`/`GINA_PLUGIN_DIST` seams) + e2e `validator-upload-preview-fields.spec.js` (arm 02 red on the pre-fix bundle through its `B459_PREFIX_BUNDLE` route lever, both thumbnails pinned as the constraint). **Reset and delete act on the input's FILES, and the fields come back (#B858-#B862, next 0.7.x):** the hidden `<prefix>[i][…]` fields are built on EVERY selection, not only when the input's virtual upload form is created — a reset removed them, so the next selection was staged and previewed but the save posted no file, and a larger re-selection got no fields for its new indices. A reset walks the input's staged files by index (the staging answer is kept on the input as `stagedFiles`), a delete walks the stored entries the bind-time scan recorded, and ONE removal request names every removed file (a reset is `POST {files}`; a delete with one name and no `-delete-method` is a body-less `DELETE`, else `POST {files}`); then each file's reset/delete link, preview node(s) and `<prefix>[i]…` fields go (`data-gina-form-upload-is-locked` fields stay). So a staged file with no `<img>` (a non-image without `preview`), an `<img>` inside a `<ul>` container's `<li>`, every file of a multi-file input (whose reset threw `InvalidStateError` setting the input's value to the files left) and the fields of a custom `data-gina-form-upload-prefix` (#B862: they were removed by the input's `name`) are all reached. A file node is an `<img>` child of the preview container or of its `<li>`, or ANY element carrying `data-upload-original-filename` — the opt-in for a stored file an edit form shows without an image (`<a data-upload-original-filename="cv.pdf" href="…">`, the attribute naming the file; an `<img>` without it is named by its `src` basename, as before). The removed fields — declared `[preview][*]` inputs included — are kept on the input and put back IN PLACE, emptied, at the next selection (an input the page re-added under the same name wins), so a replacement without a preview posts the declared preview sub-fields EMPTY (#B791's contract). #B861: the reset link id is `<input id>-<index>-reset-trigger` whatever the preview container's id (it was derived from the container's id, so a custom `data-gina-form-upload-preview` made the container itself the link and nothing was bound), the reset resolves the container the input names, and an input with no preview container no longer throws before its fields are filled. Any one reset or delete control still removes ALL of the input's files. Browser-bundled ⇒ RE-BAKE. Tests: `validator-upload-reset-reselect-b858.test.js` (22: source pins, the six helpers extracted from the shipped bytes and run on jsdom forms, dist pins; all red on the pre-fix bytes through `B858_VALIDATOR_SRC`/`B858_PLUGIN_DIST`) + e2e `validator-upload-reset-reselect-b858.spec.js` (18 arms; through `B858_PREFIX_BUNDLE` the four controls pass and the 14 others fail, on the pre-fix and on the published 0.7.3 bundle). Tests: `upload-binary-integrity.test.js` / `upload-size-accuracy.test.js` (11) / `multipart-multifile-resume.test.js` (15) / `upload-write-error-probe.test.js` / `upload-config.test.js §07` / `validator-upload-progress.test.js` (46) / `validator-upload-binary-wire.test.js` / `validator-upload-action-guard.test.js` — all red-first-validated with control-gated extractions of the shipped bytes. **The store() fluent form is restored (#B420, 0.6.16):** `self.store(target).onComplete(cb)` returns its `{onComplete}` handle synchronously as documented -- an accidental `async` on the declaration had wrapped the handle in a Promise on every stable from v0.6.0 to v0.6.15, so the fluent form (the upload guide entry-point example) threw `TypeError` while the 3-arg callback form worked throughout; the body was await-free, nothing anywhere awaits `store()`, and dropping the keyword is the whole fix (types now declare the fluent return shape). **Per-call since #B475 (2026-09-05):** the fluent handle used to register `self.on('uploaded', cb)` and never remove it, so a second `store()` on the same controller — sequential or overlapping — re-invoked every earlier `onComplete` callback with the later result; it now delivers through the callback path (`start(target, files, cb)`), one delivery per call, with the same arguments and the same synchronous timing on the empty-upload and released-response paths. The `'uploaded'` event no longer fires from `store()` at all: since #B475 the fluent form delivers through the callback, and since #B480 the fluent guard mints the handle for ANY non-function `cb` — `null` included, mirroring `query()`'s `typeof(callback) != 'function'` guard — so `store(target, files, null)` returns the handle instead of starting an upload whose outcome was emitted to nobody; `onComplete()` throws a `TypeError` synchronously when given a non-function (fail-fast at the caller rather than an uncaughtException inside an fs callback), and the seven unreachable `else emit('uploaded')` arms are removed together with the undocumented event (nothing in-tree ever listened to it, and it was never a `@fires`). **`query()`'s fluent `onComplete()` carries the same registration guard since #B485 (0.6.28)** — it minted a deliverer for any argument, so `.onComplete(null)` / `.onComplete('oops')` registered silently and the `TypeError` fired at settle INSIDE the delivery wrapper's own try/catch, surfacing as a misleading « Controller Query Exception while catching back » 500 that blamed the application callback (measured on a real instance — not the uncaughtException first assumed); now a `TypeError` naming `Controller::query` at the caller's line, the call-argument minting guard (`typeof(callback) != 'function'`) unchanged, so `query(options, data, null)` still returns the handle. The other 22 unguarded `onComplete` registration sites (connector `.then` shims, emitter-`once` helpers) are censused under #B491 — query()'s was the only one whose throw was swallowed. Test: `test/core/controller-store-null-callback.test.js` (9: source pins censused on a comment-stripped copy with raw-text controls, plus behavioural arms on a real instance, all red-first validated). **What a reset asks the server to remove (documented 2026-10-14):** a staged-file reset sends, by default, a `POST` of `{ files: [...] }` to the reset action (`data-gina-form-upload-reset-method` overrides the method; a `GET` or `DELETE` is sent with no body), naming each staged file by the `originalFilename` the staging answer returned, then its preview's `originalFilename`. A staging action that stores with `self.store()` finds the files under those names (`store()` publishes under the original name); one that stores them under other names, a generated one for instance, must map each `originalFilename` back to the stored file, or the staged file stays in its temporary directory after the reset.
941
943
 
942
- 211. **Request-body parsing contract — verbatim JSON, `req.rawBody`, and crash-safe decodes (consolidates former #162/#163/#164; #B28/#B30/#B64/#B588–#B592).** `application/json` bodies (POST/PUT/PATCH) parse VERBATIM first — `JSON.parse(request.body)`, with a `decodeURIComponent` fallback ONLY when that throws — so the client's exact types and string contents survive (no double-decode, no `"true"/"false"/"on"/"null"` coercion, no bracket-key expansion; error disposition unchanged — POST/PATCH 500 only when both attempts fail, PUT warns). **Urlencoded and unlabelled bodies follow the standard form algorithm (#B588/#B589/#B592, 0.6.33).** The POST/PUT/PATCH site hands the body over VERBATIM (only the content-type-gated `+`→space and a leading-`?` strip run there) and `formatDataFromString` splits on `&`, splits each pair at its FIRST `=`, then percent-decodes the name and the value exactly ONCE. Before, the body was decoded as a WHOLE — at the site and again in the helper — BEFORE that split, so an encoded `&`/`=` inside ONE value OR name became a separator that could ADD or OVERRIDE any other field (`role=user&bio=hi%26role%3Dadmin` → `role=admin`; a NAME carrying `%26role%3Dadmin` did the same), a raw `=` cut a value short (`a=b=c` → `b`), and a value was decoded up to four times (`100%2525` → `100%`). Now: a value leaning `{`/`[` is parsed as JSON when it parses — JSON carries its own types, so a quoted `"true"` INSIDE it stays a string (it was coerced) — and kept verbatim when it does not (it was dropped); a JSON value under a bracket key nests like any other value; bare `true`/`false`/`on`/`null` stay strings (they always did); raw quotes are kept (`Turn it "on"` no longer becomes `Turn it true`); a value-less segment is dropped and a repeated key keeps the last value (unchanged). The `"true"`/`"false"`/`"on"`/`"null"` casting is a DOCUMENT feature: it runs only when the whole input is a `{`/`[`-leading document or an object (stringified first — the browser validator's contract). A document is NEVER percent-decoded (#B589): the GET/HEAD re-parse used to decode the whole serialized query, so a value whose TEXT held `%22`/`%0A`/`%5C` made the document invalid and dropped EVERY query parameter (`req.get = {}`, and a `validator::` requirement copying that data answered 404); a fully `%7B`/`%5B`-encoded document is still decoded once. Isaac's query parser now decodes the NAME once as well (`+`→space first, as express's `qs` always did), so an HTML-form `user%5Bname%5D` still nests without the round-trip's accidental decode. A top-level `__proto__`/`constructor`/`prototype` name is dropped on both paths (#B592 — a JSON-valued `__proto__` swapped the PROTOTYPE of the parsed object); a route declaring a DTO re-parses its validated payload through this helper, so a top-level `prototype` key in its JSON body is now dropped too, while a plain `application/json` body is parsed as-is and keeps it. Parse failures log metadata only, never the input and never `err.message` (a `JSON.parse` message can quote the input — V8 and JavaScriptCore both do): the helper's `[365]` line logs the input's length, its leading character and `err.name`, and isaac's not-JSON warn the parameter's name, the value's length and `err.name` (#B590). The helper ships in the browser bundle, so pickup is a restart AND a re-bake. Suites: `test/lib/request-parsing-b588.test.js`, `test/lib/request-parsing-logs-b590.test.js`, `test/integration/container-boot-request-parsing.test.js` (a real boot, red-first against the pre-fix tree). **XML bodies pass through VERBATIM (#FIN1).** `application/xml`, `text/xml` and the `application/*+xml` suffix family fork off the legacy path on POST/PUT/PATCH before any decode: `request.body` stays the exact document (the same string `rawBody` carries) and the method slot is left unset — the routing loop normalises it to `{}` further down, so a controller still reads an object from `req.post`. The framework never PARSES XML, so it takes on no XML-parser surface and no XXE exposure; consumers bring their own library. Pre-#FIN1 such a body was silently DESTROYED rather than rejected: the bracket-notation data helper splits on `&` then on `=` and keeps only the first pair, so an XML declaration alone collapsed a whole document to a single bogus key which — having a key — then REPLACED `request.body` at the shared tail, while the `"true"`/`"on"` coercion separately rewrote quoted attribute values. The matched set is the convergent one — ASP.NET Core registers ApplicationXml/TextXml/ApplicationAnyXmlSyntax (`application/*+xml`), Spring's `MimeType.includes()` documents `application/*+xml` as including `application/soap+xml`, and type-is matches structured suffixes generically — with the wildcard scoped to `application/` in all three, so `image/svg+xml` is deliberately NOT matched and RFC 7303's non-document types (`application/xml-dtd` §9.5, both `xml-external-parsed-entity` §9.3/§9.4) are excluded. RFC 7303 §9.6.1 registers the suffix but RFC 6838 §4.2.8 makes it a naming convention that does NOT mandate generic processing, so this set is convergent implementation practice, not a normative requirement. ONE flag computed at the request prologue feeds all three branches (the #B103 single-site lesson, after those same three sites drifted); each arm seeds `obj = {}` because the shared POST/PATCH tail reads `typeof(obj) == 'object' && ownCount(obj)` and `typeof null === 'object'`. Both engines share the chokepoint; server-side only, no dist rebuild. **#B546 (0.6.31) — that tail, and every other own-property count over a CLIENT-KEYED container, goes through a module-local `ownCount()` rather than `<container>.count()`.** gina installs `count()` on `Object.prototype`, so the shorthand is an ordinary property lookup that an OWN field of that name SHADOWS, and a request carrying a top-level `count` made the framework call a string: a 500 on the guarded body branches, and an uncaughtException that EXITED the bundle process on the UNGUARDED query ones — unauthenticated, one request, on ANY url including one matching no route, because this parse precedes routing (driven live both ways: every shape reproduced before the fix and answers cleanly after). `ownCount()` is that same helper reached as `Object.prototype.count.call()`, which no own property can shadow, plus an explicit null/undefined branch that PRESERVES the throw the `obj = {}` seeding above depends on — the bare `.call(null)` would bind `this` to the global object and return ITS key count (measured 23) instead of throwing. Nested keys and near-misses (`counter`) were never affected. The framework's own server-to-server client (`self.query()`) sends raw `JSON.stringify(data)` for JSON bodies (RFC5987 value-encoding is for header values, not request bodies), and the inter-bundle HTTP/2 proxy no longer copies the INCOMING request's Content-Type onto the outbound JSON body it serialized itself — a urlencoded label re-routed raw JSON through the receiving parser's urlencoded branch and corrupted string values (the only incoming-CT→outbound copy framework-wide; kept for non-JSON bodies). `request.rawBody` snapshots the exact unparsed body (reference assignment, always-on, non-multipart only, `''` for empty) immediately BEFORE parsing mutates `request.body` — inbound-webhook HMAC verification needs the raw bytes, which middleware cannot recover after the stream drains; both engines share this single `core/server.js` pipeline. Malformed percent-escapes (`%`, `%zz`, truncated `%E0%A`) in a URL or query no longer kill the bundle (#B30 — an unauthenticated single-request DoS: any unguarded `decodeURIComponent` OR `decodeURI` on the request path threw `URIError` → uncaughtException → SIGTERM): redundant SECOND decodes on the GET/HEAD branches were DROPPED (the engine query parser decodes once, guarded — and since #B589 the data helper never percent-decodes the serialized query document at all), and every genuine first decode of attacker-controllable input routes through `safeDecodeURIComponent`/`safeDecodeURI` (try/decode/fallback-to-raw) — including the ERROR paths, where a malformed-% URL to a missing asset previously crashed FROM the error handler, turning a would-be 404 into a bundle kill. Sweep rule: `decodeURIComponent` and `decodeURI` are the same throwing family — sweep BOTH; fix the throw sites, never widen the uncaughtException net. Sibling #B64 (0.5.7): the two static-file resolvers confine the resolved filename to the matched mapping target (`path.resolve` both sides + separator-aware containment), so `../` / `%2F` / `%2e%2e` cannot escape to sibling files — an escape 404s exactly like a missing file. Second site, same guard (#B179, Security/CWE-22): the dev-mode Inspector SPA handler (`/_gina/inspector/*`) built its filename the same way — request target minus the prefix, joined onto the asset root, passed through the `_()` path helper — and `_()` calls `Path.normalize`, which **RESOLVES** `..` rather than rejecting it, so a literal `../` read any absolute path the bundle process could reach (verified live: 200 on `/etc/passwd`; encoded `%2e%2e` unaffected, since this handler never decodes — and decoding was deliberately not added). Node does not normalise the request-target (only clients do), so a raw HTTP client reaches it where a browser cannot. Unlike the static resolvers, this handler is **DUPLICATED per engine** (server.js + server.isaac.js) and `confineToBase` is scoped inside server.js's `Server()` closure — unreachable from isaac, which therefore declares an engine-local twin, pinned against drift by a test asserting both extracted copies agree. **Rule: any handler joining request-derived segments onto a base MUST confine the RESOLVED path; path normalisation is not a traversal defence, it is the mechanism that makes the escape land.** Corollary for endpoint families: check the SIBLING handlers' gating too — the Inspector endpoint carries no IP allowlist while its `/_gina/*` neighbours (`info`, `cache/stats`, `cache/clear`) all gate on `lib.admin.isClientAllowed`. **GET/HEAD query serialization no longer destroys escapes (#B407, consumer-reported):** both branches round-trip `request.query` through JSON.stringify + a re-parse, and the former textual nested-JSON unwrap ended with a blanket backslash strip over the WHOLE serialized document — so `%0A` in a value became the letter `n`, a backslash vanished, and a double quote OR a JSON-ARRAY value produced invalid JSON that silently dropped EVERY query param on the request (`parseBody` logs `[365]` and returns undefined). Both sites now serialize via `serializeQueryForReparse` (a shared inner helper in `processRequestData`): each own STRING value leaning `{`/`[` is unwrapped by PARSING it (kept verbatim when it does not parse — previously that shape also dropped the whole query), then a clean stringify with no post-processing; the whole-value `"true"/"false"/"on"/"null"` coercion is unchanged and, with escapes intact, can no longer match an escaped occurrence embedded inside a longer value. Intended behaviours preserved byte-for-byte (nested-object unwrap — now also correct for nested content carrying escapes, which the textual unwrap corrupted as well — coercion, plain values); array-valued and unparsable-`{`-leading params are delivered instead of killing the query. **PROTOTYPE-POLLUTION GUARD (#B446).** Every parse path that nests a bracket-notation key routes through `parseLocalObj` in `helpers/data` (aliased `nestBracketNotationKey`, and reached from `formatDataFromString`), which assigned `obj[key[k]]` from a CLIENT-SUPPLIED field name with no key filtering: `__proto__[x]=y`, `constructor[prototype][x]=y` and the percent-encoded `%5F%5Fproto%5F%5F[x]=y` each wrote to `Object.prototype` process-wide while the parsed body still read `{}` — i.e. SILENTLY. Reachable from the GET query string, urlencoded bodies, `inheritedData`, and multipart text-field names. ✅ **CONFIRMED LIVE over real HTTP on the DEFAULT `isaac` engine** (daemonless throwaway bundle, pre-fix worktree vs fixed tree, same fixture): a single unauthenticated `GET /?__proto__[polluted]=OWNED` — no body, no interaction — returned `polluted:"OWNED"` with `hasOwn:false` (the prototype-pollution signature, not an own property) and `arrayToo:"OWNED"`, and **the NEXT, innocent request inherited it at the same pid**, proving cross-request persistence. All three vectors reproduced; the fixed tree answered clean on all three with benign bracket nesting still HTTP 200. ⚠️ Isaac does NOT reference these functions at all — its own query parser is flat (`request.query[a[0]] = a[1]`); the attack survives because `server.js` re-serialises isaac's flat query (`serializeQueryForReparse`) and re-parses it through `formatDataFromString`, which restores the bracket branch. ⚠️ Instrument trap that nearly produced a FALSE NEGATIVE: `curl` treats `[...]` as a URL glob range, so every bracket request fails inside curl and never reaches the server — use `curl -g`. A second, independent source: PUT merges `JSON.parse` output as the merge SOURCE, and `JSON.parse` produces an OWN `__proto__` key, so an own-property check alone does NOT stop it — see #321. Measured gadgets before the fix: outbound-request options fully controllable (host/hostname/port/method/auth, `rejectUnauthorized` forced false, `protocol` feeding a dynamic transport require), `SAFE_HTTP_METHODS[m] === true` classifying POST as safe, and `req.routing.csrfExempt` reading true — the last two ONLY via the JSON source, since the string source yields `"true"` and is correctly rejected by the strict compare. ⚠️ The `csrfExempt` one is UNRESOLVED, not confirmed on a live route: what was measured is that a routing object LACKING an own `csrfExempt` reads the polluted value, but `core/server.js:7674` builds routes as `csrfExempt: routing[name].csrfExempt || false`, creating an OWN key that shadows the prototype — while `lib/routing/src/main.js:220` sets it only when already defined, so a route built there can lack it. Which construction path a live `req.routing` takes was NOT determined. Both sources now reject `__proto__` / `constructor` / `prototype` path segments and DROP the field rather than throwing (a throw on the parse path would turn one bad field into a 500). The guard is kept INLINE in `parseLocalObj`, not a closure helper, because `test/core/validator-send-formdata-nesting.test.js` extracts that function's source text and evals it standalone to pin client/server parity — a helper call is a ReferenceError there. `helpers/data` and the validator copy are both browser-bundled, so pickup is a bundle restart AND a re-bake. **#B591 (0.6.33):** `parseLocalObj` also carried a dead `obj = []` rebind for a numeric NON-LAST segment under a non-array container — the parent never saw it and the child slot it seeded was `null` — so `0[a]=1` threw a TypeError, and from the unguarded GET/HEAD `inheritedData` parse that EXITED the bundle (one unauthenticated request; measured exit 143). The rebind is gone in both copies: such a segment now creates a plain `{}` slot (`0[a]=1` → `{"0":{"a":"1"}}`), and no previously non-throwing result changed (every path through the rebind threw). Suite: `test/lib/bracket-nesting-b591.test.js`. Regression suite: `test/lib/prototype-pollution-b446.test.js` (attack arms each paired with a benign control, pre/post A/B validated on extracted HEAD source).
944
+ 211. **Request-body parsing contract — verbatim JSON, `req.rawBody`, and crash-safe decodes (consolidates former #162/#163/#164; #B28/#B30/#B64/#B588–#B592).** `application/json` bodies (POST/PUT/PATCH) parse VERBATIM first — `JSON.parse(request.body)`, with a `decodeURIComponent` fallback ONLY when that throws — so the client's exact types and string contents survive (no double-decode, no `"true"/"false"/"on"/"null"` coercion, no bracket-key expansion; error disposition unchanged — POST/PATCH 500 only when both attempts fail, PUT warns). **Urlencoded and unlabelled bodies follow the standard form algorithm (#B588/#B589/#B592, 0.6.33).** The POST/PUT/PATCH site hands the body over VERBATIM (only the content-type-gated `+`→space and a leading-`?` strip run there) and `formatDataFromString` splits on `&`, splits each pair at its FIRST `=`, then percent-decodes the name and the value exactly ONCE. Before, the body was decoded as a WHOLE — at the site and again in the helper — BEFORE that split, so an encoded `&`/`=` inside ONE value OR name became a separator that could ADD or OVERRIDE any other field (`role=user&bio=hi%26role%3Dadmin` → `role=admin`; a NAME carrying `%26role%3Dadmin` did the same), a raw `=` cut a value short (`a=b=c` → `b`), and a value was decoded up to four times (`100%2525` → `100%`). Now: a value leaning `{`/`[` is parsed as JSON when it parses — JSON carries its own types, so a quoted `"true"` INSIDE it stays a string (it was coerced) — and kept verbatim when it does not (it was dropped); a JSON value under a bracket key nests like any other value; bare `true`/`false`/`on`/`null` stay strings (they always did); raw quotes are kept (`Turn it "on"` no longer becomes `Turn it true`); a value-less segment is dropped and a repeated key keeps the last value (unchanged). The `"true"`/`"false"`/`"on"`/`"null"` casting is a DOCUMENT feature: it runs only when the whole input is a `{`/`[`-leading document or an object (stringified first — the browser validator's contract). A document is NEVER percent-decoded (#B589): the GET/HEAD re-parse used to decode the whole serialized query, so a value whose TEXT held `%22`/`%0A`/`%5C` made the document invalid and dropped EVERY query parameter (`req.get = {}`, and a `validator::` requirement copying that data answered 404); a fully `%7B`/`%5B`-encoded document is still decoded once. Isaac's query parser now decodes the NAME once as well (`+`→space first, as express's `qs` always did), so an HTML-form `user%5Bname%5D` still nests without the round-trip's accidental decode. A top-level `__proto__`/`constructor`/`prototype` name is dropped on both paths (#B592 — a JSON-valued `__proto__` swapped the PROTOTYPE of the parsed object); on DELETE, isaac's own query parser drops the three names too and `req.delete` is a plain copy holding the query's own keys (`copyOwnQueryKeys` in `core/server.js`; #B848, fixed in 0.7.4: the DELETE branch handed `request.query` over by reference, so a JSON-valued `__proto__` field re-pointed the prototype of `req.delete` on every DELETE to a path after the first — the routing loop copies the bag on a cold route only — and an injected `count`/`hasOwnProperty`/`toString` made the documented calls throw); a route declaring a DTO re-parses its validated payload through this helper, so a top-level `prototype` key in its JSON body is now dropped too, while a plain `application/json` body is parsed as-is and keeps it. Parse failures log metadata only, never the input and never `err.message` (a `JSON.parse` message can quote the input — V8 and JavaScriptCore both do): the helper's `[365]` line logs the input's length, its leading character and `err.name`, and isaac's not-JSON warn the parameter's name, the value's length and `err.name` (#B590). The helper ships in the browser bundle, so pickup is a restart AND a re-bake. Suites: `test/lib/request-parsing-b588.test.js`, `test/lib/request-parsing-logs-b590.test.js`, `test/integration/container-boot-request-parsing.test.js` (a real boot, red-first against the pre-fix tree). **XML bodies pass through VERBATIM (#FIN1).** `application/xml`, `text/xml` and the `application/*+xml` suffix family fork off the legacy path on POST/PUT/PATCH before any decode: `request.body` stays the exact document (the same string `rawBody` carries) and the method slot is left unset — the routing loop normalises it to `{}` further down, so a controller still reads an object from `req.post`. The framework never PARSES XML, so it takes on no XML-parser surface and no XXE exposure; consumers bring their own library. Pre-#FIN1 such a body was silently DESTROYED rather than rejected: the bracket-notation data helper splits on `&` then on `=` and keeps only the first pair, so an XML declaration alone collapsed a whole document to a single bogus key which — having a key — then REPLACED `request.body` at the shared tail, while the `"true"`/`"on"` coercion separately rewrote quoted attribute values. The matched set is the convergent one — ASP.NET Core registers ApplicationXml/TextXml/ApplicationAnyXmlSyntax (`application/*+xml`), Spring's `MimeType.includes()` documents `application/*+xml` as including `application/soap+xml`, and type-is matches structured suffixes generically — with the wildcard scoped to `application/` in all three, so `image/svg+xml` is deliberately NOT matched and RFC 7303's non-document types (`application/xml-dtd` §9.5, both `xml-external-parsed-entity` §9.3/§9.4) are excluded. RFC 7303 §9.6.1 registers the suffix but RFC 6838 §4.2.8 makes it a naming convention that does NOT mandate generic processing, so this set is convergent implementation practice, not a normative requirement. ONE flag computed at the request prologue feeds all three branches (the #B103 single-site lesson, after those same three sites drifted); each arm seeds `obj = {}` because the shared POST/PATCH tail reads `typeof(obj) == 'object' && ownCount(obj)` and `typeof null === 'object'`. Both engines share the chokepoint; server-side only, no dist rebuild. **#B546 (0.6.31) — that tail, and every other own-property count over a CLIENT-KEYED container, goes through a module-local `ownCount()` rather than `<container>.count()`.** gina installs `count()` on `Object.prototype`, so the shorthand is an ordinary property lookup that an OWN field of that name SHADOWS, and a request carrying a top-level `count` made the framework call a string: a 500 on the guarded body branches, and an uncaughtException that EXITED the bundle process on the UNGUARDED query ones — unauthenticated, one request, on ANY url including one matching no route, because this parse precedes routing (driven live both ways: every shape reproduced before the fix and answers cleanly after). `ownCount()` is that same helper reached as `Object.prototype.count.call()`, which no own property can shadow, plus an explicit null/undefined branch that PRESERVES the throw the `obj = {}` seeding above depends on — the bare `.call(null)` would bind `this` to the global object and return ITS key count (measured 23) instead of throwing. **#B837 (0.7.4) — the helper's own key test was shadowable too:** it counted with `this.hasOwnProperty(key)` inside a `try` whose `catch` returned the count so far, so a field named `hasOwnProperty` (an own key that is not a function) made every count over that container read 0 — GET and HEAD left `req.get` empty, DELETE left `req.delete` empty, POST and PATCH left `req.body` the raw string, all with no error — and an object with no prototype read 0 through `.call`. Both installed copies (`utils/prototypes.js`, which a bundle process runs, and `helpers/prototypes.js`, which the browser bundle carries) now test each key with `Object.prototype.hasOwnProperty.call(this, key)`, as do `functionCount()`, which threw on both shapes, and the validator's `is` rule, whose field scan answered « could not evaluate » when the data held such a field; pickup is a restart and a re-bake. Nested keys and near-misses (`counter`) were never affected. The framework's own server-to-server client (`self.query()`) sends raw `JSON.stringify(data)` for JSON bodies (RFC5987 value-encoding is for header values, not request bodies), and the inter-bundle HTTP/2 proxy no longer copies the INCOMING request's Content-Type onto the outbound JSON body it serialized itself — a urlencoded label re-routed raw JSON through the receiving parser's urlencoded branch and corrupted string values (the only incoming-CT→outbound copy framework-wide; kept for non-JSON bodies). `request.rawBody` snapshots the exact unparsed body (reference assignment, always-on, non-multipart only, `''` for empty) immediately BEFORE parsing mutates `request.body` — inbound-webhook HMAC verification needs the raw bytes, which middleware cannot recover after the stream drains; both engines share this single `core/server.js` pipeline. Malformed percent-escapes (`%`, `%zz`, truncated `%E0%A`) in a URL or query no longer kill the bundle (#B30 — an unauthenticated single-request DoS: any unguarded `decodeURIComponent` OR `decodeURI` on the request path threw `URIError` → uncaughtException → SIGTERM): redundant SECOND decodes on the GET/HEAD branches were DROPPED (the engine query parser decodes once, guarded — and since #B589 the data helper never percent-decodes the serialized query document at all), and every genuine first decode of attacker-controllable input routes through `safeDecodeURIComponent`/`safeDecodeURI` (try/decode/fallback-to-raw) — including the ERROR paths, where a malformed-% URL to a missing asset previously crashed FROM the error handler, turning a would-be 404 into a bundle kill. Sweep rule: `decodeURIComponent` and `decodeURI` are the same throwing family — sweep BOTH; fix the throw sites, never widen the uncaughtException net. Sibling #B64 (0.5.7): the two static-file resolvers confine the resolved filename to the matched mapping target (`path.resolve` both sides + separator-aware containment), so `../` / `%2F` / `%2e%2e` cannot escape to sibling files — an escape 404s exactly like a missing file. Second site, same guard (#B179, Security/CWE-22): the dev-mode Inspector SPA handler (`/_gina/inspector/*`) built its filename the same way — request target minus the prefix, joined onto the asset root, passed through the `_()` path helper — and `_()` calls `Path.normalize`, which **RESOLVES** `..` rather than rejecting it, so a literal `../` read any absolute path the bundle process could reach (verified live: 200 on `/etc/passwd`; encoded `%2e%2e` unaffected, since this handler never decodes — and decoding was deliberately not added). Node does not normalise the request-target (only clients do), so a raw HTTP client reaches it where a browser cannot. Unlike the static resolvers, this handler is **DUPLICATED per engine** (server.js + server.isaac.js) and `confineToBase` is scoped inside server.js's `Server()` closure — unreachable from isaac, which therefore declares an engine-local twin, pinned against drift by a test asserting both extracted copies agree. **Rule: any handler joining request-derived segments onto a base MUST confine the RESOLVED path; path normalisation is not a traversal defence, it is the mechanism that makes the escape land.** Corollary for endpoint families: check the SIBLING handlers' gating too — the Inspector endpoint carries no IP allowlist while its `/_gina/*` neighbours (`info`, `cache/stats`, `cache/clear`) all gate on `lib.admin.isClientAllowed`. **GET/HEAD query serialization no longer destroys escapes (#B407, consumer-reported):** both branches round-trip `request.query` through JSON.stringify + a re-parse, and the former textual nested-JSON unwrap ended with a blanket backslash strip over the WHOLE serialized document — so `%0A` in a value became the letter `n`, a backslash vanished, and a double quote OR a JSON-ARRAY value produced invalid JSON that silently dropped EVERY query param on the request (`parseBody` logs `[365]` and returns undefined). Both sites now serialize via `serializeQueryForReparse` (a shared inner helper in `processRequestData`): each own STRING value leaning `{`/`[` is unwrapped by PARSING it (kept verbatim when it does not parse — previously that shape also dropped the whole query), then a clean stringify with no post-processing; the whole-value `"true"/"false"/"on"/"null"` coercion is unchanged and, with escapes intact, can no longer match an escaped occurrence embedded inside a longer value. Intended behaviours preserved byte-for-byte (nested-object unwrap — now also correct for nested content carrying escapes, which the textual unwrap corrupted as well — coercion, plain values); array-valued and unparsable-`{`-leading params are delivered instead of killing the query. **PROTOTYPE-POLLUTION GUARD (#B446).** Every parse path that nests a bracket-notation key routes through `parseLocalObj` in `helpers/data` (aliased `nestBracketNotationKey`, and reached from `formatDataFromString`), which assigned `obj[key[k]]` from a CLIENT-SUPPLIED field name with no key filtering: `__proto__[x]=y`, `constructor[prototype][x]=y` and the percent-encoded `%5F%5Fproto%5F%5F[x]=y` each wrote to `Object.prototype` process-wide while the parsed body still read `{}` — i.e. SILENTLY. Reachable from the GET query string, urlencoded bodies, `inheritedData`, and multipart text-field names. ✅ **CONFIRMED LIVE over real HTTP on the DEFAULT `isaac` engine** (daemonless throwaway bundle, pre-fix worktree vs fixed tree, same fixture): a single unauthenticated `GET /?__proto__[polluted]=OWNED` — no body, no interaction — returned `polluted:"OWNED"` with `hasOwn:false` (the prototype-pollution signature, not an own property) and `arrayToo:"OWNED"`, and **the NEXT, innocent request inherited it at the same pid**, proving cross-request persistence. All three vectors reproduced; the fixed tree answered clean on all three with benign bracket nesting still HTTP 200. ⚠️ Isaac does NOT reference these functions at all — its own query parser is flat (`request.query[a[0]] = a[1]`); the attack survives because `server.js` re-serialises isaac's flat query (`serializeQueryForReparse`) and re-parses it through `formatDataFromString`, which restores the bracket branch. ⚠️ Instrument trap that nearly produced a FALSE NEGATIVE: `curl` treats `[...]` as a URL glob range, so every bracket request fails inside curl and never reaches the server — use `curl -g`. A second, independent source: PUT merges `JSON.parse` output as the merge SOURCE, and `JSON.parse` produces an OWN `__proto__` key, so an own-property check alone does NOT stop it — see #321. Measured gadgets before the fix: outbound-request options fully controllable (host/hostname/port/method/auth, `rejectUnauthorized` forced false, `protocol` feeding a dynamic transport require), `SAFE_HTTP_METHODS[m] === true` classifying POST as safe, and `req.routing.csrfExempt` reading true — the last two ONLY via the JSON source, since the string source yields `"true"` and is correctly rejected by the strict compare. ⚠️ The `csrfExempt` one is UNRESOLVED, not confirmed on a live route: what was measured is that a routing object LACKING an own `csrfExempt` reads the polluted value, but `core/server.js:7674` builds routes as `csrfExempt: routing[name].csrfExempt || false`, creating an OWN key that shadows the prototype — while `lib/routing/src/main.js:220` sets it only when already defined, so a route built there can lack it. Which construction path a live `req.routing` takes was NOT determined. Both sources now reject `__proto__` / `constructor` / `prototype` path segments and DROP the field rather than throwing (a throw on the parse path would turn one bad field into a 500). The guard is kept INLINE in `parseLocalObj`, not a closure helper, because `test/core/validator-send-formdata-nesting.test.js` extracts that function's source text and evals it standalone to pin client/server parity — a helper call is a ReferenceError there. `helpers/data` and the validator copy are both browser-bundled, so pickup is a bundle restart AND a re-bake. **#B591 (0.6.33):** `parseLocalObj` also carried a dead `obj = []` rebind for a numeric NON-LAST segment under a non-array container — the parent never saw it and the child slot it seeded was `null` — so `0[a]=1` threw a TypeError, and from the unguarded GET/HEAD `inheritedData` parse that EXITED the bundle (one unauthenticated request; measured exit 143). The rebind is gone in both copies: such a segment now creates a plain `{}` slot (`0[a]=1` → `{"0":{"a":"1"}}`), and no previously non-throwing result changed (every path through the rebind threw). **#B792 (next 0.7.x):** a SECOND null source survived #B591 — a JSON value (`a=[null]`, `a={"x":null}`) plants `null` in a slot a later bracket path then descends into, throwing the same way from the same unguarded GET/HEAD `inheritedData` site (one unauthenticated request → exit 143; rated HIGH, CVSS 7.5, GHSA to file at the cut). Both copies now replace a `null` slot with a fresh container (last-write-wins), like a string slot; a non-null primitive still boxes and no-ops. Suites: `test/lib/bracket-nesting-b591.test.js` + `test/lib/bracket-nesting-null-slot-b792.test.js`. Regression suite: `test/lib/prototype-pollution-b446.test.js` (attack arms each paired with a benign control, pre/post A/B validated on extracted HEAD source). **#B793 (next 0.7.x):** the one call that runs this parse, `processRequestData()` in the request's `'end'` listener (core/server.js), now sits in a `try`. An exception thrown while the request data is parsed (the GET, HEAD and DELETE branches and the PUT tail hold no try of their own), or on the synchronous hand-off that follows it, is answered through the server-side `throwError()` as a 500 `Could not evaluate <METHOD> request data.` (JSON for an XHR/API request, the bundle's error page for an HTML one) with the incident ref and its pairing line, instead of reaching `uncaughtException` and ending the bundle; a `multipart/form-data` request never runs that call (Busboy's listeners build its fields) and is not covered by it. This is a net under the parse, not a second way to handle bad input: the rule above stands (fix the throw site), and each catch is logged at error level so that it is. Test: `test/integration/container-boot-parse-throw-b793.test.js` drives it on a booted bundle with test doubles over `formatDataFromString` and `Object.prototype.count`, since no known input throws there. **#B843 (next 0.7.x):** the multipart branch's own Busboy listeners (`'field'`, `'file'`, `'finish'`) never run that call, so #B793's guard does not cover them; they are now guarded separately by overriding `busboy.on` IN PLACE — the registration lines stay verbatim, so the #B92-adjacent / #B143 source pins (which `indexOf`/regex `busboy.on('field', function onMultipartField` etc.) still hold. A throw inside one answers the same 500 `Could not evaluate <METHOD> request data.` on EVERY supported Node version (driven for all three listeners on Node 22, 24, 25 and 26; on Express 5 and outside the local scope, where the wire and the error page carry the first line only, on Node 25); before, it reached `uncaughtException` and EXITED the bundle on Node 22 (engines floor `>= 22`), and on Node 24+ the outcome depended on the listener — `'field'`: the stream machinery forwarded it to busboy's `'error'` → `onBusboyError`, a MISLEADING 400 `Malformed multipart/form-data request` (the body is not malformed; a framework function threw), bundle alive; `'file'` (raised where the write stream is created): that 400, then the bundle EXITED; `'finish'`: no answer and the bundle EXITED. A genuinely malformed body still answers 400 via `onBusboyError`; the per-listener catch SWALLOWS (no rethrow), so on Node 24+ nothing is forwarded and `onBusboyError` cannot double-answer. Test: `test/integration/container-boot-multipart-throw-b843.test.js` (the `'field'` listener via the `nestBracketNotationKey` double; red-first on the pre-fix tree, green on Node 22/24/26). **#B844 (next 0.7.x):** the callbacks NESTED in a file part, which the `'file'` listener only registers, ran outside that wrap and now run under it: `writeStreams[index].on('error')`, `writeStreams[index].on('finish')`, the close callback it hands to `this.close(` (`onUploaded` — the hand-off of a request that carries a file runs from it, so the SAME hand-off exception was answered 500 without a file and ended the bundle with one), `file.on('end')` and the `autoTmpCleanupTimeout` timer's callback. Each is wrapped where it is registered (`guardMultipartListener(function …)`; the registration text is kept for the #B143 pins), and an exception raised in one is answered 500 `Could not evaluate <METHOD> request data.` when nothing has answered or taken the request yet, else logged with its stack (`[ busboy ] [ onListenerThrow ] not answered: …` — after the `'error'` handler's own 500, or in the timer); before, each ended the bundle on Node 22, 24, 25 and 26 (measured with test doubles that raise inside the framework's own statements; no real input is known). The guard's message line goes through `escapeLogControlChars` (an engine exception message quotes a property name as written, line feed included), and `delete busboy.on` before `request.pipe(busboy)` removes the override, so that pipe()'s own `'finish'` hook is not wrapped (a wrapped listener is not removed by unpipe). NOT wrapped: the line Transform's `_transform` / `_flush`. Tests: `test/integration/container-boot-multipart-nested-throw-b844.test.js` (the `'file'` and end-of-body listeners and the five callbacks, on a booted bundle) and `test/core/multipart-nested-guard-b844.test.js` (source pins, the guard run with stubs). Server-side only; restart the bundle, no re-bake.
943
945
 
944
- 212. **Structured (JSON) logging — `GINA_LOG_FORMAT=json` + per-request `requestId`/`durationMs` (consolidates former #152/#155; #M12a/#M12b).** The logger resolves its render format ONCE at init into `opt.format` (precedence `GINA_LOG_FORMAT=json|text` > `GINA_LOG_STDOUT` truthy ⇒ json > `text` default) BEFORE containers are cloned; a JSON line is `{ts, level, bundle, message, group, msg}` — `bundle`/`message` canonical, `group`/`msg` retained as additive back-compat aliases — and the raw `console.log` path honours the format too (otherwise JSON mode would interleave plain lines and break a collector); the `text` default keeps container logs byte-identical. Per-request `requestId` + `durationMs` ride JSON logs via a NARROW `AsyncLocalStorage` (`process.gina._reqALS`, parked on `process.gina` so it survives dev require-cache busting), gated on JSON logging ONLY (text renders no id field, so the ALS would be pure overhead — the text path stays byte-identical/zero-cost): the id resolver honours a SANITISED inbound `X-Request-Id` (`/^[\w.\-]{1,128}$/`, regenerate-on-violation kills log forging) else `crypto.randomUUID()`; the `.run({requestId, startMs})` wrap sits at `handle()` — NOT the request-entry handler — because the `request.on('end')` boundary between them loses async context while `handle()`'s awaits preserve it (the original body became `_handleDispatch`; `handle` is a thin wrapper); HTTP/2 gets per-stream scoping free via Node's per-stream compat `'request'` event, NOT `session.on('stream')`; the JSON-assembly sites read `getStore()` and add `requestId` + per-line `durationMs`, gracefully absent for CLI/boot/off-request logs. `.run()`, never `enterWith()` (enterWith bleeds sideways across siblings). **MS1 (2026-07-24, 0.5.25):** the same id is now PROPAGATED beyond the process — every `self.query()` outbound path (the file-download proxy + both the HTTP/1 and HTTP/2 inter-bundle clients) forwards it as `x-request-id` (sourced from the resolved `req._ginaReqId`, never a raw inbound header; a caller-set value always wins), and `server.js onRequest` ECHOES `X-Request-Id` back on every response — ungated / independent of `GINA_LOG_FORMAT` (the id is always-on even when the JSON-log field isn't) and guarded against an already-sent response — so one logical request stays correlatable as it fans out across bundles and a caller/LB/APM reads the id off the wire. `controller.js`/`server.js` are server-side → no dist rebuild; restart to apply. Tests: `test/core/request-id-propagation.test.js`. **The contextless `require('gina')` boundary + MQ-speaker transport resilience (moved here from the DTO entry that surfaced it; #B276/#B277 0.6.4, #B318 0.6.5, #B323 fixed post-0.6.5 — shipped 0.6.6 with the reconnect).** Importing gina outside a spawned bundle child has ALWAYS been an intended boundary (`index.mjs`'s own docblock states it; both published entries throw alike), but two defects sat on top of it. **(1) The throw was uncatchable and could HANG the process.** The logger is a load-time singleton whose default flows are `['default','mq']`, so `speaker.js` opens a TCP socket BEFORE the boot reaches its throw — and that socket kept the event loop alive (listener-CONTINGENT, measured both ways: nothing bound to the MQ port ⇒ ECONNREFUSED ⇒ exit 0, so the bug is invisible on a quiet machine and hangs with no output on one running bundles or in CI). Fixed by `client.unref()`: a logging transport must never be why a process stays alive. ⚠️ #B318: a THIRD state exists beyond connected/REFUSED — an UNREACHABLE host, where `unref()` covers the socket HANDLE but not the pending `TCPConnectWrap` REQUEST, which holds the loop by itself for the OS connect timeout (~75s on macOS); fixed with an unref'd connect deadline (2s default, `opt.mqConnectTimeout`) that `destroy(err)`s only while `client.connecting`. ⚠️ **That safety claim — "only while connecting" — is MEASURED FALSE and shipped a HIGH regression for one release (#B323):** `client.connecting` does NOT flip when the kernel completes the connect; it flips when the POLL phase runs `afterConnect` — and a timer fires in the TIMERS phase, which precedes poll. On any boot that blocks the event loop past the deadline (a bundle mount off a network filesystem — every Kubernetes-class start) the loop resumes, runs the OVERDUE deadline first, reads `connecting === true` on a connection the kernel established seconds ago, and destroys it; the bundle then logged NOWHERE for the rest of its life (the speaker dialled exactly once, ever). Measured both directions: a kernel-completed dial reads `connecting` TRUE at the timers phase and FALSE at the check phase; a black-holed one reads TRUE at both. The fix defers the verdict one phase — `setImmediate` INSIDE the deadline, so the read happens in the CHECK phase, after poll — a completed connect survives while a genuinely pending one still dies on schedule (#B318's no-hang contract intact). **Generalisable: a state flag written by an event-loop callback cannot be read from an EARLIER phase and treated as current** — `connecting`, `destroyed`, `readyState` and every `pending*` counter share the property, and a blocked loop is precisely what makes the stale read reachable; a timers-phase guard over I/O state wants a `setImmediate` (or the event itself), never a direct read. **The speaker also RECONNECTS (0.6.6):** `startMQSpeaker` returns a stable `{write}` transport FACADE (`mq/index.js` captures the return ONCE for the life of the process — without the indirection a replaced socket is unreachable); each dial builds its OWN `clientOptions` (the listener mints a fresh `sessionId` per connection and the handshake only fires while `clientOptions.sessionId` is unset — a shared object would make every reconnect skip its acknowledgement); `close` on the CURRENT socket (a `current !== client` guard keeps a superseded one from stacking a second connection) arms a capped unref'd backoff (`min(500 * 2^n, 30000)`, reset on connect). Unref'd is load-bearing BOTH ways: a short-lived CLI still exits while a long-lived bundle keeps retrying and HEALS if a listener appears later. The caller callback settles ONCE, the warn fires once per OUTAGE (not per retry), and frames are DROPPED while down — an unbounded queue behind an outage of unknown length is a memory leak, and the `default`/stdout flow carries the same lines regardless. ⚠️ The socket still CONNECTS — `unref` changes only whether it votes on process lifetime (consumer-verified against a live listener: the connected line still logs; "unref'd" is not "suppressed"). ⚠️ The workaround `GINA_LOG_STDOUT=true` does splice `mq` out of the flows but ALSO flips log format to JSON (measured) — a container logging-mode flag pressed into service as a don't-open-a-socket switch. **(2) The boundary's error now names the boundary** — the old message named an internal call (`setPath("gina.home", path): path cannot be empty`) because `getEnvVar` reads `process.gina` ONLY and is empty outside the CLI; it now routes the reader to `SuperController.createTestInstance()`, the supported way to exercise controller code without booting. ⛔ **Do NOT "fix" the boundary by extending the `getEnvVar → process.env` ladder to `gna.js`, nor by skipping the empty `setPath`** — REFUTED BY MEASUREMENT: satisfying that call merely defers the failure 8 lines to a bare-global `ReferenceError` (strictly less legible), and that `setPath` is the SOLE registration site for `gina.home` repo-wide (the SQLite connector and session store read it). Failing fast at the first detectable point is correct. Diagnostic instrument for the hang class: `process._getActiveRequests()` reports `TCPConnectWrap` while `_getActiveHandles()` shows only the unref'd Socket. Tests: `test/lib/logger-mq-speaker-resilience.test.js` (§01 deferral-ordering + reconnect-shape pins; §02 a child that blocks 3s right after the dial and must still deliver — red-first: pre-fix it lost the frame while the connection was ESTABLISHED, the defect's own signature; §03 a listener destroyed and rebound must be heard again; §04 the no-listener child still exits promptly) + `logger-mq-speaker-unref.test.js` (comment-stripped source pin — subtracting the fix left a bare existence pin GREEN against the commented-out line — + a behavioural arm with its own must-be-killed control). **Log redaction (#B433, 0.6.19):** every message is redacted BEFORE it is rendered and dispatched — inside the logger's `emit()`, the single pre-render point all 46 URL-bearing framework sites pass through (both engines, every render delegate, the CSRF filter; all levelled, none `console.log`), plus the raw `console.log` path — so stdout, the MQ speaker/`gina tail`, the file transport and the Inspector taps all receive the same masked line and a JSON line cannot be corrupted (the marker lands inside the message string). Configured per bundle in `settings.json > log.redact` `{enabled, defaults, secrets, patterns}`, ON by default: `defaults` = JWT · URL userinfo password · `Bearer`/`Basic` · named credential query keys (`token`, `access_token`, `api_key`, `secret`, `password`, `signature`, `otp`, …, key kept / value masked) · api-key headers — measured 0 false positives on 433k real log lines, ~1 µs per line, linear patterns; `secrets` = every value the secrets resolver substituted for a `${secret:KEY}` placeholder (settings, connectors, routing — one resolve point) masked verbatim, values < 8 chars skipped with a boot warn; `patterns` = consumer rules (regex source string → `[REDACTED]`, or `{pattern, flags, replacement, name}` with `$1` kept), `g` always enforced. Deliberately NOT a default: a bare long-hex path segment (a sha256 content-address key from storage and an opaque 64-hex credential are the same regex class — the consumer adds `(?<![0-9a-f])[0-9a-f]{64}(?![0-9a-f])` — anchored on the class, not `\b`, which never fires against a prefixed `key_<hex>` segment). Fail-closed: an unknown key, a non-boolean flag, an invalid or empty-matching pattern refuses the boot (a dropped rule is a leak). Installed by `core/config.js::loadBundleConfig` right after the bundle's `secrets.resolve()` — the earliest resolved point, so connector-init lines are already covered — via `console.setRedaction(block, {group, secrets: lib.secrets.getResolvedValues(conf)})`; state lives on the logger's persisted context (survives `refreshCore()`), keyed by bundle, UNION across bundles (one bundle enabling is enough in a merged process; a per-route `logUrl:false` flag was rejected by measurement — it cannot reach the second URL copy inside the #ERRREF error stack). The 404 ref line carries the URL twice in ONE record (prefix + the error's own message); both copies are masked. Restart to apply, no re-bake (server-side only). A per-route or per-site flag is NOT the extension point; the logger seam is. Error rendering (#B434, 0.6.19): an `Error` passed as a log argument renders via `util.inspect` — message, stack, own props, `[cause]` chain — at BOTH stdout writers (the levelled `write()`/`parse()` walk and the raw `console.log` `JSON.stringify` path each saw only ENUMERABLE own props, so a bare Error rendered `{}`), top-level and nested alike, realm-safe (`util.types.isNativeError` beside `instanceof`), and the rendered message still crosses the redaction seam (content is built in `write()`, redacted in `emit()`). Non-Error arguments render byte-identically to before. **The `file` log sink — an IN-PROCESS transport, and the three defects that made it unusable (#B523/#B526–#B531, 0.6.30).** The opt-in `file` container connected to the MQ, received every line and wrote NOTHING: `setup()` was driven from `processProperties.bundles`, which `lib/logger/src/helper.js:125` fills only when `process.argv` matches `bundle:(start|stop|restart)` — while `core/gna.js:294` splices `process.argv` down to `[node, appPath]` in every bundle process loaded through the CLI, so that list is structurally always empty and no filename was ever assigned. Fixing the filename exposed what the dead sink had been hiding, measured on a live daemon topology: **(a)** the container dialled the MQ port at construction and ran `process.exit(0)` from its socket error handler, and in the daemon that dial happens BEFORE the daemon's own listener binds — so `gina start` died before "Framework ready" 3/3 whenever the flow was enabled, and a daemonless bundle exited with status 0 one second after boot; **(b)** the listener FORWARDS every speaker's line to every `writeToFile` session, so every process carrying the flow wrote EVERY bundle's lines into one shared per-host file (measured twice-over with two bundles) and built a full `Config` for a bundle it is not, which crashed `gina bundle:start` 3/3; **(c)** N processes appending to one file each kept their own rotation state and size counter, so rotation raced and lost lines silently. **The sink is therefore no longer MQ-coupled: it listens on the `logger#file` event `emit()` already raises for every flow, exactly like `containers/default`, and writes only the lines ITS OWN process logged.** No socket, no daemon dependency (it works under `gina-container` and in a container), no foreign `Config`, one writer per file. The file is named after the LOG GROUP — `<logdir>/<bundle>@<project>.log` — which is what makes "one writer" true; a group without `@` (the CLI's and the daemon's own `gina` lines) is not filed, matching the guard the old `write()` already applied. Records are written WITHOUT ANSI escapes, and `GINA_LOG_FORMAT=json` is honoured with the same line shape the stdout container writes. Rotation is configured under `rotate` in `~/.gina/user/extensions/logger/file/config.json` — the machine-level surface that also ENABLES the container (it reaches the container because `loadContainers()` merges `flowsOptions[flow]` over the logger options with override:true). Keys: `enabled` (default true), `when` (`daily`|null), `size` (default `10MB`), `count` (default 5), `maxAge` (e.g. `30d`, off). Mechanism is rename-then-reopen, never copy-then-truncate: the retired vendored rotator (MIT/Capriza, undeclared in either manifest so invisible to Socket and Dependabot, and unreachable — its `require` path resolved to a directory that does not exist) copied then truncated, losing every line appended during the copy window. ⚠️ The descriptor is opened SYNCHRONOUSLY and the stream wrapped over it: `createWriteStream(path)` opens asynchronously, so a burst of lines logged within one tick reaches a size trigger while the file does not exist on disk yet and the cascade's `renameSync` throws — measured with 60 lines in one tick. A size or age without an explicit unit is REFUSED, never guessed, and any invalid value disables rotation with a message naming key, value and consequence — reported THROUGH THE FLOWS (`process.emit('logger#'+flow, …)`, one payload per flow, which is what `emit()` itself does), never through raw `process.stdout.write`: under a daemon `lib/cmd/bundle/start.js` consumes the child's stdout and relays nothing after start, so the old raw-stdout refusal reached NOBODY (measured 0 in the daemon log, 0 at a tail client, 0 in the file, 0 in the CLI output). Logging continues either way. Two bounds stated honestly: bytes still queued when the process exits can be lost (`end()` is asynchronous, and making every write synchronous would let a full disk block the request loop), and a stream that stops draining past a 4 MB buffer drops lines with one warning per outage — the same posture the MQ speaker documents. ⚠️ **Generalisable trap that cost this arc most of its time: the repo-root `utils/prototypes.js` installs `Object.prototype.count` + `functionCount` and `Array.prototype.clone` + `inArray` ON REQUIRE, unguarded — so `typeof(anyObject.count)` is `'function'` for EVERY object including `{}`.** A `typeof(user.<key>) != 'undefined'` guard over a user-config object therefore hands the inherited METHOD back as the configured value — here `~~(function)` is 0 and rotation disabled itself reporting "count is undefined" on a valid default. ⛔ Do NOT cite or patch `helpers/prototypes.js:169`: it declares the same names, but its guard `typeof(Object.count) == 'undefined'` reads the INHERITED method once `utils/` has run (`Object` inherits through `Function.prototype`), so every declaration there is skipped — the trap defeats its own guard and that line is dead code. The properties are `enumerable: false`, so `Object.keys()` reports `[]` and `JSON.stringify` drops them, which is exactly why every probe read the key as ABSENT rather than as a function. ⚠️ An isolated repro is the CHEAPEST way to see this, not an impossible one — `node -e "require('./utils/prototypes.js'); console.log(typeof({}).count)"` prints `function` in a plain process with no framework and no invocation (control: without the require it prints `undefined`). What DOES false-negative is requiring the OTHER file: `helpers/prototypes.js` exports a constructor that must be CALLED, so a bare require of it installs nothing and reports every key absent — inside the framework tree too, which is why that probe reads like a legitimate in-context measurement. Pair any such probe with a known-positive control. ⚠️ **The same collision has a SECOND, REQUEST-FACING direction — #B546 (0.6.31):** the trap above is the framework READING a config key that the helper makes look present; the mirror is the framework CALLING `<container>.count()` on a container whose keys the CLIENT chooses (parsed body, query bag, route params, `req.files`, `self.query()` data, a routing rule's validator data, and `| length` on BOTH template engines). There an own field named `count` shadows the helper and the framework calls a string — see #211 for the impact and the `ownCount()` remedy, applied at 27 sites across `core/server.js`, `core/controller/controller.js` and the validator engine. Counts over FRAMEWORK-built objects (response headers, the routing table, config) deliberately keep the shorthand, and the helper itself stays on `Object.prototype` for application code. Use `Object.prototype.hasOwnProperty.call(obj, key)` for any own-key test over config in this framework, never `typeof` — the guard is name-independent, so it is right for all four names and any added later. **#B524 (0.6.30) — `gina-container` applies the container preset ITSELF.** Unless `GINA_LOG_STDOUT` is already set, the launcher writes `process.env.GINA_LOG_STDOUT = 'true'` ABOVE its `utils/helper` require — that require initialises the launcher's OWN logger, and an unconfigured container was measured running TWO redialling speakers (launcher + bundle), each warning `ECONNREFUSED 127.0.0.1:8125` once and then dialling every ≤30 s for the life of the container — and the bundle inherits it through the spawn; `image:build` images inherit it for free, their entrypoint being `gina-init && exec gina-container`. It MUST be a raw `process.env` write (`setEnvVar()` populates `process.gina`, which the logger never reads). Explicit values win both ways, measured on isolated boots: `GINA_LOG_FORMAT=text` ⇒ coloured text with the dial still skipped; `GINA_LOG_STDOUT=false` ⇒ the pre-0.6.30 behaviour byte-for-byte. ⚠️ LAUNCHER topology only: a bundle started through a framework daemon (`gina start` → `bundle:start`) is untouched — there the MQ transport is what `gina tail` reads, and the daemon DISCARDS the bundle's own stdout after startup (`bundle/start.js` `if (isStarting) return;`), so the relay is the only path a runtime line has to an operator. **#B691 (0.7.1) — the one exception, during the boot itself:** the MQ listener keeps NO backlog (`listener.js` `report()` forwards each frame to the tails attached at that instant) and `gina tail` cannot ask for earlier frames, so a tail attached after the boot — the ordinary `bundle:start`-then-`tail` order, and a container init script that tails after starting — saw none of a bundle's boot-time lines, including the 0.7.0 `autoescape` and unanchored-`requirements` warnings. The startup watchdog now passes the bundle's warn-and-above boot lines on to the `bundle:start` client (so also to `bundle:restart`, which prints its start step): `warn`/`warning`, `error`/`err`, `crit` and `alert` (the logger renders the name the caller used, and recommends `warning`/`err`); `emerg` keeps its `aborted :(` path. The filter is `lib/cmd/bundle/inc/boot-lines.js`: it buffers by line across chunks, reads the level from the ANSI-stripped `[date] [level ][group]` header or from a JSON line's `level`, keeps a multi-line entry whole until its colour block closes (`format()` wraps the whole message in one), and caps a line and an entry at 64 KB. It runs after the `isStarting` guard and before the EADDRINUSE/emerg/started checks, so a warning comes before `started V(-.o)V`, which then sits on its own line; with no such line the output is byte-identical. A tail attached first still gets the lines, so they show twice there (accepted). Runtime lines stay the tail's. Pickup = a DAEMON restart (`framework:init` requires a command module once), not a `bundle:restart`. Tests: `test/lib/bundle-start-boot-lines.test.js`. That topology's JSON answer is the OTHER half of #B524: **`gina tail` renders one JSON object per line when its OWN logger's resolved format is `json`** (`GINA_LOG_FORMAT=json` on the tail process — the pod's environment reaches it; `lib/cmd/framework/tail.js` reads `console.getOptions().format`, the logger's single precedence rule, and routes BOTH render sites — the delayed-message replay and the live stream — through one `renderLine(pl)`; same `{ts, level, bundle, message, group, msg}` shape, NO `requestId`/`durationMs` because the relay payload is `{group, level, content}` only). Measured on a daemon-free relay scene (a real `MQListener` on an isolated port + a `gina-container` bundle booted with `GINA_LOG_STDOUT=false` so it speaks + `bin/cli tail`): format unset ⇒ 5 ANSI lines, 0 JSON; `json` ⇒ 5 JSON objects, 0 escapes, the tail's own connect lines included. ⛔ `GINA_LOG_STDOUT=true` is NOT the daemon topology's switch — it never reaches a daemon-spawned bundle's logger (#B532: `bin/cli:336` `filterArgs()` MOVES every `GINA_*` key out of `process.env` before `bundle/start.js:404` spawns with no `env:`, and the child's logger initialises at `gna.js:183` BEFORE the ctx mirror at `:276` restores them — so the tutorial's `GINA_LOG_FORMAT=json gina bundle:start` cannot reach the bundle either, and a daemon-topology JSON line can never carry `requestId` until that is fixed), and if it did reach the bundle it would silence the relay the tail reads.
946
+ 212. **Structured (JSON) logging — `GINA_LOG_FORMAT=json` + per-request `requestId`/`durationMs` (consolidates former #152/#155; #M12a/#M12b).** The logger resolves its render format ONCE at init into `opt.format` (precedence `GINA_LOG_FORMAT=json|text` > `GINA_LOG_STDOUT` truthy ⇒ json > `text` default) BEFORE containers are cloned; a JSON line is `{ts, level, bundle, message, group, msg}` — `bundle`/`message` canonical, `group`/`msg` retained as additive back-compat aliases — and the raw `console.log` path honours the format too (otherwise JSON mode would interleave plain lines and break a collector); the `text` default keeps container logs byte-identical. Per-request `requestId` + `durationMs` ride JSON logs via a NARROW `AsyncLocalStorage` (`process.gina._reqALS`, parked on `process.gina` so it survives dev require-cache busting), gated on JSON logging ONLY (text renders no id field, so the ALS would be pure overhead — the text path stays byte-identical/zero-cost): the id resolver honours a SANITISED inbound `X-Request-Id` (`/^[\w.\-]{1,128}$/`, regenerate-on-violation kills log forging) else `crypto.randomUUID()`; the `.run({requestId, startMs})` wrap sits at `handle()` — NOT the request-entry handler — because the `request.on('end')` boundary between them loses async context while `handle()`'s awaits preserve it (the original body became `_handleDispatch`; `handle` is a thin wrapper); HTTP/2 gets per-stream scoping free via Node's per-stream compat `'request'` event, NOT `session.on('stream')`; the JSON-assembly sites read `getStore()` and add `requestId` + per-line `durationMs`, gracefully absent for CLI/boot/off-request logs. `.run()`, never `enterWith()` (enterWith bleeds sideways across siblings). **MS1 (2026-07-24, 0.5.25):** the same id is now PROPAGATED beyond the process — every `self.query()` outbound path (the file-download proxy + both the HTTP/1 and HTTP/2 inter-bundle clients) forwards it as `x-request-id` (sourced from the resolved `req._ginaReqId`, never a raw inbound header; a caller-set value always wins), and `server.js onRequest` ECHOES `X-Request-Id` back on every response — ungated / independent of `GINA_LOG_FORMAT` (the id is always-on even when the JSON-log field isn't) and guarded against an already-sent response — so one logical request stays correlatable as it fans out across bundles and a caller/LB/APM reads the id off the wire. `controller.js`/`server.js` are server-side → no dist rebuild; restart to apply. Tests: `test/core/request-id-propagation.test.js`. **The contextless `require('gina')` boundary + MQ-speaker transport resilience (moved here from the DTO entry that surfaced it; #B276/#B277 0.6.4, #B318 0.6.5, #B323 fixed post-0.6.5 — shipped 0.6.6 with the reconnect).** Importing gina outside a spawned bundle child has ALWAYS been an intended boundary (`index.mjs`'s own docblock states it; both published entries throw alike), but two defects sat on top of it. **(1) The throw was uncatchable and could HANG the process.** The logger is a load-time singleton whose default flows are `['default','mq']`, so `speaker.js` opens a TCP socket BEFORE the boot reaches its throw — and that socket kept the event loop alive (listener-CONTINGENT, measured both ways: nothing bound to the MQ port ⇒ ECONNREFUSED ⇒ exit 0, so the bug is invisible on a quiet machine and hangs with no output on one running bundles or in CI). Fixed by `client.unref()`: a logging transport must never be why a process stays alive. ⚠️ #B318: a THIRD state exists beyond connected/REFUSED — an UNREACHABLE host, where `unref()` covers the socket HANDLE but not the pending `TCPConnectWrap` REQUEST, which holds the loop by itself for the OS connect timeout (~75s on macOS); fixed with an unref'd connect deadline (2s default, `opt.mqConnectTimeout`) that `destroy(err)`s only while `client.connecting`. ⚠️ **That safety claim — "only while connecting" — is MEASURED FALSE and shipped a HIGH regression for one release (#B323):** `client.connecting` does NOT flip when the kernel completes the connect; it flips when the POLL phase runs `afterConnect` — and a timer fires in the TIMERS phase, which precedes poll. On any boot that blocks the event loop past the deadline (a bundle mount off a network filesystem — every Kubernetes-class start) the loop resumes, runs the OVERDUE deadline first, reads `connecting === true` on a connection the kernel established seconds ago, and destroys it; the bundle then logged NOWHERE for the rest of its life (the speaker dialled exactly once, ever). Measured both directions: a kernel-completed dial reads `connecting` TRUE at the timers phase and FALSE at the check phase; a black-holed one reads TRUE at both. The fix defers the verdict one phase — `setImmediate` INSIDE the deadline, so the read happens in the CHECK phase, after poll — a completed connect survives while a genuinely pending one still dies on schedule (#B318's no-hang contract intact). **Generalisable: a state flag written by an event-loop callback cannot be read from an EARLIER phase and treated as current** — `connecting`, `destroyed`, `readyState` and every `pending*` counter share the property, and a blocked loop is precisely what makes the stale read reachable; a timers-phase guard over I/O state wants a `setImmediate` (or the event itself), never a direct read. **The speaker also RECONNECTS (0.6.6):** `startMQSpeaker` returns a stable `{write}` transport FACADE (`mq/index.js` captures the return ONCE for the life of the process — without the indirection a replaced socket is unreachable); each dial builds its OWN `clientOptions` (the listener mints a fresh `sessionId` per connection and the handshake only fires while `clientOptions.sessionId` is unset — a shared object would make every reconnect skip its acknowledgement); `close` on the CURRENT socket (a `current !== client` guard keeps a superseded one from stacking a second connection) arms a capped unref'd backoff (`min(500 * 2^n, 30000)`, reset on connect). Unref'd is load-bearing BOTH ways: a short-lived CLI still exits while a long-lived bundle keeps retrying and HEALS if a listener appears later. The caller callback settles ONCE, the warn fires once per OUTAGE (not per retry), and frames are DROPPED while down — an unbounded queue behind an outage of unknown length is a memory leak, and the `default`/stdout flow carries the same lines regardless. ⚠️ The socket still CONNECTS — `unref` changes only whether it votes on process lifetime (consumer-verified against a live listener: the connected line still logs; "unref'd" is not "suppressed"). ⚠️ The workaround `GINA_LOG_STDOUT=true` does splice `mq` out of the flows but ALSO flips log format to JSON (measured) — a container logging-mode flag pressed into service as a don't-open-a-socket switch. **(2) The boundary's error now names the boundary** — the old message named an internal call (`setPath("gina.home", path): path cannot be empty`) because `getEnvVar` reads `process.gina` ONLY and is empty outside the CLI; it now routes the reader to `SuperController.createTestInstance()`, the supported way to exercise controller code without booting. ⛔ **Do NOT "fix" the boundary by extending the `getEnvVar → process.env` ladder to `gna.js`, nor by skipping the empty `setPath`** — REFUTED BY MEASUREMENT: satisfying that call merely defers the failure 8 lines to a bare-global `ReferenceError` (strictly less legible), and that `setPath` is the SOLE registration site for `gina.home` repo-wide (the SQLite connector and session store read it). Failing fast at the first detectable point is correct. Diagnostic instrument for the hang class: `process._getActiveRequests()` reports `TCPConnectWrap` while `_getActiveHandles()` shows only the unref'd Socket. Tests: `test/lib/logger-mq-speaker-resilience.test.js` (§01 deferral-ordering + reconnect-shape pins; §02 a child that blocks 3s right after the dial and must still deliver — red-first: pre-fix it lost the frame while the connection was ESTABLISHED, the defect's own signature; §03 a listener destroyed and rebound must be heard again; §04 the no-listener child still exits promptly) + `logger-mq-speaker-unref.test.js` (comment-stripped source pin — subtracting the fix left a bare existence pin GREEN against the commented-out line — + a behavioural arm with its own must-be-killed control). **Log redaction (#B433, 0.6.19):** every message is redacted BEFORE it is rendered and dispatched — inside the logger's `emit()`, the single pre-render point all 46 URL-bearing framework sites pass through (both engines, every render delegate, the CSRF filter; all levelled, none `console.log`), plus the raw `console.log` path — so stdout, the MQ speaker/`gina tail`, the file transport and the Inspector taps all receive the same masked line and a JSON line cannot be corrupted (the marker lands inside the message string). Configured per bundle in `settings.json > log.redact` `{enabled, defaults, secrets, patterns}`, ON by default: `defaults` = JWT · URL userinfo password · `Bearer`/`Basic` · named credential query keys (`token`, `access_token`, `api_key`, `secret`, `password`, `signature`, `otp`, …, key kept / value masked) · api-key headers — measured 0 false positives on 433k real log lines, ~1 µs per line, linear patterns; `secrets` = every value the secrets resolver substituted for a `${secret:KEY}` placeholder (settings, connectors, routing — one resolve point) masked verbatim, values < 8 chars skipped with a boot warn; `patterns` = consumer rules (regex source string → `[REDACTED]`, or `{pattern, flags, replacement, name}` with `$1` kept), `g` always enforced. Deliberately NOT a default: a bare long-hex path segment (a sha256 content-address key from storage and an opaque 64-hex credential are the same regex class — the consumer adds `(?<![0-9a-f])[0-9a-f]{64}(?![0-9a-f])` — anchored on the class, not `\b`, which never fires against a prefixed `key_<hex>` segment). Fail-closed: an unknown key, a non-boolean flag, an invalid or empty-matching pattern refuses the boot (a dropped rule is a leak). Installed by `core/config.js::loadBundleConfig` right after the bundle's `secrets.resolve()` — the earliest resolved point, so connector-init lines are already covered — via `console.setRedaction(block, {group, secrets: lib.secrets.getResolvedValues(conf)})`; state lives on the logger's persisted context (survives `refreshCore()`), keyed by bundle, UNION across bundles (one bundle enabling is enough in a merged process; a per-route `logUrl:false` flag was rejected by measurement — it cannot reach the second URL copy inside the #ERRREF error stack). The 404 ref line carries the URL twice in ONE record (prefix + the error's own message); both copies are masked. Restart to apply, no re-bake (server-side only). A per-route or per-site flag is NOT the extension point; the logger seam is. Error rendering (#B434, 0.6.19): an `Error` passed as a log argument renders via `util.inspect` — message, stack, own props, `[cause]` chain — at BOTH stdout writers (the levelled `write()`/`parse()` walk and the raw `console.log` `JSON.stringify` path each saw only ENUMERABLE own props, so a bare Error rendered `{}`), top-level and nested alike, realm-safe (`util.types.isNativeError` beside `instanceof`), and the rendered message still crosses the redaction seam (content is built in `write()`, redacted in `emit()`). Non-Error arguments render byte-identically to before. **Line-break safety in the text format (#B830, 0.7.4):** the levelled writer's string branch no longer rewrites a WRITTEN backslash + r/n/t into a control character — only a REAL CR/LF/TAB is handled (CR→LF, TAB kept), so a written `\n` stays literal text and cannot forge a log line (CWE-117); legitimate multi-line arguments (an Error, an err.stack string) are unchanged. `parse()` writes a logged object's keys and string values — a nested array, an array of pairs and a Buffer inside an array included — with their control characters as visible escapes through a module-private `escapeLogControlChars`: `\n`/`\r`/`\t`, else `\uXXXX`, over C0, DEL, C1 (U+007F–U+009F) and the line separators U+2028/U+2029. Framework sites that put a request value into a log or error message escape it AT THE SITE: the multipart upload field/group/extension messages, the static content-type lines, the POST/PUT/PATCH body-parse warns (the escaped `err.message`, not `err.stack`), the validator `isDate` and condition warns, the lib/routing placeholder warn, the render-swig template-name lines, the isaac engine.io message lines, the controller redirect notice and the « Ignoring message » lines. An isaac query string with no `=` that is not JSON is reported by its length and the error's name at warn (it used to print a stack quoting it). The error-DETAIL lines — the #ERRREF pairing lines of core/server.js, the core/controller/controller.js twin (3 sites), helpers/context.js `throwError` and lib/lane `ctx.error()`, plus the late-error lines — go through `escapeLogDetailKeepFrames`: every line's control characters are escaped and a REAL line feed is kept only before a line shaped like a stack frame (whitespace, `at`, whitespace, any text) or starting with `caused by:`, so an injected break becomes the visible `\n` while real stacks stay multi-line. ⛔ Do not replace it with a per-error message-boundary escape: the pairing line logs a client-passed stack WHOLE (#B670) and the controller's `errorObject.stack` is often a synthetic call-site — measured, that shape broke 51 tests. Accepted residual: a value crafted to look like a frame line still renders as one; a real line feed in a plain string argument still starts a new line; an Error logged by application code keeps its message as it is. **The redaction reads a message twice** (`redact.apply()`): the escapes are written BEFORE `emit()` redacts, and a visible escape ends in a word character where whitespace stood, so `\b`, a lookbehind and `\s` stopped matching and a multi-line secret was no longer found verbatim. A message holding a visible escape is therefore matched as written, then decoded (`decodeView()`: each escape read as the character it stands for, with an offset map); a span found decoded is masked in the text as written, a kept group (`$1`, `$&`, `$<name>`) is copied as written so no control character is written back, and the secret spans of the two readings are merged. The decoded reading only ADDS masks: the escapers leave the backslash alone, so a credential that itself holds a written backslash + n/r/t must still be found as written (a decoded-only reading printed it — measured). A message with no visible escape takes one `replace` per rule, as before. **#B834 — the decoded reading also reads the two quote escapes the object writers add to a string value** (backslash + double quote from the levelled writer and from `JSON.stringify` on the raw `console.log` path, backslash + single quote from the levelled writer): a resolved secret holding a quote, logged inside an object or through `console.log` (an object or an array), matched neither reading and printed in full; it is now masked, and the reading still only adds masks. **#B838 — the secret values are searched on every escape layer, whichever renderer wrote them.** Three more writers alter a value before `emit()` redacts: `JSON.stringify` (an object, an array or a key through `console.log`, or a JSON string the caller built) and `util.inspect` (an `Error`, on both paths) escape the BACKSLASH ITSELF — which the logger's object writer does not — and write control characters and lone surrogates in their own forms (`\b`, `\f`, `\u00XX`, `\xNN`, `\udXXX`); `util.inspect` also lays a value's line breaks out (a long string, over about 72 characters, is split after each line feed into separately quoted pieces joined by a quote, ` +` and a new line; a nested Error's message is indented after each line feed); and the levelled string path writes a carriage return as a line feed. A secret holding a backslash, a control character, a lone surrogate or a line break then matched neither reading and printed in full. `apply()` now reads the secret values (NOT the pattern rules, which keep their two readings) on the message as written, on its decoded reading, and on up to three layers of backslash escaping read back from each (`decodeEscapes()`: one scan, any `\xHH` / `\uHHHH`, an unknown escape left as written). Three, because the logger itself stacks two — an Error inside an object logged through `console.log` is inspected, then stringified — and a string the caller serialised adds one. A layer's offset map is built only when a secret is found on it, and a line that holds only the object writer's simple escapes is searched exactly as before. On the secret side `compileState()` tolerates LAYOUT only: a carriage return matches CR or LF, and a line feed may be followed by any run of whitespace, quotes and `+`; a value holding no line break compiles to the same literal source as before. ⛔ The two grammars stay separate: the object writer leaves the backslash alone, so a backslash before an escaped line feed is written `\\n` there, which `decodeView()` reads as a backslash and a line feed and `decodeEscapes()` as a written `\n`. Not masked, by rule: a value that is not written as its own characters (a Buffer's bytes, base64, URL-encoding, another serialiser's escapes); a value under more than three layers of escaping; and a secret that sits inside a longer string of more than 10,000 characters held by an `Error`, which `util.inspect` cuts (the head of a secret that IS the cut string is masked). Tests: `test/lib/logger-redact-renderers-b838.test.js` — every C0 and C1 character, lone surrogates, quote and backslash combinations and long multi-line values, in 54 value positions through the real logger, pinned as one exact table. Text-format behaviour changes: a written backslash + n/r/t is written as-is (pass a real line feed for a multi-line message); a multi-line string inside a logged object prints on one line (pass the Error itself to keep a multi-line stack); an error line writes a break that no stack frame follows as a visible `\n` (a 404 logs `Page not found: \n/path` on one line). JSON format: still one line per message; its `message` value follows the same changes. The two escapers are private per module — nine copies of the first (logger, server.js, server.isaac.js, controller.js, controller.render-swig.js, helpers/context.js where the pair sits inside `throwError`, lib/lane, lib/routing, form-validator.js), six of the second — compared byte for byte and over a code-point fuzz by `test/lib/log-escape-parity-b830.test.js`, which also keeps `decodeView()` in step with the escaped set. lib/routing and form-validator.js are browser-bundled, so the pickup is restart AND re-bake. Tests: `test/lib/logger-line-break-b830.test.js`, `test/lib/logger-redact-readings-b830.test.js`, `test/core/log-line-break-sites-b830.test.js` (one extract-and-run arm per site). **The `file` log sink — an IN-PROCESS transport, and the three defects that made it unusable (#B523/#B526–#B531, 0.6.30).** The opt-in `file` container connected to the MQ, received every line and wrote NOTHING: `setup()` was driven from `processProperties.bundles`, which `lib/logger/src/helper.js:125` fills only when `process.argv` matches `bundle:(start|stop|restart)` — while `core/gna.js:294` splices `process.argv` down to `[node, appPath]` in every bundle process loaded through the CLI, so that list is structurally always empty and no filename was ever assigned. Fixing the filename exposed what the dead sink had been hiding, measured on a live daemon topology: **(a)** the container dialled the MQ port at construction and ran `process.exit(0)` from its socket error handler, and in the daemon that dial happens BEFORE the daemon's own listener binds — so `gina start` died before "Framework ready" 3/3 whenever the flow was enabled, and a daemonless bundle exited with status 0 one second after boot; **(b)** the listener FORWARDS every speaker's line to every `writeToFile` session, so every process carrying the flow wrote EVERY bundle's lines into one shared per-host file (measured twice-over with two bundles) and built a full `Config` for a bundle it is not, which crashed `gina bundle:start` 3/3; **(c)** N processes appending to one file each kept their own rotation state and size counter, so rotation raced and lost lines silently. **The sink is therefore no longer MQ-coupled: it listens on the `logger#file` event `emit()` already raises for every flow, exactly like `containers/default`, and writes only the lines ITS OWN process logged.** No socket, no daemon dependency (it works under `gina-container` and in a container), no foreign `Config`, one writer per file. The file is named after the LOG GROUP — `<logdir>/<bundle>@<project>.log` — which is what makes "one writer" true; a group without `@` (the CLI's and the daemon's own `gina` lines) is not filed, matching the guard the old `write()` already applied. Records are written WITHOUT ANSI escapes, and `GINA_LOG_FORMAT=json` is honoured with the same line shape the stdout container writes. Rotation is configured under `rotate` in `~/.gina/user/extensions/logger/file/config.json` — the machine-level surface that also ENABLES the container (it reaches the container because `loadContainers()` merges `flowsOptions[flow]` over the logger options with override:true). Keys: `enabled` (default true), `when` (`daily`|null), `size` (default `10MB`), `count` (default 5), `maxAge` (e.g. `30d`, off). Mechanism is rename-then-reopen, never copy-then-truncate: the retired vendored rotator (MIT/Capriza, undeclared in either manifest so invisible to Socket and Dependabot, and unreachable — its `require` path resolved to a directory that does not exist) copied then truncated, losing every line appended during the copy window. ⚠️ The descriptor is opened SYNCHRONOUSLY and the stream wrapped over it: `createWriteStream(path)` opens asynchronously, so a burst of lines logged within one tick reaches a size trigger while the file does not exist on disk yet and the cascade's `renameSync` throws — measured with 60 lines in one tick. A size or age without an explicit unit is REFUSED, never guessed, and any invalid value disables rotation with a message naming key, value and consequence — reported THROUGH THE FLOWS (`process.emit('logger#'+flow, …)`, one payload per flow, which is what `emit()` itself does), never through raw `process.stdout.write`: under a daemon `lib/cmd/bundle/start.js` consumes the child's stdout and relays nothing after start, so the old raw-stdout refusal reached NOBODY (measured 0 in the daemon log, 0 at a tail client, 0 in the file, 0 in the CLI output). Logging continues either way. Two bounds stated honestly: bytes still queued when the process exits can be lost (`end()` is asynchronous, and making every write synchronous would let a full disk block the request loop), and a stream that stops draining past a 4 MB buffer drops lines with one warning per outage — the same posture the MQ speaker documents. ⚠️ **Generalisable trap that cost this arc most of its time: the repo-root `utils/prototypes.js` installs `Object.prototype.count` + `functionCount` and `Array.prototype.clone` + `inArray` ON REQUIRE, unguarded — so `typeof(anyObject.count)` is `'function'` for EVERY object including `{}`.** A `typeof(user.<key>) != 'undefined'` guard over a user-config object therefore hands the inherited METHOD back as the configured value — here `~~(function)` is 0 and rotation disabled itself reporting "count is undefined" on a valid default. ⛔ Do NOT cite or patch `helpers/prototypes.js:169`: it declares the same names, but its guard `typeof(Object.count) == 'undefined'` reads the INHERITED method once `utils/` has run (`Object` inherits through `Function.prototype`), so every declaration there is skipped — the trap defeats its own guard and that line is dead code. The properties are `enumerable: false`, so `Object.keys()` reports `[]` and `JSON.stringify` drops them, which is exactly why every probe read the key as ABSENT rather than as a function. ⚠️ An isolated repro is the CHEAPEST way to see this, not an impossible one — `node -e "require('./utils/prototypes.js'); console.log(typeof({}).count)"` prints `function` in a plain process with no framework and no invocation (control: without the require it prints `undefined`). What DOES false-negative is requiring the OTHER file: `helpers/prototypes.js` exports a constructor that must be CALLED, so a bare require of it installs nothing and reports every key absent — inside the framework tree too, which is why that probe reads like a legitimate in-context measurement. Pair any such probe with a known-positive control. ⚠️ **The same collision has a SECOND, REQUEST-FACING direction — #B546 (0.6.31):** the trap above is the framework READING a config key that the helper makes look present; the mirror is the framework CALLING `<container>.count()` on a container whose keys the CLIENT chooses (parsed body, query bag, route params, `req.files`, `self.query()` data, a routing rule's validator data, and `| length` on BOTH template engines). There an own field named `count` shadows the helper and the framework calls a string — see #211 for the impact and the `ownCount()` remedy, applied at 27 sites across `core/server.js`, `core/controller/controller.js` and the validator engine. Counts over FRAMEWORK-built objects (response headers, the routing table, config) deliberately keep the shorthand, and the helper itself stays on `Object.prototype` for application code. Use `Object.prototype.hasOwnProperty.call(obj, key)` for any own-key test over config in this framework, never `typeof` — the guard is name-independent, so it is right for all four names and any added later. The logger's object walk had the same shadowable count (#B832, 0.7.4): it now counts keys with `Object.keys` (until #B837 the `ownCount()` `.call` form read 0 on a null-prototype object or one with an own `hasOwnProperty` key, which dropped the commas), and a null-prototype object (`querystring.parse()`), an array element `{"toString": "x"}` or a Symbol no longer makes a log call throw in the caller. **#B524 (0.6.30) — `gina-container` applies the container preset ITSELF.** Unless `GINA_LOG_STDOUT` is already set, the launcher writes `process.env.GINA_LOG_STDOUT = 'true'` ABOVE its `utils/helper` require — that require initialises the launcher's OWN logger, and an unconfigured container was measured running TWO redialling speakers (launcher + bundle), each warning `ECONNREFUSED 127.0.0.1:8125` once and then dialling every ≤30 s for the life of the container — and the bundle inherits it through the spawn; `image:build` images inherit it for free, their entrypoint being `gina-init && exec gina-container`. It MUST be a raw `process.env` write (`setEnvVar()` populates `process.gina`, which the logger never reads). Explicit values win both ways, measured on isolated boots: `GINA_LOG_FORMAT=text` ⇒ coloured text with the dial still skipped; `GINA_LOG_STDOUT=false` ⇒ the pre-0.6.30 behaviour byte-for-byte. ⚠️ LAUNCHER topology only: a bundle started through a framework daemon (`gina start` → `bundle:start`) is untouched — there the MQ transport is what `gina tail` reads, and the daemon DISCARDS the bundle's own stdout after startup (`bundle/start.js` `if (isStarting) return;`), so the relay is the only path a runtime line has to an operator. **#B691 (0.7.1) — the one exception, during the boot itself:** the MQ listener keeps NO backlog (`listener.js` `report()` forwards each frame to the tails attached at that instant) and `gina tail` cannot ask for earlier frames, so a tail attached after the boot — the ordinary `bundle:start`-then-`tail` order, and a container init script that tails after starting — saw none of a bundle's boot-time lines, including the 0.7.0 `autoescape` and unanchored-`requirements` warnings. The startup watchdog now passes the bundle's warn-and-above boot lines on to the `bundle:start` client (so also to `bundle:restart`, which prints its start step): `warn`/`warning`, `error`/`err`, `crit` and `alert` (the logger renders the name the caller used, and recommends `warning`/`err`); `emerg` keeps its `aborted :(` path. The filter is `lib/cmd/bundle/inc/boot-lines.js`: it buffers by line across chunks, reads the level from the ANSI-stripped `[date] [level ][group]` header or from a JSON line's `level`, keeps a multi-line entry whole until its colour block closes (`format()` wraps the whole message in one), and caps a line and an entry at 64 KB. It runs after the `isStarting` guard and before the EADDRINUSE/emerg/started checks, so a warning comes before `started V(-.o)V`, which then sits on its own line; with no such line the output is byte-identical. A tail attached first still gets the lines, so they show twice there (accepted). Runtime lines stay the tail's. Pickup = a DAEMON restart (`framework:init` requires a command module once), not a `bundle:restart`. Tests: `test/lib/bundle-start-boot-lines.test.js`. That topology's JSON answer is the OTHER half of #B524: **`gina tail` renders one JSON object per line when its OWN logger's resolved format is `json`** (`GINA_LOG_FORMAT=json` on the tail process — the pod's environment reaches it; `lib/cmd/framework/tail.js` reads `console.getOptions().format`, the logger's single precedence rule, and routes BOTH render sites — the delayed-message replay and the live stream — through one `renderLine(pl)`; same `{ts, level, bundle, message, group, msg}` shape, NO `requestId`/`durationMs` because the relay payload is `{group, level, content}` only). Measured on a daemon-free relay scene (a real `MQListener` on an isolated port + a `gina-container` bundle booted with `GINA_LOG_STDOUT=false` so it speaks + `bin/cli tail`): format unset ⇒ 5 ANSI lines, 0 JSON; `json` ⇒ 5 JSON objects, 0 escapes, the tail's own connect lines included. ⛔ `GINA_LOG_STDOUT=true` is NOT the daemon topology's switch — it never reaches a daemon-spawned bundle's logger (#B532: `bin/cli:336` `filterArgs()` MOVES every `GINA_*` key out of `process.env` before `bundle/start.js:404` spawns with no `env:`, and the child's logger initialises at `gna.js:183` BEFORE the ctx mirror at `:276` restores them — so the tutorial's `GINA_LOG_FORMAT=json gina bundle:start` cannot reach the bundle either, and a daemon-topology JSON line can never carry `requestId` until that is fixed), and if it did reach the bundle it would silence the relay the tail reads.
945
947
 
946
- 213. **Client-plugin discipline — CSP-safe listeners, native-dialog parity, preload coalescing (consolidates former #149/#159/#200).** (1) Client-bundle plugins must NOT inject inline event-handler attributes (`setAttribute('onclick', …)`, `el.onX = …`) — they trip CSP `script-src-attr` under nonce-based policies; suppress defaults with `addEventListener('click', e => e.preventDefault())`, and keep it `preventDefault`-ONLY (no stopPropagation) when the element participates in event delegation other handlers depend on — a `preventDefault`-only listener still sets `event.defaultPrevented` exactly as the inline handler did. (2) Dialog popins open as native modals (`$el.showModal()`) in EVERY env — the dev-only non-modal downgrade + manual overlay are gone for dialog mode (native `::backdrop`); a consumer that PRE-OPENS the dialog (skeleton loading) must also use `showModal()` or it is born non-modal with nothing positioning it; the opt-in `preOpen`/`loadingShell` skeleton is idempotent via `hasAttribute('open')` — NOT getAttribute truthiness, because `showModal()` sets `open` to the EMPTY string — and since #B574 (2026-09-20) `popinOpen`'s own re-entry guard reads the same `hasAttribute('open')`: it read getAttribute truthiness, never skipped a shell-opened dialog, and on the new trigger's default MODELESS resolution called `show()` on the still-modal shell, which throws `InvalidStateError` and left `isOpen` false on a visibly open popin; a native UA close (Escape, `<form method="dialog">`) fires the element's `close` event WITHOUT the plugin's own close path, so a once-per-element `close` listener (the event is `close`, not `cancel` — `cancel` is Escape-only) routes it through the plugin close, keeping open-state/listeners/toolbar consistent — a UA-closed shared popin otherwise re-opens "one render behind" (#B58); and since gh#76 §8 (2026-09-20) the `preOpen` loading shell is an explicit STATE — `$popin.isLoading` is true from the moment the shell shows until the real open (`isOpen` stays false, so the two `!isOpen ⇒ popinOpen` consumers still run it), backed by a per-popin load sequence and the in-flight transport (`_loadSeq` / `_loadXhr`): `close()` / `destroy()` on a loading popin cancel the load (`closeLoadingShell` — sequence bump, `abort()`, teardown by the shell's OWN state because the class-keyed teardown never matches a dialog shell, trigger release, `close.<id>`; the aborted transport's readyState-4 handler runs its release block and then drops on the sequence check, so a cancel fires no `error`), the native `close` sync is bound at SHELL time through `bindNativeCloseSync` (guard `isOpen || isLoading`) so an Escape during the load routes through the plugin instead of re-opening when the content lands (driven on the pre-fix bundle: Escape closed the dialog, the landing re-opened it), `loadContent()` on a loading popin injects into the DIALOG element (`target` still names the container until popinOpen re-points it) and completes the open through popinOpen, and a non-2xx load fires `error.<id>` FIRST, then closes the shell if nothing loaded content into it; a popin without `preOpen` never enters the state, and `getActivePopin()` stays open-only; and #B579 (2026-09-20): the declarative trigger's `loaded.<id>` listener applies a NON-STRING detail as nothing — `popinLoadContent`'s redirect branch fires `loaded.<id>` with the POPIN OBJECT as detail (the legacy listener only binds on it), so a `load()` landing on an already-OPEN `data-gina-dialog` popin wrote the new body and then wiped it, leaving the dialog empty with no error (driven on the published bundle; every version since 0.4.6). (3) A popin/dialog click fired TWO identical GETs because the hover/`focusin` preload — `focusin` is part of the click gesture — was never reused: an in-flight preload registry lets the click-time consume ADOPT the in-flight fetch (waiter woken with the body, caller's own load on failure) instead of fetching again, and the legacy click path consumes preloads at all now (#B54); only the initial GET is ever preloaded. The consume path bypassing the full load tail (redirect/JSON handling) was ASSUMED acceptable — but a hover/focus-WARMED trigger whose GET returns a redirect/JSON response (`application/json` `{isXhrRedirect,location}`) had that raw JSON blind-injected as the popin body via `applyContent` (`$el.innerHTML`), the `_self` tunnel never firing — IDENTICAL symptom to the #B77 `_self` timer race but a DIFFERENT mechanism (the consume path, regression `2c61c494` v0.5.5), so #B77 fixed only the UNWARMED click-time path and the WARMED path persisted until #B80 (2026-07-06, `37e6829c`): `preloadFetch`'s `onreadystatechange` now caches a 2xx response ONLY when its Content-Type is NOT `application/json` (mirrors `popinLoad`'s own `isJsonContent` detection), firing the in-flight waiters with `null` (→ `consumePreload`'s `onMiss` = the click-time `doLoad`) and leaving the cache empty (→ a ready consume returns false → `doLoad`), so a JSON-returning trigger falls through to the click-time `popinLoad`'s full redirect/JSON tail exactly as a non-preloaded click (one extra GET on click — the hover-warm GET is not reused; measured 2 GETs). Only a genuine HTML fragment is preloaded+injected. Browser-bundled → prod dist rebuilt; VERIFIED in a real browser (a warmed legacy `data-gina-popin-url` redirect trigger now shows the tunnel target, not the raw JSON; the decline path positively exercised via resource-timing) — jsdom is falsely green. That residual — the GET itself still fired on hover for side-effecting triggers, authenticated (same-origin cookies) and CSRF-token-less (GET) — is CLOSED by the #B91 per-trigger opt-out (2026-07-10): `data-gina-dialog-preload="false"` on the trigger (honored on legacy `data-gina-popin-url` triggers too — the gate reads the attribute off the closest-matched intent target; case-INSENSITIVE `/^false$/i` on purpose, so a templated "False" cannot fail open and fire the GET anyway — deliberately safer than data-gina-dialog-modal's case-sensitive parse) suppresses BOTH the hover warm and the focusin-on-click warm at the shared intent handler; the opted-out click loads normally at click time (undefined cache slot → consume returns false → the caller's click-time load; exactly one GET per click). Default stays preload-ON: GET is presumed safe to fire early per HTTP semantics — a side-effecting trigger declares itself (the hover-prefetch ecosystem's convention, live-verified). (4) A proxied/tunnelled redirect JSON response (`isXhrRedirect`+`location`, default `_self`) used to `$popin.load()` then arm a blind `setTimeout(50, () => !$popin.isOpen && $popin.open())`; a follow-up load slower than 50 ms opened the popin against a not-yet-injected (skeleton/empty) target → intermittent unhandled-deref crash. Removed as vestigial (v0.1.0, 2021) — the already-armed `loaded.<id>` listener opens CONTENT-FIRST (injects the body via popinBind/handleLoadedBody, THEN popinOpen), so the load alone suffices; the `_self` branch's `return;` still guards the `window.open` fall-through (non-`_self` targets only) (#B77). Event contract: `open.<id>` = a fresh open, `loaded.<id>` = reload/redirect content injected — a consumer needing "content ready on every load" must listen to BOTH. A structurally identical blind timer lived in the SIBLING validator `Validator::Popin now redirecting` path (`core/plugins/lib/validator/src/main.js`), removed by #B79 (2026-07-10): the validator DISCARDED popinLoad's return, and that return IS the `{open}` handle whose `open()` arms the content-first `loaded.<id>` listener — so the timer was papering over a race the discarded handle created (an XHR faster than 50 ms fired `loaded` into the void and the body was lost, a slower one opened an empty popin first). It now captures the handle and calls `open()` inside the same not-open gate, guarding the `undefined` popinLoad returns when the request cannot start (CORS unsupported) so a failed load never blind-opens an empty popin; and the cross-popin branch resets `isRedirecting` before closing the ORIGINAL popin, because `popinClose` early-bails on a redirecting popin — that close was a silent no-op, leaving the original open behind the new one (browser-verified: pre-fix stays open, post-fix closes). MEASURED CORRECTION: the timer was NOT load-bearing for the different-popin branch as long assumed — that branch threw first, because the published `gina.popin` WAS re-assembled with a target-wins merge on every `new Popin()`, so its `getPopinByName`/`getPopinById` stayed bound to the FIRST instance's registry and resolved ONLY the boot popin, while `$popins` + `getActivePopin` saw every popin and `gina.popin.activePopinId` never updated (so `getActivePopin()` returned null once nothing was open) — and popins registered AFTER an instance's publish (click-time in-page dialog registrations) never reached the published registry at all, with destroyed popins lingering in it. FIXED as #B90 (2026-07-10): ONE module-scoped registry (`_sharedPopins`) aliased by every instance's `$popins`; a publish-ONCE `gina.popin = instance` (the published object IS the first instance, LIVE — re-publishing was both the freeze defect and, with a shared registry, a self-merge recursion hazard: gina's merge deep-recurses plain objects and `$popin.eventData` can hold the $popin itself); and a `setActivePopinId` write-through helper at all 7 write sites keeping the published `activePopinId` truthful no matter which instance opens or closes a popin. Browser-verified both ways on the built bundle (pre-fix: accessors blind + the validator cross-popin redirect 422-throws `not found`; fixed: accessors resolve every instance's popins and a form submit redirecting into a DIFFERENT popin works end-to-end — the original closes, the target loads content-first, `activePopinId` follows). Generalises: an accessor published through a target-wins `merge()` silently keeps the first instance's closure — publish a live instance once and share module-scoped state instead of re-merging per construction; and never infer a code path is reachable from the fact that it exists. (5) EAGER content warm — `data-gina-dialog-preload="eager"` (case-insensitive) opts a trigger into a one-shot idle warm-all pass: after `window` load, on requestIdleCallback (setTimeout fallback), serialized one GET at a time, routed through the SAME shared per-trigger gate as the hover warm (`warmTrigger`: disabled skip → the `"false"` opt-out → URL-cache dedup → in-flight reserve + fetch) so the two warm paths cannot drift and whichever fires second is a no-op; skipped entirely under Save-Data; triggers injected after the pass keep the delegated hover warm; staleness matches the shipped no-TTL hover semantics — the opt-in accepts the wider warm→open window. (6) #B139 (2026-07-20, 0.5.22): the content cache no longer outlives the open it warmed — measured pre-fix it was a ONE-GENERATION-LAGGING store (every open after the first paid ~1 GET yet rendered the PREVIOUS open's fetch: the leftover entry — the #B54 in-flight adoption's repopulated body, or the around-open re-warm — blocked the fresh warm's dedup; NO invalidation path existed, close/unbind/destroy never touched the cache; reproduced back to 0.5.4, so it predates #B54 and the eager pass). Fix: close clears the popin's content-URL slot (stamped at consumePreload both branches + popinLoad) AND re-sweeps the same slot ~120ms later, because the close-time a11y focus-return and pointer re-hover fire TRUSTED synthetic intents that re-warm the slot with close-era content within 1ms of the close (measured; a raced sweep is benign by construction — at most one extra fetch, never staleness, since an adopted in-flight body still reaches its open through the waiter chain). AND `preload="false"` triggers now skip the cache READ at open on both open paths — `false` is the hard always-refetch spelling for volatile popins (its GET always happens at open, never from a same-URL sibling's warm); no new annotation vocabulary. Warmed-never-opened entries keep the page-lifetime eager semantics above; default triggers pay at most one extra idempotent GET per close (the swept synthetic warm). Content preload deliberately does NOT ride 103 Early Hints: popin responses vary on `X-Requested-With` (a non-XHR GET of a fragment layout gets the iframe-wrap variant and misses the scripts append), and a browser `Link rel=preload` fetch never carries that header — wrong-variant bytes or a double GET, with no success branch; `self.setEarlyHints()` remains the right tool for a popin's STATIC subassets (the CSS/JS it injects via getScript/getStyle). (7) #A11Y8 (2026-08-05, 0.6.4): the background-`inert` loop in `applyNonModalShims` skipped `instance.target` — the shared `.gina-popins` container — and since every popin lives INSIDE that container, and `popinOpen` never closes the popin it supersedes (it only overwrites `activePopinId`), opening a second NON-MODAL dialog left the first one fully keyboard-reachable behind it: a user could tab out of the dialog on screen and into a stale one. Non-modal is the FRAMEWORK DEFAULT for `data-gina-dialog` (`resolveModal` falls through to `return false` at step 5; only a legacy `data-gina-popin-name` trigger is unconditionally modal), so this was the ordinary path, not an exotic one — note item (2)'s "native modals in EVERY env" predates the non-modal branch and now describes LEGACY triggers only. Fix: descend into the container instead of skipping it, and inert sibling `dialog[open]` ONLY — a `<dialog>` without `open` is already `display:none` per the UA stylesheet, so it is unreachable without help (measured in Chrome with controls firing both directions; the modal path was never affected, native `showModal()` handles the top layer itself). Teardown needed NO change: `removeNonModalShims` sweeps `[data-gina-popin-inert]` document-wide, so dialogs nested in the container restore without it knowing they exist. The `getAttribute('inert') == null` guard means gina only marks what it set, so a consumer-set `inert` is never stamped and never stripped. All seven are browser-bundled — prod dist rebuild required; verify (2), (3), (4) and (5) with a REAL preemptive-open / preload / redirect-tunnel consumer — a minimal smoke page is falsely green; (7) needs TWO popins open at once, the only scene in which it differs at all. (8) **A trigger gate must not trust the native `disabled` ATTRIBUTE on an element the browser already enforces (#B296, 0.6.5).** The three DISPATCH-time gates (`openFromTrigger`, the `bindOpen` document proxy, the per-`$element` listener) now require `!('disabled' in $el)` before the attribute counts, mirroring the validator's `isTriggerDisabled` (#B293) so the two subsystems agree on what "disabled" means. Rationale, measured: a natively-disabled `<button>` delivers **0 clicks to JS**, so the attribute arm could only ever fire on a `disabled` written DURING the dispatch — the shape of every consumer double-submit guard — which ate the open and then cleared the attribute, leaving nothing marked and a normal-looking control; on an `<a>`/custom element/span the browser enforces nothing, so the arm is KEPT (`'disabled' in $el` → `button:true · input:true · anchor:false · custom-element:false · span:false`). It also cannot weaken gina's OWN re-entry guard: `armPopinTrigger` arms `<a>` with `aria-disabled` (untouched arm) and every other tag with native `disabled` — enforced by the browser for real controls, and still enforced by this gate for `<span>`-likes, which is exactly the branch the `in` test preserves. **Two gates are deliberately NOT changed:** the hover/focus `warmTrigger` preload gate (removing it there would start PRELOADING a `<button disabled>` nobody can click — if it ever changes it wants the IDL property `$el.disabled === true`, not the ignore treatment) and the bind-time `$link` skip (structurally unreachable by a mid-dispatch write, and it carries a different one-arm predicate). **Reachability is unequal and the difference is load-bearing:** at `openFromTrigger` gina's proxy is DELEGATED so a button-bound guard always wins the race (plain #B293 shape reproduces); at the per-`$element` listener gina binds to the NODE, so only a CAPTURE-phase or earlier-registered guard can poison it (measured both ways — a target-phase guard bound after gina's does NOT reproduce); the legacy document-proxy site is traced-not-exercised. Test `test/e2e/popin-trigger-native-disabled.spec.js` — a replica cannot catch this, it is an ordering interaction between a consumer listener and a delegated proxy. ⚠️ **Scene trap for anyone writing a popin close-button test:** the close element must carry NO `id` — gina assigns `popin.close.<n>` only to an id-less one and the dispatch gate matches on that prefix, so a consumer id makes EVERY arm read "did not close", subtract control included (that is its own defect, #B299). (9) **A teardown loop must never splice the array it is walking (#B265, 0.6.5).** `popinUnbind`'s validator-form teardown spliced `$popin['$forms']` inside a `for` bounded by a length captured BEFORE the loop, so each splice shifted the array left under an incrementing cursor and the read index skipped one every time — the originally ODD-indexed forms were never destroyed and were left behind in the very array the loop exists to empty. Because the popin's `innerHTML = ''` runs BEFORE the loop, their surviving validator entries pointed at already-detached nodes, and `validateFormById`'s "return existing when available" early return then handed the stale entry back on the next open, so the form and its submit trigger came up silently inert — the same end symptom as #B294 by a completely different route. Fix: snapshot with `.slice()`, clear once with `.length = 0`, iterate the snapshot. **Two things worth carrying beyond this bug.** First, `destroy()` is not free: it fires `destroy.<formId>` (validator `main.js:4241`) and `'destroy'` IS on the plugin's public registrable-event list, so making a skipped form destroy properly starts firing consumer `on('destroy')` callbacks that never fired before — a teardown fix is a behaviour change, not merely a leak fix. Second, per-form teardown is now wrapped: `destroy()` → `unbindForm` → `getFormById(vFormId)` THROWS for a form holding a `data-gina-form-virtual` file input once its virtual form is unresolvable, which is precisely the detached state every form is in at that point — and before the guard, one such throw silently abandoned every LATER form in the loop. **Reachability is much narrower than it looks and must not be overstated:** the loop is gated on a validator — since #B756 (0.7.2) the one the POPIN was registered with (`$popin.options.validator`, falling back to the closure's `$validatorInstance`); before, the closure alone, a PER-INSTANCE value assigned only from `options.validator`. Gina's own boot does `new Popin({name:'gina-dialog-boot'})` with no validator, and the delegated `data-gina-dialog` listener is installed once by that boot instance (module guard `_ginaDialogDelegated`), so **the declarative dialog path can never reach this code** — it needs a popin constructed with a validator (`new Popin({name, validator})`, the legacy popin API). #B756 was the closure gate's own defect: `gina.popin` IS that validator-less boot instance, so the documented `gina.popin.close(name)` skipped a validator-registered popin's teardown and the reopened form came up unbound (`validateFormById`'s early return again — a third route to the #B265 symptom), while the popin's own `close()` and its close button run the registering instance and always tore down. A client navigation took the same route: gina/nav's fragment swap closes the active popin through `gina.popin.close(name)` (`closeActivePopin`), so a validator popin still open when a navigation swapped the page skipped the teardown too (measured on pre-0.7.2 bundles). Since #B762 (0.7.3) that close runs BEFORE the swap moves focus to the region and applies its scroll decision: run after them, closing the popin returned focus to its trigger and scrolled the page back down to it, modal and non-modal popins alike (an open popin inerts the page outside it, so the region could not take focus); e2e `nav-popin-close-focus-b762.spec.js`. Pins: arm 04 of e2e `validator-upload-popin-reopen-b733.spec.js`, and e2e `validator-upload-popin-reopen-nav-b756.spec.js` for the navigation. That is also why the test is a replica + source pins (`test/core/popin-forms-teardown.test.js`) rather than an e2e arm: an e2e scene on the declarative path would be VOID, every arm reading "nothing destroyed" for a reason unrelated to the defect. (10) **Never re-derive an element's ROLE from its id when the call path already proves it (#B299 + #B301, 0.6.5).** `register()`'s close branch gated on `/^popin\.close\./.test(event.target.id)` — a prefix gina mints at bind time — and that single line carried TWO silent defects: gina assigns the prefixed id **only to an id-less element** (`:1560`), so a consumer-supplied id is taken verbatim and matches nothing (**#B299**); and `event.target` is whatever was actually CLICKED, so an icon nested inside the button matches nothing either (**#B301** — the ordinary `<button class="gina-popin-close"><svg/></button>`, and by far the wider case). Both are invisible: `cancelEvent` runs at the top of the listener, so the button also swallows its own default — no error, no navigation, nothing. Fix: read **`event.currentTarget`** (the element `register()` bound — a `.gina-popin-close` by construction, since that function has ONE call site fed only from `querySelectorAll('.gina-popin-close')`) and treat a `popin.click.*` id as the sole exception, which preserves the dual-role element (a trigger that is ALSO a close button — reachable because `bindOpen` scans `document`, not just the host page). ⚠️ **What must NOT be "fixed" instead: rewriting the element's id.** The `$close` teardown sweep removes this listener via `gina.events[eId] == eId` — the degenerate name===id entry that `events.js:42` produces — so decoupling the event name from the id leaks the listener; and overwriting a consumer id would break their selectors, `aria-labelledby` and test hooks. Contrast `bindOpen:1195-1203`, which takes the OPPOSITE policy and does clobber a consumer id on trigger elements. Measured with controls firing both directions on the real bundle (id-less closes / consumer-id does not / nested click does not / patched all close), test `test/e2e/popin-close-dispatch.spec.js`. (11) **gina's own in-flight arm must be honoured by the path that dispatches it — a legacy trigger re-fired during its own load (#B298, 0.6.5).** `armPopinTrigger` marks an `<a>` trigger `aria-disabled="true"` for the duration of its popin's load (every other tag gets the native `disabled`, which the browser enforces). But the ONLY dispatch route for a pure-legacy `data-gina-popin-name` trigger is the `bindOpen` document click proxy, whose predicate tests the native attribute ALONE — and an `<a>` never carries it here — so a second click during the load reached the open handler and issued a SECOND XHR. `bindDelegatedOpen` returns early for a trigger carrying neither `data-gina-dialog` nor `data-gina-dialog-src`, so `openFromTrigger`'s own `aria-disabled` arm never covered this population. Fix: gate at the top of the legacy per-element open handler, predicate copied VERBATIM from `openFromTrigger` (native arm included, so #B296's `!('disabled' in $el)` rule still holds). **Gating THERE rather than in the proxy is load-bearing, and was MEASURED rather than reasoned:** a trigger's direct children each get their own listener from `proxyClick`, which fires the custom event DIRECTLY and never passes the proxy predicate at all — a proxy-level gate still let the child-click route fire twice, while the handler-level gate stops both (both routes converge there, and `currentTarget` is the element `bindOpen` bound, so child markup cannot dodge it). ⚠️ **Reachability is narrower than it looks, and the scene is easy to get wrong:** a real click HOVERS first, which warms the preload (`warmTrigger` reads `data-gina-popin-url` too), and the click then ADOPTS that in-flight fetch instead of calling `popinLoad` — so nothing is ever armed and the question goes unasked (a probe without the opt-out reads 1 request for a reason unrelated to the gate, its own counter-can-read-2 control failing). The defect needs the documented `data-gina-dialog-preload="false"` opt-out (#B91) — i.e. exactly the triggers whose GET has server-side effects, which is why it is not cosmetic. Whether a no-hover activation (touch, some keyboard paths) is a second reachable population is UNMEASURED. Test `test/e2e/popin-legacy-trigger-aria-disabled.spec.js` (4 arms, red-first; the two fix arms failed 2-vs-1 on the pre-fix dist while their scene/armed/click assertions passed, so the red is attributable to the defect). (12) **A click adopting a still-in-flight hover/focus preload is a genuine wait — it now arms the trigger exactly like the cold click-time XHR (#B285, 0.6.5).** Both consume branches previously armed NOTHING (only a preOpen popin got its skeleton), so with warm-on-intent preloading the COMMON open path showed no busy affordance at all. `consumePreload` gained a guarded 4th param `onSettled`, fired synchronously after the ready (cached) apply and at the TOP of the adopted waiter — success AND failure, release-before-apply, the cold readyState-4 order. The CALLERS own the affordance (arm on adopted-wait only via a settled-flag; release via `releasePopinTrigger`, armPopinTrigger's mirror), keeping `consumePreload` loading-state-agnostic — load-bearing for the extract-and-execute test harness, which injects neither `document` nor `loadingState` and calls with ≤3 args (the guard makes the 4th a no-op), and the right factoring anyway (it reports that it settled; callers decide who cares). The ready branch's SYNCHRONOUS settle is equally load-bearing: without it a caller cannot distinguish ready from in-flight and would arm forever — an instant cached open never flashes a busy state. Double-click protection during the wait comes free from EXISTING mechanisms (the entry gates refuse an armed trigger; the browser suppresses a disabled `<button>`), and the failed-adoption leg releases before the click-time fallback re-arms through popinLoad's own path. Playwright note: an armed `<a>` reads [disabled] in the accessibility tree, so Playwright's own actionability check refuses to click it — a second-click scene needs `force: true` (a real pointer is NOT blocked on aria-disabled). e2e `test/e2e/popin-preload-loading-state.spec.js` (5 arms, red-first: 4 red on the pre-fix dist, ready-branch no-arm control green on both). (13) **A free variable inside a `try` turned every successful JSON load into a fabricated server error (#B315, 0.6.6).** `popinLoad`'s readyState-4 2xx branch dispatched `success.<id>` on `$forms[0]` — but the module's sole `var $forms` is declared in `popinBind`, a SIBLING function under `Popin`, so reading it threw `ReferenceError` straight into that same handler's `catch`, which fabricates `{status: 422, error}` and fires `error.<id>`. `success` therefore never reached a subscriber at all. ⚠️ **The observable is worse than a stack trace, and that is the part worth carrying:** the catch overwrites `result.error` with `JSON.parse(xhr.responseText)` whenever the response is `application/json`, and the throwing line is reachable ONLY for JSON (a non-JSON body returns early at the `loaded.` trigger just above it) — so the consumer received a **422 whose payload was the SUCCESSFUL response body**, reading as a server-side failure that never happened. Fix: dispatch on `$el`, matching the two sibling triggers in the same handler (`loaded.`, `error.`) — `popinLoad` is the CONTENT loader, so a JSON response need not involve a form at all; the `$forms[0]` target was copy-paste from a validator context, whose commented-out `handleXhrResponse` line still sits directly above it. Reproduced BEFORE fixing (a replica of the readyState-4 2xx branch with two firing controls: non-JSON → `loaded`, `location` → early return); tests `test/core/popin.test.js §34` (4 — scope pin, single-declaration-plus-position pin, dispatch-target pin, dist-fidelity pin; both source pins validated RED against the pre-fix source, the dist pin RED before the rebuild). ⚠️ **The registry's other two events still never fire (#B315b):** `progress`'s entire `xhr.onprogress` block including its `triggerEvent` is commented out (dead by construction, with its `ontimeout` sibling), and `click` has ZERO `triggerEvent` sites anywhere — the `popin.click.*` identifiers are per-element DOM event names in a different namespace. Both still register cleanly through `on()`, so the surface advertises three events and delivered none; their disposition is a DESIGN question (implement, or drop them from the registry so the surface stops lying) and was deliberately NOT folded into this fix, which was an unambiguous defect. **The popin `::backdrop` rule is scoped to gina's own dialogs (#B329, fixed 2026-08-24).** The sheet shipped `dialog::backdrop` (dark overlay + blur) UNSCOPED, painting gina's backdrop on EVERY consumer `<dialog>` on the page; now `dialog.gina-popin-container::backdrop`, matching the reduced-motion rules that were already scoped. Both dialog-creation sites set the container class on the `<dialog>` element itself, so gina's own popins keep their backdrop. Consumer-visible: a page relying on the free backdrop for its own dialogs styles them itself now, and a popin dialog element supplied by the page's own markup (the adopt-by-id path) needs `gina-popin-container` to keep gina's backdrop. Pins: `popin-backdrop-scope.test.js` (source + compiled twin + `gina.min.css`, present/absent controls). Browser-bundled ⇒ consumers restart AND re-bake. **A form's or a link's `text/html` XHR answer is routed by the popin the SUBMITTING element is inside, never by "the active popin" (gh#76 + #B571, 2026-09-20).** The validator captures `gina.popin.getPopinContaining($form)` into the per-send closure at submit (the same capture stamps the `X-Gina-Popin-Id`/`-Name` request headers, so `self.isPopinContext()` is true only for a contained form) — and since #B572 (2026-09-22) the STAGED-UPLOAD path makes the same capture once per file selection (`$ownerPopin = getPopinContaining($el.form || $el)`, `$el.form` being the consumer's real form), so the virtual `gina-upload-*` form, its preview lookups, its `uploadProperties.isPopinContext` flag and its staging request belong to the popin the REAL form is inside, or to `document.body`. It was the LAST surviving `isPopinContext()` (« some popin is open ») gate: a PAGE form's file chosen while an unrelated popin was open had its virtual form appended inside that popin — staging 200, all ten hidden metadata fields EMPTY, the save posted without the file, the staging request claiming that popin's id, zero errors — reachable through the file-picker race (the OS picker is application-modal and ignores `inert`, which blocks only the click path) and through script-assigned `input.files`; a form INSIDE the popin was always fine and still is (measured 10/10 both ways). Dev-mode notice `[FormValidator][popin] the staged upload of `#<input>` (form `#<form>`) is placed with its own form …`, from `warnIfOldRulePlacedUpload`, the twin of `warnIfOldRuleRouted`; the popin branch's `$target` DOMParser copy is deliberately untouched (measured working when chosen by containment). Pins: `test/core/validator-upload-popin-containment.test.js` (block-scoped absence pin + the helper driven in a lifted scope with every free identifier supplied), e2e `validator-upload-popin-containment.spec.js` (page form + open popin, the picker race, and the inside-the-popin control, red-first through `B572_PREFIX_BUNDLE`). **A popin close + reopen re-stages, and same-named staged inputs in two forms stay apart (#B733/#B732, 0.7.2):** the file-input change handler reuses a virtual `gina-upload-*` record's element only while it `isConnected`; a detached record is `destroy()`ed (its listeners and their registry entries go with it), deleted from `$forms`, and a new virtual form is built — it used to fall back to `getFormById()`, which returns the validator RECORD, and use that record as the element, so after a popin close (the content is wiped, nothing destroys the virtual form) every selection threw `setAttribute is not a function` and staged nothing. The virtual id of a bracket-less name ends with `-<form id>` (`gina-upload-doc-<formId>`; a bracketed name already carried the form id, once per `]`, and is unchanged) — `gina-upload-doc` was shared by every form, so the second form's upload filled the FIRST form's hidden fields and left its own empty; a listener or selector matching a bracket-less virtual id literally must read the input's `data-gina-form-virtual` instead. Same-named staged inputs inside ONE form still share a virtual form (their hidden-field names collide too). Pins: e2e `validator-upload-popin-reopen-b733.spec.js` (4 arms, incl. #B756's `gina.popin.close(name)`) and `validator-upload-same-name-b732.spec.js` (2 arms), red-first on the pre-fix dist. For a submit, the validator honours its capture at settle only while that popin is still open AND its element still contains the form (a close + reopen in flight detaches the form ⇒ legacy payload); anything else — a page form while a popin is open OR loading — is the legacy handler-only `{contentType, content, status}` payload, with a dev-mode `[FormValidator][popin]` notice naming the popin the old rule would have targeted (it REPLACED an open popin's content, or raised a false `422` `Popin x is not open !` on a loading one — the loading window is reachable through a preload-opted-out trigger, never a hovered default one, whose click adopts the warm). The popin branch now also emits the `.hform` (validator) / `.hlink` (`utils/events.js`, whose `.hform` half is dead — no caller passes `$form`) companions with the parsed xhr-data, so declared callbacks run for forms inside popins (#B571). `getActivePopin()` returns OPEN popins only — the `activePopinId` one when open, else the first open — never a registered-but-not-open one (§8(a)); `popinLoadContent` honours `this` when called as a method (both internal sites use `.call($popin, …)`, the manager-level call keeps the active fallback); the redirect branch resolves `sendCtx.popin || (result.popin ? getActivePopin() : null)` — a plain `location` redirect from a page form falls through to the page redirect (measured pre-fix: it loaded INTO the open popin AND navigated, two fetches), a name-less `{popin:{close}}` with nothing open is a no-op. `getPopinContaining` walks the registry with `getElementById(id).contains(el)` (innermost wins; the element id is the popin id on every flavour; 0.2 µs worst case) — a non-modal popin still inerts the page, so a page form can only be submitted by script while one is open, which is what the request-side arms of `test/e2e/validator-popin-form-target.spec.js` do. Companion `test/e2e/popin-preopen-modeless.spec.js` pins #B574 (`popinOpen` guard `hasAttribute('open')`). Browser-bundled ⇒ consumers restart AND re-bake. **#B575 (0.6.32) — the two hidden transport inputs are DEV-ONLY, and both popin branches now parse tolerantly.** `spliceXhrInputs` runs only under `_isDev` (`NODE_ENV_IS_DEV === 'true'`), so outside dev mode a `renderWithoutLayout` answer carries NO `gina-without-layout-xhr-data`/`-view`; both branches dereferenced `.value` on the absent element, the `TypeError` was caught INSIDE the try and surfaced as a false `422` error callback AFTER a successful server write, and the popin was never loaded. One shared `parseXhrHtmlAnswer()` now returns `{doc, data, view}` with `data`/`view` `null` when absent and the two inputs STRIPPED from the parsed document (they are consumed transport — left in, a swap into a region inside a `<form>` would resubmit them and repeated swaps would duplicate their ids). ⚠️ The parsed data is delivered VERBATIM when present — injecting a `status` key would change the payload every contained form already receives (the slice-1 contract `validator-popin-form-target.spec.js §05` pins) — and the payload is `{status}` only when the inputs are absent; `validator-form-target.test.js §06` pins that absence SCOPED to the popin branch, since `result.status = xhr.status` is legitimate elsewhere (the legacy payload builders in `utils/events.js`). (14) **`data-gina-dialog-target` is ONE selector applied on BOTH sides, with THREE fallbacks — all announced in dev mode since #B580 (2026-09-22).** `applyContent($el, html, $popin, partialTarget)` reads the slot with `$el.querySelector(partialTarget)` and the incoming region with `parsed.querySelector(partialTarget)` over a `new DOMParser()` document, then assigns `$slot.innerHTML = $incoming.innerHTML` — the SLOT ELEMENT survives, which is what preserves chrome and its bindings. The three misses are all fail-soft (a popin open is a retryable read, unlike a submit): a selector the ENGINE REFUSES ⇒ full replace — pre-#B580 this threw an uncaught `SyntaxError` out of the `loaded.<id>` handler / preload-consume tail, so the dialog silently kept its previous content (MEASURED on the real bundle: `Failed to execute 'querySelector' on 'Element': '#slot >' is not a valid selector.`); no match in the OPEN DIALOG ⇒ full replace; no match in the ANSWER ⇒ the whole `parsed.body` into the slot — the SECOND fallback, which the published guide did not mention and nothing pinned. `warnPartialTarget()` emits one `console.warn` per event naming the popin, the selector and which fallback ran, gated on `gina.config.envIsDev`. ⚠️ Testing surface: the e2e harness (`test/e2e/runtime-server.js` serves `envIsDev:'false'`) can assert only the FALLBACK — the NOTICE belongs to `popin.test.js §22`, which drives the REAL brace-walk-extracted function, because the §21 replica omits `$popin` and mirrors the pre-fix body; keep `applyContent`'s signature and first `if ( !partialTarget )` branch byte-shaped or the regex pins at `popin.test.js:1121-1130` and `popin-reload-open.test.js:61` go red. ⚠️ The attribute is the dialog-scoped sibling of `data-gina-form-select`, NOT of `data-gina-form-target`: one selector, both sides, nothing resolved relative to an element, so the `this`/`closest x`/`find x`/`next x` grammar does not apply — all four are valid CSS, so writing one takes the silent fallback instead of reporting a mistake. ⚠️ The "legacy triggers get a full replace" rule covers PURE legacy only: `bindDelegatedOpen` returns early ONLY for a trigger carrying NEITHER `data-gina-dialog` NOR `data-gina-dialog-src`, so a MIXED trigger (legacy attributes + `-src`) routes through `openFromTrigger` and DOES get the partial swap.
948
+ 213. **Client-plugin discipline — CSP-safe listeners, native-dialog parity, preload coalescing (consolidates former #149/#159/#200).** (1) Client-bundle plugins must NOT inject inline event-handler attributes (`setAttribute('onclick', …)`, `el.onX = …`) — they trip CSP `script-src-attr` under nonce-based policies; suppress defaults with `addEventListener('click', e => e.preventDefault())`, and keep it `preventDefault`-ONLY (no stopPropagation) when the element participates in event delegation other handlers depend on — a `preventDefault`-only listener still sets `event.defaultPrevented` exactly as the inline handler did. (2) Dialog popins open as native modals (`$el.showModal()`) in EVERY env — the dev-only non-modal downgrade + manual overlay are gone for dialog mode (native `::backdrop`); a consumer that PRE-OPENS the dialog (skeleton loading) must also use `showModal()` or it is born non-modal with nothing positioning it; the opt-in `preOpen`/`loadingShell` skeleton is idempotent via `hasAttribute('open')` — NOT getAttribute truthiness, because `showModal()` sets `open` to the EMPTY string — and since #B574 (2026-09-20) `popinOpen`'s own re-entry guard reads the same `hasAttribute('open')`: it read getAttribute truthiness, never skipped a shell-opened dialog, and on the new trigger's default MODELESS resolution called `show()` on the still-modal shell, which throws `InvalidStateError` and left `isOpen` false on a visibly open popin; a native UA close (Escape, `<form method="dialog">`) fires the element's `close` event WITHOUT the plugin's own close path, so a once-per-element `close` listener (the event is `close`, not `cancel` — `cancel` is Escape-only) routes it through the plugin close, keeping open-state/listeners/toolbar consistent — a UA-closed shared popin otherwise re-opens "one render behind" (#B58); and since gh#76 §8 (2026-09-20) the `preOpen` loading shell is an explicit STATE — `$popin.isLoading` is true from the moment the shell shows until the real open (`isOpen` stays false, so the two `!isOpen ⇒ popinOpen` consumers still run it), backed by a per-popin load sequence and the in-flight transport (`_loadSeq` / `_loadXhr`): `close()` / `destroy()` on a loading popin cancel the load (`closeLoadingShell` — sequence bump, `abort()`, teardown by the shell's OWN state because the class-keyed teardown never matches a dialog shell, trigger release, `close.<id>`; the aborted transport's readyState-4 handler runs its release block and then drops on the sequence check, so a cancel fires no `error`), the native `close` sync is bound at SHELL time through `bindNativeCloseSync` (guard `isOpen || isLoading`) so an Escape during the load routes through the plugin instead of re-opening when the content lands (driven on the pre-fix bundle: Escape closed the dialog, the landing re-opened it), `loadContent()` on a loading popin injects into the DIALOG element (`target` still names the container until popinOpen re-points it) and completes the open through popinOpen, and a non-2xx load fires `error.<id>` FIRST, then closes the shell if nothing loaded content into it; a popin without `preOpen` never enters the state, and `getActivePopin()` stays open-only; and #B579 (2026-09-20): the declarative trigger's `loaded.<id>` listener applies a NON-STRING detail as nothing — `popinLoadContent`'s redirect branch fires `loaded.<id>` with the POPIN OBJECT as detail (the legacy listener only binds on it), so a `load()` landing on an already-OPEN `data-gina-dialog` popin wrote the new body and then wiped it, leaving the dialog empty with no error (driven on the published bundle; every version since 0.4.6). (3) A popin/dialog click fired TWO identical GETs because the hover/`focusin` preload — `focusin` is part of the click gesture — was never reused: an in-flight preload registry lets the click-time consume ADOPT the in-flight fetch (waiter woken with the body, caller's own load on failure) instead of fetching again, and the legacy click path consumes preloads at all now (#B54); only the initial GET is ever preloaded. The consume path bypassing the full load tail (redirect/JSON handling) was ASSUMED acceptable — but a hover/focus-WARMED trigger whose GET returns a redirect/JSON response (`application/json` `{isXhrRedirect,location}`) had that raw JSON blind-injected as the popin body via `applyContent` (`$el.innerHTML`), the `_self` tunnel never firing — IDENTICAL symptom to the #B77 `_self` timer race but a DIFFERENT mechanism (the consume path, regression `2c61c494` v0.5.5), so #B77 fixed only the UNWARMED click-time path and the WARMED path persisted until #B80 (2026-07-06, `37e6829c`): `preloadFetch`'s `onreadystatechange` now caches a 2xx response ONLY when its Content-Type is NOT `application/json` (mirrors `popinLoad`'s own `isJsonContent` detection), firing the in-flight waiters with `null` (→ `consumePreload`'s `onMiss` = the click-time `doLoad`) and leaving the cache empty (→ a ready consume returns false → `doLoad`), so a JSON-returning trigger falls through to the click-time `popinLoad`'s full redirect/JSON tail exactly as a non-preloaded click (one extra GET on click — the hover-warm GET is not reused; measured 2 GETs). Only a genuine HTML fragment is preloaded+injected. Browser-bundled → prod dist rebuilt; VERIFIED in a real browser (a warmed legacy `data-gina-popin-url` redirect trigger now shows the tunnel target, not the raw JSON; the decline path positively exercised via resource-timing) — jsdom is falsely green. That residual — the GET itself still fired on hover for side-effecting triggers, authenticated (same-origin cookies) and CSRF-token-less (GET) — is CLOSED by the #B91 per-trigger opt-out (2026-07-10): `data-gina-dialog-preload="false"` on the trigger (honored on legacy `data-gina-popin-url` triggers too — the gate reads the attribute off the closest-matched intent target; case-INSENSITIVE `/^false$/i` on purpose, so a templated "False" cannot fail open and fire the GET anyway — deliberately safer than data-gina-dialog-modal's case-sensitive parse) suppresses BOTH the hover warm and the focusin-on-click warm at the shared intent handler; the opted-out click loads normally at click time (undefined cache slot → consume returns false → the caller's click-time load; exactly one GET per click). Default stays preload-ON: GET is presumed safe to fire early per HTTP semantics — a side-effecting trigger declares itself (the hover-prefetch ecosystem's convention, live-verified). (4) A proxied/tunnelled redirect JSON response (`isXhrRedirect`+`location`, default `_self`) used to `$popin.load()` then arm a blind `setTimeout(50, () => !$popin.isOpen && $popin.open())`; a follow-up load slower than 50 ms opened the popin against a not-yet-injected (skeleton/empty) target → intermittent unhandled-deref crash. Removed as vestigial (v0.1.0, 2021) — the already-armed `loaded.<id>` listener opens CONTENT-FIRST (injects the body via popinBind/handleLoadedBody, THEN popinOpen), so the load alone suffices; the `_self` branch's `return;` still guards the `window.open` fall-through (non-`_self` targets only) (#B77). Event contract: `open.<id>` = a fresh open, `loaded.<id>` = reload/redirect content injected — a consumer needing "content ready on every load" must listen to BOTH. A structurally identical blind timer lived in the SIBLING validator `Validator::Popin now redirecting` path (`core/plugins/lib/validator/src/main.js`), removed by #B79 (2026-07-10): the validator DISCARDED popinLoad's return, and that return IS the `{open}` handle whose `open()` arms the content-first `loaded.<id>` listener — so the timer was papering over a race the discarded handle created (an XHR faster than 50 ms fired `loaded` into the void and the body was lost, a slower one opened an empty popin first). It now captures the handle and calls `open()` inside the same not-open gate, guarding the `undefined` popinLoad returns when the request cannot start (CORS unsupported) so a failed load never blind-opens an empty popin; and the cross-popin branch resets `isRedirecting` before closing the ORIGINAL popin, because `popinClose` early-bails on a redirecting popin — that close was a silent no-op, leaving the original open behind the new one (browser-verified: pre-fix stays open, post-fix closes). MEASURED CORRECTION: the timer was NOT load-bearing for the different-popin branch as long assumed — that branch threw first, because the published `gina.popin` WAS re-assembled with a target-wins merge on every `new Popin()`, so its `getPopinByName`/`getPopinById` stayed bound to the FIRST instance's registry and resolved ONLY the boot popin, while `$popins` + `getActivePopin` saw every popin and `gina.popin.activePopinId` never updated (so `getActivePopin()` returned null once nothing was open) — and popins registered AFTER an instance's publish (click-time in-page dialog registrations) never reached the published registry at all, with destroyed popins lingering in it. FIXED as #B90 (2026-07-10): ONE module-scoped registry (`_sharedPopins`) aliased by every instance's `$popins`; a publish-ONCE `gina.popin = instance` (the published object IS the first instance, LIVE — re-publishing was both the freeze defect and, with a shared registry, a self-merge recursion hazard: gina's merge deep-recurses plain objects and `$popin.eventData` can hold the $popin itself); and a `setActivePopinId` write-through helper at all 7 write sites keeping the published `activePopinId` truthful no matter which instance opens or closes a popin. Browser-verified both ways on the built bundle (pre-fix: accessors blind + the validator cross-popin redirect 422-throws `not found`; fixed: accessors resolve every instance's popins and a form submit redirecting into a DIFFERENT popin works end-to-end — the original closes, the target loads content-first, `activePopinId` follows). Generalises: an accessor published through a target-wins `merge()` silently keeps the first instance's closure — publish a live instance once and share module-scoped state instead of re-merging per construction; and never infer a code path is reachable from the fact that it exists. (5) EAGER content warm — `data-gina-dialog-preload="eager"` (case-insensitive) opts a trigger into a one-shot idle warm-all pass: after `window` load, on requestIdleCallback (setTimeout fallback), serialized one GET at a time, routed through the SAME shared per-trigger gate as the hover warm (`warmTrigger`: disabled skip → the `"false"` opt-out → URL-cache dedup → in-flight reserve + fetch) so the two warm paths cannot drift and whichever fires second is a no-op; skipped entirely under Save-Data; triggers injected after the pass keep the delegated hover warm; staleness matches the shipped no-TTL hover semantics — the opt-in accepts the wider warm→open window. (6) #B139 (2026-07-20, 0.5.22): the content cache no longer outlives the open it warmed — measured pre-fix it was a ONE-GENERATION-LAGGING store (every open after the first paid ~1 GET yet rendered the PREVIOUS open's fetch: the leftover entry — the #B54 in-flight adoption's repopulated body, or the around-open re-warm — blocked the fresh warm's dedup; NO invalidation path existed, close/unbind/destroy never touched the cache; reproduced back to 0.5.4, so it predates #B54 and the eager pass). Fix: close clears the popin's content-URL slot (stamped at consumePreload both branches + popinLoad) AND re-sweeps the same slot ~120ms later, because the close-time a11y focus-return and pointer re-hover fire TRUSTED synthetic intents that re-warm the slot with close-era content within 1ms of the close (measured; a raced sweep is benign by construction — at most one extra fetch, never staleness, since an adopted in-flight body still reaches its open through the waiter chain). AND `preload="false"` triggers now skip the cache READ at open on both open paths — `false` is the hard always-refetch spelling for volatile popins (its GET always happens at open, never from a same-URL sibling's warm); no new annotation vocabulary. Warmed-never-opened entries keep the page-lifetime eager semantics above; default triggers pay at most one extra idempotent GET per close (the swept synthetic warm). Content preload deliberately does NOT ride 103 Early Hints: popin responses vary on `X-Requested-With` (a non-XHR GET of a fragment layout gets the iframe-wrap variant and misses the scripts append), and a browser `Link rel=preload` fetch never carries that header — wrong-variant bytes or a double GET, with no success branch; `self.setEarlyHints()` remains the right tool for a popin's STATIC subassets (the CSS/JS it injects via getScript/getStyle). (7) #A11Y8 (2026-08-05, 0.6.4): the background-`inert` loop in `applyNonModalShims` skipped `instance.target` — the shared `.gina-popins` container — and since every popin lives INSIDE that container, and `popinOpen` never closes the popin it supersedes (it only overwrites `activePopinId`), opening a second NON-MODAL dialog left the first one fully keyboard-reachable behind it: a user could tab out of the dialog on screen and into a stale one. Non-modal is the FRAMEWORK DEFAULT for `data-gina-dialog` (`resolveModal` falls through to `return false` at step 5; only a legacy `data-gina-popin-name` trigger is unconditionally modal), so this was the ordinary path, not an exotic one — note item (2)'s "native modals in EVERY env" predates the non-modal branch and now describes LEGACY triggers only. Fix: descend into the container instead of skipping it, and inert sibling `dialog[open]` ONLY — a `<dialog>` without `open` is already `display:none` per the UA stylesheet, so it is unreachable without help (measured in Chrome with controls firing both directions; the modal path was never affected, native `showModal()` handles the top layer itself). Teardown needed NO change: `removeNonModalShims` sweeps `[data-gina-popin-inert]` document-wide, so dialogs nested in the container restore without it knowing they exist. The `getAttribute('inert') == null` guard means gina only marks what it set, so a consumer-set `inert` is never stamped and never stripped. All seven are browser-bundled — prod dist rebuild required; verify (2), (3), (4) and (5) with a REAL preemptive-open / preload / redirect-tunnel consumer — a minimal smoke page is falsely green; (7) needs TWO popins open at once, the only scene in which it differs at all. (8) **A trigger gate must not trust the native `disabled` ATTRIBUTE on an element the browser already enforces (#B296, 0.6.5).** The three DISPATCH-time gates (`openFromTrigger`, the `bindOpen` document proxy, the per-`$element` listener) now require `!('disabled' in $el)` before the attribute counts, mirroring the validator's `isTriggerDisabled` (#B293) so the two subsystems agree on what "disabled" means. Rationale, measured: a natively-disabled `<button>` delivers **0 clicks to JS**, so the attribute arm could only ever fire on a `disabled` written DURING the dispatch — the shape of every consumer double-submit guard — which ate the open and then cleared the attribute, leaving nothing marked and a normal-looking control; on an `<a>`/custom element/span the browser enforces nothing, so the arm is KEPT (`'disabled' in $el` → `button:true · input:true · anchor:false · custom-element:false · span:false`). It also cannot weaken gina's OWN re-entry guard: `armPopinTrigger` arms `<a>` with `aria-disabled` (untouched arm) and every other tag with native `disabled` — enforced by the browser for real controls, and still enforced by this gate for `<span>`-likes, which is exactly the branch the `in` test preserves. **Two gates are deliberately NOT changed:** the hover/focus `warmTrigger` preload gate (removing it there would start PRELOADING a `<button disabled>` nobody can click — if it ever changes it wants the IDL property `$el.disabled === true`, not the ignore treatment) and the bind-time `$link` skip (structurally unreachable by a mid-dispatch write, and it carries a different one-arm predicate). **Reachability is unequal and the difference is load-bearing:** at `openFromTrigger` gina's proxy is DELEGATED so a button-bound guard always wins the race (plain #B293 shape reproduces); at the per-`$element` listener gina binds to the NODE, so only a CAPTURE-phase or earlier-registered guard can poison it (measured both ways — a target-phase guard bound after gina's does NOT reproduce); the legacy document-proxy site is traced-not-exercised. Test `test/e2e/popin-trigger-native-disabled.spec.js` — a replica cannot catch this, it is an ordering interaction between a consumer listener and a delegated proxy. ⚠️ **Scene trap for anyone writing a popin close-button test:** the close element must carry NO `id` — gina assigns `popin.close.<n>` only to an id-less one and the dispatch gate matches on that prefix, so a consumer id makes EVERY arm read "did not close", subtract control included (that is its own defect, #B299). (9) **A teardown loop must never splice the array it is walking (#B265, 0.6.5).** `popinUnbind`'s validator-form teardown spliced `$popin['$forms']` inside a `for` bounded by a length captured BEFORE the loop, so each splice shifted the array left under an incrementing cursor and the read index skipped one every time — the originally ODD-indexed forms were never destroyed and were left behind in the very array the loop exists to empty. Because the popin's `innerHTML = ''` runs BEFORE the loop, their surviving validator entries pointed at already-detached nodes, and `validateFormById`'s "return existing when available" early return then handed the stale entry back on the next open, so the form and its submit trigger came up silently inert — the same end symptom as #B294 by a completely different route. Fix: snapshot with `.slice()`, clear once with `.length = 0`, iterate the snapshot. **Two things worth carrying beyond this bug.** First, `destroy()` is not free: it fires `destroy.<formId>` (validator `main.js:4241`) and `'destroy'` IS on the plugin's public registrable-event list, so making a skipped form destroy properly starts firing consumer `on('destroy')` callbacks that never fired before — a teardown fix is a behaviour change, not merely a leak fix. Second, per-form teardown is now wrapped: `destroy()` → `unbindForm` → `getFormById(vFormId)` THROWS for a form holding a `data-gina-form-virtual` file input once its virtual form is unresolvable, which is precisely the detached state every form is in at that point — and before the guard, one such throw silently abandoned every LATER form in the loop. **Reachability is much narrower than it looks and must not be overstated:** the loop is gated on a validator — since #B756 (0.7.2) the one the POPIN was registered with (`$popin.options.validator`, falling back to the closure's `$validatorInstance`); before, the closure alone, a PER-INSTANCE value assigned only from `options.validator`. Gina's own boot does `new Popin({name:'gina-dialog-boot'})` with no validator, and the delegated `data-gina-dialog` listener is installed once by that boot instance (module guard `_ginaDialogDelegated`), so **the declarative dialog path can never reach this code** — it needs a popin constructed with a validator (`new Popin({name, validator})`, the legacy popin API). #B756 was the closure gate's own defect: `gina.popin` IS that validator-less boot instance, so the documented `gina.popin.close(name)` skipped a validator-registered popin's teardown and the reopened form came up unbound (`validateFormById`'s early return again — a third route to the #B265 symptom), while the popin's own `close()` and its close button run the registering instance and always tore down. A client navigation took the same route: gina/nav's fragment swap closes the active popin through `gina.popin.close(name)` (`closeActivePopin`), so a validator popin still open when a navigation swapped the page skipped the teardown too (measured on pre-0.7.2 bundles). Since #B762 (0.7.3) that close runs BEFORE the swap moves focus to the region and applies its scroll decision: run after them, closing the popin returned focus to its trigger and scrolled the page back down to it, modal and non-modal popins alike (an open popin inerts the page outside it, so the region could not take focus); e2e `nav-popin-close-focus-b762.spec.js`. Pins: arm 04 of e2e `validator-upload-popin-reopen-b733.spec.js`, and e2e `validator-upload-popin-reopen-nav-b756.spec.js` for the navigation. That is also why the test is a replica + source pins (`test/core/popin-forms-teardown.test.js`) rather than an e2e arm: an e2e scene on the declarative path would be VOID, every arm reading "nothing destroyed" for a reason unrelated to the defect. (10) **Never re-derive an element's ROLE from its id when the call path already proves it (#B299 + #B301, 0.6.5).** `register()`'s close branch gated on `/^popin\.close\./.test(event.target.id)` — a prefix gina mints at bind time — and that single line carried TWO silent defects: gina assigns the prefixed id **only to an id-less element** (`:1560`), so a consumer-supplied id is taken verbatim and matches nothing (**#B299**); and `event.target` is whatever was actually CLICKED, so an icon nested inside the button matches nothing either (**#B301** — the ordinary `<button class="gina-popin-close"><svg/></button>`, and by far the wider case). Both are invisible: `cancelEvent` runs at the top of the listener, so the button also swallows its own default — no error, no navigation, nothing. Fix: read **`event.currentTarget`** (the element `register()` bound — a `.gina-popin-close` by construction, since that function has ONE call site fed only from `querySelectorAll('.gina-popin-close')`) and treat a `popin.click.*` id as the sole exception, which preserves the dual-role element (a trigger that is ALSO a close button — reachable because `bindOpen` scans `document`, not just the host page). ⚠️ **What must NOT be "fixed" instead: rewriting the element's id.** The `$close` teardown sweep removes this listener via `gina.events[eId] == eId` — the degenerate name===id entry that `events.js:42` produces — so decoupling the event name from the id leaks the listener; and overwriting a consumer id would break their selectors, `aria-labelledby` and test hooks. Contrast `bindOpen:1195-1203`, which takes the OPPOSITE policy and does clobber a consumer id on trigger elements. Measured with controls firing both directions on the real bundle (id-less closes / consumer-id does not / nested click does not / patched all close), test `test/e2e/popin-close-dispatch.spec.js`. (11) **gina's own in-flight arm must be honoured by the path that dispatches it — a legacy trigger re-fired during its own load (#B298, 0.6.5).** `armPopinTrigger` marks an `<a>` trigger `aria-disabled="true"` for the duration of its popin's load (every other tag gets the native `disabled`, which the browser enforces). But the ONLY dispatch route for a pure-legacy `data-gina-popin-name` trigger is the `bindOpen` document click proxy, whose predicate tests the native attribute ALONE — and an `<a>` never carries it here — so a second click during the load reached the open handler and issued a SECOND XHR. `bindDelegatedOpen` returns early for a trigger carrying neither `data-gina-dialog` nor `data-gina-dialog-src`, so `openFromTrigger`'s own `aria-disabled` arm never covered this population. Fix: gate at the top of the legacy per-element open handler, predicate copied VERBATIM from `openFromTrigger` (native arm included, so #B296's `!('disabled' in $el)` rule still holds). **Gating THERE rather than in the proxy is load-bearing, and was MEASURED rather than reasoned:** a trigger's direct children each get their own listener from `proxyClick`, which fires the custom event DIRECTLY and never passes the proxy predicate at all — a proxy-level gate still let the child-click route fire twice, while the handler-level gate stops both (both routes converge there, and `currentTarget` is the element `bindOpen` bound, so child markup cannot dodge it). ⚠️ **Reachability is narrower than it looks, and the scene is easy to get wrong:** a real click HOVERS first, which warms the preload (`warmTrigger` reads `data-gina-popin-url` too), and the click then ADOPTS that in-flight fetch instead of calling `popinLoad` — so nothing is ever armed and the question goes unasked (a probe without the opt-out reads 1 request for a reason unrelated to the gate, its own counter-can-read-2 control failing). The defect needs the documented `data-gina-dialog-preload="false"` opt-out (#B91) — i.e. exactly the triggers whose GET has server-side effects, which is why it is not cosmetic. Whether a no-hover activation (touch, some keyboard paths) is a second reachable population is UNMEASURED. Test `test/e2e/popin-legacy-trigger-aria-disabled.spec.js` (4 arms, red-first; the two fix arms failed 2-vs-1 on the pre-fix dist while their scene/armed/click assertions passed, so the red is attributable to the defect). (12) **A click adopting a still-in-flight hover/focus preload is a genuine wait — it now arms the trigger exactly like the cold click-time XHR (#B285, 0.6.5).** Both consume branches previously armed NOTHING (only a preOpen popin got its skeleton), so with warm-on-intent preloading the COMMON open path showed no busy affordance at all. `consumePreload` gained a guarded 4th param `onSettled`, fired synchronously after the ready (cached) apply and at the TOP of the adopted waiter — success AND failure, release-before-apply, the cold readyState-4 order. The CALLERS own the affordance (arm on adopted-wait only via a settled-flag; release via `releasePopinTrigger`, armPopinTrigger's mirror), keeping `consumePreload` loading-state-agnostic — load-bearing for the extract-and-execute test harness, which injects neither `document` nor `loadingState` and calls with ≤3 args (the guard makes the 4th a no-op), and the right factoring anyway (it reports that it settled; callers decide who cares). The ready branch's SYNCHRONOUS settle is equally load-bearing: without it a caller cannot distinguish ready from in-flight and would arm forever — an instant cached open never flashes a busy state. Double-click protection during the wait comes free from EXISTING mechanisms (the entry gates refuse an armed trigger; the browser suppresses a disabled `<button>`), and the failed-adoption leg releases before the click-time fallback re-arms through popinLoad's own path. Playwright note: an armed `<a>` reads [disabled] in the accessibility tree, so Playwright's own actionability check refuses to click it — a second-click scene needs `force: true` (a real pointer is NOT blocked on aria-disabled). e2e `test/e2e/popin-preload-loading-state.spec.js` (5 arms, red-first: 4 red on the pre-fix dist, ready-branch no-arm control green on both). (13) **A free variable inside a `try` turned every successful JSON load into a fabricated server error (#B315, 0.6.6).** `popinLoad`'s readyState-4 2xx branch dispatched `success.<id>` on `$forms[0]` — but the module's sole `var $forms` is declared in `popinBind`, a SIBLING function under `Popin`, so reading it threw `ReferenceError` straight into that same handler's `catch`, which fabricates `{status: 422, error}` and fires `error.<id>`. `success` therefore never reached a subscriber at all. ⚠️ **The observable is worse than a stack trace, and that is the part worth carrying:** the catch overwrites `result.error` with `JSON.parse(xhr.responseText)` whenever the response is `application/json`, and the throwing line is reachable ONLY for JSON (a non-JSON body returns early at the `loaded.` trigger just above it) — so the consumer received a **422 whose payload was the SUCCESSFUL response body**, reading as a server-side failure that never happened. Fix: dispatch on `$el`, matching the two sibling triggers in the same handler (`loaded.`, `error.`) — `popinLoad` is the CONTENT loader, so a JSON response need not involve a form at all; the `$forms[0]` target was copy-paste from a validator context, whose commented-out `handleXhrResponse` line still sits directly above it. Reproduced BEFORE fixing (a replica of the readyState-4 2xx branch with two firing controls: non-JSON → `loaded`, `location` → early return); tests `test/core/popin.test.js §34` (4 — scope pin, single-declaration-plus-position pin, dispatch-target pin, dist-fidelity pin; both source pins validated RED against the pre-fix source, the dist pin RED before the rebuild). ⚠️ **The registry's other two events still never fire (#B315b):** `progress`'s entire `xhr.onprogress` block including its `triggerEvent` is commented out (dead by construction, with its `ontimeout` sibling), and `click` has ZERO `triggerEvent` sites anywhere — the `popin.click.*` identifiers are per-element DOM event names in a different namespace. Both still register cleanly through `on()`, so the surface advertises three events and delivered none; their disposition is a DESIGN question (implement, or drop them from the registry so the surface stops lying) and was deliberately NOT folded into this fix, which was an unambiguous defect. **The popin `::backdrop` rule is scoped to gina's own dialogs (#B329, fixed 2026-08-24).** The sheet shipped `dialog::backdrop` (dark overlay + blur) UNSCOPED, painting gina's backdrop on EVERY consumer `<dialog>` on the page; now `dialog.gina-popin-container::backdrop`, matching the reduced-motion rules that were already scoped. Both dialog-creation sites set the container class on the `<dialog>` element itself, so gina's own popins keep their backdrop. Consumer-visible: a page relying on the free backdrop for its own dialogs styles them itself now, and a popin dialog element supplied by the page's own markup (the adopt-by-id path) needs `gina-popin-container` to keep gina's backdrop. Pins: `popin-backdrop-scope.test.js` (source + compiled twin + `gina.min.css`, present/absent controls). Browser-bundled ⇒ consumers restart AND re-bake. **A form's or a link's `text/html` XHR answer is routed by the popin the SUBMITTING element is inside, never by "the active popin" (gh#76 + #B571, 2026-09-20).** The validator captures `gina.popin.getPopinContaining($form)` into the per-send closure at submit (the same capture stamps the `X-Gina-Popin-Id`/`-Name` request headers, so `self.isPopinContext()` is true only for a contained form) — and since #B572 (2026-09-22) the STAGED-UPLOAD path makes the same capture once per file selection (`$ownerPopin = getPopinContaining($el.form || $el)`, `$el.form` being the consumer's real form), so the virtual `gina-upload-*` form, its preview lookups, its `uploadProperties.isPopinContext` flag and its staging request belong to the popin the REAL form is inside, or to `document.body`. It was the LAST surviving `isPopinContext()` (« some popin is open ») gate: a PAGE form's file chosen while an unrelated popin was open had its virtual form appended inside that popin — staging 200, all ten hidden metadata fields EMPTY, the save posted without the file, the staging request claiming that popin's id, zero errors — reachable through the file-picker race (the OS picker is application-modal and ignores `inert`, which blocks only the click path) and through script-assigned `input.files`; a form INSIDE the popin was always fine and still is (measured 10/10 both ways). Dev-mode notice `[FormValidator][popin] the staged upload of `#<input>` (form `#<form>`) is placed with its own form …`, from `warnIfOldRulePlacedUpload`, the twin of `warnIfOldRuleRouted`; the popin branch's `$target` DOMParser copy is deliberately untouched (measured working when chosen by containment). Pins: `test/core/validator-upload-popin-containment.test.js` (block-scoped absence pin + the helper driven in a lifted scope with every free identifier supplied), e2e `validator-upload-popin-containment.spec.js` (page form + open popin, the picker race, and the inside-the-popin control, red-first through `B572_PREFIX_BUNDLE`). **A popin close + reopen re-stages, and same-named staged inputs in two forms stay apart (#B733/#B732, 0.7.2):** the file-input change handler reuses a virtual `gina-upload-*` record's element only while it `isConnected`; a detached record is `destroy()`ed (its listeners and their registry entries go with it), deleted from `$forms`, and a new virtual form is built — it used to fall back to `getFormById()`, which returns the validator RECORD, and use that record as the element, so after a popin close (the content is wiped, nothing destroys the virtual form) every selection threw `setAttribute is not a function` and staged nothing. The virtual id of a bracket-less name ends with `-<form id>` (`gina-upload-doc-<formId>`; a bracketed name already carried the form id, once per `]`, and is unchanged) — `gina-upload-doc` was shared by every form, so the second form's upload filled the FIRST form's hidden fields and left its own empty; a listener or selector matching a bracket-less virtual id literally must read the input's `data-gina-form-virtual` instead. Same-named staged inputs inside ONE form still share a virtual form (their hidden-field names collide too). Pins: e2e `validator-upload-popin-reopen-b733.spec.js` (4 arms, incl. #B756's `gina.popin.close(name)`) and `validator-upload-same-name-b732.spec.js` (2 arms), red-first on the pre-fix dist. For a submit, the validator honours its capture at settle only while that popin is still open AND its element still contains the form (a close + reopen in flight detaches the form ⇒ legacy payload); anything else — a page form while a popin is open OR loading — is the legacy handler-only `{contentType, content, status}` payload, with a dev-mode `[FormValidator][popin]` notice naming the popin the old rule would have targeted (it REPLACED an open popin's content, or raised a false `422` `Popin x is not open !` on a loading one — the loading window is reachable through a preload-opted-out trigger, never a hovered default one, whose click adopts the warm). The popin branch now also emits the `.hform` (validator) / `.hlink` (`utils/events.js`, whose `.hform` half is dead — no caller passes `$form`) companions with the parsed xhr-data, so declared callbacks run for forms inside popins (#B571). `getActivePopin()` returns OPEN popins only — the `activePopinId` one when open, else the first open — never a registered-but-not-open one (§8(a)); `popinLoadContent` honours `this` when called as a method (both internal sites use `.call($popin, …)`, the manager-level call keeps the active fallback); the redirect branch resolves `sendCtx.popin || (result.popin ? getActivePopin() : null)` — a plain `location` redirect from a page form falls through to the page redirect (measured pre-fix: it loaded INTO the open popin AND navigated, two fetches), a name-less `{popin:{close}}` with nothing open is a no-op. `getPopinContaining` walks the registry with `getElementById(id).contains(el)` (innermost wins; the element id is the popin id on every flavour; 0.2 µs worst case) — a non-modal popin still inerts the page, so a page form can only be submitted by script while one is open, which is what the request-side arms of `test/e2e/validator-popin-form-target.spec.js` do. Companion `test/e2e/popin-preopen-modeless.spec.js` pins #B574 (`popinOpen` guard `hasAttribute('open')`). Browser-bundled ⇒ consumers restart AND re-bake. **#B575 (0.6.32) — the two hidden transport inputs are DEV-ONLY, and both popin branches now parse tolerantly.** `spliceXhrInputs` runs only under `_isDev` (`NODE_ENV_IS_DEV === 'true'`), so outside dev mode a `renderWithoutLayout` answer carries NO `gina-without-layout-xhr-data`/`-view`; both branches dereferenced `.value` on the absent element, the `TypeError` was caught INSIDE the try and surfaced as a false `422` error callback AFTER a successful server write, and the popin was never loaded. One shared `parseXhrHtmlAnswer()` now returns `{doc, data, view}` with `data`/`view` `null` when absent and the two inputs STRIPPED from the parsed document (they are consumed transport — left in, a swap into a region inside a `<form>` would resubmit them and repeated swaps would duplicate their ids). ⚠️ The parsed data is delivered VERBATIM when present — injecting a `status` key would change the payload every contained form already receives (the slice-1 contract `validator-popin-form-target.spec.js §05` pins) — and the payload is `{status}` only when the inputs are absent; `validator-form-target.test.js §06` pins that absence SCOPED to the popin branch, since `result.status = xhr.status` is legitimate elsewhere (the legacy payload builders in `utils/events.js`). (14) **`data-gina-dialog-target` is ONE selector applied on BOTH sides, with THREE fallbacks — all announced in dev mode since #B580 (2026-09-22).** `applyContent($el, html, $popin, partialTarget)` reads the slot with `$el.querySelector(partialTarget)` and the incoming region with `parsed.querySelector(partialTarget)` over a `new DOMParser()` document, then assigns `$slot.innerHTML = $incoming.innerHTML` — the SLOT ELEMENT survives, which is what preserves chrome and its bindings. The three misses are all fail-soft (a popin open is a retryable read, unlike a submit): a selector the ENGINE REFUSES ⇒ full replace — pre-#B580 this threw an uncaught `SyntaxError` out of the `loaded.<id>` handler / preload-consume tail, so the dialog silently kept its previous content (MEASURED on the real bundle: `Failed to execute 'querySelector' on 'Element': '#slot >' is not a valid selector.`); no match in the OPEN DIALOG ⇒ full replace; no match in the ANSWER ⇒ the whole `parsed.body` into the slot — the SECOND fallback, which the published guide did not mention and nothing pinned. `warnPartialTarget()` emits one `console.warn` per event naming the popin, the selector and which fallback ran, gated on `gina.config.envIsDev`. ⚠️ Testing surface: the e2e harness (`test/e2e/runtime-server.js` serves `envIsDev:'false'`) can assert only the FALLBACK — the NOTICE belongs to `popin.test.js §22`, which drives the REAL brace-walk-extracted function, because the §21 replica omits `$popin` and mirrors the pre-fix body; keep `applyContent`'s signature and first `if ( !partialTarget )` branch byte-shaped or the regex pins at `popin.test.js:1121-1130` and `popin-reload-open.test.js:61` go red. ⚠️ The attribute is the dialog-scoped sibling of `data-gina-form-select`, NOT of `data-gina-form-target`: one selector, both sides, nothing resolved relative to an element, so the `this`/`closest x`/`find x`/`next x` grammar does not apply — all four are valid CSS, so writing one takes the silent fallback instead of reporting a mistake. ⚠️ The "legacy triggers get a full replace" rule covers PURE legacy only: `bindDelegatedOpen` returns early ONLY for a trigger carrying NEITHER `data-gina-dialog` NOR `data-gina-dialog-src`, so a MIXED trigger (legacy attributes + `-src`) routes through `openFromTrigger` and DOES get the partial swap. (4) **Listener ledger discipline — `reBind()` never stacks, `destroy()` detaches (#B585, 2026-10-07).** `bindForm` records every listener it attaches on the record (`$form.boundListeners`: the form-level proxies, `validate.<id>`/`reset.<id>`, the native `submit` proxy, the live-check / autocomplete / select / file / checkbox / radio handlers and the submit trigger's own listener — `addListener` returns the callback, so each existing call is wrapped in a push and keeps its text) and `unbindForm` detaches exactly those by reference, releases the registry keys the binding wrote, clears the `registered.<id>` live-check flags and releases the submit trigger's marks (`data-gina-form-submit-trigger-for`, the `__ginaSubmitBoundFor` expando) with the record's `submitTrigger` claim, so the next bind — a `reBind()`, or a fresh same-id record after `destroy()` — claims and binds the trigger as a first bind does. Before it, `unbindForm` detached NOTHING: its nine form-level `removeListener` calls passed the validator RECORD (no `removeEventListener`), and `utils/events.js removeListener` with no 4th argument detaches nothing anyway — `gina.events` is a NAME → element-id registry that holds no callback, so deleting a key never detaches a handler, and the 4th parameter is a COMPLETION callback (handed to `removeEventListener`, then invoked): never pass a DOM handler as it. `on()` records the wrapper it attaches on the handle (`consumerListeners`); a `.on()` handler and the declarative `data-gina-form-event-on-*` hooks survive a `reBind()` (their keys stay, so the form-level submit proxy still routes a NATIVE submit — `requestSubmit()`, Enter in a form without a submit button, a wrapped-label click; a click on the trigger ends in `validate.<id>` directly — to `.on('submit')`, and a re-registration is dropped by the add-once guard rather than stacked); `destroy()` fires `destroy.<id>` then removes them — only while the form is still in the document: the popin teardown destroy()s a form AFTER its content was replaced (`popinLoadContent` writes the new innerHTML before `popinUnbind`) or cleared, and the validator's popin branch then dispatches `success.<id>` on that old, detached form after `loadContent()`, so a detached form keeps its `.on()` handlers (they die with the element) while its keys are released for the same-id successor — the first cut drained them and five e2e arms lost their declared success callback. The one `window` listener each live-checked field registered through the browser's own `addEventListener` with gina's 4-argument shape is gone. Consumer-visible: the Safari N-characters-per-keystroke symptom after repeated re-binds (#B135's interception stacked one keydown per re-bind) and a belt restoring a form's `gina.events` keys after `reBind()` are both retired; a consumer that destroy()s a form and binds it again gets a clean record that claims its submit trigger (pre-fix the stale listeners of the destroyed binding answered the click). Pins: `test/core/validator-unbind-ledger-b585.test.js` (structure + executed arms + dist fidelity) and e2e `validator-rebind-listeners-b585.spec.js` (a live-listener ledger over `EventTarget.prototype.add/removeEventListener`, keyed by element id — an old and a new element sharing an id count together; `GINA_B585_PREFIX_BUNDLE=<pre-fix gina.min.js>` runs it as the subtract arm). Browser-bundled ⇒ pickup is restart AND re-bake. (15) **A popin's document click proxy claims a trigger only when its instance id is followed by `-` (#B876).** Each `new Popin()` registers a document click listener whose predicate is the cached `_rePopinClick`. Instance ids are `'gina-popins-' + _nextId()` (`gina-popins-gp-1`, `gina-popins-gp-14`, … from one shared counter, which triggers also draw from, so a page reaches colliding ids easily) and every engine-built click trigger id is `popin.click.gina-popin-<instance.id>-<_nextId()>-<name>`. Built without the delimiter, the regex of `gina-popins-gp-1` also matched the triggers of `gina-popins-gp-14`: one click fired two proxies, the popin loaded twice and the second load replaced the bound form, which then submitted natively. Fixed by `instance.id + '-'` in the regex. Pin: `test/core/popin-click-prefix-collision-b876.test.js` (drives the real construction sliced from the source and both dist files, with ids built the way the source builds them; seams `B876_POPIN_SRC` / `B876_PLUGIN_DIST` — a published npm package ships only `dist/`, so take `popin/main.js` from the matching git tag). Browser-bundled ⇒ pickup is a re-bake.
947
949
 
948
- 214. **Per-request routing-clone correctness — narrow the defensive clone, and propagate mutations onto returned clones (consolidates former #194/#195; #B52-residual, 2026-06-18).** The router's per-request `options.conf = JSON.clone(conf)` — a multi-MB deep clone of the ENTIRE bundle config per matched request, held for the request's whole query+render window — was narrowed to: shallow-copy the top level + `conf.content`, deep-clone ONLY `conf.content.routing`, the one subtree actually MUTATED per request (audited: every other per-request write is a whole-subtree REASSIGNMENT a shallow copy isolates, and plugins/connectors/models read config via their own clones, never through the request's) — removing a dev/high-load heap high-water-mark proportional to config size (measured 163→62 MB peak under 150 concurrent slow requests, drains on idle). **Narrowed again — the routing deep clone is retired too (#P40 S3b, 2026-09-09):** the only per-request write on that subtree is a whole-property REPLACEMENT on the MATCHED rule (`options.conf.content.routing[options.rule].param = params.param`), and `params.middleware` — the array `processMiddlewares` splices — is already the request's own copy from the matcher; so `this.route` now shallow-copies the routing map and shallow-copies the matched rule only, every other rule staying shared by reference (the deep clone cost ~5 µs at 8 routes and ~290 µs at 380 on the dev host, on every matched request, for a map nothing else mutates). Pinned by `test/core/router-per-rule-copy.test.js` (source pins with a comment-strip control + a behavioural compiled from the shipped source whose shared-rule arm discriminates against the deep clone) and the realigned `test/core/router.test.js §11`. Rule: copy only what a per-request write actually touches, at the granularity of the write — a whole-property replacement needs a shallow copy of its parent, never a deep clone of the tree — and share the immutable remainder by reference; but audit EVERY per-request writer first, or a missed mutate-into-a-shared-subtree reintroduces cross-request contamination. Sibling: `getRouteByUrl` (server-side redirect/relative-route resolution AND browser-bundled) aliased the shared route config's `param` by REFERENCE while the matcher rewrites `param.{path,namespace,file,title}` in place for `:placeholder` routes — request A's substitution contaminated request B (server) and repeat navigations (client). The fix is TWO coordinated edits, not just "clone the alias": clone `param` per request AND propagate the substituted param onto the returned route object — the function returns a fresh clone of the SINGLETON, so cloning alone returns the un-substituted `:placeholder` and regresses even the first request. Rule: when a matcher both aliases a shared config object and returns a re-clone of that object, isolating the alias is insufficient — propagate the per-request mutations onto the returned clone. The sibling is browser-bundled → prod dist rebuild. **Third member of the same family — do not COPY a key the source does not have (#B423, 2026-08-26).** The `setOptions` per-request loop that refreshes each cloned rule's `host`/`hostname` from `envConf.routing[r]` copied both unconditionally, for EVERY rule. But `config.js`'s host/hostname defaulting deliberately EXCLUDES `param.control === "redirect"` rules (`… && !/^redirect$/.test(routing[rule].param.control)`), so those keys are **ABSENT** there — and `target.k = source.k` on an absent `source.k` CREATES an own property valued `undefined`. The write lands on `envConf._routingCloned`, which is cached for the PROCESS LIFETIME, so the poisoning is permanent: every later no-arg `getConfig()` → `JSON.clone(local.options.conf)` then hit `source[key] === undefined` and emitted the clone's `"should not be left \`undefined\`. Assigning to \`null\`"` warn — one `host` + one `hostname` per redirect rule per clone, forever (a consumer measured it as ~76% of that log line's volume, drowning the genuine warns it exists to surface). Fixed by existence-guarding both copies (`typeof(source.k) != 'undefined'`), so absent stays absent. **Two gates bound the surface, both measured:** the whole block sits inside `if ( typeof(local.options.template) != 'undefined' && … )` — TEMPLATE/view routes ONLY, so an API-only bundle never reproduced it — and the copy loop is `_isRoutingUpdateNeeded`-gated. **Rule: in a refresh-the-clone loop, an assignment is not free — copying an absent key MANUFACTURES an `undefined` the clone utility is right to complain about. Guard the copy, never the warn** (silencing `JSON.clone`'s warn would hide a signal the framework deliberately emits), and never "fix" it upstream by giving redirect rules a host — that exclusion is intentional. Server-side only (controller.js is not browser-bundled — verified by dist token grep with a firing control) ⇒ restart, no re-bake. Tests: `test/core/controller-routing-host-copy.test.js` (source pins on the guard + the upstream exclusion, plus a real-`JSON.clone` behavioral whose SUBTRACT arm runs the pre-fix unguarded shape and asserts it both creates the keys and fires exactly one warn per key per rule).
950
+ 214. **Per-request routing-clone correctness — narrow the defensive clone, and propagate mutations onto returned clones (consolidates former #194/#195; #B52-residual, 2026-06-18).** The router's per-request `options.conf = JSON.clone(conf)` — a multi-MB deep clone of the ENTIRE bundle config per matched request, held for the request's whole query+render window — was narrowed to: shallow-copy the top level + `conf.content`, deep-clone ONLY `conf.content.routing`, the one subtree actually MUTATED per request (audited: every other per-request write is a whole-subtree REASSIGNMENT a shallow copy isolates, and plugins/connectors/models read config via their own clones, never through the request's) — removing a dev/high-load heap high-water-mark proportional to config size (measured 163→62 MB peak under 150 concurrent slow requests, drains on idle). **Narrowed again — the routing deep clone is retired too (#P40 S3b, 2026-09-09):** the only per-request write on that subtree is a whole-property REPLACEMENT on the MATCHED rule (`options.conf.content.routing[options.rule].param = params.param`), and `params.middleware` — the array `processMiddlewares` splices — is already the request's own copy from the matcher; so `this.route` now shallow-copies the routing map and shallow-copies the matched rule only, every other rule staying shared by reference (the deep clone cost ~5 µs at 8 routes and ~290 µs at 380 on the dev host, on every matched request, for a map nothing else mutates). Pinned by `test/core/router-per-rule-copy.test.js` (source pins with a comment-strip control + a behavioural compiled from the shipped source whose shared-rule arm discriminates against the deep clone) and the realigned `test/core/router.test.js §11`. Rule: copy only what a per-request write actually touches, at the granularity of the write — a whole-property replacement needs a shallow copy of its parent, never a deep clone of the tree — and share the immutable remainder by reference; but audit EVERY per-request writer first, or a missed mutate-into-a-shared-subtree reintroduces cross-request contamination. Sibling: `getRouteByUrl` (server-side redirect/relative-route resolution AND browser-bundled) aliased the shared route config's `param` by REFERENCE while the matcher rewrites `param.{path,namespace,file,title}` in place for `:placeholder` routes — request A's substitution contaminated request B (server) and repeat navigations (client). The fix is TWO coordinated edits, not just "clone the alias": clone `param` per request AND propagate the substituted param onto the returned route object — the function returns a fresh clone of the SINGLETON, so cloning alone returns the un-substituted `:placeholder` and regresses even the first request. Rule: when a matcher both aliases a shared config object and returns a re-clone of that object, isolating the alias is insufficient — propagate the per-request mutations onto the returned clone. The sibling is browser-bundled → prod dist rebuild. **The substitution itself is a FUNCTION replacer (#B688, 2026-10-06).** `fitsWithRequirements` (the request path) and `checkRouteParams` (`getRoute()` and the matched request) write the placeholder value into `param.{path,title,namespace}`; a string replacement (`.replace(regex, value)`) expanded `$`-patterns found in the value — a request to `/user/$%60` turned `"title": "User :id"` into `User User ` — and dropped the `/` its `(:v/|:v$)` regex consumes (`/users/:id/edit` → `/users/42edit`). Use the shared `replacement` helper (it restores the `/`) or `function () { return value; }`, as `param.file` and the url always did. **Third member of the same family — do not COPY a key the source does not have (#B423, 2026-08-26).** The `setOptions` per-request loop that refreshes each cloned rule's `host`/`hostname` from `envConf.routing[r]` copied both unconditionally, for EVERY rule. But `config.js`'s host/hostname defaulting deliberately EXCLUDES `param.control === "redirect"` rules (`… && !/^redirect$/.test(routing[rule].param.control)`), so those keys are **ABSENT** there — and `target.k = source.k` on an absent `source.k` CREATES an own property valued `undefined`. The write lands on `envConf._routingCloned`, which is cached for the PROCESS LIFETIME, so the poisoning is permanent: every later no-arg `getConfig()` → `JSON.clone(local.options.conf)` then hit `source[key] === undefined` and emitted the clone's `"should not be left \`undefined\`. Assigning to \`null\`"` warn — one `host` + one `hostname` per redirect rule per clone, forever (a consumer measured it as ~76% of that log line's volume, drowning the genuine warns it exists to surface). Fixed by existence-guarding both copies (`typeof(source.k) != 'undefined'`), so absent stays absent. **Two gates bound the surface, both measured:** the whole block sits inside `if ( typeof(local.options.template) != 'undefined' && … )` — TEMPLATE/view routes ONLY, so an API-only bundle never reproduced it — and the copy loop is `_isRoutingUpdateNeeded`-gated. **Rule: in a refresh-the-clone loop, an assignment is not free — copying an absent key MANUFACTURES an `undefined` the clone utility is right to complain about. Guard the copy, never the warn** (silencing `JSON.clone`'s warn would hide a signal the framework deliberately emits), and never "fix" it upstream by giving redirect rules a host — that exclusion is intentional. Server-side only (controller.js is not browser-bundled — verified by dist token grep with a firing control) ⇒ restart, no re-bake. Tests: `test/core/controller-routing-host-copy.test.js` (source pins on the guard + the upstream exclusion, plus a real-`JSON.clone` behavioral whose SUBTRACT arm runs the pre-fix unguarded shape and asserts it both creates the keys and fires exactly one warn per key per rule). **Fourth member — never hand a request its methods by WRITING them onto a cached class or module export (#B807, 2026-10-07).** The router gave each route middleware the request's 17 controller methods (`renderJSON`, `redirect`, `throwError`, `render`, `query`, `getConfig`, …) by assigning them onto `Middleware.prototype`, and gave `controllers/setup.js` its 15 members by assigning them onto the cached export (the nunjucks delegate wrote `engine` + `throwError` onto the same export). Outside dev the module stays in the require cache, shared by every request (the router evicts a middleware per request only when `isCacheless`), and a method is looked up when it is CALLED — so a middleware calling `self.renderJSON()` after an await answered whichever request had passed through the same file last, and its own request was never answered; a bundle-local middleware with a shared twin escaped (`lib/inherits` mints a fresh class per call), and so did every dev stack. Fixed: the instance is built with `Reflect.construct(Middleware, [], PerRequestMiddleware)` on a per-request layer (`Object.create(Middleware.prototype)` carrying the 17 methods), so the methods are reachable in the constructor body and stay bound to their request; `setup.js` runs on `Object.create(Setup)` at both call sites; nothing is written onto the class or the export. Cost measured on node v25: ≈ +1.7 µs per middleware dispatch (a fresh prototype per request makes V8 build new hidden classes; ≈ +0.2 µs on Bun). What app code can observe: in a middleware constructor `new.target` is the per-request constructor and `Object.getPrototypeOf(this)` is the layer, not the class; in `setup.js` `this` is an object inheriting from the export, so a member read through the exported function by name, or state kept on `this` across runs, no longer works. Rule: per-request values go on a per-request object — never on a shared object a later read resolves through — and a reproduction of such a defect must keep the module cached (a dev arm is the control, never the test). Pinned by `test/core/router-middleware-per-request-b807.test.js` (the real `processMiddlewares`, setup-wrapper and `registerUserFilters` bytes; two interleaved dispatches with serialized, dev and twin controls; comment-stripped source pins).
949
951
 
950
952
  215. **AI-connector runtime CLI — `connector:infer`, `connector:test`, `connector:models` (0.5.6-0.5.8).** All three resolve the merged shared+bundle connector config + `${secret:KEY}` credentials (never echoed) and instantiate the AI connector DIRECTLY — no bundle boot, no daemon socket. The AI connector core is deliberately CLI-loadable standalone (it requires the lib registry directly, not the framework bootstrap that exits outside a booted bundle; a spawn smoke locks that guarantee), and the buffered + streaming runners share one `loadAiCore(projectPath)` helper. `connector:infer <connector> [<bundle>] @<project>` runs a one-off inference and prints the normalised result (`--format=json` → `{content, model, usage}`; `--raw` passes the provider payload through); `--stream` emits NDJSON token frames (`start`/`delta`/`done`/`error`, honest `null` counters when a provider omits usage); stdout/stderr flush via `fs.writeSync`, so piped output never truncates at the pipe buffer. `connector:test` is the CI readiness gate: validate-only by default and fully OFFLINE (config shape + driver-installed + secret resolution), exits non-zero on any failure; bare → every project, `@<project>` → every connector; `--connect` adds a live probe (AI connectors only, via `client.models.list()` — zero generation tokens). `connector:models <connector> [<bundle>] @<project>` lists the provider's live model catalogue (one id per line; `--format=json` passes provider entries through VERBATIM — shapes differ per provider, only `id` is guaranteed; honest `{supported: false, reason}` + non-zero exit when a client lacks `models.list` — never a fabricated empty list). Config hardening underneath: the shared resolver returns a DEEP COPY of the selected entry (a nested secret resolve-in-place can never poison the cached config), and an `"ai": {…}` entry with no explicit `connector` field is recognised by its entry key.
951
953
 
@@ -982,7 +984,7 @@ Dev-mode query instrumentation captures every database query tied to the current
982
984
 
983
985
  252. **Audit trail — `settings.json > audit` + `self.audit()` + authz auto-events (#COMPLY2 slices 1-2, 2026-07-17, 0.5.19).** A user-attributed append-only record of "who did what to which record when", DISTINCT from `lib/logger` (its own store; never the log sinks). Opt in with `audit.enabled: true` (STRICTLY boolean — a truthy `"true"` refuses to boot, the quietly-OFF class: a compliance control that silently does nothing is worse than one that is absent) and call `self.audit(action, data[, cb])`. **Record schema v1:** `{ id, ts, requestId, actor:{key,roles}, action, resource?, meta?, ip, rule, method, bundle, env }`. **The correlation key is the SHARED request id, not a second one:** slice 1 hoisted the existing `request._ginaReqId` stamp OUT of the `_reqCtxLogging` (JSON-log-mode) gate in `server.js` `onInstance` — always-on, both engines, **plus a first-seer `if (!request._ginaReqId)` guard** the gated stamp never had (it sits in the isaac double-dispatch spot ⇒ a re-entered dispatch REGENERATED the uuid; the hoist closes that latent hazard by construction). The `_reqALS` `.run()` stays JSON-gated, so the deferred always-on-ALS throughput question is untouched. One id, two consumers: audit records and JSON log lines correlate for free, and `_resolveRequestId`'s inbound `X-Request-Id` sanitization is reused — **so the id is client-influenceable BY DESIGN: it is correlation, never attribution** (attribution is the actor fields). **`rule` carries the re-keyed `<rule>@<bundle>` form** (`homepage@web`, `secure@web` — measured live), because `config.js` re-keys every rule at normalisation; a consumer grepping the trail must expect the suffix, not the bare routing.json key (same read as the #OBS1 metrics route label). `ip` is the socket remoteAddress, `::ffff:`-normalized — **`X-Forwarded-For` is NEVER read** (attacker-writable, the #OBS1 rule). `actor` is a SNAPSHOT of `session.user[audit.actorKey]` (default `"id"`) + a COPY of `user.roles`, never the whole user object (PII). **Default backend = append-only JSONL file**, path DERIVED as `<projectPath>/logs/audit-<bundle>-<env>.jsonl` — NOT read from `logsPath`, which is a **measured DEAD placeholder**: `env.json` declares it at the file ROOT, outside the `${bundle}`/`${env}` subtree config.js copies, nothing ever assigns it, so `${logsPath}` resolves to the literal string `"undefined"` and has zero template consumers (`projectPath` is inside the propagated subtree and provably resolves — it is what the live `bundlesPath` is built from). **Per-ENV filename is load-bearing:** two envs of one bundle running concurrently must never interleave writers into one file (harmless for JSONL, FATAL for the slice-3 hash chain). A relative `audit.file` resolves against the project root, never the process cwd (which depends on how the bundle was launched). **Writes are SERIALIZED** (FIFO, one in-flight `fs.write`): parallel writes on one fd complete in threadpool ORDER, and the chain needs on-disk order == emit order, so the queue ships in the MVP rather than with slice 3. `audit.store` (a connectors.json entry, resolved through the `lib/audit-store` dispatcher — the 3rd instance of the job-store mould) is wired from day 1 but **NO connector ships an implementation yet ⇒ configuring it is a clean boot REFUSAL**, never a silent fallback; `store`+`file` together is refused too (mutual exclusion, no silent precedence). **Framework auto-events are ON when audit is on:** the authz-gate deny sites emit `authz.denied` carrying `meta.outcome` (`401`|`login-bounce`|`403-roles`|`403-policy`|`401-machine` — the last added by #MS3's machine deny writer, whose records also carry the machine actor) — the real shape is **3 physical writers / 6 call sites / 5 outcomes** (`denyUnauthenticated`'s two exits + the SHARED `denyForbidden` with its explicit `outcome` arg + #MS3's `denyMachineUnauthenticated`), wired INSIDE the module by deep-path `require('../../audit/src/main')` because the deny helpers are unexported (the job→uuid precedent; one-way dep, no cycle). Opt out with `audit.events.authz: false`. The emit is fully contained (try/catch + enabled-gated), so **an audit failure can never change an authorization outcome** (locked by a subtract asserting identical thrown statuses with audit on vs off). Makes PCI 10.2.4 real with zero app code; the unauth-401 flood caveat is a throttling concern, not an audit one. **Two shapes worth copying:** (a) the boot lint `throw`s INSIDE `init()`'s try and INHERITS the #B57 emerg+`fs.writeSync(2,…)`+`exit(1)` from its enclosing catch — hand-rolling it would double-log and drop the `ServerEngine <stack>` prefix; (b) the boot destination line is `console.info`, NOT `.debug` — the shipped default `log_level: "info"` FILTERS debug, so a `.debug` would silently defeat the "path logged at boot" contract. `start()` is adopt-once (the `lib/job` precedent). **`self.audit()` on a released response emits a DEGRADED record** (req-derived fields null) instead of dropping — every req read in the record builder is null-safe by construction, so NO #B35 early-return: present-but-degraded beats absent for a compliance trail (the opposite of the render-path guards, deliberately). Server-side only — no dist rebuild. Live-verified daemonless: disabled = true no-op with an action calling `self.audit()`; enabled = full-schema record (real uuid requestId, socket ip, `<rule>@<bundle>`) + exactly one `authz.denied` on an unauth 401; `enabled:"true"` and an implementation-less `store` each refuse the boot with the exact emerg and never listen. **Slice 3 (2026-07-26, 0.6.0) adds the TAMPER-EVIDENCE hash chain + `gina audit:verify`.** Opt in with `audit.chain.enabled: true` + a signing key (`audit.chain.secret` — a literal or `${secret:VAR}`, or the `GINA_AUDIT_SECRET` env var read through the framework env reader, the #MS3 shape); every record then gains a `hash` = **`HMAC-SHA256(secret, prevHash + ':' + canonicalV1(record))`, hex, 64-zero genesis**. `canonicalV1` (key-sorted, JSON-value-space) is the canonical form insertion-order `JSON.stringify` never was — the chain store PROJECTS each record through a `JSON.parse(JSON.stringify())` round-trip BEFORE digesting, or a live `Date` in `meta` would digest as `{}` while the disk holds its ISO string. **`createChainStore` wraps the unchanged append seam** (the store stays dumb): one record in flight, the hash computed at DEQUEUE so hash order == append order == emit order, and **`prevHash` advances ONLY on a successful inner append** — a dropped record (disk full, serialize failure) never forks the on-disk chain; the next record chains from the last that landed. Consumer callbacks are guarded so a throwing callback cannot stall the queue. **Boot resume reads the trail TAIL in O(1)** (`readChainTail`, a bounded backwards window — never a whole-file scan); a torn tail from a crash mid-write is terminated with a `'\n'` (append-only preserved — the damaged bytes stay as their own unparseable line), a loud `console.warn` names the damage, and a chained `audit.chain.break` record is written as the first append carrying the damage report in `meta` — NOT a crash loop. **`gina audit:verify <bundle> @<project>`** (new offline CLI group — `verify.js` + `arguments.json` + `help.txt`, `'audit:'` in `bin/cli` allowedOffline) walks the file and reports the first break with line + reason, or the intact totals, `--format=json` for machines; exit **0** intact / **1** broken / **2** usage-or-config (`fs.writeSync` flush — a verdict must never truncate on a pipe). The verifier's rules each close a hole: hashless records are legal ONLY as a contiguous leading prefix (a pre-chain trail — anywhere later they FAIL, so inserting unhashed lines is never free); an unparseable line FAILS unless the very next record is a chained `audit.chain.break` acknowledgment (reported as a warning, never silently passed — and only ONE damaged line per ack, consecutive garbage FAILS); empty lines are skipped; a trailing unacknowledged torn tail is a WARNING (the crash-just-happened state, the next boot acknowledges); digests compared with `crypto.timingSafeEqual`. **Boot lint grows four unconditional chain-shape conjuncts** (`chain` object / `enabled` strict-boolean / `secret` non-empty-string / no unresolved `${...}`) **+ three gated guards**: no signing key → refuse (tamper-evidence without a key is silently OFF — the truthy-string class); `chain` + connector `store` → refuse (the seam carries NO ordering obligation, a chain over reordered records forks silently); and a **cross-bundle shared explicit `audit.file`** → refuse when EITHER party chains (two writers fork a linear chain; boot-detectable in both process modes by replaying the sibling's file derivation over `options.conf`). A `<32`-char key WARNS. **Threat model, stated in the docs not implied:** detects post-hoc edit, deletion, insertion and reordering by anyone WITHOUT the key (a duplicated/replayed record breaks too — its predecessor's hash no longer matches); it is explicitly NOT a defence against the WRITING PROCESS, which holds the key and can forge a whole chain — stream the JSONL trail to WORM/Object-Lock storage for that stronger adversary (the recognized PCI-DSS §10.3.3 control, already documented). **Two boundaries the chain cannot cross, pinned honestly:** truncation at the exact tail is invisible (nothing after it commits to it — read the record count), and an empty/absent trail verifies trivially. Merged-process mode stays BOOTABLE (runtime-measured single-writer) but a sibling bundle whose `audit` settings are silently ignored there is now NAMED at boot. `schema/settings.json` gains the previously-undeclared `audit.chain` block (`enabled` boolean + `secret` string, `additionalProperties:false`), so an editor now flags a mistyped `chian`/`enabeld` — which the runtime lint would otherwise catch only as a boot refusal. As change-detection it maps to **PCI-DSS v4.0.1 §10.3.4** (file-integrity/change-detection), NOT §10.3.2 (prevent-modification, which the WORM control covers). Server-side only — NO dist rebuild; enabling the chain needs a bundle restart. Live-verified daemonless (isolated home, both process modes): boots with `(tamper-evident chain: ON)`, records chain, `audit:verify` PASSES; a one-byte edit / a middle deletion / a reorder each FAIL at the right line while the untouched trail PASSES (both directions); a restart resumes the chain across the process boundary (proven by an independent HMAC re-implementation reproducing the post-restart hash from the pre-restart tail); a torn tail warns then the next boot acknowledges it with a chained break; no-key boot REFUSES; a merged pair shows the sibling-ignored warn; a cross-bundle shared `audit.file` REFUSES.
984
986
 
985
- 253. **The run family — `gina image:run <image>` + `gina container:ps` / `container:stop` (podman on the container host).** The verbs drive `podman` (buildah builds images but cannot run them; podman's OCI runtime is crun) on the SAME host every `image:*` verb resolves — `GINA_CONTAINER_HOST=ssh://[user@]host[:port]` env override → native → `container.host` settings — so `container:ps` always lists the host `image:build` builds onto. A build-only host (buildah present, podman absent — ssh remote rc 127 / `command not found` / native spawn ENOENT) is reported honestly: `run unavailable on this host: podman not found on <host> (buildah <ver> present — build-only host); image:run needs podman + conmon` (the buildah probe runs in the failure path only). `image:run`: detached by default, the container id ALONE on stdout with progress on stderr so `ID=$(gina image:run <image>)` captures just the id; `--format=json` → `{ host, id, name, image, ports }`; default ports = the image's own baked EXPOSE mapped same:same (read by parsing the FULL `podman image inspect` document in JS — a `--format '{{json .Config.ExposedPorts}}'` token carries a SPACE and an ssh remote shell would split it: any argv token containing a space cannot cross the ssh transport, prefer a no-token command whose output you parse in JS); `--publish=<host:ctr>[,…]` overrides, `--publish=none` disables; `--rm`; `--stream` = foreground NDJSON (`start` → `log{stream,line}` → `done{exitCode}`|`error`, fs.writeSync-flushed, the container's own exit code propagated through the remote shell + ssh). Env: `--env-var=K=V` (repeatable) + `--env-file=<local path>` compose one env file that reaches podman WITHOUT touching argv — natively a 0600 temp file; over ssh the lines ride ssh stdin into a remote `mktemp` file a shell `trap` removes (`--env-file /dev/stdin` does NOT work over ssh — sshd's stdin pipe cannot be re-opened by path, rc 125; and never `exec podman` there — exec replaces the shell so the trap never fires and the file leaks); podman lets a later duplicate key win, so the inline `--env-var` lines are composed AFTER the file's and override it; keys gated `^[A-Za-z_][A-Za-z0-9_]*$`, values newline-rejected — secrets never in argv, `${secret:KEY}` never baked. `container:ps [--all]` normalizes podman's snake_case `Ports` to `[{hostPort,containerPort,protocol}]` (null→`[]`, `hostIp` only when single-interface-bound, `range` only when the entry publishes a real range >1); `container:stop <name|id> [--time=<s>] [--force]` classifies the rung from a post-stop inspect because podman exits 0 either way — `graceful` (the container handled the signal; a gina bundle traps SIGTERM → 143), `killed` (137 = 128+SIGKILL after the grace period), `forced` (`--force` → `podman kill`); an already-exited target is a success no-op. Every user token is charset-gated BEFORE any command assembly (validate→assemble→exec, test-pinned). All stop rungs, stream, env and publish arms live-verified end-to-end on podman 5.7.0 over ssh (0.5.19).
987
+ 253. **The run family — `gina image:run <image>` + `gina container:ps` / `container:stop` (podman on the container host).** The verbs drive `podman` (buildah builds images but cannot run them; podman's OCI runtime is crun) on the SAME host every `image:*` verb resolves — `GINA_CONTAINER_HOST=ssh://[user@]host[:port]` env override → native → `container.host` settings — so `container:ps` always lists the host `image:build` builds onto. A build-only host (buildah present, podman absent — ssh remote rc 127 / `command not found` / native spawn ENOENT) is reported honestly: `run unavailable on this host: podman not found on <host> (buildah <ver> present — build-only host); image:run needs podman + conmon` (the buildah probe runs in the failure path only). `image:run`: detached by default, the container id ALONE on stdout with progress on stderr so `ID=$(gina image:run <image>)` captures just the id; `--format=json` → `{ host, id, name, image, ports }`, where `name` is `--name`'s value or `null`: since 0.7.4 (#B779) the name comes from `--name=` only — the shared CmdHelper turns a lone positional into `name` (a bundle command's bundle), and for `image:run` that positional is the IMAGE, so without `--name` a `repo:tag` was refused as « invalid --name » and a reference that is also a valid container name named the container after the image; default ports = the image's own baked EXPOSE mapped same:same (read by parsing the FULL `podman image inspect` document in JS — a `--format '{{json .Config.ExposedPorts}}'` token carries a SPACE and an ssh remote shell would split it: any argv token containing a space cannot cross the ssh transport, prefer a no-token command whose output you parse in JS); `--publish=<host:ctr>[,…]` overrides, `--publish=none` disables; `--rm`; `--stream` = foreground NDJSON (`start` → `log{stream,line}` → `done{exitCode}`|`error`, fs.writeSync-flushed, the container's own exit code propagated through the remote shell + ssh). Env: `--env-var=K=V` (repeatable) + `--env-file=<local path>` compose one env file that reaches podman WITHOUT touching argv — natively a 0600 temp file; over ssh the lines ride ssh stdin into a remote `mktemp` file a shell `trap` removes (`--env-file /dev/stdin` does NOT work over ssh — sshd's stdin pipe cannot be re-opened by path, rc 125; and never `exec podman` there — exec replaces the shell so the trap never fires and the file leaks); podman lets a later duplicate key win, so the inline `--env-var` lines are composed AFTER the file's and override it; keys gated `^[A-Za-z_][A-Za-z0-9_]*$`, values newline-rejected — secrets never in argv, `${secret:KEY}` never baked. `container:ps [--all]` normalizes podman's snake_case `Ports` to `[{hostPort,containerPort,protocol}]` (null→`[]`, `hostIp` only when single-interface-bound, `range` only when the entry publishes a real range >1); `container:stop <name|id> [--time=<s>] [--force]` classifies the rung from a post-stop inspect because podman exits 0 either way — `graceful` (the container handled the signal; a gina bundle traps SIGTERM → 143), `killed` (137 = 128+SIGKILL after the grace period), `forced` (`--force` → `podman kill`); an already-exited target is a success no-op. Every user token is charset-gated BEFORE any command assembly (validate→assemble→exec, test-pinned). All stop rungs, stream, env and publish arms live-verified end-to-end on podman 5.7.0 over ssh (0.5.19).
986
988
 
987
989
  254. **`redirect()` carries request data through the session by default; the clear-text URL form is the session-less fallback (2026-07-17, 0.5.19).** When a redirect's request holds params, they cross it via the session flash channel (`inheritedData` on `req.session.user || req.session`) whenever a live session exists — `router.js`'s route dispatch merges them into `req.get` on the next routed GET, then **one-shot deletes** them (a refresh does NOT replay; the URL form did — the one behaviour change). Three write sites, each gated on a live `userSession` alone: `redirect()`'s XHR branch (the `local.haltedRequestUrlResumed` conjunct that had limited it to resume-triggered XHR redirects is GONE), `redirect()`'s method-switch path (`inheritedDataIsNeeded`), and `resumeRequest()`'s GET branch. **The whole URL build AND the 2000-char cap now sit inside `if ( !userSession )`** — so a session-ful redirect never composes the string and can no longer `424` (a >2000 payload rides the session; live-measured 2600 chars intact), while a session-less bundle is byte-identical to before (`?inheritedData=<RFC5987 JSON>` in clear, capped, `424` over). `resumeRequest`'s stash sits pre-split (after the stale-`inheritedData` delete, before the popin/plain-XHR/non-XHR three-way), so **all three GET replay flavors now carry the paused data** — previously only the popin flavor did, because it alone routed through `redirect()`; plain-XHR and non-XHR silently DROPPED it. A custom `requestStorage` with no live session degrades exactly as before. Server-side only — no dist rebuild (`controller.js` is not browser-bundled). The practical security consequence (consumer-verified live): a session-ful bundle halting a credential-bearing POST no longer discloses the payload — credentials included — in clear in the URL (address bar, browser history, access logs). ⚠️ **That claim was INCOMPLETE and is corrected here (#B551, 2026-09-18 — SECURITY): the 0.5.19 change moved the credentials OUT of the URL and INTO the session store, where they were written in CLEAR.** DRIVEN on a booted bundle with a sentinel password and two controls (an email sentinel that had to keep arriving, a never-sent string that had to stay absent): a login `POST` put `{"email":…,"password":"<plaintext>"}` into the sqlite session row; on the AUTHENTICATED path it survived the consuming 200 GET at `user.inheritedData.password`, and on the FAILED path `inheritedData` was cleared but the value had already been COPIED ON to `haltedRequest.data.password` via the consume→halt chain. A REJECTED attempt was stashed the same way. The session-less URL branch is unchanged and still carries the payload in clear, so BOTH disclosure surfaces were live simultaneously, in different deployments. **Fixed by filtering what is carried:** `redirect()` now builds a filtered COPY of the params and drops keys matching `lib/inspector-redact`'s tokenising list (`password`/`secret`/`token`/`apikey`/`authorization`/`credentials` + case and separator variants; metadata suffixes such as `passwordRules` deliberately pass). The COPY is load-bearing, not stylistic — `lib/merge` does NOT clone (its clone block is commented out), so the stashed object was a LIVE reference to `req.post` and an in-place filter would have stripped fields the application's own action still reads. The filter sits BEFORE both the URL build and all session writes, so one pass covers every externalisation site. Logged at `debug`, never `warn`: a login always carries a password, so a warn would fire on the success path of the commonest flow in the framework. Behaviour change: a field deliberately named for a credential no longer reaches the target. ⚠️ **The session stash is TWO-ERA and a version claim about it must not be made from a token grep** — `userSession.inheritedData` is present from `v0.1.0`, but there it is conjunctively gated (`v0.1.0:1799` `if ( userSession && local.haltedRequestUrlResumed )`) so only an XHR redirect during a paused-request resume reached it; a plain login POST took the `else` branch, commented *"will be passed in clear"*, into the URL. `8ee5063a8` (v0.5.19) dropped the conjunct and added the method-switch write. ⇒ **session-store exposure for a login POST begins at `0.5.19`; the URL exposure is the older surface.** Counting the token finds code PRESENCE, never REACHABILITY — measure the gate, with a transition table across tags and a control token proving each blob was actually read. ⚠️ **The consume now persists itself (#B550, 2026-09-18).** The `delete userSession.inheritedData` had NO explicit save, so its durability was incidental — and on HTTP/2 it never landed at all: every render delegate writes with `stream.respond()`/`stream.end()` on the raw stream and calls neither `res.writeHead` nor `res.end`, so a session middleware's save-on-end proxy never runs and the stored record kept the stash for the session's whole lifetime — for a credential-bearing redirect, exactly the retention the one-shot delete exists to prevent. A typeof-guarded `request.session.save()` now follows the delete, best-effort (a failure warns; it never fails the request). **The same fix closes the sibling half:** `redirect()`'s two XHR exits (`isXhrRedirect` and the popin form) terminate through the COMPAT response instead of the raw stream, as the 303 exit always did — a session rotated by `req.login()` immediately before the redirect previously never got its new cookie to the client, which kept presenting the already-replaced id and arrived unauthenticated. The opt-out is a one-shot `req._ginaForceCompatSend` flag consumed inside `render-json.js`; it rides the REQUEST, never the controller closure, because the redirect span it is set in is extracted and executed closure-free by its own tests. Every other HTTP/2 render stays byte-identical. ⚠️ **Still open, deliberately (tracked as #B562):** on an ordinary HTTP/2 render a `rolling` cookie never rolls and an application's own `req.session` mutations are not persisted — an app that mutates the session during a rendered response must call `req.session.save()` itself. ⚠️ **And not only on renders** — but mind WHICH error writer: there are TWO `throwError`s and they differ structurally on HTTP/2. The **server-side twin** (`core/server.js`) is raw-stream on BOTH its JSON (`:8551-8552`) and HTML (`:8695-8697`) exits, as is the render-cache hit path — so a session mutation is lost on those responses too. The **controller's own `self.throwError()`**, the one applications call, is NOT: `core/controller/controller.js` contains ZERO live `stream.respond(` call sites (all three grep hits are comments), and both its main exits terminate through `res.writeHead` + `res.end`, so its hooks fire normally. Anchored counts: 18 raw-stream send sites across the 7 render delegates, 12 in `core/server.js`, 30 in `core/server.isaac.js` — all of the form `response.stream.respond(`, being its `/_gina/*` handlers plus the pre-routing maintenance gate; its STATICS are NOT among them (they terminate on the compat `response` via `response.end()` / `.pipe(response)`), and `/_gina/*` endpoints carry no application session, so isaac's 30 are in scope for the mechanism but not for the session consequence. ⚠️ Counting these needs the `response.stream.` receiver: a bare `stream\.respond\(` needle reads **1** on that file (a commented-out stub) and invites the false conclusion that isaac has none. Scope is protocol-bound, NOT engine-bound: the delegates branch on `typeof(res.stream) != 'undefined'` with no engine test, so HTTP/1.1 is unaffected on both engines (a real `ServerResponse` has no `.stream`); whether the express engine reaches the raw-stream path at all is UNMEASURED (a naive express+http2 mount does not survive express's own `req` prototype re-rooting). ⚠️ **Adjacent pre-existing crash on the same path — FIXED same day (0.5.19):** `getRoute(rule, params)` dereferenced `route.requirements[p]` in its extra-params loop, and a route declaring no `requirements` composes with `requirements: undefined` → `TypeError: Cannot read properties of undefined (reading '<key>')` for any param not in `route.param` — reached from `resumeRequest`'s `getRoute(rule, haltedRequest.params || dataAsParams)` (since #B215 that recompose is the SESSION-LESS fallback only — a session-ful GET replay redirects to the byte-exact `haltedRequest.url` — query string included since #B219 completed the capture side: the isaac engine strips the query from `req.url` before controllers run (it is parsed into `req.get`), so `pauseRequest()` snapshots `req.originalUrl || req.url` (isaac stamps `originalUrl` byte-exact before its strip; express sets it natively and never strips), `haltedRequestUrlResumed` records that full URL (middleware comparing it to `req.url` by equality should compare against `req.originalUrl || req.url` instead), and pre-#B219 path-only snapshots replay exactly as captured — because the recompose only carries query keys captured into `req.params`, i.e. keys declared in BOTH `requirements` AND `param`: a `param`-bound-only key substitutes its `:key` placeholders at match-commit yet never reaches `req.params`, and an undeclared key never does either, so the replayed GET arrived query-less, matched anyway, and rendered literal `:key` template paths as a 500 — the `inheritedData` flash cannot heal that since router.js merges it into `req.get` AFTER matching; with no session the recompose remains, its composed query params being the halted data's only travel channel), so a halted GET route with data and no `requirements` block 500'd before the stash ran (also reachable from the `url` template filter / `getUrl()` family, browser bundle included). The deref is now guarded (`route.requirements && …`, the fitsWithRequirements discipline), so extra params append to the composed URL as `?key=value` query params; the requirements-DECLARED-key skip (the path-placeholder fold) is unchanged — declaring a key in `requirements` still makes the matcher fold it in as a path placeholder, so a placeholder-less URL 404s (a `requirements` block is a matching declaration, not a sanitizer). ⚠️ **A THIRD carrying channel existed only on paper until #B352 (0.6.8): `param['keep-params']`.** Documented as a redirect-route key since the pre-GitHub import, it was read into a local in `redirect()` and never consumed — so EVERY `control:"redirect"` route silently discarded the caller's query string. The framework's own auto-generated `webroot@<bundle>` route (config.js, created for any non-root `server.webroot`) was the loudest victim: its `param.path` is a CONSTANT, so `/app?t=…` → `302 /app/` arrived with the parameter already gone, surfacing in the application as an unexplained missing value rather than a bad link — nothing on screen or in its own logs points at the URL. The flag is now honoured: `path` gains the incoming query (source `local.req.originalUrl || local.req.url`, the same #B219 idiom above, since isaac strips the query from `req.url` before controllers run) BEFORE the `inheritedData` composition, so that block's `?`-vs-`&` test sees it; on the wrong-method path — an UNSAFE method (POST/PUT/DELETE), which is switched to GET and answered 303 — both channels fire, so the target carries the query verbatim AND an `inheritedData` copy is made (redundant but consistent). ⚠️ **Do NOT read that second copy off the `Location`** — per this entry's own headline it rides the SESSION whenever one is mounted, and only appends to the URL as the session-less fallback. So a `?inheritedData=…` in a redirect target means "session-less bundle", never "the copy happened"; a clean `Location` on a session-bearing bundle is the SAME mechanism landing elsewhere. A session-less scaffold and a real session-bearing tier therefore disagree on the visible `Location` while behaving identically (2026-08-14: the session-less form measured here on an isolated scaffold, the clean-`Location` form reported by a consumer against a session-bearing tier — the two readings look like a contradiction and are not). ⚠️ **HEAD does NOT take that path since #B353 (same release, 0.6.8): it is a SAFE method** — GET without a body — and the gate had tested `!== 'GET'`, sweeping it in with the unsafe methods, which cost it a spurious "wrong method" warning on a route that explicitly lists HEAD in its own `method` list, a 303 telling the client to re-issue as GET and fetch a body it did not ask for, and (because switching the method broke `originalMethod === req.method`) an `inheritedData` copy a GET never receives. The gate now admits GET **and** HEAD in BOTH clauses, still by string comparison per #P13, so HEAD converges exactly on GET: same status (the route's configured code, 302 on the synthetic route), same `Location`, no warning. Measured live, with POST/PUT held at 303 as the control that the gate was NARROWED, not disabled. Default stays `false`, so every user-declared redirect route is byte-identical; the synthetic route opts in, which is the fix. Scope is deliberately narrow — an ABSOLUTE `param.url` never inherits the query, because forwarding the caller's parameters to another origin would hand a third party whatever they carried (session token, account id); CR/LF are stripped so a crafted query cannot split the `Location` header. ⚠️ **`webrootAutoredirect: false` is NOT a workaround for the drop** (measured, both arms, with positive + negative controls): that flag only removes the EXTRA site-root `/` match, while the bare-webroot match comes from the route's base `url` and keeps redirecting — losing the query — regardless. Server-side only, `controller.js`/`config.js` not browser-bundled ⇒ no dist rebuild, pickup = bundle restart. **`redirect()` is ASYNC, and its relative-path form resolves again (former #255, 0.5.19):** `getRouteByUrl` (lib/routing) is async and its internal `compareUrls` await is honoured — the historical un-awaited call read `.past` off a pending Promise, so NO rule could EVER match server-side: the documented-primary `self.redirect('/path')` relative form had been dead for years (the ignoreWebRoot form only worked because it bypasses resolution entirely). The fix mirrors the engine loop's exact-url fast-path — the two matchers are declared byte-parallel ("must remain identical to server.js"): any behaviour added to one must land in the other. The resolution lands in a LOCAL and is adopted onto `req.routing` only on success — the no-clobber shape is load-bearing twice over: the matcher reads and stamps `request.routing` on the request it is handed (a `false` there silently voids the writes), and the error reporters' diagnostics deref `req.routing.param` (with the old `false` sentinel the designed 404 turned into a crash-derived 500 from inside the reporter). A double miss now throws a clean 404 (`redirect target not found`); a resolver rejection is contained as a 500 — either way one request, never the process. The response-header composer guards `!request.routing` FALSY-AWARE (the old `typeof == 'undefined'` guard passed the boolean `false` through to a strict-mode primitive-property write that threw from inside the error path itself — a double-fault the router's catch could not contain, ending in SIGTERM). Practical: prefer `return self.redirect(...)` from controller actions so a rejection threads to the framework's thenable backstop; the URL, route-name and ignoreWebRoot forms settle same-tick. `getRouteByUrl` ships in the browser bundle with zero client callers — the async declaration rides the next per-bundle re-bake with no client behaviour change expected.
988
990
 
@@ -1011,13 +1013,13 @@ Dev-mode query instrumentation captures every database query tied to the current
1011
1013
 
1012
1014
 
1013
1015
 
1014
- 273. **Error responses carry a first-class incident ref (#ERRREF).** Both `throwError` builders (the engine-attached one in core/server.js + the controller-side `this.throwError`) mint a short incident ref per error — 6 uppercase hex from `crypto.randomBytes(3)`, or a relay-safe caller-supplied `ref` (charset `[\w.-]`, max 32, the X-Request-Id sanitize discipline; anything else re-mints, so log forging is neutralized) — returned as a top-level `ref` field on every JSON error body in ALL scopes (a random correlation key, no server detail; the stack-egress gate still strips `stack` outside local scope), stamped on the custom-error-page data (`eData.ref`) and the inline HTML fallback pages, and paired server-side in ONE error-level log line per thrown error (`[ ref XXXXXX ][ req <requestId> ] METHOD [ code ] url` + full message/stack/cause) emitted BEFORE the wire sanitize — every scope, production included, composing with the always-on request correlation id instead of duplicating it. Consolidates the former in-gate stack-egress log emits + per-branch summary lines into one line per error, and closes two gaps: the controller JSON/XHR branch stripped the stack with NO pre-strip log (a production API error's stack was lost server-side entirely), and the server XHR summary line logged no message. `Error.cause` reaches the log, never the wire. Always-on, no config; additive/back-compat on the wire. The two mint copies are kept byte-identical (test-pinned). Server-side only — no dist rebuild; running bundles pick it up at restart. **#B533 (2026-09-09, 0.6.30): the THIRD `throwError` — `helpers/context.js`'s, behind the implicit-global `getConfig`/`getLib` and reached when a conf slice or a lib cannot be resolved during a live request — was OUTSIDE this contract: `err.stack` verbatim in the `error` string in EVERY scope, and no log line at all (its only `console.emerg` sits in the no-live-response branch, so an operator could neither see it fire nor search for past occurrences).** It now mints the same ref (a third byte-identical mint copy, test-pinned against server.js's), emits the same `[ ref ][ req ]` pairing line via `console.error` BEFORE the wire write (bundle from `getContext('bundle')`; request id / method / url from `res.req` when present — the router slot carries no request object), and shapes the wire by the same fail-closed `NODE_SCOPE_IS_LOCAL` read: local keeps the stack (the `error` string is byte-identical there for an Error without a cause), every other scope gets the message line only. `Error.cause` reaches the log, never the wire; a relay-safe `err.ref` is honoured; the one-arg string form no longer prints `undefined`; the never-reachable HTML arm (#B254) is deleted rather than made live. Residual shared with the twins: a `require` failure's MESSAGE can still name the module path (frames and the version dir are gone). Sibling filed, not fixed: the `router` slot it reads is process-global and never cleared, so under concurrency the response it writes is the LAST-ROUTED request's, not the failing caller's (#B534, code-read). Test: test/core/context-throwerror-egress.test.js (24 — source pins + the shipped branch compiled from source with every free identifier injected, a frozen verbatim pre-fix copy as the harness's instrument check and the subtract; red-first 18 red / 6 controls green). Tests: test/core/error-ref.test.js (36 — control-gated extraction-executed compositions of the real bytes + a frozen pre-fix subtract) with server-throwerror-stack-gate.test.js §02 realigned to the log-free helper. **#A11Y3 (2026-08-04, 0.6.4) — those inline HTML fallback pages are now CONFORMING DOCUMENTS.** A per-file `a11yErrorDocument(code, bodyHtml, req)` helper (duplicated in core/server.js + controller.js so each error path stays self-contained) wraps the existing body in `<!doctype html><html lang="…"><head><title>Error N</title></head><body><main>…</main></body></html>`; the body markup — and therefore the `ref` above — is embedded VERBATIM, so nothing in this entry's contract changes. It fixes a real DEFAULT-PATH defect, not an edge case: the HTTP/1.1 branch closed `<body>` with an *opening* `<html>` tag (so the document never terminated) and both branches opened two `<pre>` while closing one, and a default scaffolded project ships no `templates/html/errors/` directory — `errorFiles` is populated only by config.js's readdir of that path — so `hasCustomErrorFile` is false and this markup IS what an unhandled 500 serves. (`core/template/error/` exists but has ZERO readers; it is not scaffolding.) A second trigger: even a project WITH error pages falls back here when the error came from `processMiddlewares`. `lang` comes from `a11yLangTag(req)` — negotiated culture normalized to BCP-47 (`en_CM`→`en-CM`, q-value stripped, `_`→`-`), falling back to `en` rather than emitting a tag AT cannot parse; the same normalization now guards `page.view.lang` and the three render-nunjucks error fallbacks, and adds doctype+`lang` to render-swig's layoutless/iframe wrapper. The locale LOOKUP deliberately keeps the raw underscore form (its resolution behaviour is a separate concern, and `getEnvVar('GINA_CULTURE') || 'en_CM'` is source-pinned) — only what reaches the document is normalized. ⚠️ Two hazards for anyone editing these sites: the layoutless wrapper's `</body>` is load-bearing beyond markup validity (release-banner's `maybeInject()` splices the dev banner on `/<\/body>/i`, and no test would catch its loss), and `controller.test.js` source-pins the literal `var msgString = '<h1 class="status">Error ` — so the wrap must stay a SEPARATE statement at the `res.end()` site, never prepended to that assignment. `helpers/context.js`'s HTML error branch was deliberately NOT touched: `var isUsingTemplate = isUsingTemplate` makes it permanently `undefined`, so that branch is unreachable dead code and the file always answers `application/json`. Server-side only — no dist rebuild; running bundles pick it up at restart. Full suite 14546/14546 green.
1016
+ 273. **Error responses carry a first-class incident ref (#ERRREF).** Both `throwError` builders (the engine-attached one in core/server.js + the controller-side `this.throwError`) mint a short incident ref per error — 6 uppercase hex from `crypto.randomBytes(3)`, or a relay-safe caller-supplied `ref` (charset `[\w.-]`, max 32, the X-Request-Id sanitize discipline; anything else re-mints, so log forging is neutralized) — returned as a top-level `ref` field on every JSON error body in ALL scopes (a random correlation key, no server detail; the stack-egress gate still strips `stack` outside local scope), stamped on the custom-error-page data (`eData.ref`) and the inline HTML fallback pages, and paired server-side in ONE error-level log line per thrown error (`[ ref XXXXXX ][ req <requestId> ] METHOD [ code ] url` + full message/stack/cause) emitted BEFORE the wire sanitize — every scope, production included, composing with the always-on request correlation id instead of duplicating it. Consolidates the former in-gate stack-egress log emits + per-branch summary lines into one line per error, and closes two gaps: the controller JSON/XHR branch stripped the stack with NO pre-strip log (a production API error's stack was lost server-side entirely), and the server XHR summary line logged no message. `Error.cause` reaches the log, never the wire. Always-on, no config; additive/back-compat on the wire. The two mint copies are kept byte-identical (test-pinned). Server-side only — no dist rebuild; running bundles pick it up at restart. **#B533 (2026-09-09, 0.6.30): the THIRD `throwError` — `helpers/context.js`'s, behind the implicit-global `getConfig`/`getLib` and reached when a conf slice or a lib cannot be resolved during a live request — was OUTSIDE this contract: `err.stack` verbatim in the `error` string in EVERY scope, and no log line at all (its only `console.emerg` sits in the no-live-response branch, so an operator could neither see it fire nor search for past occurrences).** It now mints the same ref (a third byte-identical mint copy, test-pinned against server.js's), emits the same `[ ref ][ req ]` pairing line via `console.error` BEFORE the wire write (bundle from `getContext('bundle')`; request id / method / url from `res.req` when present — the router slot carries no request object), and shapes the wire by the same fail-closed `NODE_SCOPE_IS_LOCAL` read: local keeps the stack (the `error` string is byte-identical there for an Error without a cause), every other scope gets the message line only. `Error.cause` reaches the log, never the wire; a relay-safe `err.ref` is honoured; the one-arg string form no longer prints `undefined`; the never-reachable HTML arm (#B254) is deleted rather than made live. Residual shared with the twins: a `require` failure's MESSAGE can still name the module path (frames and the version dir are gone). Sibling filed, not fixed: the `router` slot it reads is process-global and never cleared, so under concurrency the response it writes is the LAST-ROUTED request's, not the failing caller's (#B534, code-read). Test: test/core/context-throwerror-egress.test.js (24 — source pins + the shipped branch compiled from source with every free identifier injected, a frozen verbatim pre-fix copy as the harness's instrument check and the subtract; red-first 18 red / 6 controls green). Tests: test/core/error-ref.test.js (36 — control-gated extraction-executed compositions of the real bytes + a frozen pre-fix subtract) with server-throwerror-stack-gate.test.js §02 realigned to the log-free helper. **#A11Y3 (2026-08-04, 0.6.4) — those inline HTML fallback pages are now CONFORMING DOCUMENTS.** A per-file `a11yErrorDocument(code, bodyHtml, req)` helper (duplicated in core/server.js + controller.js so each error path stays self-contained) wraps the existing body in `<!doctype html><html lang="…"><head><title>Error N</title></head><body><main>…</main></body></html>`; the body markup — and therefore the `ref` above — is embedded VERBATIM, so nothing in this entry's contract changes. It fixes a real DEFAULT-PATH defect, not an edge case: the HTTP/1.1 branch closed `<body>` with an *opening* `<html>` tag (so the document never terminated) and both branches opened two `<pre>` while closing one, and a default scaffolded project ships no `templates/html/errors/` directory — `errorFiles` is populated only by config.js's readdir of that path — so `hasCustomErrorFile` is false and this markup IS what an unhandled 500 serves. (`core/template/error/` exists but has ZERO readers; it is not scaffolding.) A second trigger: even a project WITH error pages falls back here when the error came from `processMiddlewares`. `lang` comes from `a11yLangTag(req)` — negotiated culture normalized to BCP-47 (`en_CM`→`en-CM`, q-value stripped, `_`→`-`), falling back to `en` rather than emitting a tag AT cannot parse; the same normalization now guards `page.view.lang` and the three render-nunjucks error fallbacks, and adds doctype+`lang` to render-swig's layoutless/iframe wrapper. The locale LOOKUP deliberately keeps the raw underscore form (its resolution behaviour is a separate concern, and `getEnvVar('GINA_CULTURE') || 'en_CM'` is source-pinned) — only what reaches the document is normalized. ⚠️ Two hazards for anyone editing these sites: the layoutless wrapper's `</body>` is load-bearing beyond markup validity (release-banner's `maybeInject()` splices the dev banner on `/<\/body>/i`, and no test would catch its loss), and `controller.test.js` source-pins the literal `var msgString = '<h1 class="status">Error ` — so the wrap must stay a SEPARATE statement at the `res.end()` site, never prepended to that assignment. `helpers/context.js`'s HTML error branch was deliberately NOT touched: `var isUsingTemplate = isUsingTemplate` makes it permanently `undefined`, so that branch is unreachable dead code and the file always answers `application/json`. Server-side only — no dist rebuild; running bundles pick it up at restart. Full suite 14546/14546 green. **#B806 (0.7.4): the server-side builder read the request from the Server-wide `local.request` slot (overwritten at every arrival), so after an async gap an error for request A was built from whichever request arrived last — wrong JSON-vs-HTML form, another request’s URL / routing / session in the custom error page, a mis-correlated pairing line, CORS from the wrong Origin. It now resolves the request from the response it answers (`var _req = ( res && res.req ) ? res.req : local.request`, the same resolution in `getResponseProtocol`, which also fixes the `handleStatics` stale-protocol sibling), falling back to the slot only for a non-native response (middleware-swapped / setup.js alias) — no-worse-than-today there; `res.req` is the response’s own request on node + bun, both engines, through close. Same commit closed a sibling (a preflight-shaped error threw because `checkPreflightRequest` was handed the never-assigned response slot — now `res`) and #B815 (an extensionless HTML URL’s inline fallback page carried `undefined; charset=…` because the server twin lacked the controller twin’s `if (!ext) ext = 'html'`). Server-side, no dist rebuild; pickup = bundle restart. Test: test/core/server-throwerror-request-scope-b806.test.js (16, red-first on the pre-fix blob 10/6).
1015
1017
 
1016
1018
 
1017
1019
  275. **The `controller:` CLI group — `add` scaffolds, `remove`/`rm` reference-awarely deletes, `rename` reference-awarely renames a namespace controller (#R9, 2026-07-23).** `gina controller:add <name> <bundle> @<project> [--controls=a,b,c] [--api|--views]` — a new OFFLINE CLI group (`lib/cmd/controller/`, registered in `bin/cli` allowedOffline; a develop install serves the verb immediately, npm consumers from 0.5.25). Generates `controllers/controller.<name>.js` with one JSDoc'd action stub per `--controls` entry (omitted → a single `default` action — the `core/template/boilerplate/bundle_namespace` seed's own action name). Bundle FLAVOR auto-detected via `config/templates.json` presence (config.js's `hasViews` signal, offline-readable without a boot): a VIEW bundle → `self.render()` stubs + one template per action at `templates/html/<name>/<action>.html`; an API-only bundle → `self.renderJSON()` stubs, no templates. `--api`/`--views` force it (both → error). Route wiring is PRINT-ONLY: prints paste-ready rules keyed `<name>-<action>` carrying `namespace` + `param.control`, and for a VIEW rule an explicit `param.file: "<action>"` — render-swig.js:364-383 strips a `<namespace>-` prefix from a DEFAULTED `param.file` (which equals the rule name) and emits a per-request "does not respect gina naming convention" WARN, so the explicit file resolves `templates/html/<ns>/<action>.html` warn-free (the boilerplate `homepage` rule sidesteps it with a non-prefixed name); the `default` action's URL is the namespace root `/<name>`, else `/<name>/<action>`. Refuses an existing `controller.<name>.js` (no `--force` overwrite — remove it first), and validates the namespace charset `/^[a-z][a-z0-9_]*$/i` BEFORE any path build (`controller` reserved case-insensitively; the value is interpolated into file paths, a RegExp and a JS class name, so a loose value is an injection vector). Positionals come from the group's own pure `inc/args.js` parser (`opt.argv.slice(3)` minus `@project`/`--flags`) — CmdHelper's clean positional cleanup is `bundle:`-ONLY (helper.js:482), so `self.bundles` for any other topic is contaminated with the project's OTHER bundles and cannot be read for `<name> <bundle>`. Pure `inc/` helpers (`namespace` charset+className, `scaffold` parseControls/buildRules/formatRulesBlock/renderController/renderTemplate, `args` positionals) are require-by-path unit-tested behaviourally; the paste-ready report prints via flush-safe `fs.writeSync(1, …)` (the connector:infer precedent — a `console.log`/`process.stdout.write` before `process.exit` truncates on a pipe). Boot-verified end-to-end in an isolated home: the scaffolded view controller serves HTTP 200 with the rendered body and NO naming-convention warn. Tests: `test/lib/controller-add.test.js` (38). **`controller:remove <name> <bundle> @<project> [--dry-run] [--force] [--format=json]`** (alias `controller:rm` = `module.exports = require('./remove')`) is REFERENCE-AWARE: a namespace with no matching `controller.<name>.js` doesn't error — `router.js:521-525` WARNs and silently falls back to the default `controller.js` (a misdispatch), so a bare delete is unsafe. The pure `inc/reference-scan.js` (node `fs`/`path` only, no framework globals) scans the four measured reference sites — the controller file, routing.json rule-level `namespace` AND `param.namespace` (both load a controller; the body is comment-stripped with a STRING-AWARE regex so a `$schema` URL survives, and non-object entries are skipped like `config.js:2029`), and `requireController('<name>')` literals (both quote styles) across the bundle's `.js` tree — then REFUSES with a per-file blocker list unless clean (routing rules + external `requireController` calls block; a self-reference inside the file being deleted is moot). Clean → interactive readline yes/no (the `view:add` idiom; a non-TTY stdin aborts, naming `--force`/`--dry-run`) → deletes the controller file + its `templates/html/<name>/` tree. It NEVER edits routing.json. `--force` deletes the file+templates even with blockers (listing what remains to clean by hand), `--dry-run` previews, `--format=json` emits an envelope (`{controllerFile,templateDir,routingRefs,requireRefs,dynamicRefs,blocking,removable,removed}`) and deletes only with `--force`. Dynamic references a static scan cannot resolve (`param.namespace` `:variable`, non-literal `requireController(expr)`) are surfaced as an ADVISORY note, never silently cleared. The default `controller.js` can never be removed (`controller` is reserved). Deletion-plan file counts are taken BEFORE the delete. Tests: `test/lib/controller-remove.test.js` (34). **`controller:rename <old> <new> <bundle> @<project> [--dry-run] [--force] [--format=json]`** reuses the scanner + adds the pure `inc/reference-rewrite.js` (also fs/global-free): it moves `controller.<old>.js` → `controller.<new>.js`, moves `templates/html/<old>/`, and rewrites the old namespace at the two ANCHORED sites — routing.json `"namespace": "<old>"` VALUES (rule-level AND param.namespace; a QUOTED-STRING-anchored `replace`, NOT a JSON parse→stringify, so comments/ordering/whitespace survive byte-for-byte, and a substring like `checkout2` or a `:variable` value is never matched) and every `requireController('<old>')` literal (both quote styles, spacing preserved). Unlike `remove`, rename DOES edit routing.json (only those values). A full plan is shown, then an interactive readline confirm (non-TTY aborts naming `--force`); apply is ALL-OR-NOTHING — snapshot every write+move, roll back on any failure. `--force` applies without the prompt, `--dry-run` previews, `--format=json` emits an envelope and applies only with `--force`. Residuals it REPORTS-not-rewrites: `:variable`/non-literal dynamic refs and the cosmetic `<Bundle><Namespace>Controller` class name (gina loads by file path, so it is a label, not a reference). Target collision (`controller.<new>.js` or `templates/html/<new>/` exists) hard-refuses — no overwrite. Tests: `test/lib/controller-rename.test.js` (18).
1018
1020
 
1019
- 276. **Worker-global proxy-context poisoning by port-less internal calls — the `getUrl`/`url` template filters, the cross-bundle redirect-by-URL target and the error-fallback redirect now prefer the emitting request's own classification; opt-in `server.proxy.requireForwardedHeaders` makes classification deterministic (#B152).** A request whose inbound Host carries no `:port` is classified reverse-proxied (the first arm of the per-request classification, both engines) and REFRESHES `process.gina.PROXY_HOST`/`PROXY_HOSTNAME` — but a port-less Host is also what an internal call addressed by service/DNS name carries (a container health probe on an app route — only `/_gina/health/check` itself, `$`-anchored, bypasses the classification block — a mesh hop, a sibling-bundle request), so ONE such call repointed every later worker-global read at the internal host: both `getUrl` filter branches (the path/bundle-override `hostname` composition AND the post-`getRoute` `proxy_hostname` override feeding `toUrl()`), the redirect-by-URL `getRoute(path).toUrl()` branch, and `throwError`'s route-object fallback. On a proxy-less fresh worker the same call CREATES proxy mode permanently (the composite latch arms once the global exists). Fixed server-side, NO dist rebuild (`getUrl` is not browser-bundled — the dist's `getUrl` hits are `getUrlProps`, a substring artifact): all four readers prefer THIS request's per-request slots (`req._ginaIsProxyHost` strict-`=== true` + `req._ginaProxyHostname`) over the worker-global, which stays the fallback for renders with no request of their own — a raw victim resolves the config host despite the latch, a proxied victim emits its own host, a slot-less caller is byte-identical; `core/router.js` fills the slots when ABSENT so the Express engine (which never set them) gets per-request truth engine-agnostically, isaac's earlier identical classification always winning. The opt-in key (settings.json + published schema; strict boolean, fail-safe false, boot-resolved once, `console.info` when armed) disables the port-less heuristic so ONLY X-Forwarded-Host classifies as proxied — the one mechanism that also protects req-less renders; enable it only behind a front proxy that always sends X-Forwarded-Host. Two mechanism corrections vs the field report that surfaced this: `PROXY_PORT` is boot-static (never request-refreshed; the boot scheme-switch forces it to 80/443, clobbering any proxy.json-hostname port), so a nonstandard port in an emitted URL comes from the victim request's OWN normalized `headers.port`/`[':port']`, never the poisoner; and moving container probes off `/_gina/health/check` onto app routes is what acquires the bug — nothing signals it. Pickup: restart (server-side only). Tests: `test/core/proxy-request-scope.test.js` (44, incl. a real `getRoute`/`toUrl` subtract reproducing the internal-host emission pre-fix). **Falsy proxy-host state degrades the URL builder, never crashes it (former #291, #B168, 0.6.0):** server-side `getRoute()` resolves `route.proxy_hostname` from the worker global with an envConf fallback, and BOTH are framework-produced falsy states (the global is boot-set only from a proxy config carrying a hostname and otherwise first written by a proxied request; the envConf fallback is deliberately written null for a direct-classified render) — with the worker-wide proxied latch true and both unset, the unguarded rewrite threw `TypeError: Cannot read properties of null (reading 'replace')` on EVERY server-side `getRoute()` while the state lasted: URL building for mail/workers, redirects and health checks alike (observed live: 72 identical failures through a readiness probe, healing in-process once a later render rewrote the envConf fallback). The truthiness guard falls back to the route's direct hostname AND flips `route.isProxyHost` false — `toUrl()` keys on that flag, so a bare skip would stringify the unset value into the emitted URL, converting a loud crash into silently wrong links; a once-per-process warning names the degraded state. The `url` template filters hold `getRoute()`'s own resolution and degrade only when nothing resolved anywhere (their per-request override used to re-force the flag with an unresolved value in slot-less renders, undoing the fix — and replacing a usable envConf-derived value with an unset one); the non-proxied branch's gate requires TRUTHY (the old `typeof` admitted a defined-but-falsy global — typeof null is 'object'). Browser bundle changed (`lib/routing` ships in it) with zero client behavior change — the client arm resolves from `window.location`, which cannot be unset. Rule: a framework-produced falsy state must DEGRADE the builder, and the degrade must flip the flag downstream code keys on. **#B367 (0.6.8) — those same headers are now VALIDATED WHERE THEY ARE READ, because until 0.6.8 they reached the browser unescaped and were a reflected-XSS vector.** `X-Forwarded-Host`, `X-Forwarded-Proto`, `X-Forwarded-Prefix` and the caller's own `Host`/`:authority` feed `page.environment.hostname` / `.webroot` / `.proxyHost` / `.proxyHostname`, which the client bootstrap (`gina.onload.min.js`) carries in SINGLE-QUOTED JS string literals (`hostname:'{{ … }}'`, `window.__ginaWebroot='{{ … }}'`). The substitution is `whisper(dic, layout, /\{{ ([a-zA-Z.]+) \}}/g)` — whisper's rule branch is `replaceable.replace(rule, (s,key) => dictionary[key] || s)`, a RAW splice that escapes nothing — and the loader is injected AFTER template compilation precisely so the engine never sees those tokens. So a single quote in one header closed the literal and executed attacker script on every rendered page, unauthenticated (reproduced live over HTTP on both the host and prefix vectors). The guard is at INGEST, not emission, and that choice is load-bearing: whisper runs over the WHOLE layout, so the same dictionary also feeds HTML contexts where a JS-string escape would emit literal backslashes; and the sibling values already safe (`forms`, `routing`, `validatorLabels`) use `encodeRFC5987ValueChars` + a client `decodeURIComponent`, so extending that pattern would have changed the browser bundle and billed every consumer a re-bake for a server-side flaw. A host must be `name[:port]` or a bracketed IPv6 literal (`/^[A-Za-z0-9._:\[\]-]+$/`, ≤255), a forwarded scheme must be exactly `http`/`https`, a prefix must be URL-path characters; anything else is REFUSED and the request falls back to the bundle's configured host/webroot as if the header were absent — including the classification itself, so a malformed `X-Forwarded-Host` no longer marks the request proxied. The guard is TWINNED in `core/server.isaac.js` and `core/router.js` (the same deliberate twinning as the classification above) and a test pins the two character classes EQUAL, because a drift makes one engine exploitable again. Known consequence: a comma-separated `X-Forwarded-Host` (chained proxies) now fails the guard and falls back — pre-fix it produced `scheme://a.example, b.example`, i.e. already garbage; splitting the list is deliberately NOT done, since element 0 is the original client's own value and taking it would reopen the vector, and any other element needs a trusted-hop count the framework does not have. Server-side only ⇒ pickup is a bundle RESTART, no re-bake. ⚠️ **Field reachability (consumer-reported 2026-08-15, and it INVALIDATED our own published check): `X-Forwarded-Prefix` is the header that actually exposes people, and the obvious audit question misses it.** We had told operators to ask whether their proxy SETS the `X-Forwarded-*` headers from its own knowledge or FORWARDS what the client sent. That question is a FALSE-NEGATIVE GENERATOR: a conscientious edge config sets `Host`/`X-Forwarded-Host`/`X-Forwarded-Proto`/`X-Forwarded-For` and never MENTIONS `X-Forwarded-Prefix` (a mount path is a concern most deployments never set deliberately), and nginx forwards any header it does not explicitly override — so the prefix travels verbatim while the other three are correctly replaced, and the operator answers "we overwrite them, we're fine" and is WRONG. Reported on a two-layer nginx topology (both layers setting Host + proto, outer setting X-Forwarded-Host, NEITHER naming the prefix — measured 0 with firing controls). **Verified first-hand here at the `v0.6.7` tag: the prefix block's only enclosing scope is `server.on('request', …)` — there is NO proxy-classification gate on it at all**, so the prefix is accepted whether or not the request counts as proxied, and correctly overriding `X-Forwarded-Host` cannot close it; the gap is sufficient alone. Ask the question PER HEADER ("is `X-Forwarded-Prefix` named in this config?") at EVERY layer, never as a blanket `X-Forwarded-*` question. Rule: a request header that will be interpolated into a client-side script is untrusted input at the READ site, and the cheapest correct place to reject it is where it enters — not where it is emitted. Second rule, from the reachability miss: when you hand operators a check for whether a flaw can reach them, make it name EACH input separately — a check phrased over a family of headers silently assumes the proxy treats the family uniformly, and proxies do not. **#B502 (0.6.28) — the LAST req-less reader now resolves per request, and the router twin stops rewriting the worker-global from direct requests.** Everything above re-pointed the framework's OWN callers; an APPLICATION-level `getRoute(…).toUrl()` — the form this file documents — still resolved from `getContext('isProxyHost')` (a latch that arms the moment any request writes `process.gina.PROXY_HOSTNAME` and never resets) plus that global. Measured on isolated two-bundle scenes: after ONE port-less-Host request, every later DIRECT request's `toUrl()` lost its port on an http/1.1 bundle (`http://127.0.0.1/web/echo/3` for a bundle on `localhost:9940` — isaac strips the port from `headers.host` BEFORE the router twin re-classifies, so every direct isaac request re-wrote the globals from the stripped host) and, on an http/2 + https bundle, emitted the LAST port-less client's host verbatim (`http://evil.example/…` after one `Host: evil.example` — attacker-choosable, and the shape a field report described). Fix in three parts: `server.js handle()` enters `process.gina._reqALS` on EVERY request in every log mode (#M12b had it JSON-only) with a `proxy` slot; `core/router.js` fills the slot from THIS request's stamps right after the engine-agnostic classification; `lib/routing getRoute()` reads the store FIRST and keeps the latch + worker-global only for req-less callers (boot, CLI, cron — no store). The router twin's `proxyReqIsProxied` now defers to an existing isaac stamp (the pre-strip truth), so direct requests no longer rewrite the worker-global; isaac's port-less scheme chain matches the twin's (X-Forwarded-Proto, then PROXY_SCHEME, then the bundle scheme). Both logger readers stay JSON-gated, so text mode gains only the ALS enter. `requireForwardedHeaders` closes the port-less-Host path only on earlier versions — the classification's `X-Forwarded-Host` term is ungated on both engines (`server.isaac.js:2188-2192`, router twin), so a client with direct reach could still supply the host; the complete interim was a proxy overriding both headers. `lib/routing` is browser-bundled ⇒ pickup is a bundle RESTART **and a re-bake** — the only dist hunks are the server branch's three lines and the client branch is byte-identical, so the re-bake keeps bundle-freshness honest and changes no client behaviour. Residual, by design: `PROXY_SCHEME` is the PROJECT's `def_scheme` (gna.js), so with no `X-Forwarded-Proto` an https bundle in an http-default project still stamps `http://` on both twins (#B506, LOW). Tests: `test/core/proxy-context-b502.test.js` (source pins on all three parts + a real-ALS replica of the resolution rule; red-first 6/4 on the pre-change source). **#B511 (0.6.29) — a path-form `getUrl` route containing `@` no longer 500s the render (both engines).** The swig and nunjucks `getUrl` filters split any `@`-bearing route as `rule@bundle` BEFORE testing whether it was a path, so `'/assets/img/common/header@2x.png' | getUrl` — the retina idiom the filter's own comment cites — became rule `/assets/img/common/header` @ bundle `2x.png`, failed the bundle lookup and called `throwError(500)` mid-template; `throwError` RENDERS (it never throws), the site is outside the filter's routing try, and nothing returns after it, so the page answered 500 while the action's own render was discarded by the released-response guard (measured live on an isolated prod boot: 500 → 200 with the extension intact after the fix, on swig and on a bare-template nunjucks scene). The guard adds one term to the split's condition — a route starting with `/` is a path, never a rule reference — at both sites. Unchanged: `'rule@bundle'` still splits, a passed base still wins over the in-string form, and a path that needs another bundle's host passes it as the base argument (`| getUrl(null, 'web')`) — the only form one measured consumer corpus used (zero bare calls). Disclosed consequence: a path-form route cannot name a bundle in-string. Neither filter lib is browser-bundled (`build.json` 0/0) ⇒ pickup = bundle RESTART, no re-bake. Tests: `test/lib/geturl-b511.test.js` (per-engine source pins incl. the guard's position BEFORE the path branch — the ordering IS the defect — and a predicate lifted from each engine's shipped condition, with the pre-fix decision as the subtract control). Generalises: a soft-failing filter can still hard-fail through a render-side `throwError` reached before its own try — pin the ORDER of the guards, not just their presence.
1020
- 277. **Render/output cache — pluggable backends, release-namespaced keys, event invalidation, flush, Cache-Status (consolidates former #234/#235/#237/#238/#242/#244; 0.5.18–0.5.22).** The framework caches rendered responses under two key namespaces — `static:` HTML + `data:` JSON — in the multi-purpose server Map (which ALSO holds `swig:` compiled templates + `http2session:` sessions: every bulk operation scopes to the output namespaces ONLY). CONFIG: bundle-wide defaults on `server.cache` (`enable` is the hard gate for writer AND reader; plus `path`/`ttl`/`sliding`/`maxAge`); `type`/`store` come from the bundle `config/settings.json` top-level `cache` block, folded into the runtime `server.cache` at config-load (env.json keys win; without the fold the documented default was inert); per-route via a routing.json rule's top-level `cache: {…}` with FILL-only inheritance — a per-route value always wins, and a route that sets `type` at all keeps it (only an OMITTED `type` inherits the bundle default). STRATEGIES: `memory` (inline content); `fs` (body file + a `.meta` sidecar carrying created/ttl/sliding/maxAge/headers/events; restart READ-BACK on an index miss with ABSOLUTE expiry preserved — a restart never extends a TTL; pure-sliding read-back counts as a fresh access, a documented imprecision); `redis` two-tier (L1 = the in-process Map written synchronously; L2 = shared redis via fire-and-forget `PSETEX` — the response never waits; `warm()` repopulates L1 with the AUTHORITATIVE remaining PTTL and re-registers the route's events so a warmed entry stays evictable; fail-open with one once-per-process warn + a 1s `commandTimeout` so a blackholed socket cannot hang the render hot path; a graceful shutdown leaves L2 INTACT — peer replicas and the restarting replica warm from it; every redis route needs a ttl or `invalidateOnEvents` — boot-enforced fail-fast, with proportionality: an `enable:false` bundle never opens a connection and would-be-fatals downgrade to loud warns). KEYS: one `buildKey` owns `[<token>:]<kind>:<bundle>:<url>` at every writer AND reader (the format was previously duplicated at 4 sites and drifted); the token (`GINA_CACHE_NAMESPACE || GINA_VERSION`, sanitized) release-namespaces every cache so a framework upgrade auto-invalidates, and the token is ALSO an fs PATH segment — a measured requirement, not cosmetics: with the token only in the key, a namespace change reused the same file path and read-back served stale cross-namespace bytes. EVENTS: routes register `cache.invalidateOnEvents`; fire from a controller via `self.cache.invalidateByEvent(event)` (a deliberately NARROW facade — it never exposes `from()`/`set()`, and reaches the OWN process only) or cross-bundle via `gina cache:clear @<project> --event=<name>` / `POST /_gina/cache/clear?event=<name>`; TTL/sliding expiry runs the SAME eviction as an explicit delete (cleanup fns fire + registrations reclaim), and fs/redis persistence re-registers events on read-back/warm. FLUSH: the CLI runs the offline fs reclaim FIRST (works with the bundle down; reclaims prior-release orphan dirs; never touches the reserved `config`/`swig` infra-cache dirs) then the in-heap endpoint (admin-gated, POST-only — a flush is a mutation a prefetch must not fire; `event` WINS over `bundle`); `--dry-run` previews the fs set + probes reachability read-only and deliberately claims NO count. READ PATH: engine-agnostic in the shared request handler (express included — previously isaac-only), so a fresh replica's FIRST GET can serve a peer replica's write; every hit carries RFC 9211 `Cache-Status: <name>; hit; ttl=N; detail=memory|redis|fs` (naming the physical tier that served the bytes) and every genuine miss `<name>; fwd=uri-miss` — `<name>` = `server.cache.name` when set to a valid token (#B238: a letter then up to 63 of `[A-Za-z0-9._-]`, a conservative RFC 8941 subset; an invalid value boot-warns and falls back), else the default `gina-cache`, resolved ONCE at boot (server.js stamps `instance._cacheName`; all mint sites on both engines read the stamp, so the identifier cannot disagree across engines or hit/miss) — and when `server.hidePoweredBy` is true + the cache enabled + no name set, boot warns that the wire still names the framework (warn-not-flip: the identifier is a documented-stable wire value — set any token e.g. `cache` to close the disclosure, or explicit `gina-cache` to silence); cached routes re-mint CSP nonces on hits (#B130 — header + body, stored entries never mutated). **A gated route is never cached** — pairing `cache` with `param.requireAuth`/`roles`/`policy` (or leaving it mode-gated) REFUSES the boot, and the delegates skip the write regardless: the key carries no principal and both serve points precede the authorization gate (#B158). Server-side only — none of this ever needs a dist rebuild. Tests: `test/lib/render-cache.test.js`, `test/core/server-render-cache-read.test.js`, `test/core/server-render-cache-boot.test.js`, `test/lib/cache-clear.test.js`; consumer guide: the docs-site caching guide. Since 0.7.1 the isaac PRE-ROUTING read runs only while `server.cache.enable` is on (the phase-2 per-request trims, slice H) — parity with the writers and the express-side read; an entry left on disk by a run that had caching enabled is no longer served while it is disabled. **#B750 (fixed for 0.7.2):** `serveRenderCacheHit`'s HTTP/2 branch assigned `res.headersSent = true` after `stream.end()` — `headersSent` is a getter-only accessor on BOTH Node response classes (it already reports a raw send), so in strict-mode server.js the assignment threw a TypeError after the body went out: every redis L2 warm over HTTP/2 (`detail=redis`) logged an unhandled rejection and lost its access line. Never assign `headersSent`; the same fix removed four strict-mode siblings (render-nunjucks HEAD and body over HTTP/2, render-xml over HTTP/2 and HTTP/1.1). A fake response with a plain writable `headersSent` cannot reproduce the throw, which is why the suites missed it: test on a real `Http2ServerResponse`. Tests: `test/core/h2-raw-send-b749-b750.test.js`.
1021
+ 276. **Worker-global proxy-context poisoning by port-less internal calls — the `getUrl`/`url` template filters, the cross-bundle redirect-by-URL target and the error-fallback redirect now prefer the emitting request's own classification; opt-in `server.proxy.requireForwardedHeaders` makes classification deterministic (#B152).** A request whose inbound Host carries no `:port` is classified reverse-proxied (the first arm of the per-request classification, both engines) and REFRESHES `process.gina.PROXY_HOST`/`PROXY_HOSTNAME` — but a port-less Host is also what an internal call addressed by service/DNS name carries (a container health probe on an app route — only `/_gina/health/check` itself, `$`-anchored, bypasses the classification block — a mesh hop, a sibling-bundle request), so ONE such call repointed every later worker-global read at the internal host: both `getUrl` filter branches (the path/bundle-override `hostname` composition AND the post-`getRoute` `proxy_hostname` override feeding `toUrl()`), the redirect-by-URL `getRoute(path).toUrl()` branch, and `throwError`'s route-object fallback. On a proxy-less fresh worker the same call CREATES proxy mode permanently (the composite latch arms once the global exists). Fixed server-side, NO dist rebuild (`getUrl` is not browser-bundled — the dist's `getUrl` hits are `getUrlProps`, a substring artifact): all four readers prefer THIS request's per-request slots (`req._ginaIsProxyHost` strict-`=== true` + `req._ginaProxyHostname`) over the worker-global, which stays the fallback for renders with no request of their own — a raw victim resolves the config host despite the latch, a proxied victim emits its own host, a slot-less caller is byte-identical; `core/router.js` fills the slots when ABSENT so the Express engine (which never set them) gets per-request truth engine-agnostically, isaac's earlier identical classification always winning. The opt-in key (settings.json + published schema; strict boolean, fail-safe false, boot-resolved once, `console.info` when armed) disables the port-less heuristic so ONLY X-Forwarded-Host classifies as proxied — the one mechanism that also protects req-less renders; enable it only behind a front proxy that always sends X-Forwarded-Host. Two mechanism corrections vs the field report that surfaced this: `PROXY_PORT` is boot-static (never request-refreshed; the boot scheme-switch forces it to 80/443, clobbering any proxy.json-hostname port), so a nonstandard port in an emitted URL comes from the victim request's OWN normalized `headers.port`/`[':port']`, never the poisoner; and moving container probes off `/_gina/health/check` onto app routes is what acquires the bug — nothing signals it. Pickup: restart (server-side only). Tests: `test/core/proxy-request-scope.test.js` (44, incl. a real `getRoute`/`toUrl` subtract reproducing the internal-host emission pre-fix). **Falsy proxy-host state degrades the URL builder, never crashes it (former #291, #B168, 0.6.0):** server-side `getRoute()` resolves `route.proxy_hostname` from the worker global with an envConf fallback, and BOTH are framework-produced falsy states (the global is boot-set only from a proxy config carrying a hostname and otherwise first written by a proxied request; the envConf fallback is deliberately written null for a direct-classified render) — with the worker-wide proxied latch true and both unset, the unguarded rewrite threw `TypeError: Cannot read properties of null (reading 'replace')` on EVERY server-side `getRoute()` while the state lasted: URL building for mail/workers, redirects and health checks alike (observed live: 72 identical failures through a readiness probe, healing in-process once a later render rewrote the envConf fallback). The truthiness guard falls back to the route's direct hostname AND flips `route.isProxyHost` false — `toUrl()` keys on that flag, so a bare skip would stringify the unset value into the emitted URL, converting a loud crash into silently wrong links; a once-per-process warning names the degraded state. The `url` template filters hold `getRoute()`'s own resolution and degrade only when nothing resolved anywhere (their per-request override used to re-force the flag with an unresolved value in slot-less renders, undoing the fix — and replacing a usable envConf-derived value with an unset one); the non-proxied branch's gate requires TRUTHY (the old `typeof` admitted a defined-but-falsy global — typeof null is 'object'). Browser bundle changed (`lib/routing` ships in it) with zero client behavior change — the client arm resolves from `window.location`, which cannot be unset. Rule: a framework-produced falsy state must DEGRADE the builder, and the degrade must flip the flag downstream code keys on. **#B367 (0.6.8) — those same headers are now VALIDATED WHERE THEY ARE READ, because until 0.6.8 they reached the browser unescaped and were a reflected-XSS vector.** `X-Forwarded-Host`, `X-Forwarded-Proto`, `X-Forwarded-Prefix` and the caller's own `Host`/`:authority` feed `page.environment.hostname` / `.webroot` / `.proxyHost` / `.proxyHostname`, which the client bootstrap (`gina.onload.min.js`) carries in SINGLE-QUOTED JS string literals (`hostname:'{{ … }}'`, `window.__ginaWebroot='{{ … }}'`). The substitution is `whisper(dic, layout, /\{{ ([a-zA-Z.]+) \}}/g)` — whisper's rule branch is `replaceable.replace(rule, (s,key) => dictionary[key] || s)`, a RAW splice that escapes nothing — and the loader is injected AFTER template compilation precisely so the engine never sees those tokens. So a single quote in one header closed the literal and executed attacker script on every rendered page, unauthenticated (reproduced live over HTTP on both the host and prefix vectors). The guard is at INGEST, not emission, and that choice is load-bearing: whisper runs over the WHOLE layout, so the same dictionary also feeds HTML contexts where a JS-string escape would emit literal backslashes; and the sibling values already safe (`forms`, `routing`, `validatorLabels`) use `encodeRFC5987ValueChars` + a client `decodeURIComponent`, so extending that pattern would have changed the browser bundle and billed every consumer a re-bake for a server-side flaw. A host must be `name[:port]` or a bracketed IPv6 literal (`/^[A-Za-z0-9._:\[\]-]+$/`, ≤255), a forwarded scheme must be exactly `http`/`https`, a prefix must be URL-path characters; anything else is REFUSED and the request falls back to the bundle's configured host/webroot as if the header were absent — including the classification itself, so a malformed `X-Forwarded-Host` no longer marks the request proxied. The guard is TWINNED in `core/server.isaac.js` and `core/router.js` (the same deliberate twinning as the classification above) and a test pins the two character classes EQUAL, because a drift makes one engine exploitable again. Known consequence: a comma-separated `X-Forwarded-Host` (chained proxies) now fails the guard and falls back — pre-fix it produced `scheme://a.example, b.example`, i.e. already garbage; splitting the list is deliberately NOT done, since element 0 is the original client's own value and taking it would reopen the vector, and any other element needs a trusted-hop count the framework does not have. Server-side only ⇒ pickup is a bundle RESTART, no re-bake. ⚠️ **Field reachability (consumer-reported 2026-08-15, and it INVALIDATED our own published check): `X-Forwarded-Prefix` is the header that actually exposes people, and the obvious audit question misses it.** We had told operators to ask whether their proxy SETS the `X-Forwarded-*` headers from its own knowledge or FORWARDS what the client sent. That question is a FALSE-NEGATIVE GENERATOR: a conscientious edge config sets `Host`/`X-Forwarded-Host`/`X-Forwarded-Proto`/`X-Forwarded-For` and never MENTIONS `X-Forwarded-Prefix` (a mount path is a concern most deployments never set deliberately), and nginx forwards any header it does not explicitly override — so the prefix travels verbatim while the other three are correctly replaced, and the operator answers "we overwrite them, we're fine" and is WRONG. Reported on a two-layer nginx topology (both layers setting Host + proto, outer setting X-Forwarded-Host, NEITHER naming the prefix — measured 0 with firing controls). **Verified first-hand here at the `v0.6.7` tag: the prefix block's only enclosing scope is `server.on('request', …)` — there is NO proxy-classification gate on it at all**, so the prefix is accepted whether or not the request counts as proxied, and correctly overriding `X-Forwarded-Host` cannot close it; the gap is sufficient alone. Ask the question PER HEADER ("is `X-Forwarded-Prefix` named in this config?") at EVERY layer, never as a blanket `X-Forwarded-*` question. Rule: a request header that will be interpolated into a client-side script is untrusted input at the READ site, and the cheapest correct place to reject it is where it enters — not where it is emitted. Second rule, from the reachability miss: when you hand operators a check for whether a flaw can reach them, make it name EACH input separately — a check phrased over a family of headers silently assumes the proxy treats the family uniformly, and proxies do not. **#B502 (0.6.28) — the LAST req-less reader now resolves per request, and the router twin stops rewriting the worker-global from direct requests.** Everything above re-pointed the framework's OWN callers; an APPLICATION-level `getRoute(…).toUrl()` — the form this file documents — still resolved from `getContext('isProxyHost')` (a latch that arms the moment any request writes `process.gina.PROXY_HOSTNAME` and never resets) plus that global. Measured on isolated two-bundle scenes: after ONE port-less-Host request, every later DIRECT request's `toUrl()` lost its port on an http/1.1 bundle (`http://127.0.0.1/web/echo/3` for a bundle on `localhost:9940` — isaac strips the port from `headers.host` BEFORE the router twin re-classifies, so every direct isaac request re-wrote the globals from the stripped host) and, on an http/2 + https bundle, emitted the LAST port-less client's host verbatim (`http://evil.example/…` after one `Host: evil.example` — attacker-choosable, and the shape a field report described). Fix in three parts: `server.js handle()` enters `process.gina._reqALS` on EVERY request in every log mode (#M12b had it JSON-only) with a `proxy` slot; `core/router.js` fills the slot from THIS request's stamps right after the engine-agnostic classification; `lib/routing getRoute()` reads the store FIRST and keeps the latch + worker-global only for req-less callers (boot, CLI, cron — no store). The router twin's `proxyReqIsProxied` now defers to an existing isaac stamp (the pre-strip truth), so direct requests no longer rewrite the worker-global; isaac's port-less scheme chain matches the twin's (X-Forwarded-Proto, then PROXY_SCHEME, then the bundle scheme). Both logger readers stay JSON-gated, so text mode gains only the ALS enter. `requireForwardedHeaders` closes the port-less-Host path only on earlier versions — the classification's `X-Forwarded-Host` term is ungated on both engines (`server.isaac.js:2188-2192`, router twin), so a client with direct reach could still supply the host; the complete interim was a proxy overriding both headers. `lib/routing` is browser-bundled ⇒ pickup is a bundle RESTART **and a re-bake** — the only dist hunks are the server branch's three lines and the client branch is byte-identical, so the re-bake keeps bundle-freshness honest and changes no client behaviour. Residual, by design: `PROXY_SCHEME` is the PROJECT's `def_scheme` (gna.js), so with no `X-Forwarded-Proto` an https bundle in an http-default project still stamps `http://` on both twins (#B506, LOW). Tests: `test/core/proxy-context-b502.test.js` (source pins on all three parts + a real-ALS replica of the resolution rule; red-first 6/4 on the pre-change source). **#B511 (0.6.29) — a path-form `getUrl` route containing `@` no longer 500s the render (both engines).** The swig and nunjucks `getUrl` filters split any `@`-bearing route as `rule@bundle` BEFORE testing whether it was a path, so `'/assets/img/common/header@2x.png' | getUrl` — the retina idiom the filter's own comment cites — became rule `/assets/img/common/header` @ bundle `2x.png`, failed the bundle lookup and called `throwError(500)` mid-template; `throwError` RENDERS (it never throws), the site is outside the filter's routing try, and nothing returns after it, so the page answered 500 while the action's own render was discarded by the released-response guard (measured live on an isolated prod boot: 500 → 200 with the extension intact after the fix, on swig and on a bare-template nunjucks scene). The guard adds one term to the split's condition — a route starting with `/` is a path, never a rule reference — at both sites. Unchanged: `'rule@bundle'` still splits, a passed base still wins over the in-string form, and a path that needs another bundle's host passes it as the base argument (`| getUrl(null, 'web')`) — the only form one measured consumer corpus used (zero bare calls). Disclosed consequence: a path-form route cannot name a bundle in-string. Neither filter lib is browser-bundled (`build.json` 0/0) ⇒ pickup = bundle RESTART, no re-bake. Tests: `test/lib/geturl-b511.test.js` (per-engine source pins incl. the guard's position BEFORE the path branch — the ordering IS the defect — and a predicate lifted from each engine's shipped condition, with the pre-fix decision as the subtract control). Generalises: a soft-failing filter can still hard-fail through a render-side `throwError` reached before its own try — pin the ORDER of the guards, not just their presence. **#B516 (0.7.4) — a `getUrl` call in a render context with no request, or with no bundle configuration, degrades instead of throwing (both engines).** Every rule form (a bare rule gets the current bundle as its base) and every path with a bundle base runs a branch that read `ctx.req.headers` unguarded, and `ctx.options.conf` was read before it. So a context built outside a request — an application's mail or scheduled-task renderer calling the filter factory itself with `{ options, isProxyHost }` — threw `TypeError … reading 'headers'`, and a context with no `options.conf` (the boot registration, an async delegate's context-free registration) threw on every form, a plain path included. `getUrl` now builds a request-shaped VIEW of such a context — empty headers, the context's method (else GET), the current bundle's conf from the Config registry — and leaves every downstream line as it was, so a request render is byte-identical and the caller's context object is never written. A request-less rule form resolves through `getRoute()`'s own req-less chain; a path with a bundle base takes the worker's proxy host when one is known, else the bundle's configured hostname; an unknown port is never appended (`:NaN`) and an unresolvable proxy host is never stringified (`scheme://undefined`). Two cases throw a named `Error`: an unknown bundle when the context has no `throwError`, and no bundle configuration anywhere. Neither filter lib is browser-bundled ⇒ pickup = bundle RESTART, no re-bake. Tests: `test/lib/geturl-requestless-b516.test.js` (real modules, both engines; 16 of the 18 arms per engine are red on the pre-fix bytes).
1022
+ 277. **Render/output cache — pluggable backends, release-namespaced keys, event invalidation, flush, Cache-Status (consolidates former #234/#235/#237/#238/#242/#244; 0.5.18–0.5.22).** The framework caches rendered responses under two key namespaces — `static:` HTML + `data:` JSON — in the multi-purpose server Map (which ALSO holds `swig:` compiled templates + `http2session:` sessions: every bulk operation scopes to the output namespaces ONLY). CONFIG: bundle-wide defaults on `server.cache` (`enable` is the hard gate for writer AND reader; plus `path`/`ttl`/`sliding`/`maxAge`); `type`/`store` come from the bundle `config/settings.json` top-level `cache` block, folded into the runtime `server.cache` at config-load (env.json keys win; without the fold the documented default was inert). **Where `server.cache` is set — measured (#B744): `settings.server.cache.<env>.json` > `settings.json` `server.cache` > the project `env.json` `<bundle>.<env>.server.cache` > the framework template (`enable:false`, `ttl:3600`, `path:${cachePath}`, `sliding:false`, `maxAge:0`, `maxEntries:1000`); those six keys are INERT in the top-level `cache` block (the fold is fill-only and runs after the template filled them), and since 0.7.4 the boot warns per such key found there, naming `server.cache` (`RenderCache.inertTopLevelKeys`; the schema marks them deprecated at that place). A whole-settings `settings.<env>.json` is merged at the top level and wins over `settings.json` since 0.7.4 (#B784 — the section was derived prefix-first, so it nested under a `<env>` key); the general form is `settings[.<section>][.<env>].json`.** per-route via a routing.json rule's top-level `cache: {…}` with FILL-only inheritance — a per-route value always wins, and a route that sets `type` at all keeps it (only an OMITTED `type` inherits the bundle default). STRATEGIES: `memory` (inline content); `fs` (body file + a `.meta` sidecar carrying created/ttl/sliding/maxAge/headers/events; restart READ-BACK on an index miss with ABSOLUTE expiry preserved — a restart never extends a TTL; pure-sliding read-back counts as a fresh access, a documented imprecision; **since 0.7.4 isaac roots the read-back at the WRITER's `server.cache.path`, stamped `server._cachePath` at init (#B785 — it used the top-level infra `cachePath`, equal only by default, so a custom path missed every entry after a restart), and `cache:clear`'s offline reclaim resolves the same root offline via `RenderCache.resolveCacheRoot` (sub-file > settings.json > env.json > default)**); `redis` two-tier (L1 = the in-process Map written synchronously; L2 = shared redis via fire-and-forget `PSETEX` — the response never waits; `warm()` repopulates L1 with the AUTHORITATIVE remaining PTTL and re-registers the route's events so a warmed entry stays evictable; fail-open with one once-per-process warn + a 1s `commandTimeout` so a blackholed socket cannot hang the render hot path; a graceful shutdown leaves L2 INTACT — peer replicas and the restarting replica warm from it; every redis route needs a ttl or `invalidateOnEvents` — boot-enforced fail-fast, with proportionality: an `enable:false` bundle never opens a connection and would-be-fatals downgrade to loud warns). KEYS: one `buildKey` owns `[<token>:]<kind>:<bundle>:<url>` at every writer AND reader (the format was previously duplicated at 4 sites and drifted); the token (`GINA_CACHE_NAMESPACE || GINA_VERSION`, sanitized) release-namespaces every cache so a framework upgrade auto-invalidates, and the token is ALSO an fs PATH segment — a measured requirement, not cosmetics: with the token only in the key, a namespace change reused the same file path and read-back served stale cross-namespace bytes. EVENTS: routes register `cache.invalidateOnEvents`; fire from a controller via `self.cache.invalidateByEvent(event)` (a deliberately NARROW facade — it never exposes `from()`/`set()`, and reaches the OWN process only) or cross-bundle via `gina cache:clear @<project> --event=<name>` / `POST /_gina/cache/clear?event=<name>`; TTL/sliding expiry runs the SAME eviction as an explicit delete (cleanup fns fire + registrations reclaim), and fs/redis persistence re-registers events on read-back/warm. FLUSH: the CLI runs the offline fs reclaim FIRST (works with the bundle down; reclaims prior-release orphan dirs; never touches the reserved `config`/`swig` infra-cache dirs) then the in-heap endpoint (admin-gated, POST-only — a flush is a mutation a prefetch must not fire; `event` WINS over `bundle`); `--dry-run` previews the fs set + probes reachability read-only and deliberately claims NO count. READ PATH: engine-agnostic in the shared request handler (express included — previously isaac-only), so a fresh replica's FIRST GET can serve a peer replica's write; every hit carries RFC 9211 `Cache-Status: <name>; hit; ttl=N; detail=memory|redis|fs` (naming the physical tier that served the bytes) and every genuine miss `<name>; fwd=uri-miss` — `<name>` = `server.cache.name` when set to a valid token (#B238: a letter then up to 63 of `[A-Za-z0-9._-]`, a conservative RFC 8941 subset; an invalid value boot-warns and falls back), else the default `gina-cache`, resolved ONCE at boot (server.js stamps `instance._cacheName`; all mint sites on both engines read the stamp, so the identifier cannot disagree across engines or hit/miss) — and when `server.hidePoweredBy` is true + the cache enabled + no name set, boot warns that the wire still names the framework (warn-not-flip: the identifier is a documented-stable wire value — set any token e.g. `cache` to close the disclosure, or explicit `gina-cache` to silence); cached routes re-mint CSP nonces on hits (#B130 — header + body, stored entries never mutated). **The miss-path `Cache-Control: <visibility>, max-age=<ttl>` (#C6) rides the write's own gate since 0.7.4 (#B744): `server.cache.enable === 'true'` + GET + a route `cache`, at all four delegate sites (swig ×2, json, nunjucks) — with the switch off no header goes out (until 0.7.3 it went out whatever the switch, dev included, so a browser reused a route's response for its whole ttl while the server stored nothing); `visibility` (`private` default | `public`) is a per-route `cache` key.** **A gated route is never cached** — pairing `cache` with `param.requireAuth`/`roles`/`policy` (or leaving it mode-gated) REFUSES the boot, and the delegates skip the write regardless: the key carries no principal and both serve points precede the authorization gate (#B158). Server-side only — none of this ever needs a dist rebuild. Tests: `test/lib/render-cache.test.js`, `test/core/server-render-cache-read.test.js`, `test/core/server-render-cache-boot.test.js`, `test/lib/cache-clear.test.js`, `test/core/render-cache-control-b744.test.js`, `test/core/render-cache-top-level-warn-b744.test.js`, `test/core/server-render-cache-readback-b785.test.js`, `test/core/config-settings-env-file-b784.test.js`; consumer guide: the docs-site caching guide. Since 0.7.1 the isaac PRE-ROUTING read runs only while `server.cache.enable` is on (the phase-2 per-request trims, slice H) — parity with the writers and the express-side read; an entry left on disk by a run that had caching enabled is no longer served while it is disabled. **#B750 (fixed for 0.7.2):** `serveRenderCacheHit`'s HTTP/2 branch assigned `res.headersSent = true` after `stream.end()` — `headersSent` is a getter-only accessor on BOTH Node response classes (it already reports a raw send), so in strict-mode server.js the assignment threw a TypeError after the body went out: every redis L2 warm over HTTP/2 (`detail=redis`) logged an unhandled rejection and lost its access line. Never assign `headersSent`; the same fix removed four strict-mode siblings (render-nunjucks HEAD and body over HTTP/2, render-xml over HTTP/2 and HTTP/1.1). A fake response with a plain writable `headersSent` cannot reproduce the throw, which is why the suites missed it: test on a real `Http2ServerResponse`. Tests: `test/core/h2-raw-send-b749-b750.test.js`.
1021
1023
 
1022
1024
  278. **A cache key is opaque DATA — never route it through an expression/condition evaluator.** An output-cache key embeds the request URL, so a querystring's `?`/`=` parse as OPERATOR tokens in any condition-DSL lookup — the render cache's event registry originally lived in a collection whose dedup ran keys through the condition evaluator, and the SECOND cache-miss render of any cached GET route with `invalidateOnEvents` + a querystring THREW (in the swig path that rejection unwound to the function-level try, whose catch answered 500 — discarding an already-rendered page). The registry became a plain array matched with `===`. Generalizes beyond caching: never let a value carrying user-controlled characters reach a query/condition DSL as an expression — match registry rows with `===` on plain structures, and treat every composite key as an opaque string.
1023
1025
 
@@ -1037,7 +1039,7 @@ Dev-mode query instrumentation captures every database query tied to the current
1037
1039
  290. **`lib/authn` — password hashing, account lockout and RFC 6238 TOTP (#COMPLY3, 2026-07-27, 0.6.0).** Hooks and helpers, never an identity provider: gina owns no user record, credential store, login route or session id, so the module ENDS where `req.login()` begins (#288) and `lib/authz-gate` takes over from `req.session.user`. The composition a bundle writes is `validatePasswordPolicy(pw)` at registration/change → `createLockout().check(key)` BEFORE spending a KDF → `verifyPassword(pw, stored)`, pairing `dummyVerify` on the account-not-found branch → `req.login(user, done)`. **Hashing** is scrypt (node core, memory-hard, no native addon) encoded as a self-describing PHC string `$scrypt$ln=17,r=8,p=1$<salt>$<key>`, so the cost travels with the hash and raising it is not a flag day: `needsRehash(stored)` reports what is below policy and the next successful login upgrades it transparently — the only moment the plaintext is in hand. `verifyPassword` ALSO verifies `$argon2*$` and `$2a/2b/2y$` through the CONSUMING PROJECT's own package (the connector project-path pattern), so a bundle arriving with existing hashes keeps working; gina never MINTS those — one mint path, one parameter set. **`dummyVerify` must always be given `{like: <a stored hash>}`**: it has no stored hash to read a cost from, so at the shipped default against cheaper hashes the unknown-account branch measured 13.9x SLOWER than the known one — an INVERTED enumeration oracle, louder than doing nothing. Both it and `verifyPassword` surface the same `AUTHN_QUEUE_FULL` shed error, because any divergence between the two branches under saturation is itself the enumeration signal. Policy is length-first per NIST SP 800-63B (12 chars, no mandatory character classes) returning stable codes (`too-short`, `denied-substring`, …); passwords are NFC-normalised on both sides so a device-encoding difference cannot lock a user out of their own account. **Lockout** defaults to PCI-DSS v4.0.1 §8.3.4 (lock after 10 consecutive failures, for 30 minutes; `reset()` is the standard's "or until identity is confirmed" half), keys on a caller-chosen string because gina cannot derive one, and SERIALIZES operations per key — the counter update is a read-modify-write across an async store call, so without it 20 concurrent failures against a threshold of 5 recorded ONE attempt and never locked. Pass `normalizeKey` whenever the key is user-supplied or case variants each get their own counter and multiply the threshold; the default store is per-process, so pass a shared `store` (the same callback `get`/`set`/`del` contract the job and audit seams use) for multi-replica correctness — otherwise the ceiling degrades to roughly `maxAttempts` per replica. One `auth.lockout` audit record is written on the TRANSITION into locked, never per attempt. **Lockout is not rate limiting**: per-ACCOUNT credential failures vs per-CLIENT request volume — different axes, neither substitutes, and request-rate limiting is tracked separately on the roadmap. **TOTP** returns the matched step as an absolute `counter`; the consumer persists it and requires the next accepted counter to be strictly greater, or an observed code stays usable for its whole acceptance window — the RFC assigns replay defence to the verifier and gina has nowhere to write. A malformed code is `{valid:false}` (same shape as a wrong one), while an unusable secret throws — a configuration fault, not a login attempt. Registered plain-`require`, not `_require`: it holds the KDF concurrency gauge and its FIFO queue at module scope, so a dev-mode hot reload would strand in-flight logins, and a security primitive stays out of the reload path on principle. Declared on `GinaLib` in `types/index.d.ts` — the two-way runtime-parity gate reds the whole suite otherwise, with a message naming only the key. Server-side only: no dist rebuild, pickup is a bundle restart.
1038
1040
 
1039
1041
 
1040
- 292. **SQLite under Bun — every framework SQLite consumer resolves its driver through one seam (`lib/sqlite-driver`), and the Bun adapter stamps the node-shaped numeric `errcode` onto bun errors.** Bun **< 1.4** implements no `node:sqlite` (`No such built-in module`, measured on bun 1.2.21 + 1.3.14), so the sqlite ORM connector, session store and async-job store previously failed at boot under Bun while the framework state store silently degraded to JSON. `lib/sqlite-driver.getDatabaseSync()` tries `node:sqlite` FIRST (the Node path returns the native `DatabaseSync` verbatim — zero Node delta, and the adapter self-retires if a future Bun ships `node:sqlite` — **and Bun 1.4 does: re-measured 2026-09-16 on `oven/bun:1.4.2`, `node:sqlite` resolves, so on Bun >= 1.4 the seam takes the Node path and the adapter is never constructed. The container smoke is the positive discriminator: it reports `driver DatabaseSync` on 1.4.2 where 1.3.14 reports `driver BunDatabaseSync`. Bun 1.4's `node:sqlite` error shape is field-identical to Node's (`Error`, `code: 'ERR_SQLITE_ERROR'`, numeric `errcode`, no `errno`), so `lib/connector-error` classifies it correctly WITHOUT the adapter's stamping. Because `engines.bun` still declares `>= 1.2`, CI runs a two-image smoke matrix — a bumpable current-Bun leg plus a DELIBERATELY FROZEN pre-1.4 leg that is the only end-to-end coverage the adapter path has**), else under Bun wraps `bun:sqlite.Database` in a `DatabaseSync`-shaped adapter covering exactly the surface the framework uses — constructor / `exec` / `prepare` → `get`/`all`/`run` with positional params / `close` — measured 13/13 parity on both bun versions (file creation, WAL pragmas, `null` bindings, `{changes, lastInsertRowid}` both numbers, `get()` miss → `undefined`, expando props on the handle, use-after-close throws). The one real divergence is ERROR SHAPE: bun throws `SQLiteError` with the numeric SQLite result code on `errno` plus a specific string `code` (e.g. `SQLITE_BUSY`), where node throws `Error` with `code: 'ERR_SQLITE_ERROR'` and the number on `errcode` — the adapter mirrors `errno` → `errcode` on every rethrown error so the transient/permanent classifier's numeric branch (`errcode & 0xff`) reads both drivers identically, extended codes included (a raw bun `SQLITE_BUSY_RECOVERY` string would miss the exact-string table and misclassify as permanent). Rule: any new SQLite consumer must resolve through the seam, never `require('node:sqlite')` directly (pinned per consumer). Bun boundary that remains: the mongodb connector cannot load under Bun at all — its own `bson` dependency calls `v8.isBuildingSnapshot()`, **still unimplemented as of Bun 1.4.2 (re-measured 2026-09-16: Bun 1.4 does NOT fix this, unlike its sibling gaps — it did ship `node:sqlite`, it does advertise the RFC 8441 `SETTINGS_ENABLE_CONNECT_PROTOCOL` that opt-in WebSocket-over-HTTP/2 needs — and #H13 ws-over-h2 is VERIFIED END-TO-END on Bun 1.4.2 (a booted https/h2 bundle, a real extended CONNECT, and an RFC 6455 round-trip through the shipped `lib/ws-framing`, with exact and `:param` routes both answering 200 and the result matrix element-for-element identical to node:24; bun 1.3.14 is the firing control, failing only at the advertisement) — and it does honour `allowHTTP1`; do not generalise from those to this one)**; that one has no framework-side fix. **`new require(mod)(args)` is a Bun boot-crash for every connector — and the repair is the PLAIN call, NOT `new (require(mod))(args)` (former #293):** the expression parses as `(new require(mod))(args)`: `require` is invoked as a CONSTRUCTOR (a constructor returning an object yields that object, so it evaluates to `module.exports`), which is then invoked as a PLAIN call. Node tolerates it (its `require` has a [[Construct]] slot); Bun's does not — `TypeError: function is not a constructor` at every such site. Measured on the same module under node:24 and oven/bun:1.3.14: `new require(p)(a,b)` works on Node / THROWS on Bun; `require(p)(a,b)` works on BOTH and on Node the two forms returned IDENTICAL results — the zero-Node-delta repair; `new (require(p))(a,b)` is WRONG because it would change Node semantics from a plain call to real construction, diverging for any connector that returns a primitive or nothing. Four live sites fixed: `lib/model.js` boot + reloadModels connector managers, `core/model/template/index.js`, and the `core/server.js` multipart liner. The sibling break behind it: `core/model/entity.js` reassigned `arguments` — V8 permits it in sloppy mode, JSC rejects outright (`SyntaxError: Invalid assignment target`) — repaired with a local variable for THAT scope's own two reads ONLY: the function body holds two MORE `arguments` reads nested inside `.on(evt, function(){…})` callbacks, where `arguments` is each callback's OWN binding, so rewriting those would be a silent behaviour change (a first pass rewrote all four; the cold-read-the-diff pass caught it pre-commit). Both were invisible for the whole Bun-support arc because NO CI leg — Node or Bun — exercised any connector; the SQLite leg of the container smoke found the first one on its first Bun run. Instrument lesson: a per-file `bun -e "require(f)"` sweep reported the entity file as parsing FINE (a stuck-FALSE reading); a `Bun.Transpiler` sweep over all 346 framework files was the known-positive control that located it, and a direct CJS require then reproduced the exact boot message. **Running a project's own tests under `bun test` (Bun 1.4.2).** Bun 1.4's runner closed the two blockers that made the `node:test` suite un-runnable under it — `(_, done)` callbacks (`done is not a function`) and `mock is not yet implemented` — so gina's suite now runs under `bun test` as a CI gate behind an expected-failures set. Two runner differences bite any project testing a gina app under Bun. (1) **`bun test` shares ONE process across files where `node --test` forks per file**, so a suite mutating `global`, `require.cache` or `process.gina` leaks state between files and its own pass count drifts between identical runs — pass `--isolate` (a fresh global object per file); `process.env` is isolated by neither that flag nor `--parallel`. (2) **`bun test` injects `NODE_ENV=test` with no opt-out**, and gina resolves the active environment as `process.env.NODE_ENV` FIRST, falling back to the configured env only when it is unset (`core/config.js`) — so a bundle whose config overlays and port matrix are keyed `dev`/`prod` silently resolves to `test`, and the boot-time port lookup throws on the missing key. Set `NODE_ENV` explicitly for the run; the same failures reproduce Bun-free under `node --test` with `NODE_ENV=test`, so this is the documented env override meeting a runner that sets it, not a Bun defect. And for tests that reach framework libraries: the file-scope `NODE_PATH` + `Module._initPaths()` recipe is a no-op against a RUNTIME mutation under Bun, so a bare `require('lib/<name>')` inside a test file throws `MODULE_NOT_FOUND` and every test in that file silently fails to REGISTER — and bun's JUnit reporter is blind to load-time errors, so the report shows a smaller suite rather than a failure (the exit code does fire) — require framework libs by computed path instead; the `_resolveFilename` shim in `core/gna.js` covers bundles, not this recipe.
1042
+ 292. **SQLite under Bun — every framework SQLite consumer resolves its driver through one seam (`lib/sqlite-driver`), and the Bun adapter stamps the node-shaped numeric `errcode` onto bun errors.** Bun **< 1.4** implements no `node:sqlite` (`No such built-in module`, measured on bun 1.2.21 + 1.3.14), so the sqlite ORM connector, session store and async-job store previously failed at boot under Bun while the framework state store silently degraded to JSON. `lib/sqlite-driver.getDatabaseSync()` tries `node:sqlite` FIRST (the Node path returns the native class verbatim — `Database` where the module exports it, since Node 26.11.0 renamed `DatabaseSync` and kept the old name as a deprecated alias (DEP0210), else `DatabaseSync` — zero Node delta, and the adapter self-retires if a future Bun ships `node:sqlite` — **and Bun 1.4 does: re-measured 2026-09-16 on `oven/bun:1.4.2`, `node:sqlite` resolves, so on Bun >= 1.4 the seam takes the Node path and the adapter is never constructed. The container smoke is the positive discriminator: it reports `driver node:sqlite` on 1.4.2 where 1.3.14 reports `driver bun:sqlite`. That report is a KIND decided by identity inside the booted bundle — `node:sqlite` when the live connection is an instance of the class the runtime's own module exports, `bun:sqlite` when it is the adapter — never a class name: Node 26.11.0 renamed the native class from `DatabaseSync` to `Database` (the old name stays as a deprecated alias, DEP0210) and `bun:sqlite`'s own class is also called `Database`, so a name can neither survive a rename nor tell the two drivers apart. Bun 1.4's `node:sqlite` error shape is field-identical to Node's (`Error`, `code: 'ERR_SQLITE_ERROR'`, numeric `errcode`, no `errno`), so `lib/connector-error` classifies it correctly WITHOUT the adapter's stamping. Because `engines.bun` still declares `>= 1.2`, CI runs a two-image smoke matrix — a bumpable current-Bun leg plus a DELIBERATELY FROZEN pre-1.4 leg that is the only end-to-end coverage the adapter path has**), else under Bun wraps `bun:sqlite.Database` in a `DatabaseSync`-shaped adapter covering exactly the surface the framework uses — constructor / `exec` / `prepare` → `get`/`all`/`run` with positional params / `close` — measured 13/13 parity on both bun versions (file creation, WAL pragmas, `null` bindings, `{changes, lastInsertRowid}` both numbers, `get()` miss → `undefined`, expando props on the handle, use-after-close throws). The one real divergence is ERROR SHAPE: bun throws `SQLiteError` with the numeric SQLite result code on `errno` plus a specific string `code` (e.g. `SQLITE_BUSY`), where node throws `Error` with `code: 'ERR_SQLITE_ERROR'` and the number on `errcode` — the adapter mirrors `errno` → `errcode` on every rethrown error so the transient/permanent classifier's numeric branch (`errcode & 0xff`) reads both drivers identically, extended codes included (a raw bun `SQLITE_BUSY_RECOVERY` string would miss the exact-string table and misclassify as permanent). Rule: any new SQLite consumer must resolve through the seam, never `require('node:sqlite')` directly (pinned per consumer). Bun boundary that remains: the mongodb connector cannot load under Bun at all — its own `bson` dependency calls `v8.isBuildingSnapshot()`, **still unimplemented as of Bun 1.4.2 (re-measured 2026-09-16: Bun 1.4 does NOT fix this, unlike its sibling gaps — it did ship `node:sqlite`, it does advertise the RFC 8441 `SETTINGS_ENABLE_CONNECT_PROTOCOL` that opt-in WebSocket-over-HTTP/2 needs — and #H13 ws-over-h2 is VERIFIED END-TO-END on Bun 1.4.2 (a booted https/h2 bundle, a real extended CONNECT, and an RFC 6455 round-trip through the shipped `lib/ws-framing`, with exact and `:param` routes both answering 200 and the result matrix element-for-element identical to node:24; bun 1.3.14 is the firing control, failing only at the advertisement) — and it does honour `allowHTTP1`; do not generalise from those to this one)**; that one has no framework-side fix. **`new require(mod)(args)` is a Bun boot-crash for every connector — and the repair is the PLAIN call, NOT `new (require(mod))(args)` (former #293):** the expression parses as `(new require(mod))(args)`: `require` is invoked as a CONSTRUCTOR (a constructor returning an object yields that object, so it evaluates to `module.exports`), which is then invoked as a PLAIN call. Node tolerates it (its `require` has a [[Construct]] slot); Bun's does not — `TypeError: function is not a constructor` at every such site. Measured on the same module under node:24 and oven/bun:1.3.14: `new require(p)(a,b)` works on Node / THROWS on Bun; `require(p)(a,b)` works on BOTH and on Node the two forms returned IDENTICAL results — the zero-Node-delta repair; `new (require(p))(a,b)` is WRONG because it would change Node semantics from a plain call to real construction, diverging for any connector that returns a primitive or nothing. Four live sites fixed: `lib/model.js` boot + reloadModels connector managers, `core/model/template/index.js`, and the `core/server.js` multipart liner. The sibling break behind it: `core/model/entity.js` reassigned `arguments` — V8 permits it in sloppy mode, JSC rejects outright (`SyntaxError: Invalid assignment target`) — repaired with a local variable for THAT scope's own two reads ONLY: the function body holds two MORE `arguments` reads nested inside `.on(evt, function(){…})` callbacks, where `arguments` is each callback's OWN binding, so rewriting those would be a silent behaviour change (a first pass rewrote all four; the cold-read-the-diff pass caught it pre-commit). Both were invisible for the whole Bun-support arc because NO CI leg — Node or Bun — exercised any connector; the SQLite leg of the container smoke found the first one on its first Bun run. Instrument lesson: a per-file `bun -e "require(f)"` sweep reported the entity file as parsing FINE (a stuck-FALSE reading); a `Bun.Transpiler` sweep over all 346 framework files was the known-positive control that located it, and a direct CJS require then reproduced the exact boot message. **Running a project's own tests under `bun test` (Bun 1.4.2).** Bun 1.4's runner closed the two blockers that made the `node:test` suite un-runnable under it — `(_, done)` callbacks (`done is not a function`) and `mock is not yet implemented` — so gina's suite now runs under `bun test` as a CI gate behind an expected-failures set. Two runner differences bite any project testing a gina app under Bun. (1) **`bun test` shares ONE process across files where `node --test` forks per file**, so a suite mutating `global`, `require.cache` or `process.gina` leaks state between files and its own pass count drifts between identical runs — pass `--isolate` (a fresh global object per file); `process.env` is isolated by neither that flag nor `--parallel`. (2) **`bun test` injects `NODE_ENV=test` with no opt-out**, and gina resolves the active environment as `process.env.NODE_ENV` FIRST, falling back to the configured env only when it is unset (`core/config.js`) — so a bundle whose config overlays and port matrix are keyed `dev`/`prod` silently resolves to `test`, and the boot-time port lookup throws on the missing key. Set `NODE_ENV` explicitly for the run; the same failures reproduce Bun-free under `node --test` with `NODE_ENV=test`, so this is the documented env override meeting a runner that sets it, not a Bun defect. And for tests that reach framework libraries: the file-scope `NODE_PATH` + `Module._initPaths()` recipe is a no-op against a RUNTIME mutation under Bun, so a bare `require('lib/<name>')` inside a test file throws `MODULE_NOT_FOUND` and every test in that file silently fails to REGISTER — and bun's JUnit reporter is blind to load-time errors, so the report shows a smaller suite rather than a failure (the exit code does fire) — require framework libs by computed path instead; the `_resolveFilename` shim in `core/gna.js` covers bundles, not this recipe.
1041
1043
 
1042
1044
  294. **DuckDB connector (`"connector": "duckdb"`) — embedded analytical (columnar / OLAP) store with the standard entity wiring.** Config keys: `database` (names the model dir `models/<database>/` AND the default file), `file` (path or `':memory:'`; defaults to `~/.gina/{database}.duckdb`), `readOnly` (driver `access_mode: 'READ_ONLY'`), `scope`. Driver: `@duckdb/node-api`, installed in the PROJECT — a caret pin `^1.5.5` fails npm E404 because the package publishes only prerelease-suffixed versions (`1.5.5-r.2`) and a caret never matches another version's prerelease tuple; use `>=1.5.5-r.0 <2`. Entity SQL loads from `models/<database>/sql/<Entity>/*.sql` (or flat `<Entity>_<method>.sql`) with `@param` casting (number/integer, float with comma→dot, string) and `@return {object|array|boolean|number}` shaping; `?` and `$1` both bind positionally as an array. Row-returning detection is dialect-wide (`SELECT|WITH|FROM|SUMMARIZE|PIVOT|UNPIVOT|DESCRIBE|SHOW`) because a bare ^SELECT test routes CTEs to the write path, where run() reports rowsChanged 0 and the rows are silently lost (measured). Rows come from `getRowObjectsJson()` — BIGINT/HUGEINT/DECIMAL/DATE/TIMESTAMP and COUNT values arrive as STRINGS (pg parity; `@return {number}` Number()s a COUNT result); the non-Json row getters leak BigInt wrappers that would crash renderJSON. Writes return `{changes}` (no insertId analog). Locks (measured): single-writer ACROSS processes — while one process holds a file read-write, no other process can open it at all; any number of READ-ONLY processes share one file; same-process re-open is fine (merged-process bundles share cleanly). `count` is an UNUSABLE SQL-method name on EVERY gina SQL connector (mysql/postgresql/sqlite/duckdb): gina extends Object.prototype with a property-counting `count()` helper (and `functionCount`), and the shared already-defined skip-guard (`typeof prototype[name] !== 'undefined'` — a prototype-chain lookup) silently refuses to attach `count.sql`, so calls hit the global helper instead of the query; rename the file (e.g. `countRows.sql`) — since 0.6.1 that skip is warned at boot (#B173). Errors stamp PERMANENT via the connector-error classifier (embedded engine — no transient network class). QI type `DUCKDB`; live index introspection via `duckdb_indexes()` in dev. The NAPI addon loads and queries under Bun (measured on 1.2.x).
1043
1045
 
@@ -1055,21 +1057,21 @@ Dev-mode query instrumentation captures every database query tied to the current
1055
1057
  305. **`self.push()` — the recipient is decided SERVER-SIDE, and reaching every client requires an explicit `{ broadcast: true }` (#B364, 0.6.8; live vulnerability in every release ≤ 0.6.7).** The engine.io push primitive used to read its recipient from the REQUEST BODY (`req[method].sessionID`), so any caller on a route that reached `push()` could aim a payload at another user's session by naming its id — and OMITTING the id fell open to a broadcast to every connected socket. The payload defaults to request input too, so both the target and the content were attacker-chosen. Resolution order is now `option.sessionID` (supplied by YOUR server-side code) → the caller's own session → nothing at all, with a warn; the request body cannot influence the recipient in any branch, and an all-clients fan-out must be asked for deliberately with `{ broadcast: true }`. **The migration this forces is NARROWER than the release first stated, and the correction matters:** carrying the recipient IN THE REQUEST is the vulnerability, so a hop that threads the queueing user's session id through the body stays closed — but the HTTP-hop SHAPE is recoverable whenever that hop is AUTHENTICATED. `option.sessionID` is the FIRST branch of the resolution order, so a request-bound controller that decodes a credential its own server minted can name the recipient itself (`self.push(payload, { sessionID: verified.sessionID })`), leaving the recipient server-decided and the request body still unable to influence it. ⚠️ `0.6.7` ACCEPTS `option` but never reads it for the recipient (verified at the tag — the recipient there is `req[method].sessionID` and nothing else), so an option-only migration is a SILENT no-op before `0.6.8` and a deployment spanning both versions must write BOTH sinks. What genuinely has NO substitute is a worker with no request context at all: `push()` returns early once the request is released (`local.req == null`) and nothing outside the controller can reach the socket set (measured — zero other `eio.clients` readers across core and lib), so that shape goes through polling `GET /_gina/jobs/:id` or a transport the application owns until an explicit out-of-request channel exists — **which now DOES: `gina.pushToSession(sessionID, payload[, option][, callback])` (#B366).** It is deliberately narrow, because the failure it replaces was a wide default: the recipient is a REQUIRED argument (absent/empty is an ERROR, never a fan-out) and **no broadcast is reachable from that API at all** — the deliberate all-clients send stays in-request as `self.push(payload, { broadcast: true })`. Source the recipient from SERVER-HELD state captured when the work was queued; round-tripping a BARE recipient id through any client-writable field hands the choice back to the caller and re-opens this bug one layer up — but a SERVER-MINTED, integrity-protected token naming the recipient is a sanctioned shape (the same pattern the #B364 fix documents for self.push()'s authenticated hop): the signature fixes the recipient at mint time, so the browser can only replay a decision the server already made. Conditions: the handler VERIFIES the token and derives the recipient ONLY from the verified claims (a plaintext id beside it is never consulted; a disagreeing one is overridden and logged — tamper detection for free); absent/unverifiable fails CLOSED with no unsigned fallback; keep it short-lived, because targeting integrity is NOT replay immunity — though a token naming a destroyed/rotated session matches no bound socket (#B365) and delivers to zero. Delivery is REPORTED, not assumed: `callback(err, {delivered})` fires exactly once with the socket count and `delivered: 0` is a normal outcome, because the shape it replaces was fire-and-forget and blind (a consumer measured ~41% of their progress pushes never sending, with nothing surfacing it). Coded errors: `PUSH_INVALID_RECIPIENT` / `PUSH_INVALID_PAYLOAD` / `PUSH_CHANNEL_NOT_CONFIGURED` (no engine.io — includes the express engine) / `PUSH_CHANNEL_NOT_READY` (before the bundle's first request publishes the instance) / `PUSH_PAYLOAD_SERIALIZE_FAILED`. Also `lib.push.toSession(instance, …)` for code holding its own instance. ⚠️ **The IN-REQUEST `self.push()` now refuses the same way on a channel-less engine (#B371).** The channel is an isaac-engine facility — `serverInstance.eio` is attached there and nowhere else — so on the express engine the client lookup used to dereference `undefined` and surface as an opaque TypeError-derived 500 naming neither push nor the channel. It now warns, hands a supplied `callback` a `PUSH_CHANNEL_NOT_CONFIGURED` error — fulfilling the `callback(err, result)` contract its JSDoc had always documented but the body never once invoked — and sends nothing, WITHOUT failing the request: the condition is structural and process-wide, identical on every call, so a notification side-channel does not take down the response it rode in on. ⚠️ **The obvious escape hatch does NOT work, and fails SILENTLY — measured.** `push()` resolves the caller's session from `req.sessionID` FIRST and only then falls back to `req.session.id`, so an app that assigns **`req.sessionID`** (a plain request property) to the target before the controller runs does keep delivering — but assigning **`req.session.id`** does not: `express-session` defines it as `Object.defineProperty(this, 'id', { value: req.sessionID })` with no `writable` (verified first-hand at `session/session.js:26`, v1.17.3), so outside strict mode the write is a no-op, no error is raised, and push() resolves to a freshly minted per-request id unrelated to the target. This correction is itself a worked example of the rule: a consumer relayed "it still delivers" as MEASURED having only verified the assignment LINE EXISTED, never that it EXECUTED — it sat behind a branch that could not be reached, and would have been inert anyway. Verifying a citation exists is not verifying it runs. Receiver-side identity is the SEPARATE second axis, and it is now CLOSED too (#B365): a socket's `sessionId` used to come from `payload.session.id` — client-sent, on EVERY message, never checked — so anyone could claim another user's session and receive its pushes, needing strictly LESS than the cookie because a rendered page carries the BARE sid in its bootstrap script while the cookie carries the signed form. It is now derived once at connection from the upgrade request's own cookie, by replaying the bundle's OWN session middleware over that request (same secret/store/cookie name, zero new config, and the framework never handles the secret — it works whether or not the bundle adopted `gina.plugins.Session()`), with an INERT response so a socket upgrade can never emit `Set-Cookie` or persist a session. Fails CLOSED: no middleware / no cookie / no verify ⇒ no id ⇒ the socket matches no targeted push and receives only deliberate broadcasts. A client that still asserts an id is logged and ignored — a free impersonation detector. Rule of thumb the pair encodes: decide the SENDER's aim and the RECEIVER's identity separately, and never let either default to a client-supplied value. Rule: a primitive whose blast radius is "everyone connected" must make the wide case the explicit one — a recipient that defaults to the request, and an absent recipient that means everybody, is a broadcast primitive any caller can aim.
1056
1058
 
1057
1059
  306. **Per-scope bundle deployment — `manifest.json` `bundles[<name>].scopes` (#B373, shipped in 0.6.9).** A registered bundle used to be deployed in EVERY scope: the only exclusion was leaving it out of `manifest.bundles`, which removes it from all of them. `scopes` is an OPTIONAL allow-list with the same semantics as a route's rule-level `scopes` — **absent or null means every scope** (so every existing manifest is unchanged), `["local"]` means that scope only, `[]` parks the bundle everywhere, and a NON-ARRAY is a named manifest error rather than a silent "no scopes" (the predicate returns false for both, so reporting a type error as "not deployed" would send the operator hunting the wrong thing). ⚠️ **Deleting `releases[<scope>]` by hand is NOT a substitute and never was** — measured: BOTH build verbs walk every project scope and re-seed any missing `releases[scope]` + `target`, so a hand-deleted entry regrows on the next build even one built for a different scope; absence cannot carry intent, which is why this is a key and not a convention. A boolean inside `releases[<scope>]` was also refused: `bundle:copy` and `bundle:rename` both `for (var env in entry.releases[scope])`, so it would be iterated as an environment. **Skip vs refuse is split by whether the exclusion was ASKED FOR:** the boot loop and `project:build` (bulk) SKIP an excluded bundle with a notice naming the scope and the remedy — one parked bundle must not block a project build, and a bundle vanishing silently is the #B183 lesson; the STARTING bundle and `bundle:build <name> --scope=X` (an explicit single target) REFUSE by name, because a silent no-op on a deploy script reads as success. The starting-bundle refusal is deliberately placed BEFORE the apps loop: skipping it instead would kill the boot further down in the #B181(b) env.json guard, whose message describes an entirely different cause. The predicate is DUPLICATED in `core/gna.js` because mount resolution runs before Config exists and cannot reach that closure — a test pins the two copies as behaviourally identical, since drift would mean a bundle skipped at one layer and mounted at the other. Both gna sites mattered: the CLI mount deref sits OUTSIDE any try (an excluded starting bundle died there as an opaque TypeError before Config's named refusal could run), and the mount-resolution loop's deref sits in a try whose catch ABORTS the whole mount (so one excluded sibling would have taken the process down at any non-dev scope). Seeding is filtered in both build verbs, which is what makes the opt-out durable. Documented in `schema/manifest.json` (optional, never required) and its docs-site copy. Rule the shape encodes: when a config key already exists whose ABSENCE you are tempted to overload as intent, check who WRITES it — a value your own tooling re-creates cannot express a decision. **The declaration also survives `project:add`/`project:import` (#B375 + #B376, fixed in the same release as this feature, 0.6.9).** Those verbs used to carry a 2023-era count-mismatch reset: whenever a project's DECLARED bundle count differed from a readdir of `<project>/src` (else `/releases`), the whole `manifest.bundles` block was emptied and written back — for EVERY registered project, not just the target — then only the import target was rebuilt from a six-key template carrying no `scopes`, no `gina_version` and no custom keys, with `version`/`tag`/release targets reset to defaults. A bystander project got NO rebuild (a permanently empty `bundles` block that fails its next boot), and plain `project:add` never rebuilds at all. The reset is retired (kept commented in `lib/cmd/helper.js` per the replace-don't-delete convention) and the end-of-loadAssets rescan now runs as a UNION for the current project: manifest-declared bundles keep their entries verbatim, disk-only bundles are appended for the additive #B55 seeding, and a declared bundle whose tree is absent is WARNED about once per command (naming bundle + scanned location) — never auto-pruned, because the declaration may be precisely this entry's scopes restriction; removal stays `gina bundle:remove`'s job. The rescan also derives each bundle's `configPaths.settings` from the loop-invariant scan root (#B376 — the old loop grew the root by one segment per iteration, so every bundle after the first pointed into its predecessors' tree and the protocol/scheme settings-consistency pass silently skipped it), and `addBundlePorts` skips a declared-but-absent bundle's settings check instead of dereferencing its missing `configPaths` (a latent TypeError reachable via a manifest declaring N bundles of which some are swapped for different on-disk names). Tests: `test/lib/project-manifest-resync.test.js` (17 — source pins + union/subtract replicas, red-first validated 11-fail/6-pass against the pre-fix source). **Registration is also protocol/scheme-hygienic (#B378 + #B379 + #B380, fixed in the same release, 0.6.9):** a project's `protocols`/`schemes` lists in `~/.gina/projects.json` are DERIVED bookkeeping constrained to the framework's supported sets in `~/main.json` — they may gain a value a bundle's `settings.json` validly declares (that is how the port matrix learns what a project's bundles use), but an unsupported value is warned about by name (bundle, value, allowed set) once per command and adopted nowhere, not even as the bundle entry's default. Previously ANY string a bundle declared was adopted and persisted, and `image:build` baked the polluted list into the synthesized container's environment (`ENV GINA_PROTOCOLS=…`); worse, the enrichment pass resolved EVERY registered project's bundles against the CURRENT project's path, so two projects sharing a bundle name (an `api`/`web` in both) leaked declarations into each other's registry entries from commands that never named them — each project's bundles now resolve against its own path. The import-time heal that rewrites an invalid bundle declaration to the project default still runs (it keeps the bundle bootable) but reports each change by name as a warning instead of a debug line, and the port-setup merge reads its source list by its own index (it read the target's, pushing `undefined` on overshoot — no demonstrated consequence, fixed for correctness) and admits only framework-supported values, so stale `ports.json` keys from a framework update cannot re-enter the lists. The runtime boot path never reads the project lists (measured — `core/gna.js` zero references, `core/config.js` one comment; `core/server.js`'s read is a dead variable), so pickup is CLI-side only. Tests: `test/lib/project-protocol-hygiene.test.js` (19 — pins + adoption/merge replicas with subtract arms, red-first 12-fail/7-pass against the pre-fix source).
1058
- 307. **Express engine — Express 5 supported, range declared `>= 4 < 6` (#B211, shipped in 0.6.9).** A bundle with `settings.server.json > engine: "express"` could not boot on Express 5, twice over: (1) the engine-agnostic catch-all mounted `all('*')`, and Express 5's router (path-to-regexp v8) REJECTS the bare-string wildcard at mount time — `TypeError: Missing parameter name`, exit before `listen()`; (2) past the mount, Express 5 defines `req.query` as a prototype GETTER (v4 assigned it from its auto-mounted query middleware as an own property), and the framework's request pipeline ASSIGNS `request.query` at 8 sites under `'use strict'` — each a per-request `TypeError: Cannot set property query ... which has only a getter`. Fixes: the catch-all pattern is ENGINE-CONDITIONAL — express mounts the RegExp `/(.*)/ ` (accepted + live-dispatching `/`, webroot and deep paths on Express 4 AND 5), while isaac KEEPS the string `'*'` because its request listener's dispatch gate is literally `path === '*' || path == request.url` (server.isaac.js) — a RegExp there matches nothing and every request HANGS with no response (measured; the gate is pinned by `test/core/express-engine-compat.test.js` as a tripwire). The express adapter (`core/server.express.js`) shadows `query` on the per-app request prototype with a writable own DATA property — a measured no-op on Express 4, and on 5 it restores the framework's owns-the-query-parse contract. The adapter logs the detected express version at engine construction (`engine: express v<X> (supported: >= 4 < 6)`), and an out-of-range major (`< 4` or `>= 6`) logs a LOUD warning but still boots — warn-not-refuse by design decision (a wrong refusal is a total outage; a wrong warning is a log line). Express stays CONSUMER-PROVIDED: deliberately not a framework dependency, and NEVER a peerDependency — npm >= 7 auto-installs peers, which would force express onto every consumer; install `express@^5` (or `@^4`) in the project itself. Server-side only ⇒ pickup = bundle restart, NO re-bake. Verified by a live A/B boot smoke on express 4.22.2 AND 5.2.1 (same scaffold, both serve `/web/` + `/_gina/health/check` + `/_gina/info` 200 and complete a POST through the query-assign sites) plus 13 unit pins incl. a pure-node replica of the getter mechanism. **#B666 (0.7.0):** the shadow alone left `request.query` UNDEFINED on Express 5 until the pipeline assigned it (its GET/HEAD branches only), and the DELETE branch plus the empty-body fallback of the POST/PUT/PATCH branches count it raw — so ONE DELETE, or one body-less POST/PUT/PATCH, killed the bundle (uncaughtException → SIGTERM; unauthenticated, any URL, before routing; measured live on express 5.2.1 against the released 0.6.33 — Express 4 and isaac never affected). The shadow is now an ACCESSOR on `app.request` (`queryAccessorDescriptor` in `core/server.express.js`): the getter materialises Express's OWN parse — its getter beneath the shadow, so the app's `query parser` setting is honoured at read time — as a PLAIN, writable own property on the first read (`querystring.parse`, the `simple` default on 5, returns a null-prototype object that gina's `Object.prototype.count()` cannot iterate; the copy is built with `defineProperty`, so a client `__proto__` key never reaches the setter), and the setter stores; on Express 4 (no getter on the chain) it reads undefined and stores — the data property's behaviour byte for byte. ⛔ NO `app.use` at engine construction: gina registers nothing before the bundle's `onInitialize`, and creating Express's router early freezes `strict routing` / `case sensitive routing` on both majors and the query parser on Express 4 ahead of a consumer's `app.set(...)` — the first draft did exactly that and was withdrawn on that measurement. Rated High 7.5 (CWE-476, the #B591 class), affected `>= 0.6.9 <= 0.6.33` with Express 5. Tests: `test/core/express-query-b666.test.js` (the shipped helpers extracted and driven on pure-node replicas of both Express request prototypes; red-first 19/24 against the released adapter). **#B668 (0.7.0):** the express engine never stripped the query string from `request.url` (isaac does, in its listener, before dispatch), so on BOTH majors every URL carrying `?…` answered 404 — routes AND statics (`/css/app.css?v=3`) — because `handle()`'s pathname, `handleStatics` and `fitsWithRequirements` all compared the query-carrying URL (measured live on 4.22.3 and 5.2.1 against the released 0.6.33; not an S6 regression). `core/server.js` now strips it for express inside the catch-all, after the `/_gina` handlers (they read `?key=` off the full URL) and before the webroot filter, the statics and the routing loop — materialising `request.query` FIRST, because the accessor reads the URL lazily, and inside that layer so a throwing `query parser` is a 500 through Express's own catch, never a process exit; `request.originalUrl` keeps the full URL. Consequence: the warm route cache's `method:path` keys collapse query variants on express exactly as on isaac (#B422 re-checks the verdict per hit). Tests: `test/core/express-url-query-strip-b668.test.js` (the shipped block extracted and executed, the isaac arm as the inert control; red-first 7/8 against the released server.js).
1060
+ 307. **Express engine — Express 5 supported, range declared `>= 4 < 6` (#B211, shipped in 0.6.9).** A bundle with `settings.server.json > engine: "express"` could not boot on Express 5, twice over: (1) the engine-agnostic catch-all mounted `all('*')`, and Express 5's router (path-to-regexp v8) REJECTS the bare-string wildcard at mount time — `TypeError: Missing parameter name`, exit before `listen()`; (2) past the mount, Express 5 defines `req.query` as a prototype GETTER (v4 assigned it from its auto-mounted query middleware as an own property), and the framework's request pipeline ASSIGNS `request.query` at 8 sites under `'use strict'` — each a per-request `TypeError: Cannot set property query ... which has only a getter`. Fixes: the catch-all pattern is ENGINE-CONDITIONAL — express mounts the RegExp `/(.*)/ ` (accepted + live-dispatching `/`, webroot and deep paths on Express 4 AND 5), while isaac KEEPS the string `'*'` because its request listener's dispatch gate is literally `path === '*' || path == request.url` (server.isaac.js) — a RegExp there matches nothing and every request HANGS with no response (measured; the gate is pinned by `test/core/express-engine-compat.test.js` as a tripwire). The express adapter (`core/server.express.js`) shadows `query` on the per-app request prototype with a writable own DATA property — a measured no-op on Express 4, and on 5 it restores the framework's owns-the-query-parse contract. The adapter logs the detected express version at engine construction (`engine: express v<X> (supported: >= 4 < 6)`), and an out-of-range major (`< 4` or `>= 6`) logs a LOUD warning but still boots — warn-not-refuse by design decision (a wrong refusal is a total outage; a wrong warning is a log line). Express stays CONSUMER-PROVIDED: deliberately not a framework dependency, and NEVER a peerDependency — npm >= 7 auto-installs peers, which would force express onto every consumer; install `express@^5` (or `@^4`) in the project itself. Server-side only ⇒ pickup = bundle restart, NO re-bake. Verified by a live A/B boot smoke on express 4.22.2 AND 5.2.1 (same scaffold, both serve `/web/` + `/_gina/health/check` + `/_gina/info` 200 and complete a POST through the query-assign sites) plus 13 unit pins incl. a pure-node replica of the getter mechanism. **#B666 (0.7.0):** the shadow alone left `request.query` UNDEFINED on Express 5 until the pipeline assigned it (its GET/HEAD branches only), and the DELETE branch plus the empty-body fallback of the POST/PUT/PATCH branches count it raw — so ONE DELETE, or one body-less POST/PUT/PATCH, killed the bundle (uncaughtException → SIGTERM; unauthenticated, any URL, before routing; measured live on express 5.2.1 against the released 0.6.33 — Express 4 and isaac never affected). The shadow is now an ACCESSOR on `app.request` (`queryAccessorDescriptor` in `core/server.express.js`): the getter materialises Express's OWN parse — its getter beneath the shadow, so the app's `query parser` setting is honoured at read time — as a PLAIN, writable own property on the first read (`querystring.parse`, the `simple` default on 5, returns a null-prototype object, which inherits no `count()` for the documented `req.get.count()` to call; the copy is built with `defineProperty`, so a client `__proto__` key never reaches the setter), and the setter stores; on Express 4 (no getter on the chain) it reads undefined and stores — the data property's behaviour byte for byte. ⛔ NO `app.use` at engine construction: gina registers nothing before the bundle's `onInitialize`, and creating Express's router early freezes `strict routing` / `case sensitive routing` on both majors and the query parser on Express 4 ahead of a consumer's `app.set(...)` — the first draft did exactly that and was withdrawn on that measurement. Rated High 7.5 (CWE-476, the #B591 class), affected `>= 0.6.9 <= 0.6.33` with Express 5. Tests: `test/core/express-query-b666.test.js` (the shipped helpers extracted and driven on pure-node replicas of both Express request prototypes; red-first 19/24 against the released adapter). **#B668 (0.7.0):** the express engine never stripped the query string from `request.url` (isaac does, in its listener, before dispatch), so on BOTH majors every URL carrying `?…` answered 404 — routes AND statics (`/css/app.css?v=3`) — because `handle()`'s pathname, `handleStatics` and `fitsWithRequirements` all compared the query-carrying URL (measured live on 4.22.3 and 5.2.1 against the released 0.6.33; not an S6 regression). `core/server.js` now strips it for express inside the catch-all, after the `/_gina` handlers (they read `?key=` off the full URL) and before the webroot filter, the statics and the routing loop — materialising `request.query` FIRST, because the accessor reads the URL lazily, and inside that layer so a throwing `query parser` is a 500 through Express's own catch, never a process exit; `request.originalUrl` keeps the full URL. Consequence: the warm route cache's `method:path` keys collapse query variants on express exactly as on isaac (#B422 re-checks the verdict per hit). Tests: `test/core/express-url-query-strip-b668.test.js` (the shipped block extracted and executed, the isaac arm as the inert control; red-first 7/8 against the released server.js). **#B847 (0.7.4):** with Express 4 and a `querystring`-based `query parser` (`app.set('query parser', 'simple')`), `req.delete` had no prototype on every DELETE to a path after the first (the routing loop copies the bag on a cold route only), so `req.delete.count()` and `.hasOwnProperty()` were not functions (measured on express 4.22.3); the DELETE branch now hands over a plain copy holding the query's own keys on every engine (`copyOwnQueryKeys`, shared with #B848), which also drops a `__proto__`/`constructor`/`prototype` field from `req.delete` on Express. Express 4's default `extended` parser (qs) and Express 5 (through #B666's accessor) already gave a plain object.
1059
1061
  308. **Boot-time bundle mounts are idempotent, atomic and concurrency-safe (#B381, shipped in 0.6.10).** Several processes may boot ONE shared project tree (e.g. replicas over a POSIX network filesystem) without racing each other's mounts. The primitive is `_.prototype.ensureSymlinkSync(destination[, type])` (helpers/path.js; value=SOURCE, arg=LINK NAME — the same convention as `symlinkSync()`), returning 'kept' | 'created' | 'replaced' | 'concurrent': (1) a link already resolving to the source (relative link text resolved against the link's own dir) whose source exists is KEPT — zero writes in the steady state; (2) otherwise it publishes atomically via a unique temp sibling in the SAME directory + `fs.renameSync()` (rename(2) atomic-replace: no absent-name window, no two-creator collision); (3) a create/rename failure is re-verified and a concurrent IDENTICAL publish counts as success ('concurrent'), anything else re-throws — fail-loud is preserved for a vanished release (source-exists guard) and for a REAL directory occupying the mount path (refused, never silently rm -rf'd — pre-#B381 the config loop silently deleted it). Consumers: `gna.mount` (core/gna.js — which also lost its early unlink whose catch lacked a `return`, a double-callback on a lost race), `isBundleMounted` (no pre-unlink; still forces the mount call when not started so a wrong link gets repaired), and core/config.js's every-bundle loop (previously N processes × M bundles of unserialised unlink/create rewrites per config load — now zero steady-state writes; the #B372 named-bundle abort remains for genuine failures). The mkdir side of the same check-then-create class is closed too: gna.mount's bundles/tmp/cache creation and `lib/generator` `createPathSync` use `fs.mkdirSync(..., {recursive:true})` (the per-segment exists/mkdir walk raced concurrent boots and threw EEXIST uncaught out of the mount). Tests: test/lib/path-ensure-symlink.test.js (real-fs arms incl. the concurrent-tolerance monkeypatch + its genuine-failure control) and test/core/mount-symlink-atomicity.test.js (call-site pins + a TWO-PROCESS contention proof whose pre-fix replica is the firing control — it must collide for the zero-failure arm to certify anything). Server-side only — none of the touched files are browser-bundled, so pickup is a bundle RESTART, no re-bake.
1060
1062
  309. **Maintenance mode — `settings.json > server.maintenance` (#MAINT1, shipped in 0.6.10).** A bundle can be closed to the public without being stopped: when maintenance is active every request EXCEPT the `/_gina/*` endpoints is answered `503` + `Retry-After` + `Cache-Control: no-store` with a self-contained maintenance page (HTML for a browser navigation, the shipped `{error:{code:'503',message:'GNA:GLOBAL:ERR:503',explicit:<message>}}` body for XHR / `X-Gina-Navigate` / json-only `Accept`). Config: `{enabled:false, retryAfter:300, message, bypassKey, allowFrom:[]}` — `enabled` must be a STRICT boolean, every other key falls back PER KEY with a boot warning, and a malformed block never refuses a boot (the `server.transientErrors` lint contract). **Placement is the feature, and it is why a route middleware cannot substitute:** the gate sits AFTER every `/_gina/*` handler and BEFORE the webroot filter, static-asset serving, both render/output-cache serve points and routing. Middleware only runs once a route has MATCHED, so a middleware-based maintenance mode leaves static assets serving 200 and answers 404 (not 503) for any unmatched URL; a cache serve point above a gate replays cached pages to the public. `/_gina/*` staying reachable is deliberate: `/_gina/health/check` keeps answering 200 so an orchestrator does not restart pods over a declared window (correct k8s maintenance keeps pods READY and serves the 503 from the app — this feature deliberately does NOT flip readiness, which would make the ingress return connection errors instead of your page; a probe that targets an APPLICATION route instead sits below the gate and must present `x-gina-maintenance-key` from the probe's own headers, on EVERY such probe — a failing liveness or startup probe makes the kubelet restart the container — with `bypassKey` in settings before the window opens (config-only; the runtime toggle cannot add it)), and the operator can always reach the toggle. Cost when off is one property read plus a boolean. **Bypass — the key is topology-independent, the IP list is not.** `bypassKey` is compared in constant time (`crypto.timingSafeEqual`, length-guarded, fail-closed when unset) and may be presented as the `x-gina-maintenance-key` header (programmatic callers) or once as `?gina-maintenance-key=…` in a browser, which mints a stateless `<expUnix>.<HMAC-SHA256>` cookie (`gina.maintenance`, 12h, HttpOnly/SameSite=Lax/Path=/, `Secure` on https) and 302s to the same URL WITHOUT the secret — the `Location` is the stripped PATH ONLY, never rebuilt from `Host` or any `X-Forwarded-*` header, since a redirect target built from attacker-controlled headers is an open redirect. Verification recomputes the MAC, so a grant survives a restart and works across every bundle of a merged-mode project sharing the key with nothing to replicate; rotating `bypassKey` revokes every outstanding cookie. `allowFrom` is honoured **ONLY for requests that do NOT classify as proxied** (proxied = a `true` `request._ginaIsProxyHost` stamp — a `false` one never vetoes, it derives from the same client-supplied `Host` — OR any `X-Forwarded-*` / `Forwarded` header OR a port-less `Host`, the last unless `server.proxy.requireForwardedHeaders`): behind a reverse proxy every `req.socket.remoteAddress` is the PROXY's, so an unconditioned IP allowlist would either admit the entire internet (proxy listed) or nobody (proxy not listed) — the condition turns that silent-open into fail-closed and leaves the key as the bypass that works under any topology. Since #B711 (0.7.1) a listed direct client also passes on an isaac bundle whose `server.protocol` is http/1.1: isaac's gate decides on the pristine `Host` and marks the request (`request._ginaMaintenanceAdmitted`), and the second gate in `core/server.js` honours the mark — before, it decided again after isaac had rewritten the `Host` without its port (isaac does so only under that protocol, so a bundle serving HTTP/2 was never affected, whatever protocol its clients speak), read the client as proxied and answered 503 on every page and static file (0.6.10–0.7.0). Resolution order: cookie → header → query(+grant) → IP∧¬proxied → 503. An invalid presented key is logged once, never with its value. **Runtime toggle:** `GET/POST /_gina/maintenance` (always-on, admin-gated on `app.json > admin.allowFrom`, both engines, declared ABOVE the gate so the off switch is never stranded behind it). Since #B714 (0.7.1) a JSON-bodied `POST` no longer stops an express bundle: the body reader threw on the text chunks that core/server.js's `request.setEncoding` delivers. Since #B709 (0.7.1) the toggle admits a loopback caller only when it connects DIRECTLY — a request relayed by a proxy on the bundle's own host is refused — and matches only its exact path, the root form or the bundle's own webroot form with any query ignored, so a nested path (`/_gina/health/check/_gina/maintenance`), the path in a query string, another letter case or `//_gina/…` no longer reaches it: call it on the bundle's port from the host or the pod, and give a same-host health-probe proxy an EXACT `location = /_gina/health/check`, never a prefix location. `POST {"enable":true|false[,"ttlSeconds":N,"retryAfter":N,"message":"…"]}`; the status payload reports `hasBypassKey` but NEVER the key. A runtime override is NOT persisted — a restart returns the bundle to its configured state, and an expired `ttlSeconds` reverts to CONFIG rather than to "off", so a forgotten dead-man timer can never re-open a site `settings.json` says is closed. `enabled:true` in config is the durable form. **`GINA_MAINTENANCE=1` (or `true`, any case; 0.6.32) boots a bundle CLOSED without a settings edit** — for a replacement pod created during a window; folded into the CONFIG layer, so the toggle still reopens the process and the status payload reads `source:'env'`; CLOSE-ONLY — `0`/`false`/unset leave the configured state (a rollout-time variable must never be able to open a site the release's configuration closed), any other value warns at boot and is ignored. Honoured under both launchers, on different transports: the daemon path (`bin/cli`) sweeps `GINA_*` into `process.gina`, so under the daemon the variable must be in the environment of the process that STARTED the daemon (a pod's init script; a warm dev daemon passes only its launch-time env), while `bin/gina-container` leaves it in `process.env` and never imports its own env into `process.gina` — the engine reads both (`getEnvVar` first, then `process.env`). **Replica sync (0.6.32) — `server.maintenance.store: '<kv namespace>'` + `pollInterval` (250..60000 ms, default 2000):** every `POST /_gina/maintenance` writes its runtime override to that namespace under the BUNDLE NAME as key (`{v:1, active, until, retryAfter, message, setBy:{pid,hostname}, at}`, store TTL = the remaining `ttlSeconds` window so the record vanishes and every replica reverts to config together; an `enable:false` is WRITTEN, never deleted, so runtime-off wins over a configured `enabled:true` replica-wide), and each process polls it on an unref'd interval whose first tick fires at boot — so one POST anywhere reaches every replica within one interval and a joining replica converges in one round-trip. The gate still reads LOCAL memory synchronously (#B383 holds, #P39 holds: no interval exists without `store`). A poll REJECTION keeps the last-known state (a store outage must never OPEN a closed site) and warns once per outage; a POST answered during the outage applies locally and replies `store: {written: false}`, and that local flip is SUPERSEDED by the next successful poll — the shared record wins, so re-issue the POST once the store answers; a resolved `null` means config; a malformed record is ignored. Boot: a namespace `lib.kv` cannot hand out REFUSES the boot (the `lib/rate-limit` / `lib/idempotency` shape — a deliberate exception to the never-refuse contract, which covers value shape), so does `failMode:'open'` (under it an outage reads as "no record" and would reopen every replica); memory-backed warns "PER PROCESS"; redis without `enableOfflineQueue:false` + `commandTimeout` warns. Status payload gains `sync:{store,key,lastSyncAt,lastError}`; a POST reply carries `store:{written,error}` — a failed write still applies locally and answers 200 with `written:false` (a 5xx would invite retrying a POST that already applied). The namespace is a CONTROL-PLANE surface (whoever can write it can close or reopen the deployment) — keep it private, the same trust boundary as sessions/rate-limit/idempotency in a shared store. **`ttlSeconds` is an INTEGER in 1..86400 (24h) and a PRESENT value outside that is refused 400 naming the bound and the config alternative (#B498, 0.6.28) — until then any invalid ttl (25h, a float, a numeric string) was SILENTLY ignored and the flip applied with NO timer, i.e. an unbounded window when a bounded one was asked for, `until: null` the only tell; absent or `null` still mean "no timer". Refused rather than clamped on purpose: a shorter-than-asked maintenance window reopens a site mid-deploy, so there is no safe direction to round toward (the instrument window clamps because a shorter CAPTURE window is harmless).** Scope is per BUNDLE: state lives on the engine instance and a server serves exactly one bundle, so merged-process mode gets per-bundle isolation for free. **And per PROCESS: the runtime override lives in the memory of the process that took the `POST` — never written or broadcast — so with replicas a `POST` closes ONE replica and a replica that restarts mid-window returns to config; the status payload carries `pid` + `hostname` (the pod name under k8s) so an operator fanning the `POST` out can read back which processes applied it. Coherence across a deployment is the consumer's to build — fan-out, or `enabled:true` in config rolled out to every replica; the bypass cookie is the exception, stateless and keyed on `bypassKey`, accepted by every replica sharing it.** **Verified scope of the "every request except the `/_gina/*` endpoints" claim:** the gate is pinned on the engine-agnostic `onRequest()` path (express) and the isaac request listener, above statics, both render/output-cache serve points and routing. Neither gate tests the path: an endpoint passes because its handler sits above the gate, so a `/_gina/` url no handler answers gets the 503 on both engines. Since #B715 (0.7.1) the isaac gate also lets through the `/_gina/*` paths that only the engine-agnostic layer answers — `/_gina/storage/stats`, `/gc`, `/verify`, and `/_gina/health/check` with a query string, which isaac's `$`-anchored handler missed on the raw url until #B717 — matched on the exact query-free root path (`_isLeftToServerJs`, kept in step with core/server.js's /_gina band by a parity test); before, they answered isaac's 503 for the whole window (0.6.10–0.7.0), so `gina storage:*` failed against a running isaac bundle. Since #B717 (0.7.1) `/_gina/health/check`, `/_gina/assets/routing.json`, `/_gina/release/status` and `/_gina/release/events` match `(?:\?|$)` on both engines — a query string missed them (isaac tests the raw url above its strip; express's /_gina band sits above the #B668 strip): a 404 on express, isaac's 503 in a window for the routing map and the release endpoints; isaac's routing-map fast path looks its asset up by the name its test matched (the query-free path's last segment would name `x` for `/x?y=/_gina/assets/routing.json`, which the unanchored test matches, and `localAsset.mime` would throw). Since #B718 (0.7.1) the health check answers `HEAD` on both engines — the GET status and headers plus `content-length`, no body — where HEAD fell through to routing: a 404, or the 503 in a window. The dev-only `/_gina/inspector`, `/logs`, `/indexes`, `/reveal` still miss a query string (LOW residual). **The contract holds under HTTP/2, MEASURED (#B383, resolved 2026-08-16) — and the reason is a CONSTRAINT that binds every future pre-routing gate: the gate must be SYNCHRONOUS.** Node's compat layer registers its own `'stream'` listener when a `'request'` listener attaches, so `core/server.js`'s separate raw byte-serving `onHttp2Strem` — registered lazily from inside the first h2 static request, and therefore SECOND on the same emitter — runs only after the compat listener returns. Because EventEmitter dispatches synchronously in registration order, a synchronous gate completes its 503 while the compat listener still holds the stack. An ASYNC gate (`await`, callback, promise, `setImmediate`) yields to the emitter first and the raw listener then serves the asset underneath it: measured as a 200 BYPASS in a 6-arm micro-replica whose synchronous arm held at 503, with a positive control serving 200. Live h2 boot confirmed statics/routed/unmatched all 503 while `/_gina/health/check` stayed 200, plus one harmless `ERR_HTTP2_HEADERS_SENT` (gina's listener losing the race it was always going to lose) which `lib/proc` downgrades to a warn — the bundle stays up. ws UPGRADEs are deliberately out of scope in slice 1 (existing sockets survive a window). Server-side only — `lib/maintenance` is absent from the browser `build.json`, so pickup is a bundle RESTART, no re-bake.
1061
1063
 
1062
- 310. **`Collection.replace()` resolves its comparison key from BOTH sides — the stored entry AND the caller's `set` (#B393, gh issue #64, shipped in 0.6.11).** `replace(filter, set[, key])` locates each entry to overwrite by comparing a key on the stored row against the same key on `set`. That key used to be chosen by inspecting the STORED row alone: it defaulted to the internal `_uuid`, fell back to `id` only when the stored row had no `_uuid`, and threw `No comparison key defined !` only in that same stored-row-lacks-it case. So the one combination neither branch covered — **stored row HAS `_uuid`, `set` does NOT** — compared `<storedUuid> == undefined`, which is never true: nothing matched, nothing was replaced, no error was raised, and the call returned a chainable result that looked successful. A silent, lossy write. Reachability is the non-obvious part: a Collection built from fresh raw data keeps no `_uuid` on the instance rows, so the `id` fallback fires and the call works — the defect appears only once the caller has **re-loaded an array a previous chained call returned**, because chained results carry the internal `_uuid` on every row the call did not replace (and `toRaw()` KEEPS a `_uuid` the caller supplied, since the constructor stamps `_hasItsOwnUuid` on reload). That is why it presents as intermittent rather than constant, and why persisting a chained result is the trigger. Now: the key is resolved per entry from both sides, falling back to `id` when BOTH carry one, and refusing loudly when the two sides share no usable key — so the previously-silent combination is no longer the quiet one. An explicitly supplied `key` argument is honoured exactly as before (no fallback, no refusal). The resolved key is also scoped per entry instead of assigned to the shared variable, so a fallback taken for one row can no longer apply to rows examined after it. Every previously-working shape is unchanged, including `set` carrying a matching `_uuid` and the fresh-collection `id` path. **`lib/collection` IS in the browser `build.json`, so pickup is a bundle RESTART **and** a re-bake.**
1064
+ 310. **`Collection.replace()` resolves its comparison key from BOTH sides — the stored entry AND the caller's `set` (#B393, gh issue #64, shipped in 0.6.11).** `replace(filter, set[, key])` locates each entry to overwrite by comparing a key on the stored row against the same key on `set`. That key used to be chosen by inspecting the STORED row alone: it defaulted to the internal `_uuid`, fell back to `id` only when the stored row had no `_uuid`, and threw `No comparison key defined !` only in that same stored-row-lacks-it case. So the one combination neither branch covered — **stored row HAS `_uuid`, `set` does NOT** — compared `<storedUuid> == undefined`, which is never true: nothing matched, nothing was replaced, no error was raised, and the call returned a chainable result that looked successful. A silent, lossy write. Reachability is the non-obvious part: a Collection built from fresh raw data keeps no `_uuid` on the instance rows, so the `id` fallback fires and the call works — the defect appears only once the caller has **re-loaded an array a previous chained call returned**, because chained results carry the internal `_uuid` on every row the call did not replace (and the FIRST `toRaw()` on a row KEEPS a `_uuid` the caller supplied, since the constructor stamps `_hasItsOwnUuid` on reload; a second `toRaw()` strips it). That is why it presents as intermittent rather than constant, and why persisting a chained result is the trigger. Now: the key is resolved per entry from both sides, falling back to `id` when BOTH carry one, and refusing loudly when the two sides share no usable key — so the previously-silent combination is no longer the quiet one. An explicitly supplied `key` argument is honoured exactly as before (no fallback, no refusal). The resolved key is also scoped per entry instead of assigned to the shared variable, so a fallback taken for one row can no longer apply to rows examined after it. Every previously-working shape is unchanged, including `set` carrying a matching `_uuid` and the fresh-collection `id` path. **`update()` writes each matched row back over the row it came from (#B822, 2026-10-09).** It used to find that place by comparing a key on each stored row with the same key on the MERGED row, after `toRaw()` had stripped the matched rows' `_uuid` in place — on a collection and on a chained result the matched rows ARE the stored rows. Rows with no `id` then compared `undefined == undefined`: every matched row went over the FIRST stripped row (a row lost, another written twice, the rest not updated, no error), and so did a SINGLE matched row once an earlier `update()` or `toRaw()` on the same collection had stripped a row before it; an empty filter, a row with no `id` before one with an `id`, rows sharing an `id` and an explicit `'id'` key on rows without one hit it too, and rows found through another collection were not written at all. Now the place is the stored row itself when the matched row is one (identity), else the stored row sharing a key with it — the explicit `key`, else `_uuid` when both carry one, else `id` when both do — never a key one side lacks; a place is written once, and a row matched by two filter objects once. Output shape unchanged: an updated row still loses the collection's `_uuid`. **`find()` given several filter objects (an OR clause) lists a row ONCE (#B827, 2026-10-10).** The match block listed a row once per filter it matched, because the guards meant to skip a row already listed looked a `_uuid` string up in an array of row objects: a row matching two filters came back twice (the same object), `limit(n)` on that result dropped a real row, and a chained call met the row twice. Now the row is listed once, in collection order, and the remaining filters are not read for it; a call whose filters cannot match the same row (two values of one key) is unchanged. **`notIn()` and `delete()` take the rows they found out by identity (#B826, 2026-10-10).** With a filter object the found rows ARE rows of the searched array, yet each was located in the clone by a key read from the FIRST found row (`_uuid`, else `id`): after `update()` or `toRaw()` had stripped the `_uuid`, rows with no `id` threw `No comparison key defined !`, rows sharing an `id` lost the first row holding it (the wrong one, no error), and the no-key form `delete(filter, false)` threw on rows with no `id` and removed nothing for a dotted key. Now, when no key is named and every found row is a row of the searched array, each is spliced out of the clone at its own place; a named key and rows from elsewhere (the array form) keep the key comparison, and such rows carrying neither the key, a `_uuid` nor an `id` are still refused. **`lib/collection` IS in the browser `build.json`, so pickup is a bundle RESTART **and** a re-bake.**
1063
1065
 
1064
1066
  311. **Per-call identity for concurrent entity calls — the ENTITY layer pairs each emit to the call it came from by AsyncLocalStorage identity (#B440, 0.6.20 — SECURITY; it was FIFO-paired from #B394 in 0.6.11 until then), the COUCHBASE CONNECTOR layer settles per call (#B429/#B430/#B431, 0.6.19). Two different mechanisms; do not reason from one to the other.** ⚠️ The description below covers ONLY hand-written entity methods that call `self.emit('<shortName>#<method>')` — and registration is a SOURCE-TEXT scan (`entity.js` tests `entity[prop].toString()` for the literal, comments INCLUDED): a comment that merely names the trigger registers the method, passing the trigger name to a helper registers it, and removing the last occurrence un-registers it (plain function: no wrapper, no `.onComplete()`, no Promise return — a call-contract change for its callers). Methods generated from `.sql` files never reach it — `core/model/entity.js:349-351`/`:414-417` say so verbatim (the connector emits the PREFIXED `N1QL:entity#method`, the entity buffer listens on the unprefixed name), so their guarantees come from the connector, described at the end of this entry. **Entity layer (`core/model/entity.js`):** The `util.promisify` fast-path (taken when a method is called detached — `this[m]` undefined + trailing function arg) used to back its pending callback into a SCALAR slot (`entity._callbacks[shortName] = cb`) plus a per-call `.once` guarded on that slot. Two concurrent calls on the SAME method raced on the one slot: the second overwrote the first, the first-arriving result was flushed to the LAST-registered callback (cross-delivery — caller B receives caller A's record), and the displaced caller's `.once` found its guard false so its promise NEVER settled (starvation — a hung request, nothing logged; the write-path variant silently persists A's document under B's key). Option B (entity-context calls) had already been given a FIFO queue + one persistent `.on` dispatcher (#M2); the fast-path kept the scalar because its own comment claimed it "bypasses queue". Now it uses the same shape: push each invocation's callback onto `entity._callbacks[shortName]` (an array), register ONE persistent `_onFpQueueEmit` dispatcher (guarded on `listenerCount === 0`) that shifts the OLDEST callback per emit and removes itself when the queue drains. The custom `emit`'s third guard already routes an ARRAY slot straight to native emit (skips `setListener` when `!Array.isArray`), so the `.on` listener receives the emit args directly. Guarantees after #B394: no callback is ever orphaned by a SIBLING call's overwrite; cross-delivery closed for in-order completion. ⚠️ **#B394's "starvation ELIMINATED" was TOO STRONG, and its documented out-of-order residual was the smaller half of the problem — #B440 (0.6.20, SECURITY): ONE lost emit permanently desynchronised the FIFO.** Both dispatchers paired an emit to the OLDEST queued resolver with no call identity, so a call that never emitted (canonically a throw inside an un-awaited `async` callback BEFORE the emit — swallowed, only `unhandledRejection` sees it) left its resolver at the head forever: with overlapping callers every later caller of that method received the NEXT caller's record and the last one hung; sequential callers all hung; the desync survives dev hot-reload and DEEPENS by one dead resolver per lost emit (measured in a real boot on both call forms: `LOSE→B, B→C, C→D, D HUNG, LATER HUNG`). Same failure shape as #B429 — where the method reads a user-scoped record, an ownership check can pass on another principal's row — hence a Security entry. The trigger is DATA-dependent (an unexpected record shape), not load-dependent: invisible in a load test, inevitable in a long-lived process. **Fix:** every wrapped call runs inside a per-process `AsyncLocalStorage` (`process.gina._entityCallALS`, shared across hot-reload generations) carrying `{ e, r }` (trigger + this call's resolver); both dispatchers call `_dequeueByIdentity(q, e)` — store names THIS trigger ⇒ splice that call's own resolver, or DROP the emit if that call already settled (never hand a late completion to the head: the tempting forget-then-`shift()` variant measurably hands A's late record to B); no store, or another trigger's ⇒ `shift()` in arrival order plus a levelled `DISPATCH:NO_CONTEXT` debug line — the honest boundary, a completion reaching the entity outside every call's async context (e.g. a native driver invoking callbacks from a loop started at boot), measured identical to pre-fix. Resolvers `_forget` themselves on settle while the persistent listener stays, which is what makes a late duplicate emit DROP instead of being buffered into `_arguments` and poisoning the next fast-path call. The fast-path now captures `cached.apply()`'s return and chains `_fpInner.then()` — its old comment claimed an escape via `_innerResult.then()` that exists only in Option B, so a Promise-returning method was immune on Option B and NOT on the fast-path (measured; a consumer's promisify→direct-await conversion was therefore necessary, not belt-and-braces). The fast-path also runs the caller's raw callback inside the store that was active when the call was made, so an entity method that calls another entity's method with a direct callback and emits its own completion from inside it still pairs by identity (measured: without that it fell back to arrival order; `.onComplete`/`.then`/promisify chains pair by identity regardless, because promise continuations keep their context). The #B394 out-of-order residual is CLOSED as a by-product (each own on both forms; `entity-promisify-concurrency.test.js` §03 now pins each-own). **Opt-in bound `settings.json > model.emitTimeout` (ms; absent/0 = no bound, the previous liveness contract; schema + settings reference + Models guide document it):** read once per entity at wrap time via `self.getConfig(self.bundle,'settings')`, it rejects a call that never completes with an Error naming the trigger and `#B440` and logs the same line at warn; set it above the slowest legitimate bulk operation, which is why there is no default. Cost ≈ +3.6 µs/call. Test `test/core/entity-call-identity.test.js` (22 arms across both call forms — lost emit, the bound, a lone later caller, out-of-order, the fast-path Promise chain, late-duplicate drop, callback chain, no-context fallback with its debug line, config read, drain; red-first on the pre-fix bytes through its `B440_ENTITY_SRC` lever: 17 red, the 5 green are the labelled controls). ⚠️ The published Models guide's concurrency note used to promise *"no call is ever left hanging"* — false before #B440 and true only under the bound — and its `insert` example wrapped a synchronous `try/catch` around an asynchronous callback, which cannot catch a throw raised inside that callback: the trigger shape itself. Both corrected in the same release. Framework-internal `promisify` sites (`controller.js` `self.query`, `form-validator.js`) promisify a CONTROLLER method, not an entity trigger, so they never enter this branch (gated on `entity._triggers`). Server-side only — NOT browser-bundled, so pickup is a bundle RESTART, no re-bake. Test `test/core/entity-promisify-concurrency.test.js` (4 arms, bounded-settle so a regression fails rather than hangs; red-first validated against pre-fix bytes — serial control green, the three concurrency arms red; §03 tightened to each-own by #B440). **Couchbase connector layer (`core/connectors/couchbase/index.js`, #B429, 0.6.19 — SECURITY):** the completion trigger `'N1QL:'+entity+'#'+method` carries NO call identity and is emitted on the entity SINGLETON (`EntitySuper[Name].instance`, `entity.js:475-493`), so the Promise/`await`/`.onComplete()` path — which reached `self.once(trigger)` because its `_internalCb` is a function — was settled by a listener EVERY in-flight caller of that method shared. Node fires all listeners on one emit, so the first completion woke them all with ITS payload and removed them: a BROADCAST, **not** arrival-order pairing, so it cross-delivered on IN-ORDER completion too (measured `A→A, B→A`) — strictly worse than the entity-layer residual above, and the reason a confidentiality/authorization concern arises (an ownership read answered with another caller's row). The explicit trailing-callback form was always safe (it settles from `onQueryCallback`'s own closure). **Fix:** the Promise path assigns `_mainCallback = _internalCb` so BOTH forms settle through one per-call `_deliver()` guard; `register()` collapses to a single dispatch and `_isRegisteredFromProto` is retired (measured inert — reset every invocation, and `register` has no `await`, so it never actually starved a query); the early error emit is gone; ONE emit per completion remains, deliberately, because `entity.js`'s emit override forwards an `N1QL:*`-matched trigger to `lib/inspector-events` (verified live) — a side effect is that the bridge now also sees direct-callback completions it previously missed. `bulkInsert` carried the same defect independently (its own trigger + `once`) and is fixed the same way. **`bulkInsert` also carried a SECOND, unrelated defect that #B429 did not reach — #B460 (0.6.24): its outer `try` wraps its OWN function body, so a synchronous throw in the prologue was caught, `console.error`d and swallowed, and the method fell off the end returning `undefined`.** Both documented shapes broke on that path: the `await` form (its own docblock's first `@example`) resolved with `undefined` — a caller treating "did not throw" as success recorded an insert that never happened — and `.onComplete(cb)` threw a TypeError on `undefined`; in both, the error existed only in the log and was unreachable to the caller. ⚠️ **The trigger is NOT only a cluster outage:** the prologue carries two DELIBERATE argument validations (`rec` falsy; a record without `.values`) whose errors the author wrote to reach the caller, which makes the defect reproducible with no cluster at all — `entity.bulkInsert(undefined)` is a complete repro, and that is what makes it testable without the SDK. **Fix:** the promise, its one-shot `_settle` resolver and the `.onComplete` shim are built BEFORE the try, so the catch settles this call (`_settle(err); return _promise;`) — `.onComplete(cb)` receives `(err)`, the `await` form rejects, and `_settle`'s `_settled` latch means a late throw cannot double-settle. ⚠️ **SCOPE — the fix moves the RETURN axis only, not the SETTLED-VALUE axis, and conflating them is what a consumer will do:** the success handler still runs `if (!_data || _data.length == 0) { _data = null }` and only promotes an error when `_meta.errors` is present, so a rows-less success reaches `_settle(false, null, _meta)` and RESOLVES WITH `null`. A non-rejection therefore still does NOT prove rows were inserted — a rows-based success check remains load-bearing after the fix (measured with a consumer whose guard was written against the pre-fix `undefined`). Generalises: after fixing a settlement defect, say which of the two axes moved — what the function RETURNS synchronously, vs what its promise RESOLVES WITH — because any downstream guard or comment written against the untouched axis keeps its conclusion while its stated premise goes stale. ⚠️ **Behaviour change: a fire-and-forget call that ignores the return now surfaces an `unhandledRejection`** where it previously failed silently (gna.js logs it, never responds) — deliberate, and documented in the migration guide. **The QUERY path does NOT share this shape and needed no change:** its promise is built inside `entities[entityName].prototype[name] = function(){…}`, an ATTACHED method, so the enclosing try has already exited by call time and a throw propagates to the caller normally — `bulkInsert` is the only method whose try wraps its own body. Generalises: **a `try` that wraps a whole promise-returning function body must settle in its `catch`, or the contract silently inverts on the failure path** — and the plumbing it settles through has to be constructed OUTSIDE that try, or it is still `undefined` when the catch runs. Tests: `test/core/couchbase-connector.test.js §14` (6 arms over EXTRACT-AND-EXECUTED shipped bytes — both call shapes driven through the real validation throws, plus three controls that are green pre-fix: the extraction anti-vacuity, the happy path reaching `resolveCluster().query()`, and the query-path-is-different pin; red-first measured 3 red / 3 green). **Siblings found while fixing it:** #B430 — the delivery `catch` re-invoked a THROWING caller callback with the same payload (ran it twice); #B431 — all three dispatches chained `.catch(onError).then(onResult)`, and a `.catch()` returning normally RESOLVES, so the trailing `.then()` ran on EVERY error and settled a second time with a bogus empty success (measured: `(Error,null,undefined)` then `(false,null,{})`, so `if (err) return next(err); render(data)` ran BOTH branches; invisible on the await path because a promise settles once, but it is why a failed query emitted 3×). Now `.then(onResult, onError)` — mutually exclusive branches — at all three sites. **Scope, PER DEFECT — the `.once(`/`.emit(` count scopes #B429 ONLY** (it requires a shared emitter; #B430/#B431 involve none, so that instrument is structurally blind to them — an over-scoped 'couchbase only' was relayed on 2026-08-27 and retracted the same day). **#B429: couchbase ONLY** — the other six ORM connectors settle on a per-call native Promise and use the trigger for debug/inspector logging only (`.once(`/`.emit(` = 0 in each, 12 in couchbase). **#B431: couchbase ONLY, verified with a PAREN-MATCHING scanner** (a character-window regex false-positived twice by spanning `});`+`return`+`else` into a different statement's `.then`) — validated against the pre-fix file as a known positive: 3 there, 0 across all nine connectors now. **#B430's class IS present elsewhere — triaged 2026-08-28 as #B432, and the count is 53, not the ~20 the first pass suggested.** A caller's callback is application code and throws for ordinary reasons (a template error, a null deref in a handler); two shapes then ran it a SECOND time with a different payload — the sync `try { cb(null, rows); } catch (e) { cb(e); }`, and the mirror `.then(function(){ cb(null, rows); }).catch(function(e){ cb(e); })`, whose trailing catch is reached when the SUCCESS handler throws. Both deliver a success and then an error for one operation (so `if (err) { return next(err); } render(data);` runs BOTH branches) and the second call reports the caller's own exception as a database failure. ⚠️ **Four instrument corrections, each of which had produced a wrong reading:** (1) a hand-written settle-name list MISSES the real callbacks — derive them per file (a param that is invoked, an `args.pop()` capture, a resolver binding); the stores settle through `fn`, and 35 sites hid behind a `0`. (2) A settle reached through a LOCAL HELPER is invisible without a fixpoint pass (`attempt`, `runQuery`, `withCollection`). (3) A lexical try/catch pair is NOT a defect when the settle sits in a nested async callback (its throw never reaches the enclosing sync catch — this alone cleared mysql, postgresql and duckdb) nor when an inner `try/catch` swallows it first, nor when the trailing settle lives in a SIBLING `else` branch. (4) A native promise resolver settles once, so a double settle through `_resolve`/`_reject` is BENIGN — 7 of 60 findings. Validate any such scanner on the pre-fix couchbase file as a known positive (it must report the #B430 site and both #B431 sites) and on the post-fix file (0). **Measured clean, both directions: mysql, postgresql, duckdb, ai** (`ai` has no callback path at all — only a native resolver). **FIXED in the entity dispatch path (0.6.19):** `core/connectors/settle-once.js` — a dependency-free sibling of `param-redact`/`sql-parser` exposing `settleOnce(label, cb, reporter)`, which returns a PER-CALL guard that delivers at most once, forwards any arity, and reports a callback throw (tagged with the query trigger) instead of replaying it. ⚠️ Build it per invocation, never at module scope — a module-scope guard would let the FIRST call suppress every later one. Wired at sqlite (`node:sqlite` is synchronous, so its callback ran inside the `try` with no microtask boundary — the most reachable instance of the whole class), mongodb (callback dispatch AND the unknown-op branch, which is reachable because `op` is validated only for falsiness, never against the recognised list) and scylladb. `couchbase/index.js` keeps its own inline `_deliver()` — the reference implementation this module generalises. **Store layers — the same shape with framework-supplied callbacks, fixed at METHOD ENTRY** by rebinding (`fn = settleOnce(label, fn, console)` immediately after the `fn = noop` normalization), so every settle path in the method — nested try/catch AND promise chain — funnels through one guard: **session stores** (couchbase v3/v4, mongodb, redis, scylladb, sqlite — 30 methods) and the **async-job stores** (mongodb, sqlite — 10 methods). ⚠️ **A LEXICAL scanner still reports these files HARMFUL, and that is CORRECT-and-expected, not a regression** — the fix REBINDS `fn` rather than renaming call sites, so the matched `fn(...)`-in-try-plus-catch shape is unchanged. A syntactic scanner's post-fix reading is evidence ONLY when the fix changed the syntax it matches; when it rebinds, the verification burden moves entirely to behavioural coverage (`connector-settle-parity.test.js` §05/§06, one arm per store over EXTRACT-AND-EXECUTED shipped bytes plus a wrap census pinning method-count == wrap-count per file). **Connector open paths (`mongodb`/`scylladb` `lib/connector.js` `onReady`) — FIXED, wrapped CONDITIONALLY** (`if (typeof fn === 'function') fn = settleOnce(…)`; measured: an unconditional wrap turns a missing callback from a loud `fn is not a function` rejection into a silent boot hang). The handler is `core/model/index.js`'s `connect` continuation; measured through the real bytes of both, a throwing continuation was re-invoked with a fabricated `Connection failed: <its own message>` AND the connector registry cache was overwritten to `err=<fabricated>, conn=null`, served to every later `connect()` for the process life — now 1 invocation, `err=null`, cache intact, the exception reported under `<connector>:connector#onReady`. The sqlite `inspector#indexes` listener is guarded for consistency (its `_ixCollector` caller has no throwing path; if it ever did, the double decrement would answer `/_gina/indexes` early with partial data). **Couchbase storage-store — CONVERTED to the shared guard** (its own local `once()` already prevented the double settle — measured on all 9 verbs with a firing subtract-control — but its JSDoc claim that the exception 'surfaces as an unhandled rejection' was FALSE on all nine: six verbs lost it silently, three (`stats`/`listZeroRefs`/`listKeys`) logged it misattributed as `<verb> failed`); now 9 wraps at verb entry (`couchbase:storage#<verb>`, reporter = the file's own global `console`), the exception reported once and never entering the CAS-retry / `withCollection` catches. The `once`→`settleOnce` swap is inert for callers: no consumer of any verb's return value exists (measured), and every strategy closure opens `if (err) return fn(err)`. **Every one of the 53 triaged sites is now guarded — the class is CLOSED** (4 entity-dispatch + 24 session-store + 10 job-store + 5 connector-open/Inspector + 10 storage-store). Test `test/core/connector-settle-parity.test.js` (one contract declared ONCE and run against every fixed connector, plus a deliberately UNGUARDED replica that must fail the discriminating arms — without it a spec every backend passes could be a spec asserting nothing; red-first measured 11 pass / 19 fail pre-fix, with every green in the code-the-fix-does-not-change bucket). Server-side only, pickup = bundle RESTART, no re-bake. Test `test/core/couchbase-concurrency.test.js` (25 arms booting the REAL connector against a controllable cluster stub so completion ORDER is chosen not raced; callback arms CAPTURE every invocation behind a grace window so a double settle is observable; red-first validated — 16 red pre-fix, and the arms that stay GREEN pre-fix are exactly the controls: serial, explicit-callback, mixed-form-no-starvation, success paths, the Inspector bridge). **#B441 (0.6.30, SECURITY) — a completion emitted AFTER its call settled is discarded at the entity's `emit`, never buffered for the next caller.** Both dispatchers remove themselves once their queue drains, so when a method emits its completion trigger more than once per call (once per loop iteration, for instance) the first emit settles the caller correctly and every SURPLUS emit finds no listener and takes the legacy `setListener` buffering path into `entity._arguments`; the fast-path's next detached caller then consumed that entry as its own result (`DISPATCH:BUFFER_CALLBACK`), the caller after it too, and the buffer grew by one entry per surplus emit — measured on a built prod release (B and C both received A's record, `_arguments` 2→4→6). Entity-context callers were immune (the #M5 per-call clear), and DEV MODE MASKS IT COMPLETELY (`isCacheless` runs the same clear on every wrapped call), so a local dev reproduction reading clean is not evidence. Fix: `_forget` — the single choke point of every settle path (identity dispatch, returned Promise, `model.emitTimeout`) — stamps the resolver `_settled`; the `emit` override reads the active per-call store and, when it names this trigger and its resolver is settled, marks the emit SURPLUS: `setListener` is skipped (nothing buffered) and `DISPATCH:REPEAT_EMIT` is logged ONCE per call at the second emit (one late emit after a Promise/timeout settle stays silent — the documented benign shape). `DISPATCH:NO_CONTEXT` moved from `_dequeueByIdentity` to the same emit-time site and now fires pending or not (a zero count used to be ambiguous: the line was gated on a non-empty queue that the self-removed dispatcher never reached). Numbered `<trigger>N` loop variants of the call's own trigger stay silent. The two `listenerCount(trigger) === 0`-after-drain invariants are untouched. Pickup: bundle restart, no re-bake. Test: `test/core/entity-b441-dispatch-signals.test.js` (15 arms; red-first 10 red / 5 controls on the pre-fix bytes via `B440_ENTITY_SRC`). **The registry that holds those singletons is keyed on (bundle, model, className) — NOT on the bare class name (#B555, 2026-09-18).** `EntitySuper[<key>]` is a process-wide static bag on the exported constructor, and a bare class name is unique only WITHIN one model: every ORM connector builds its classes from `models/<database>/entities/`, so two connectors of one bundle that declare a class of the same name landed on ONE slot — guaranteed when they share a `database`, and equally reachable across two DIFFERENT databases that each carry a `user.js` (measured: the bound is the class name, not the database). `init()` returns the registered instance when the slot is taken, which skips `setListeners()` — the ONLY path to `modelUtil.updateModel()` — so the model walked SECOND by the attach loop was left with a bare `{ _connection, getConnection }` and no entities. Attach order is connection-READY order (`lib/model.js`'s loop walks `self.models[bundle]` in the insertion order `onModelReady` created), so WHICH connector lost varied between replicas of one release; `getModelEntity()` for the loser still 'resolved', to a fresh instance that was never WIRED (no `_triggers`), which is the quieter second shape. ⚠️ Dev mode CANNOT reproduce it and that is structural, not luck: each connector deletes `core/model/entity.js` from `require.cache` and re-requires it, so every connector gets a fresh registry with empty statics — which is why no local drive ever saw it and the reporter measured it only on a deployed non-dev runtime. `EntitySuper.key(bundle, model, className)` is exposed as a static because ONE caller outside entity.js needs the same key — the `.sql`-generated prototype methods in the couchbase connector recover the singleton from the registry when called detached (#B11), and they have only the class name in scope, so they take the pair from the connector's own `infos`. Set AFTER `inherits()`, which returns a fresh constructor a pre-inherits static would not survive onto. **Safety net in the same arc:** `lib/model.js` step 2 now retains each constructed instance and fails fast — emerg + a synchronous stderr flush + `exit(1)`, the #B57 shape — naming any declared entity class that did not reach its model, because the old failure SERVED: the bundle listened and each call died later at request time. An entity setting `hasOwnEvents` opts out of the wiring and returns before `updateModel()`, so it is legitimately absent and is read off the INSTANCE and skipped; the dev-only `reloadModels` twin is deliberately left unguarded for the cache-busting reason above. Tests: `test/core/entity-registry-b555.test.js` (7 arms, red-first 4 red / 3 green on the pre-fix bytes — same-database both orders, two databases one class name, the un-wired `getModelEntity()` shape, and a dev-mode control that attaches both) + `test/lib/model-entity-attach-b555.test.js` (18 arms; `loadAllModels` is not unit-isolatable, so the guard's decision logic lives in two PURE module-level functions the test EXTRACTS and executes as shipped bytes rather than replicating). ⚠️ Live-validated against a real two-connector bundle whose class names do NOT collide (one entity dir populated, one empty) — the guard stayed silent, the boot completed and the entity-backed routes answered, which is the false-positive check a fail-fast owes.
1065
1067
 
1066
- 312. **Every `Collection` method that accepts a filter object refuses undefined-valued filter keys — the silent match-all is closed (#B396, gh issue #65, shipped in 0.6.12).** `find()` round-trips its filter objects through `JSON.stringify(arguments)`/`JSON.parse`, and stringify silently DROPS keys whose value is `undefined` — so `findOne({ id: source.missingId })` degraded to the match-everything `{}` filter and returned the collection's FIRST row (an arbitrary, plausible-looking wrong record), a mixed filter silently lost its undefined constraint, and `update({ id: undefined }, set)` wrote `set` onto EVERY record. The in-loop guard deeper in the matcher (message: ``filter `<key>` cannot be left undefined``) was written to refuse exactly this input but was DEAD CODE — the serialization stripped the keys before the loop could see them (JSON.parse can never produce an `undefined` value). The fix hoists the refusal to `find()`'s entry, BEFORE the round-trip; `findOne`, `or` and `update` all delegate to `find`, so the one gate covers the family. Deliberately unchanged: an explicitly EMPTY `{}` filter still means "no constraint" (match-all), `null` stays a legal needle comparing strictly against stored values (matches stored `null`), array arguments are skipped (record sets, not needles), and `notIn`'s ARRAY form (`notIn(rows, key)`) is unaffected because it skips `find()` entirely. ⚠️ Every OTHER filter-object entry point IS covered, including four this entry originally excluded by mistake: `notIn({…})` routes a filter-object argument straight into `find()` (`main.js:869`), `delete()` is a pure delegation to `notIn()` (`:1297`), and `replace()` (`:1199`) and `max()` (`:1373`) call `find()` too — so the covered family is EIGHT entry points, not four. Pre-fix consequences on the four that went undocumented were the worst of the set: `delete({ id: undefined })` returned an EMPTY collection (every record removed — it returns a filtered COPY, so the loss lands in the returned value, not in-place) and `max({ k: undefined })` aggregated over the whole collection instead of the filtered subset. Measured on the published `v0.6.11` vs `v0.6.12` trees with controls; no internal framework caller can pass undefined (two independent sweeps: zero live `notIn`/`replace`/`max` sites, and the two `delete` sites — `lib/proc.js:614`, `core/config.js:2887` — are each structurally string-valued or dominated by an identical-filter `findOne` that throws first). By-catch hardening: the FormValidator's conditional-case rules lookup (`findOne({ case: fields[caseName] })`) could silently merge the FIRST condition's rules when the case field was absent from the form — the refusal now routes that state into the lookup's own designed catch-and-skip (its warn already said "undeclared or misconfigured case"). Behaviour change for consumers relying on undefined-key-means-no-constraint: build filters conditionally (add a key only when its value is defined). ⚠️ That recipe is ONLY for the no-constraint intent — for a LOOKUP BY A POSSIBLY-ABSENT KEY (`if (!col.findOne({id: maybeAbsent}))`, `col.findOne({id: maybeAbsent}) || fallback`) it is the WRONG migration: an empty filter matches everything and returns the FIRST row, so the guard reads "found" and the fallback never runs — measured. Guard the CALL instead: `var row = (id != null) ? col.findOne({id: id}) : null;`. **`lib/collection` IS in the browser `build.json`, so pickup is a bundle RESTART **and** a re-bake.**
1068
+ 312. **Every `Collection` method that accepts a filter object refuses undefined-valued filter keys — the silent match-all is closed (#B396, gh issue #65, shipped in 0.6.12).** `find()` round-trips its filter objects through `JSON.stringify(arguments)`/`JSON.parse`, and stringify silently DROPS keys whose value is `undefined` — so `findOne({ id: source.missingId })` degraded to the match-everything `{}` filter and returned the collection's FIRST row (an arbitrary, plausible-looking wrong record), a mixed filter silently lost its undefined constraint, and `update({ id: undefined }, set)` wrote `set` onto EVERY record. The in-loop guard deeper in the matcher (message: ``filter `<key>` cannot be left undefined``) was written to refuse exactly this input but was DEAD CODE — the serialization stripped the keys before the loop could see them (JSON.parse can never produce an `undefined` value). The fix hoists the refusal to `find()`'s entry, BEFORE the round-trip; `findOne`, `or` and `update` all delegate to `find`, so the one gate covers the family. Deliberately unchanged: an explicitly EMPTY `{}` filter still means "no constraint" (match-all), `null` stays a legal needle comparing strictly against stored values (matches stored `null`), array arguments are skipped (record sets, not needles), and `notIn`'s ARRAY form (`notIn(rows, key)`) is unaffected because it skips `find()` entirely. ⚠️ Every OTHER filter-object entry point IS covered, including four this entry originally excluded by mistake: `notIn({…})` routes a filter-object argument straight into `find()` (`main.js:869`), `delete()` is a pure delegation to `notIn()` (`:1297`), and `replace()` (`:1199`) and `max()` (`:1373`) call `find()` too — so the covered family is EIGHT entry points, not four. Pre-fix consequences on the four that went undocumented were the worst of the set: `delete({ id: undefined })` returned an EMPTY collection (every record removed — it returns a filtered COPY, so the loss lands in the returned value, not in-place) and `max({ k: undefined })` aggregated over the whole collection instead of the filtered subset. Measured on the published `v0.6.11` vs `v0.6.12` trees with controls; no internal framework caller can pass undefined (two independent sweeps: zero live `notIn`/`replace`/`max` sites, and the two `delete` sites — `lib/proc.js:614`, `core/config.js:2887` — are each structurally string-valued or dominated by an identical-filter `findOne` that throws first). By-catch hardening: the FormValidator's conditional-case rules lookup (`findOne({ case: fields[caseName] })`) could silently merge the FIRST condition's rules when the case field was absent from the form — the refusal now routes that state into the lookup's own designed catch-and-skip (its warn already said "undeclared or misconfigured case"). Behaviour change for consumers relying on undefined-key-means-no-constraint: build filters conditionally (add a key only when its value is defined). ⚠️ That recipe is ONLY for the no-constraint intent — for a LOOKUP BY A POSSIBLY-ABSENT KEY (`if (!col.findOne({id: maybeAbsent}))`, `col.findOne({id: maybeAbsent}) || fallback`) it is the WRONG migration: an empty filter matches everything and returns the FIRST row, so the guard reads "found" and the fallback never runs — measured. Guard the CALL instead: `var row = (id != null) ? col.findOne({id: id}) : null;`. **`lib/collection` IS in the browser `build.json`, so pickup is a bundle RESTART **and** a re-bake.** **`filter(fn)` filters like `Array.prototype.filter` (#B517, 2026-10-06).** A Collection and every query result carry an OWN `filter` that is a field PROJECTION (`filter('name')`, `filter(['id','name'])`, returning a plain deep-cloned array); a function argument used to be read as a field name and returned `[]` with no error. A function now goes to the native filter (callback `(row, index, array)`, optional `thisArg`) and returns a `find()`-style result: the same row objects with the `find()` methods, so `.toRaw()` and the chain still work. Call `.toRaw()` before persisting, as with any query result: the rows carry `_uuid` until then. **Search options match the value as text, on every search (#B818, #B819, 2026-10-08).** `setSearchOption(field, 'isCaseSensitive', false)` makes the NEXT search compare `field` through the rule's template (`'^%s$'`, flag `i`) and is then cleared. The raw value used to be spliced into that template with a string replacer and the result assigned back onto the rule entry: a value holding a pattern character was compiled as a pattern (an unbalanced parenthesis threw a `SyntaxError` out of `find`; `a.b` also selected `axb`, and `update` / `delete` then acted on both rows), a `$&` sequence in a value was expanded, and the entry kept the FIRST value, so every later option search on that instance — or on any instance sharing a caller-supplied `searchOptionRules` object — matched the first value. Now the value is escaped and put into a LOCAL pattern by a function replacer, and the rule table is only read. The template is the pattern, the value is text: a constructor override such as `{ searchOptionRules: { isCaseSensitive: { false: { re: '^%s', modifiers: 'i' } } } }` (a prefix search) still applies. NOT changed: a value holding `<`, `>` or `=` is a comparison and `not null` (any case) is a keyword, with or without an option; `{ searchOptionRules: { skipEval: true } }` on the constructor turns the comparison off for plain (non-dotted) keys only. So a caller-supplied value is compared as text only with `skipEval` set, and only if `not null` cannot reach the search. **The object form works (#B820, 2026-10-08).** `setSearchOption({ <field>: { isCaseSensitive: false } })` used to throw `undefined is not an allowed searchOption !`: the one-argument form tested each top-level key, a field name, against the rule table. It now checks each field's rule names (an unknown rule is refused by name, a field entry that is not an object of rules is refused by field), reads `'true'` / `'false'` as booleans like the three-argument form, REPLACES what an earlier call set (the three-argument form ADDS, field by field), and copies the options: the caller's object is neither kept nor changed. A top-level key naming a rule (`skipEval`) is accepted and has no effect: `skipEval` is a constructor option. **A dotted key that is not a property path matches nothing, whatever it holds (#B821, 2026-10-08).** The dotted-key walker built a RegExp from the key's last segment and never read it, so `find({ 'address.ci(ty': … })` — `(`, `)` or `[` in that segment, also in the `[*]` form — threw a `SyntaxError` out of the search before the path check could refuse the key. The dead construction is gone.
1067
1069
 
1068
1070
  313. **Redis is a store backend only — no entity/ORM wiring, by design.** The redis connector class is deliberately empty: it backs FOUR purpose-bound subsystems, each minting its OWN client — the session store (`lib.SessionStore`), the async-job store (`app.json` `jobs.store`), the render-cache L2 (`settings.json` `server.cache` `type: "redis"`), and — since #KV1 slice 1 — a KV namespace backend (`settings.json` `kv.namespaces.<name>.store`; entry 314), one client PER NAMESPACE. Client failure policy diverges per subsystem by design — the render-cache L2 sets `enableOfflineQueue: false` plus a `commandTimeout` so an outage fails page-serving open instead of hanging every request, while the job store keeps ioredis's default offline queue on, and the KV store imposes NEITHER: it passes those knobs through from the `connectors.json` entry so the operator tunes per namespace (a `failMode: "open"` namespace wants the fail-fast trio; a `closed` one usually wants the queue). NON-KV redis use — data structures, pub/sub, third-party queue libraries — stays app-owned by design: it is outside the KV contract, so an app needing it reads its `connectors.json` entry via `getConfig()` and mints its own ioredis client. Redis operations do NOT appear in the Inspector's query log: `_devQueryLog` capture hangs off the entity query path, which this connector deliberately does not implement; a render-cache L2 hit is instead observable per response via the RFC 9211 `Cache-Status` header. Per-operation Inspector capture of redis store traffic was evaluated 2026-08-21 and demand-gated (measured consumer demand: zero); if demand arrives, the evidenced shape is a store-reachability/lifecycle signal on the events channel (with app-registered clients joining the same signal), not query-log wiring.
1069
1071
 
1070
1072
  314. **General-purpose KV primitive (#KV1) — `gina.kv('<namespace>')`, strict-declared namespaces over pluggable per-namespace backends (`settings.json > kv`).** Declare namespaces under `kv.namespaces` (`{ "kv": { "default": "cache", "namespaces": { "cache": { "failMode": "open" }, "tokens": {} } } }`); `gina.kv(name)` THROWS on an unconfigured block or unknown name (the throw is what surfaces a typo — the `gina.storage()` stance), and the whole feature is dormant when the block is absent. Namespaces are process-global, read once at boot from the STARTING bundle's settings. The handle is promise-native with 13 ops: `get` / `set(k, v, {ttl})` / `del` / `has` / `ttl(k)` (null=miss, -1=no expiry, else remaining ms) / `expire(k, ttlMs)` / `setnx` (set-if-absent) / `consume` (atomic read-AND-delete — the one-shot-token op; the second reader gets null) / `incr` / `decr` (integer counters; `{ttl}` applies on CREATE only; non-integer values and safe-range overflow reject) / `delIfEquals` (compare-and-delete — the safe lock-release primitive; compose with `setnx` for lock recipes) / `clear()` / `getOrSet(k, {ttl}, loader)` (fetch-or-compute with per-process single-flight; no negative caching). Value model: JSON-serialized; `undefined` AND `null` are REFUSED on every write (a stored null would be indistinguishable from a miss — store a wrapper or use `del()`); TTLs are MILLISECONDS, positive integers only — `ttl: 0` refuses rather than meaning no-expiry. Per-namespace `failMode`: `closed` (default) rejects on backend errors; `open` degrades every op to its miss-shaped result with a warning (cache-like namespaces) — consulted on backend errors only, so it becomes operative with connector-backed stores. THREE backends ship, differing by SHARING SCOPE. **In-memory** per namespace (zero config; lazy expiry plus an unref'd sweep, `sweepInterval` ms, default 30000) — SINGLE-PROCESS, lost on restart. **SQLite** (`core/connectors/sqlite/lib/kv-store.js`, #KV1 slice 2) — zero npm deps via the `lib/sqlite-driver` seam (node:sqlite, `bun:sqlite` adapter under Bun), DURABLE across restarts and shared across PROCESSES on ONE HOST; namespaces sharing a file are isolated by a composite `(ns, key)` primary key rather than a prefix, `clear()` is one namespace-scoped DELETE, and every read-modify-write verb runs inside `BEGIN IMMEDIATE`/`COMMIT` — the synchronous driver makes a verb indivisible only WITHIN a process, which is precisely the guarantee that fails once a second process opens the file, i.e. the reason to pick this backend at all. **Redis** — shared across HOSTS. **Redis** (`core/connectors/redis/lib/kv-store.js`, #KV1 slice 1): point a namespace's `store` at a `connectors.json` entry and the `lib/kv-store` dispatcher resolves `core/connectors/<connector>/lib/kv-store.js`; naming a connector that has none still REFUSES the boot rather than degrading silently to memory (the others arrive demand-first, the audit-store shipping order). The redis backend keeps every guarantee server-side: `SET .. PX .. NX` for setnx, `GETDEL` for consume when the server has it (>= 6.2) with a **Lua fallback below that — never a GET+DEL pair**, which would let two concurrent readers both redeem; Lua also for compare-and-delete and for TTL-on-CREATE-only counters (`n === by` is a racy proxy for "was created", so existence is checked inside the script). Keys are prefixed `kv:<namespace>:` by default, so two namespaces may share one entry; cluster prefixes are deliberately NOT hash-tagged (every KV op is single-key, and tagging would pin a namespace to one slot — the opposite of the job store, whose MULTI/SUNION/MGET require the tag), so `clear()` scans each master node and deletes per key rather than assuming one slot. Connection policy (`commandTimeout`/`maxRetriesPerRequest`/`enableOfflineQueue`) is passed through from the entry and otherwise left at ioredis's defaults — deliberately NOT the render-cache's fail-fast tuning, because the right policy depends on the namespace's `failMode`. Deliberate boundary — NOT a redis client: no data structures (lists/hashes/sets/streams/pub-sub), no batch `mget`/`mset`, no key scanning (use `clear()` or track your own keys), no binary values (the storage layer owns bytes), no first-class distributed locks (compose `setnx` + `delIfEquals`; a lock API done right needs fencing/renewal policy no half-primitive should imply). `lib/kv` is framework-independent (config, connector stores and the warn sink are injected by gna.js at boot; `test/lib/kv-import-boundary.test.js` enforces the boundary) and plain-require'd (its namespace registry and sweep timers survive dev-mode refreshCore). Server-side only — NOT browser-bundled, so pickup is a bundle RESTART, no re-bake.
1071
1073
  315. **Rate limiting (#MS6) — identified-caller quotas at the router band.** Opt-in via settings.json `server.rateLimit` (`enabled` strictly true, `namespace`, `keyField`, `limit`, `window`; folded into the runtime server block with env.json keys winning, resolved once at engine start onto the instance, so changes need a bundle restart; structurally invalid values on an enabled block refuse the boot). QUOTA semantics, not flood control: the gate runs AFTER route authorization (`authorizeRequest` is the principal resolver — the only writer of `req.machineCaller`, and session identity is its predicate) and BEFORE DTO validation, so the order is 401 -> 429 -> the validation-tier 422s (message validation when declared, then DTO) and a throttled caller never receives a 422 field map. A request with NO resolvable principal is SKIPPED, never bucketed — anonymous flood control belongs to the edge proxy and the #H9 HTTP/2 rapid-reset guard, and IP-keying is dishonest behind a proxy (every socket.remoteAddress is the proxy's). Keys: `u:<session.user[keyField]>` for signed-in callers (the field is operator-named because session.user is app-owned shape; an absent/empty value means unidentified => skipped) and `m:<machineCaller.name>` for #MS3 machine callers; session wins, mirroring the authz gate; values over 180 chars are sha256-hexed under the kv 512-char key cap. Counters are FIXED WINDOWS over the #KV1 primitive — `incr(key, 1, {ttl: windowMs})`, TTL-on-create-only, race-free in all three backends — so choosing the namespace's backend chooses the quota's SCOPE: in-memory counts PER PROCESS (each replica grants the quota again; the resolver warns), redis/sqlite share across replicas/processes. For a redis-backed namespace set `enableOfflineQueue: false` + `commandTimeout` on the connectors entry (the render-cache L2 fail-fast trio; with ioredis defaults an outage QUEUES every gated request so neither failMode ever fires — the resolver warns about this too). Outage policy IS the namespace's `failMode`: `open` => incr degrades to null and the gate ALLOWS without headers (the explicit `count === null` check is load-bearing — `null <= limit` is true by coercion); `closed` => the rejection is owned and answers 503 + Retry-After (the caller is NOT over quota). Denials answer 429 via `controller.throwError` with Retry-After (from the store's own ttl — one extra read on the throttled path only) plus the draft-ietf-httpapi-ratelimit-headers-11 structured fields (`RateLimit: "<policy>";r=<remaining>[;t=<sec>]`, `RateLimit-Policy: "<policy>";q=<limit>;w=<windowSec>`); allowed limited requests carry both without `t` (reporting it honestly would cost a second read per request and the parameter is optional). Per-route overrides are TOP-LEVEL routing.json keys (never under `param` — the #CSRF2 trap), propagated by BOTH route builders (cold typeof-guarded — `false` is meaningful — and the warm cached-route opt-in copy): `"rateLimit": false` exempts the route; `{limit, window}` REPLACES the default for that route in its OWN bucket (`<principal>:<rule>`), partial objects inherit the missing key; shapes are linted at boot (a malformed value refuses the boot — the DTO registrar doctrine). Dormant => the dispatch band runs today's exact synchronous path with ZERO promises minted; armed, every terminal of the verdict promise is owned (allow -> band, deny/outage -> answered inside the gate) so a store failure can never strand a request. Implementation: `lib/rate-limit` (plain-required, router-bound), wired in `core/router.js` at both dispatch sites; server-side only, but the route-flag propagation lives in browser-bundled `lib/routing`, so the release carries a dist rebuild (dead code client-side). Tests: `test/core/rate-limit.test.js` (45 — source pins on every seam, resolver refusal/warn matrix, gate behaviour over a scripted namespace, 5 mutation controls fired red-first).
1072
- 316. **Reserved-action controller hooks (`onReady`, `setup`) — dispatch semantics + the #B399 ownership guard** — Before the main action, `core/router.js` dispatches the two reserved hooks at BOTH dispatch sites (with- and without-middleware), in order, synchronously, without awaiting: an app defines `this.onReady = function(req, res, next){...}` on the controller, and `setup` resolves through a framework-synthesized wrapper that requires the bundle's `controllers/setup.js` once per controller instance (the wrapper returns the app call's own result). Since #B399, both hook loops run INSIDE the dispatch try and each hook's return value is captured — a thenable gets a `.catch` routing to `throwError(response, 500, ...)` naming the failing hook, the same guard shape the main action dispatch carries. Consequences: a SYNC hook throw answers 500 (previously it escaped to process level — on the built-in engine that was uncaughtException → emerg + SIGTERM, killing the whole bundle; Express's layer-catch answered its own 500 — engine-asymmetric); an ASYNC hook rejection answers 500 when it lands before the response is released, and degrades to the #ERRREF pairing log line when the action already responded (`throwError` is `!headersSent`-guarded). Ordering caveat: hooks are dispatched in the same synchronous frame as the action (never awaited), so a rejecting async hook does NOT prevent the action from running — its side effects still execute even when the wire answers 500; hooks are not a gating mechanism (use route middleware, route authorization, or DTO validation to refuse a request before the action). Sync or absent hooks mint zero promises — dispatch timing is unchanged for every controller that does not return a thenable from a hook. **The QUERY-DELIVERY half of the same #B399 arc (shipped separately): every app-callback delivery in `Controller::query()`** — the Node-style callback form and the `{onComplete}` facade, both transports, success/status AND transport-error deliveries — routes an `async` callback's rejected promise through one constructor-scope `_ownAsyncCbRejection` helper to the same throwError(500) shape the sync-delivery catches build (marker: `Controller Query Exception on async callback rejection.`). Pre-fix the rejection floated to the process handler and the request hung; the two success-delivery sync catches are byte-unchanged, plain callbacks mint zero promises, and a callback that responded before rejecting is absorbed by the #B31 released-response guard. The SYNC half of the same error-path surface is owned too (#B402): all 14 formerly-bare transport-error deliveries (host-missing, circuit refusal, the query-scope outer catch, both ca-read catches, h1 ALPN/request-error, the h2 typed terminals and both pre-flight PING failures) wrap the callback in try/catch routing to a shared `_ownSyncCbThrow` guard (marker: `Controller Query Exception on transport-error callback throw.`, flat 500) — previously an event/timer-frame throw escaped to the process handler (lib/proc.js: emerg + SIGTERM, a whole-bundle kill on BOTH engines for consumer bundles, since an app bug's error code matches none of the transport-lifecycle survive branches), and the caller-frame sites re-invoked the app callback a second time through the query-scope catch, handing it its own exception as the query error. The h2 session-error handler no longer answers the request itself (#B403): request notification on a failing session is owned solely by the stream-level typed deliveries (every live stream self-delivers), retiring the session-level throwError that raced the app callback's own response — and that, on a REUSED session, could answer with the CREATING request's context (session listeners bind once at fresh connect; the cache-hit path never re-binds them). Its by-catch #B404 is FIXED in the same pending release: every error-path `query#complete` emit is SINGLE-argument (mirroring the callback form — `callback(err)` on failure), while both `onComplete` facades' `(err, data)` dispatch dereferenced `data.status` unconditionally — so in handle/emitter mode a transport error or non-2xx outcome never reached the app's listener and the request answered 500 through the facade's sync catch with a marker misattributing it to an app callback exception. A `typeof data == 'undefined'` guard opening each facade's sync-guard try now delivers the payload as the error argument (on failure `cb(err)` with `data` undefined — a plain `{status, error}` object for a non-2xx status or a transport failure, a native `Error` for a pre-transport failure (missing host, unreadable certificate, open circuit) — and on success `cb(false, data)`); listener sync throws and async rejections are owned like every other delivery — and the host-missing emitter branch gained the `return` its callback twin always had (the only fall-through of the 20 emit sites — all 20 of which, with the probe-release branch, were removed by the #B475 cleanup commit of 2026-09-05 once `query()` always supplied a callback; the event now fires only from `query()`'s one-tick fallback). The documented `util.promisify(self.query)` idiom always used the callback form and was never affected by #B404 — but WAS broken by the last divergent cell, retired as #B405 (measured with controls in both directions): the h2 CALLBACK-mode dispatch delivered only 5xx to the callback and answered every other deliverable non-2xx itself via throwError, so h2 graceful degradation was impossible for 4xx and a promisified h2 query NEVER SETTLED on any non-5xx status (the await's continuation silently abandoned). Every body-announced non-2xx with a known status code now invokes `callback(data)` on both transports (h1 has done this since its #Q1 change, whose inline comment states the intent; the 3xx-with-headers replay is untouched; the retired split is preserved as comments at the site), so the promisify rejection contract now holds transport-uniformly.
1074
+ 316. **Reserved-action controller hooks (`onReady`, `setup`) — dispatch semantics + the #B399 ownership guard** — Before the main action, `core/router.js` dispatches the two reserved hooks at BOTH dispatch sites (with- and without-middleware), in order, synchronously, without awaiting: an app defines `this.onReady = function(req, res, next){...}` on the controller, and `setup` resolves through a framework-synthesized wrapper that requires the bundle's `controllers/setup.js` once per controller instance (the wrapper returns the app call's own result). Since #B399, both hook loops run INSIDE the dispatch try and each hook's return value is captured — a thenable gets a `.catch` routing to `throwError(response, 500, ...)` naming the failing hook, the same guard shape the main action dispatch carries. The route middleware call in `processMiddlewares` owns its result the same way since #B812 (2026-10-07): it used to discard it, so an `async` middleware that threw after an await — or handed over through `done` to a later middleware that threw, the throw becoming the first one's rejection — left its request unanswered and the rejection unhandled; a thenable now gets a `.catch` answering `throwError(res, 500, 'route middleware `<name>` rejected: …')`, the name read BEFORE the call because a synchronous `done` splices the list during it (`test/core/router-middleware-rejection-b812.test.js` drives the real bytes in a child process, where the pre-fix rejection is recorded instead of reaching the test runner). Consequences: a SYNC hook throw answers 500 (previously it escaped to process level — on the built-in engine that was uncaughtException → emerg + SIGTERM, killing the whole bundle; Express's layer-catch answered its own 500 — engine-asymmetric); an ASYNC hook rejection answers 500 when it lands before the response is released, and degrades to the #ERRREF pairing log line when the action already responded (`throwError` is `!headersSent`-guarded). Ordering caveat: hooks are dispatched in the same synchronous frame as the action (never awaited), so a rejecting async hook does NOT prevent the action from running — its side effects still execute even when the wire answers 500; hooks are not a gating mechanism (use route middleware, route authorization, or DTO validation to refuse a request before the action). Sync or absent hooks mint zero promises — dispatch timing is unchanged for every controller that does not return a thenable from a hook. **The QUERY-DELIVERY half of the same #B399 arc (shipped separately): every app-callback delivery in `Controller::query()`** — the Node-style callback form and the `{onComplete}` facade, both transports, success/status AND transport-error deliveries — routes an `async` callback's rejected promise through one constructor-scope `_ownAsyncCbRejection` helper to the same throwError(500) shape the sync-delivery catches build (marker: `Controller Query Exception on async callback rejection.`). Pre-fix the rejection floated to the process handler and the request hung; the two success-delivery sync catches are byte-unchanged, plain callbacks mint zero promises, and a callback that responded before rejecting is absorbed by the #B31 released-response guard. The SYNC half of the same error-path surface is owned too (#B402): all 14 formerly-bare transport-error deliveries (host-missing, circuit refusal, the query-scope outer catch, both ca-read catches, h1 ALPN/request-error, the h2 typed terminals and both pre-flight PING failures) wrap the callback in try/catch routing to a shared `_ownSyncCbThrow` guard (marker: `Controller Query Exception on transport-error callback throw.`, flat 500) — previously an event/timer-frame throw escaped to the process handler (lib/proc.js: emerg + SIGTERM, a whole-bundle kill on BOTH engines for consumer bundles, since an app bug's error code matches none of the transport-lifecycle survive branches), and the caller-frame sites re-invoked the app callback a second time through the query-scope catch, handing it its own exception as the query error. The h2 session-error handler no longer answers the request itself (#B403): request notification on a failing session is owned solely by the stream-level typed deliveries (every live stream self-delivers), retiring the session-level throwError that raced the app callback's own response — and that, on a REUSED session, could answer with the CREATING request's context (session listeners bind once at fresh connect; the cache-hit path never re-binds them). Its by-catch #B404 is FIXED in the same pending release: every error-path `query#complete` emit is SINGLE-argument (mirroring the callback form — `callback(err)` on failure), while both `onComplete` facades' `(err, data)` dispatch dereferenced `data.status` unconditionally — so in handle/emitter mode a transport error or non-2xx outcome never reached the app's listener and the request answered 500 through the facade's sync catch with a marker misattributing it to an app callback exception. A `typeof data == 'undefined'` guard opening each facade's sync-guard try now delivers the payload as the error argument (on failure `cb(err)` with `data` undefined — a plain `{status, error}` object for a non-2xx status or a transport failure, a native `Error` for a pre-transport failure (missing host, unreadable certificate, open circuit) — and on success `cb(false, data)`); listener sync throws and async rejections are owned like every other delivery — and the host-missing emitter branch gained the `return` its callback twin always had (the only fall-through of the 20 emit sites — all 20 of which, with the probe-release branch, were removed by the #B475 cleanup commit of 2026-09-05 once `query()` always supplied a callback; the event now fires only from `query()`'s one-tick fallback). The documented `util.promisify(self.query)` idiom always used the callback form and was never affected by #B404 — but WAS broken by the last divergent cell, retired as #B405 (measured with controls in both directions): the h2 CALLBACK-mode dispatch delivered only 5xx to the callback and answered every other deliverable non-2xx itself via throwError, so h2 graceful degradation was impossible for 4xx and a promisified h2 query NEVER SETTLED on any non-5xx status (the await's continuation silently abandoned). Every body-announced non-2xx with a known status code now invokes `callback(data)` on both transports (h1 has done this since its #Q1 change, whose inline comment states the intent; the 3xx-with-headers replay is untouched; the retired split is preserved as comments at the site), so the promisify rejection contract now holds transport-uniformly.
1073
1075
  317. **Boot-frame failure ownership — a crash during bundle bootstrap aborts loudly instead of hanging (#B406, 2026-08-23).** `core/gna.js`'s boot callback (`onGettingProjectConfig`) is declared `async`, so a synchronous throw anywhere in its ~1470-line direct frame became a promise REJECTION: the caller's try/catch (written for a plain callback) could never see it, and the process-level `unhandledRejection` net only logs at error level — no `[ emerg` marker, no exit. The daemon's startup watchdog (`lib/cmd/bundle/start.js`) reads the child's STDOUT only, during startup only, and matches `/(\[|\[\s+)emerg/` — on a match it SIGKILLs the child, prints the cause, and clears the startup timer; a child that dies WITHOUT the marker gets the immediate exit-code report; a child that neither exits nor emits the marker got the 60-second timeout with no cause. Pre-fix, a boot crash in that frame was the third shape. The whole frame is now owned by one try/catch routing every failure — sync throws today, any awaited rejection added later — into `abort()`, the existing boot terminal (context-aware `console.emerg` + synchronous `fs.writeSync(2)` flush + `process.exit(1)`), with non-Error rejections (`throw null`) coerced to an Error FIRST because `abort()` reads `.stack` through branches that would themselves throw on null — and a throw inside the catch would escape back to the silent net. Measured: the levelled emerg line SURVIVES an immediate `process.exit(1)` on a POSIX pipe (short writes; the 64KB truncation class is large payloads), so the single marker line reaches the watchdog — deliberately ONE marker-bearing line, since the watchdog's emerg branch has no re-entry guard and two lines risk double-firing its bulk-start accounting. Behaviour change: a throw LATE in the frame that previously left a half-initialised process limping now refuses the boot. Extends entry 178's severity-axis rule ("lethality follows the nearest async boundary") with the boot-time tier: at boot there is no request to degrade to a logged rejection — an unowned rejection means the process neither starts nor exits, which is strictly worse than either crash-and-respawn or a 500. Tests: `test/core/gna-boot-frame-ownership.test.js` (source pins red-first vs the pre-fix blob; replica arms incl. an awaited-rejection arm proving the seam is ready for a boot-time `await`, a child-process SUBTRACT reproducing the pre-fix escape at a real process-level net, and a plain-callback CONTROL locking the caller contract). Server-side only: pickup is a bundle restart, no re-bake.
1074
1076
 
1075
1077
 
@@ -1087,4 +1089,4 @@ Dev-mode query instrumentation captures every database query tied to the current
1087
1089
 
1088
1090
  328. **`bundle:build` / `project:build` `--skip-unchanged` — skip the wipe-and-copy of a release whose source is byte-identical to what it was built from (0.6.29-alpha.2).** Both verbs are a `rm -rf` of `releases/<bundle>/<scope>/<env>/<version>/` followed by a recursive byte-copy of the bundle source; they compile nothing (asset pipelines belong to the `prepare`/`postbuild` hooks declared in `manifest.json#buildScripts`). With the opt-in flag the build signs the source — `lib.releaseWatch.buildSignature(root, {prior})`: sha1 over the sorted `relpath|size|sha1(bytes)` lines of every regular file plus `relpath|symlink|target` for every symlink, `DEFAULT_IGNORE` segments pruned, spec `BUILD_SIG_SPEC` 1 — and records it at the release ROOT as `.gina-build.json` (`writeBuildMarker`, atomic temp+rename, written in the copy callback AFTER the `node_modules` link, so a copy killed mid-way leaves no marker and always rebuilds). Timestamps do not count: a fresh checkout or a plain `cp` does not invalidate — the property the #RWATCH mtime fingerprint (`fingerprintTree`, `FP_SPEC` 1, untouched) deliberately lacks, because its fail-safe direction is « stale ⇒ rebuild » while a skip needs the opposite. Stat fast path: given the prior marker, a file whose recorded `size` and `floor(mtimeMs)` both match reuses the recorded sha1 with no read — except entries whose mtime falls within `BUILD_SIG_RACY_MS` (2 s) before the marker's `signedAt` (git's racily-clean rule, for coarse-mtime filesystems), which are re-read. A stable-mtime source therefore costs one stat walk (measured 6.5 ms vs 5.5 ms for the #RW1 walk over 1,811 entries, 0 reads); a source whose mtimes were rewritten is read once, then stat-only. The decision is the pure `decideBuildAction({force, marker, releaseExists, signature})`: the ONLY skip is flag on + a marker of the current spec + release present + equal signatures; every other input rebuilds with a reason (`signature unavailable` · `--force` · `no marker` · `marker spec <s> ≠ <current>` · `release missing` · `<k> file(s) changed` with the sorted `changed` list from `diffBuildFiles` · `signature mismatch`), and any exception while evaluating is a warn + rebuild. Nothing changes without the flag (no signature, no marker), so the first flagged build always copies. On a skip the manifest update, the #RW1 stamp, both hooks and a guarded `node_modules` link (lstat first — a blind `symlinkSync` throws EEXIST) still run. `--force` rebuilds and still records the marker; `--dry-run` resolves every release, prints `[ dry-run ] would skip <target> (unchanged since <builtAt>, <n> files)` / `would rebuild <target>: <reason>` (the first 10 changed files listed) and writes nothing, runs no hook; `--format=json` writes ONE `{ project, scope, dryRun, skipUnchanged, releases:[{bundle, env, target, action, reason, changed, fileCount, builtAt}] }` envelope via `fs.writeSync(1, …)` — both modes read the same per-release records the build acted on. The `postbuild` hook's env gains `GINA_BUILD_SKIPPED_BUNDLES` (comma list of the bundles whose every resolved env was skipped) and `GINA_BUILD_SKIPPED_ALL` (`1` when that is every bundle resolved this run), set only with the flag, so a hook that bakes its own outputs can skip its own work. Not detected by design: out-of-band edits inside a release (omit the flag or pass `--force`), file mode changes (the copy never preserved them), the framework version (recorded in the marker for diagnostics only). Flags must be declared in BOTH `lib/cmd/bundle/arguments.json` and `lib/cmd/project/arguments.json` (an undeclared `--` token becomes a `NODE_OPTIONS` entry for the prepare hook); `project:build` skips creating a dev-env release record but resolves one an earlier `bundle:build` created. Server/CLI-side only ⇒ pickup = bundle restart, no re-bake.
1089
1091
  329. **RFC 9218 Extensible Priorities — the `Priority` header on the request, the outbound call and the response, and urgency-ordered async jobs (#H12, 2026-09-14).** `req.priority` is parsed ONCE per request on BOTH engines — at the top of isaac's request listener AND of the engine-agnostic catch-all, fill-when-absent guarded — so on isaac the statics, `/_gina/*` and render-cache hits carry it exactly as they do on Express (they answer inside the listener and never reach the catch-all; a parse only in the catch-all would have left the two engines asymmetric on precisely the traffic RFC 9218 targets). The parser is `lib/priority` (`require('lib/priority')`, `gina.lib.priority`): `parse(headerValue)` → `{ urgency 0-7, incremental, present }` per RFC 9218 §4 over an RFC 8941 dictionary — `u` Integer 0–7 default 3, `i` Boolean default false (a bare `i` is true; `i=1` is an Integer, i.e. the wrong type), unknown members / out-of-range or wrong-type values / member parameters ignored INDIVIDUALLY, a grammar failure (`U=1`, a trailing comma, `u = 1`…) ignored WHOLE as if absent (`present:false`), multiple field lines joined with `, `, never throws; `serialize({urgency, incremental})` → `u=N, i`; `normalizeUrgency(v)` → an integer 0–7 or 3. `self.query()` resolves the outbound header ONCE before dispatch — one site for both transports, every retry and `self.forward()` — through `resolveOutbound()`: (1) a caller-set `headers.priority` (any casing) is left alone; (2) `options.priority: false` sends nothing; (3) an explicit `options.priority` (`{urgency, incremental}` or a wire string) is sent normalized and NEVER falls through; (4) a PRESENT inbound header propagates in normalized form — RFC 9218 is end-to-end, a sub-request made for a `u=0` page is itself `u=0`. The `priority` OPTION is stripped before the merge like `critical`, because on HTTP/2 every stray `options` key ships as a wire header. `self.setPriority({urgency, incremental})` emits the RESPONSE header — an explicit `u=3` IS emitted, since on a response only an explicit member overrides the client's value (§8); headersSent-guarded (a released response is "sent", #B31), chainable. ⚠️ Advisory and CLIENT-SUPPLIED: nothing in gina grants more on its strength; a consumer may read `req.priority` only to yield. What Node cannot do stays out, deliberately: no DATA-frame send scheduling, no `PRIORITY_UPDATE` frame API (`http2stream.priority()` is a no-op), so the framework CARRIES the signal and never reorders its own writes; the #MS5 circuit breaker and the #MS6 quota do not consult it (the breaker has no queue; a client-supplied urgency may only ever YIELD, which needs an overload-shedding gate that does not exist). **`lib/job` selection is urgency-ordered:** `self.startJob(fn, { urgency: 0-7 })` / `lib.job.create(fn, { urgency })` stamps the urgency on the in-process QUEUE ENTRY (default 3; anything that is not an integer 0–7 ⇒ 3 via `normalizeUrgency`; never on the record — the fn is per-process, so there is nothing durable to order); the worker's `_dequeue()` starts the FIRST entry of the LOWEST urgency class — FIFO within a class, so equal urgencies keep the order they always had — and a retried attempt re-enters with the urgency it was created with; `stats()` is unchanged. The value is EXPLICIT ONLY, never inherited from `req.priority` — `self.startJob(fn, { urgency: req.priority.urgency })` is the application's one-liner, because a client-supplied ordering hint is the application's decision. Pickup: bundle RESTART (both engine files are load-once and `lib/job` is a plain-require singleton), NO re-bake.
1090
- 330. **Fast lane (#P49) — opt-in controller-free dispatch for JSON routes, `param.lane` (0.7.2, slice 1).** A route opts in with `"param": { "lane": "<module>", "control": "<export>" }` — nested in `param` like `param.dto`, so it rides both route builders wholesale: no `lib/routing` edit, no dist rebuild; server-side only, pickup = bundle restart, no re-bake. `param.lane` names `<bundle>/lanes/<module>.js` without `.js` (`"admin/users"` → `lanes/admin/users.js`; each `/`-separated segment matches `^[A-Za-z0-9_][A-Za-z0-9_.-]*$`, so no `..`, no leading `.` or `/`, and no leading `:`, which routing would read as a URL binding). `param.control` keeps its schema-required role and names the module's OWN function export (an inherited `constructor` or `hasOwnProperty` is refused), so `bundle:openapi`'s operationId and `bundle:mcp`'s `io.gina.control` read it unchanged. A URL parameter still needs its binding in `param` (`"id": ":id"`, read as `ctx.params.id`); without it the route does not match. Handler: `module.exports.list = function (ctx) { ctx.json({...}); };` — sync or `async`, called as `fn.call(moduleExports, ctx)`; the module is required ONCE at boot, so setup goes at module scope. Registry: `process.gina._lanes['<bundle>::<lane>#<control>']`, built by `lib/lane` `registerRoutes()` from `core/server.js` `init()` before `listen`; the request path is an O(1) `lookup(req.routing)` — no fs, no `require`. Branch point: `_handleDispatch`, after the match, the `validator::` requirements, the 405, the HEAD alias and the render-cache read. On isaac the lane is the TERMINAL of the bundle's `app.use` chain (session + CSRF still run, `csrfExempt` works; `ctx.session` is `req.session`); on express the app layers already ran and the lane dispatches directly. The controller path is unchanged (no `router.js` or controller edit) and pays one property read. Skipped per lane request: the namespace probe, the options clone, the controller `require`, `inherits`, `new Controller` + `setOptions` (incl. the views block), route middleware, the gates. `ctx` (prototype methods; detached use needs `bind`): `req`/`res` (nulled once answered — a late `json()`/`error()` logs `[ Lane ] … called after the response was released` and returns `false`), `params`, `get` (`req.get`, set on GET/HEAD only), `body` (`req.body`, the POST/PUT/PATCH alias), `routing`, `requestId`, `culture`, `session` (getter), `json(data)`, `error(...)` (`throwError` is an alias), `getConfig(name?)` (the copy-on-write view; `controller.getConfig.mode: "clone"` honoured; the proxy hostname re-point), `hasRole(role)` (the session user; its machine-caller fallback reads `req.machineCaller`, which only the authorization gate sets, so it is inert on a lane route in 0.7.2), `isXMLRequest()`, `pauseRequest(data, storage?)` (the controller's halted-request snapshot). Not on `ctx`: `query`, the `render*` methods, `redirect`, `store`, `startJob`, `t`, `audit`, early hints, trailers, `setPriority` — a route needing one stays a controller route. `ctx.json()` follows `renderJSON`: a `status` key naming a listed non-200 code sets the status (an `errno` alone never does); `param.responseDto` shapes a 2xx; one `JSON.stringify`; the idempotency record at the same point; the access line `METHOD [status] url`; HEAD = headers + `content-length`, no body; written through raw HTTP/2 `stream.respond()` (folding `res.getHeaders()`), the HTTP/2 send shim isaac installs whenever its middleware chain runs (so a wrapping session middleware's `writeHead`/`end` fire), or HTTP/1.x with an explicit `content-length`. `ctx.error()` resolves the controller `throwError` call shapes (`(errorObj)`, `(err)`, `(status, msg|err)`, `(status, obj)`, `(res, status, msg)`; `(status)` and `()` answer the status-text envelope where the controller throws or no-ops) into `{ status, error: <status text>, message, fields | errors, stack (local scope only — outside it a stack-bearing title/message/error keeps its first line), ref }` — `ref` 6 uppercase hex, or a relay-safe supplied one — plus ONE pairing line `[ BUNDLE ][ <bundle> ][ Lane ][ ref X ][ req <id> ] METHOD [ status ] url` followed by the full detail (stack, `cause`); it writes `writeHead(code, { content-type, content-length })` + `end`, so headers set earlier (CORS, `X-Request-Id`, `Retry-After`) are kept. Always JSON: no HTML error page, no `fallback`. A handler's sync throw or rejection answers `ctx.error(500, err)` (a non-Error value is wrapped) — a DIFFERENT body from a controller route's thrown action, which the router answers through the server-level `throwError(res, 500, err.stack)` as `{ status, error: <the error text>, ref }` with no `message`. A handler that never answers leaves the response open; the dispatcher never returns the handler's promise and never calls `next`. BOOT REFUSALS (``[ SERVER ] Route `<rule>`: …``, exit before listen): a malformed lane name; `param.control` empty, non-string, `onReady`, `setup` or `redirect`; a rule kept for another bundle; route `middleware`, incl. one inherited from `routing.global.json`; `cache`; `negotiate`; `namespace`; `method: "ws"`; in 0.7.2 every gate key — `param.requireAuth` (unless `false`), `param.roles`, `param.policy`, `rateLimit` or `idempotency` (unless `false`/`null`), `param.messageValidator`, `param.dto` — and the implicit gates: `auth.requireAuthByDefault: true` without `param.public: true`, `server.rateLimit.enabled: true` without `"rateLimit": false`; a missing module (with a hint when the name ends in `.js`), a module that fails to load (the refusal carries the runtime's own error: Node's SyntaxError stack, Bun's `BuildMessage` text), or no own function export of that name. Allowed: `param.responseDto`, `csrfExempt`, `requirements`, `scopes`, `param.public`, `param.requireAuth: false`, `rateLimit: false`. A lane route the bundle did not register at boot, or whose module failed to reload, answers 500 naming it — never a fall-through to a controller. DEV RELOAD: `core/gna.js` watches the `lanes/` root and every directory holding a registered module, for `change` and `rename` (an atomic save), and sets `__hotReload.lane`; the next lane dispatch re-requires every registered module, re-resolves the exports and prunes `lib/lane`'s `module.children`. The watcher block runs inside `gna.onStarted`: a bundle whose `index.js` never calls `onStarted()` (the scaffold leaves it commented out) has no watcher, and the lane then reloads its modules on EVERY lane request in dev — like the controllers. Production loads them once. Observability is inherited: request id, `X-Request-Id` echo, JSON-log `requestId`/`durationMs`, the metrics `route` label, the access line; Inspector Flow bars `lane-dispatch` + `response-write`; the Inspector Query tab does NOT capture a lane handler's queries (only the controller's `setOptions` enters the query-capture context). Engines: isaac HTTP/1.1 and HTTP/2; the Express adapter over HTTP/1.1 (it does not serve HTTP/2). Measured (one process serving a controller route, a lane route and the router-entry floor, mirrored rounds, HTTP/1.1 loopback, ten short records, access line on): lane/controller a median 0.39× CPU (0.25–0.54), about 150 µs saved per request; without the access line the lane costs no more than the router-entry floor. Migration trap: a route that already carried a `param.lane` key for its own data now opts in — rename the key. Running the gates on lane routes (slice 2: the five gate libraries call only `throwError` and `pauseRequest` on the object they are given, so `ctx` can be their egress unchanged) is NOT scheduled.
1092
+ 330. **Fast lane (#P49) — opt-in controller-free dispatch for JSON routes, `param.lane` (0.7.2, slice 1).** A route opts in with `"param": { "lane": "<module>", "control": "<export>" }` — nested in `param` like `param.dto`, so it rides both route builders wholesale: no `lib/routing` edit, no dist rebuild; server-side only, pickup = bundle restart, no re-bake. `param.lane` names `<bundle>/lanes/<module>.js` without `.js` (`"admin/users"` → `lanes/admin/users.js`; each `/`-separated segment matches `^[A-Za-z0-9_][A-Za-z0-9_.-]*$`, so no `..`, no leading `.` or `/`, and no leading `:`, which routing would read as a URL binding). `param.control` keeps its schema-required role and names the module's OWN function export (an inherited `constructor` or `hasOwnProperty` is refused), so `bundle:openapi`'s operationId and `bundle:mcp`'s `io.gina.control` read it unchanged. A URL parameter still needs its binding in `param` (`"id": ":id"`, read as `ctx.params.id`); without it the route does not match. Handler: `module.exports.list = function (ctx) { ctx.json({...}); };` — sync or `async`, called as `fn.call(moduleExports, ctx)`; the module is required ONCE at boot, so setup goes at module scope. Registry: `process.gina._lanes['<bundle>::<lane>#<control>']`, built by `lib/lane` `registerRoutes()` from `core/server.js` `init()` before `listen`; the request path is an O(1) `lookup(req.routing)` — no fs, no `require`. Branch point: `_handleDispatch`, after the match, the `validator::` requirements, the 405, the HEAD alias and the render-cache read. On isaac the lane is the TERMINAL of the bundle's `app.use` chain (session + CSRF still run, `csrfExempt` works; `ctx.session` is `req.session`); on express the app layers already ran and the lane dispatches directly. The controller path is unchanged (no `router.js` or controller edit) and pays one property read. Skipped per lane request: the namespace probe, the options clone, the controller `require`, `inherits`, `new Controller` + `setOptions` (incl. the views block), route middleware, the gates. `ctx` (prototype methods; detached use needs `bind`): `req`/`res` (nulled once answered — a late `json()`/`error()` logs `[ Lane ] … called after the response was released` and returns `false`), `params`, `get` (`req.get`, set on GET/HEAD only), `body` (`req.body`, the POST/PUT/PATCH alias), `routing`, `requestId`, `culture`, `session` (getter), `json(data)`, `error(...)` (`throwError` is an alias), `getConfig(name?)` (the copy-on-write view; `controller.getConfig.mode: "clone"` honoured; the proxy hostname re-point), `hasRole(role)` (the session user; its machine-caller fallback reads `req.machineCaller`, which only the authorization gate sets, so it is inert on a lane route in 0.7.2), `isXMLRequest()`, `pauseRequest(data, storage?)` (the controller's halted-request snapshot). Not on `ctx`: `query`, the `render*` methods, `redirect`, `store`, `startJob`, `t`, `audit`, early hints, trailers, `setPriority` — a route needing one stays a controller route. `ctx.json()` follows `renderJSON`: a `status` key naming a listed non-200 code sets the status (an `errno` alone never does); `param.responseDto` shapes a 2xx; one `JSON.stringify`; the idempotency record at the same point; the access line `METHOD [status] url`; HEAD = headers + `content-length`, no body; written through raw HTTP/2 `stream.respond()` (folding `res.getHeaders()`), the HTTP/2 send shim isaac installs whenever its middleware chain runs (so a wrapping session middleware's `writeHead`/`end` fire), or HTTP/1.x with an explicit `content-length`. `ctx.error()` resolves the controller `throwError` call shapes (`(errorObj)`, `(err)`, `(status, msg|err)`, `(status, obj)`, `(res, status, msg)`; `(status)` and `()` answer the status-text envelope where the controller throws or no-ops) into `{ status, error: <status text>, message, fields | errors, stack (local scope only — outside it a stack-bearing title/message/error keeps its first line), ref }` — `ref` 6 uppercase hex, or a relay-safe supplied one; a one-argument error object keeps its own `error` (else its message), its `message` and a relay-safe `ref`, as the controller does since #B518 — plus ONE pairing line `[ BUNDLE ][ <bundle> ][ Lane ][ ref X ][ req <id> ] METHOD [ status ] url` followed by the full detail (stack, `cause`); it writes `writeHead(code, { content-type, content-length })` + `end`, so headers set earlier (CORS, `X-Request-Id`, `Retry-After`) are kept. Always JSON: no HTML error page, no `fallback`. A handler's sync throw or rejection answers `ctx.error(500, err)` (a non-Error value is wrapped) — a DIFFERENT body from a controller route's thrown action, which the router answers through the server-level `throwError(res, 500, err.stack)` as `{ status, error: <the error text>, ref }` with no `message`. A handler that never answers leaves the response open; the dispatcher never returns the handler's promise and never calls `next`. BOOT REFUSALS (``[ SERVER ] Route `<rule>`: …``, exit before listen): a malformed lane name; `param.control` empty, non-string, `onReady`, `setup` or `redirect`; a rule kept for another bundle; route `middleware`, incl. one inherited from `routing.global.json`; `cache`; `negotiate`; `namespace`; `method: "ws"`; in 0.7.2 every gate key — `param.requireAuth` (unless `false`), `param.roles`, `param.policy`, `rateLimit` or `idempotency` (unless `false`/`null`), `param.messageValidator`, `param.dto` — and the implicit gates: `auth.requireAuthByDefault: true` without `param.public: true`, `server.rateLimit.enabled: true` without `"rateLimit": false`; a missing module (with a hint when the name ends in `.js`), a module that fails to load (the refusal carries the runtime's own error: Node's SyntaxError stack, Bun's `BuildMessage` text), or no own function export of that name. Allowed: `param.responseDto`, `csrfExempt`, `requirements`, `scopes`, `param.public`, `param.requireAuth: false`, `rateLimit: false`. A lane route the bundle did not register at boot, or whose module failed to reload, answers 500 naming it — never a fall-through to a controller. DEV RELOAD: `core/gna.js` watches the `lanes/` root and every directory holding a registered module, for `change` and `rename` (an atomic save), and sets `__hotReload.lane`; the next lane dispatch re-requires every registered module, re-resolves the exports and prunes `lib/lane`'s `module.children`. The watcher block runs inside `gna.onStarted`: a bundle whose `index.js` never calls `onStarted()` (the scaffold leaves it commented out) has no watcher, and the lane then reloads its modules on EVERY lane request in dev — like the controllers. Production loads them once. Observability is inherited: request id, `X-Request-Id` echo, JSON-log `requestId`/`durationMs`, the metrics `route` label, the access line; Inspector Flow bars `lane-dispatch` + `response-write`; the Inspector Query tab does NOT capture a lane handler's queries (only the controller's `setOptions` enters the query-capture context). Engines: isaac HTTP/1.1 and HTTP/2; the Express adapter over HTTP/1.1 (it does not serve HTTP/2). Measured (one process serving a controller route, a lane route and the router-entry floor, mirrored rounds, HTTP/1.1 loopback, ten short records, access line on): lane/controller a median 0.39× CPU (0.25–0.54), about 150 µs saved per request; without the access line the lane costs no more than the router-entry floor. Migration trap: a route that already carried a `param.lane` key for its own data now opts in — rename the key. Running the gates on lane routes (slice 2: the five gate libraries call only `throwError` and `pauseRequest` on the object they are given, so `ctx` can be their egress unchanged) is NOT scheduled.