@synopackageland/cli 0.3.10 → 0.4.1

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 (641) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -9
  3. package/dist/bin.js +1 -2
  4. package/dist/build-spk/generator.d.ts +0 -3
  5. package/dist/build-spk/generator.js +138 -287
  6. package/dist/build-spk/native-lifecycle.js +0 -3
  7. package/dist/build-spk/native-payload.js +0 -1
  8. package/dist/build-spk/notices.d.ts +5 -0
  9. package/dist/build-spk/notices.js +60 -0
  10. package/dist/cli.js +178 -151
  11. package/dist/compose/analyze.d.ts +1 -2
  12. package/dist/compose/analyze.js +5 -48
  13. package/dist/contract/unsupported-types.d.ts +10 -0
  14. package/dist/contract/unsupported-types.js +49 -0
  15. package/dist/contract/validate.js +25 -2
  16. package/dist/contract/web-launch.js +0 -2
  17. package/dist/deploy/deploy.d.ts +1 -4
  18. package/dist/deploy/deploy.js +45 -156
  19. package/dist/deploy/homes-values.js +1 -1
  20. package/dist/deploy/plan.d.ts +18 -0
  21. package/dist/deploy/plan.js +54 -0
  22. package/dist/deploy/spk-version.d.ts +2 -14
  23. package/dist/deploy/spk-version.js +25 -111
  24. package/dist/dev.d.ts +1 -3
  25. package/dist/dev.js +14 -28
  26. package/dist/error-registry.js +830 -862
  27. package/dist/host/dsm-client.js +12 -272
  28. package/dist/host/dsm-port-profile.d.ts +0 -1
  29. package/dist/host/dsm-port-profile.js +0 -2
  30. package/dist/host/types.d.ts +1 -83
  31. package/dist/index.d.ts +0 -9
  32. package/dist/index.js +0 -6
  33. package/dist/info.d.ts +0 -1
  34. package/dist/info.js +3 -10
  35. package/dist/init.d.ts +15 -1
  36. package/dist/init.js +128 -12
  37. package/dist/log.js +2 -3
  38. package/dist/native/validate.js +0 -1
  39. package/dist/standalone/binary.d.ts +9 -0
  40. package/dist/standalone/binary.js +67 -0
  41. package/dist/standalone/build.d.ts +25 -0
  42. package/dist/standalone/build.js +110 -0
  43. package/dist/standalone/daemon.d.ts +23 -0
  44. package/dist/standalone/daemon.js +114 -0
  45. package/dist/standalone/dsm-window.d.ts +26 -0
  46. package/dist/standalone/dsm-window.js +291 -0
  47. package/dist/standalone/helper-inventory.d.ts +16 -0
  48. package/dist/standalone/helper-inventory.js +2 -0
  49. package/dist/standalone/helper.d.ts +21 -0
  50. package/dist/standalone/helper.js +105 -0
  51. package/dist/standalone/host-adapter.d.ts +5 -0
  52. package/dist/standalone/host-adapter.js +148 -0
  53. package/dist/standalone/host-platform.d.ts +13 -0
  54. package/dist/standalone/host-platform.js +42 -0
  55. package/dist/standalone/host-types.d.ts +49 -0
  56. package/dist/standalone/host-types.js +1 -0
  57. package/dist/standalone/i18n.d.ts +28 -0
  58. package/dist/standalone/i18n.js +161 -0
  59. package/dist/standalone/inspect-helper.d.ts +6 -0
  60. package/dist/standalone/inspect-helper.js +88 -0
  61. package/dist/standalone/inspect-spk.d.ts +23 -0
  62. package/dist/standalone/inspect-spk.js +209 -0
  63. package/dist/standalone/lifecycle-helper.d.ts +2 -0
  64. package/dist/standalone/lifecycle-helper.js +12 -0
  65. package/dist/standalone/lifecycle.d.ts +3 -0
  66. package/dist/standalone/lifecycle.js +53 -0
  67. package/dist/standalone/manifest.d.ts +73 -0
  68. package/dist/standalone/manifest.js +279 -0
  69. package/dist/standalone/reopen-events.d.ts +2 -0
  70. package/dist/standalone/reopen-events.js +28 -0
  71. package/dist/standalone/root-messages.d.ts +7 -0
  72. package/dist/standalone/root-messages.js +259 -0
  73. package/dist/standalone/root-ops.d.ts +42 -0
  74. package/dist/standalone/root-ops.js +101 -0
  75. package/dist/standalone/root-window.d.ts +36 -0
  76. package/dist/standalone/root-window.js +302 -0
  77. package/dist/standalone/spk.d.ts +23 -0
  78. package/dist/standalone/spk.js +192 -0
  79. package/dist/template-paths.d.ts +2 -0
  80. package/dist/template-paths.js +9 -0
  81. package/dist/templates/_daemon/fixture_linux_test.go +15 -0
  82. package/dist/templates/_daemon/fixture_other_test.go +7 -0
  83. package/dist/templates/_daemon/go.mod +3 -0
  84. package/dist/templates/_daemon/main.go +608 -0
  85. package/dist/templates/_daemon/main_test.go +242 -0
  86. package/dist/templates/_daemon/process_linux.go +55 -0
  87. package/dist/templates/_daemon/process_linux_test.go +161 -0
  88. package/dist/templates/_daemon/process_other.go +14 -0
  89. package/dist/templates/_daemon/testdata/child.go +41 -0
  90. package/dist/templates/_shared/GO-LICENSE +27 -0
  91. package/dist/templates/_shared/GO-PATENTS +22 -0
  92. package/dist/templates/_shared/LICENSES/TEMPLATE.txt +21 -0
  93. package/dist/templates/_shared/notice-overrides/index.json +14 -0
  94. package/dist/templates/_shared/notice-overrides/utils-0.4.2-LICENSE +21 -0
  95. package/dist/templates/_shared/notice-overrides/utils-0.5.0-LICENSE +21 -0
  96. package/dist/templates/_shared/third-party-notices.mjs +51 -0
  97. package/dist/templates/binary/synology-app.yaml +7 -0
  98. package/dist/templates/hello-files/compose.yaml +0 -1
  99. package/dist/templates/hello-web/compose.yaml +13 -10
  100. package/dist/templates/hello-web/html/app.js +1 -23
  101. package/dist/templates/hello-web/html/index.html +1 -3
  102. package/dist/templates/hello-web-page/compose.yaml +13 -10
  103. package/dist/templates/hello-web-page/html/app.js +1 -23
  104. package/dist/templates/hello-web-page/html/index.html +1 -3
  105. package/dist/templates/native-go/README.md +324 -0
  106. package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +59 -0
  107. package/dist/templates/native-go/backend/cmd/app/main.go +49 -0
  108. package/dist/templates/native-go/backend/cmd/dsm-readonly-probe/main_linux.go +46 -0
  109. package/dist/templates/native-go/backend/cmd/helper/main.go +38 -0
  110. package/dist/templates/native-go/backend/go.mod +7 -0
  111. package/dist/templates/native-go/backend/go.sum +4 -0
  112. package/dist/templates/native-go/backend/internal/api/binary.go +154 -0
  113. package/dist/templates/native-go/backend/internal/api/binary_test.go +165 -0
  114. package/dist/templates/native-go/backend/internal/api/errors.go +33 -0
  115. package/dist/templates/native-go/backend/internal/api/registry.go +104 -0
  116. package/dist/templates/native-go/backend/internal/api/registry_test.go +329 -0
  117. package/dist/templates/native-go/backend/internal/api/server.go +159 -0
  118. package/dist/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +121 -0
  119. package/dist/templates/native-go/backend/internal/app/nas_refusal_test.go +46 -0
  120. package/dist/templates/native-go/backend/internal/app/root_none.go +9 -0
  121. package/dist/templates/native-go/backend/internal/app/routes.go +138 -0
  122. package/dist/templates/native-go/backend/internal/app/routes_test.go +172 -0
  123. package/dist/templates/native-go/backend/internal/dsm/auth.go +118 -0
  124. package/dist/templates/native-go/backend/internal/dsm/auth_test.go +139 -0
  125. package/dist/templates/native-go/backend/internal/dsmprobe/collector_linux.go +335 -0
  126. package/dist/templates/native-go/backend/internal/dsmprobe/collector_linux_test.go +41 -0
  127. package/dist/templates/native-go/backend/internal/dsmprobe/protocol.go +179 -0
  128. package/dist/templates/native-go/backend/internal/dsmprobe/protocol_test.go +29 -0
  129. package/dist/templates/native-go/backend/internal/helper/cohort.go +393 -0
  130. package/dist/templates/native-go/backend/internal/helper/cohort_publication.go +18 -0
  131. package/dist/templates/native-go/backend/internal/helper/cohort_publication_test.go +105 -0
  132. package/dist/templates/native-go/backend/internal/helper/cohort_test.go +372 -0
  133. package/dist/templates/native-go/backend/internal/helper/control.go +424 -0
  134. package/dist/templates/native-go/backend/internal/helper/control_test.go +250 -0
  135. package/dist/templates/native-go/backend/internal/helper/data_contract.go +242 -0
  136. package/dist/templates/native-go/backend/internal/helper/data_contract_test.go +51 -0
  137. package/dist/templates/native-go/backend/internal/helper/data_decode.go +184 -0
  138. package/dist/templates/native-go/backend/internal/helper/data_decode_pointer_test.go +30 -0
  139. package/dist/templates/native-go/backend/internal/helper/data_protocol.go +416 -0
  140. package/dist/templates/native-go/backend/internal/helper/data_protocol_test.go +449 -0
  141. package/dist/templates/native-go/backend/internal/helper/dsm_acl_linux.go +139 -0
  142. package/dist/templates/native-go/backend/internal/helper/dsm_acl_linux_test.go +121 -0
  143. package/dist/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux.go +95 -0
  144. package/dist/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux_test.go +56 -0
  145. package/dist/templates/native-go/backend/internal/helper/dsm_bridge_linux.go +144 -0
  146. package/dist/templates/native-go/backend/internal/helper/dsm_bridge_linux_test.go +89 -0
  147. package/dist/templates/native-go/backend/internal/helper/dsm_home_linux.go +107 -0
  148. package/dist/templates/native-go/backend/internal/helper/dsm_home_linux_test.go +82 -0
  149. package/dist/templates/native-go/backend/internal/helper/dsm_probe_transport_linux.go +151 -0
  150. package/dist/templates/native-go/backend/internal/helper/dsm_probe_transport_linux_test.go +66 -0
  151. package/dist/templates/native-go/backend/internal/helper/grant_authority.go +516 -0
  152. package/dist/templates/native-go/backend/internal/helper/grant_authority_contract.go +88 -0
  153. package/dist/templates/native-go/backend/internal/helper/grant_authority_test.go +510 -0
  154. package/dist/templates/native-go/backend/internal/helper/grant_cohort.go +389 -0
  155. package/dist/templates/native-go/backend/internal/helper/grant_cohort_test.go +239 -0
  156. package/dist/templates/native-go/backend/internal/helper/grant_delivery.go +49 -0
  157. package/dist/templates/native-go/backend/internal/helper/grant_delivery_methods.go +273 -0
  158. package/dist/templates/native-go/backend/internal/helper/grant_delivery_test.go +322 -0
  159. package/dist/templates/native-go/backend/internal/helper/grant_operation_contract.go +47 -0
  160. package/dist/templates/native-go/backend/internal/helper/grant_readonly_test.go +180 -0
  161. package/dist/templates/native-go/backend/internal/helper/grant_repository_linux.go +415 -0
  162. package/dist/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +468 -0
  163. package/dist/templates/native-go/backend/internal/helper/grant_rpc.go +147 -0
  164. package/dist/templates/native-go/backend/internal/helper/grant_rpc_test.go +51 -0
  165. package/dist/templates/native-go/backend/internal/helper/grant_snapshot.go +75 -0
  166. package/dist/templates/native-go/backend/internal/helper/grant_supervisor_linux.go +134 -0
  167. package/dist/templates/native-go/backend/internal/helper/grant_supervisor_linux_test.go +254 -0
  168. package/dist/templates/native-go/backend/internal/helper/lease.go +112 -0
  169. package/dist/templates/native-go/backend/internal/helper/lease_linux.go +44 -0
  170. package/dist/templates/native-go/backend/internal/helper/lease_other.go +8 -0
  171. package/dist/templates/native-go/backend/internal/helper/lifecycle.go +234 -0
  172. package/dist/templates/native-go/backend/internal/helper/lifecycle_test.go +473 -0
  173. package/dist/templates/native-go/backend/internal/helper/managed_pilot.go +284 -0
  174. package/dist/templates/native-go/backend/internal/helper/managed_pilot_repository_linux.go +74 -0
  175. package/dist/templates/native-go/backend/internal/helper/managed_pilot_repository_linux_test.go +40 -0
  176. package/dist/templates/native-go/backend/internal/helper/managed_pilot_test.go +210 -0
  177. package/dist/templates/native-go/backend/internal/helper/nas_shipped_refusal_linux_test.go +97 -0
  178. package/dist/templates/native-go/backend/internal/helper/native_discovery.go +79 -0
  179. package/dist/templates/native-go/backend/internal/helper/native_identity.go +89 -0
  180. package/dist/templates/native-go/backend/internal/helper/native_provider.go +159 -0
  181. package/dist/templates/native-go/backend/internal/helper/native_provider_test.go +421 -0
  182. package/dist/templates/native-go/backend/internal/helper/observation.go +204 -0
  183. package/dist/templates/native-go/backend/internal/helper/observation_health_test.go +115 -0
  184. package/dist/templates/native-go/backend/internal/helper/observation_reload_budget_test.go +117 -0
  185. package/dist/templates/native-go/backend/internal/helper/observation_test.go +196 -0
  186. package/dist/templates/native-go/backend/internal/helper/observer_diagnostic.go +109 -0
  187. package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux.go +76 -0
  188. package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +124 -0
  189. package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_test.go +98 -0
  190. package/dist/templates/native-go/backend/internal/helper/operation_bootstrap_linux.go +193 -0
  191. package/dist/templates/native-go/backend/internal/helper/operation_credentials_linux.go +56 -0
  192. package/dist/templates/native-go/backend/internal/helper/operation_linux.go +480 -0
  193. package/dist/templates/native-go/backend/internal/helper/operation_linux_test.go +528 -0
  194. package/dist/templates/native-go/backend/internal/helper/peer_linux.go +44 -0
  195. package/dist/templates/native-go/backend/internal/helper/peer_other.go +7 -0
  196. package/dist/templates/native-go/backend/internal/helper/process_linux.go +177 -0
  197. package/dist/templates/native-go/backend/internal/helper/process_other.go +5 -0
  198. package/dist/templates/native-go/backend/internal/helper/publication_test.go +178 -0
  199. package/dist/templates/native-go/backend/internal/helper/read_stream_cohort_linux_test.go +156 -0
  200. package/dist/templates/native-go/backend/internal/helper/read_transfer.go +40 -0
  201. package/dist/templates/native-go/backend/internal/helper/read_transfer_linux.go +109 -0
  202. package/dist/templates/native-go/backend/internal/helper/read_transfer_linux_test.go +118 -0
  203. package/dist/templates/native-go/backend/internal/helper/read_transfer_test.go +177 -0
  204. package/dist/templates/native-go/backend/internal/helper/readonly.go +105 -0
  205. package/dist/templates/native-go/backend/internal/helper/readonly_admission.go +85 -0
  206. package/dist/templates/native-go/backend/internal/helper/readonly_cohort_linux_test.go +253 -0
  207. package/dist/templates/native-go/backend/internal/helper/readonly_linux_test.go +378 -0
  208. package/dist/templates/native-go/backend/internal/helper/readonly_mount_linux.go +65 -0
  209. package/dist/templates/native-go/backend/internal/helper/readonly_mount_proxy_linux.go +113 -0
  210. package/dist/templates/native-go/backend/internal/helper/readonly_operations_linux.go +168 -0
  211. package/dist/templates/native-go/backend/internal/helper/readonly_resolver_linux.go +241 -0
  212. package/dist/templates/native-go/backend/internal/helper/readonly_test.go +40 -0
  213. package/dist/templates/native-go/backend/internal/helper/relaxed_identity.go +252 -0
  214. package/dist/templates/native-go/backend/internal/helper/relaxed_identity_contract.go +105 -0
  215. package/dist/templates/native-go/backend/internal/helper/relaxed_identity_test.go +406 -0
  216. package/dist/templates/native-go/backend/internal/helper/relaxed_invalidation.go +200 -0
  217. package/dist/templates/native-go/backend/internal/helper/repair.go +132 -0
  218. package/dist/templates/native-go/backend/internal/helper/repair_test.go +271 -0
  219. package/dist/templates/native-go/backend/internal/helper/s1r_actor_acl_linux_test.go +303 -0
  220. package/dist/templates/native-go/backend/internal/helper/s1r_actor_fixture_linux_test.go +184 -0
  221. package/dist/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +231 -0
  222. package/dist/templates/native-go/backend/internal/helper/s1r_fixture_contract_linux_test.go +18 -0
  223. package/dist/templates/native-go/backend/internal/helper/server_linux.go +124 -0
  224. package/dist/templates/native-go/backend/internal/helper/status.go +334 -0
  225. package/dist/templates/native-go/backend/internal/helper/status_test.go +288 -0
  226. package/dist/templates/native-go/backend/internal/helper/supervision.go +107 -0
  227. package/dist/templates/native-go/backend/internal/helper/supervision_test.go +124 -0
  228. package/dist/templates/native-go/backend/internal/helper/supervisor_frame.go +76 -0
  229. package/dist/templates/native-go/backend/internal/helper/supervisor_frame_linux_test.go +69 -0
  230. package/dist/templates/native-go/backend/internal/helper/supervisor_frame_test.go +107 -0
  231. package/dist/templates/native-go/backend/internal/helper/supervisor_linux.go +363 -0
  232. package/dist/templates/native-go/backend/internal/helper/supervisor_linux_test.go +913 -0
  233. package/dist/templates/native-go/backend/internal/helper/supervisor_socket_eof_test.go +74 -0
  234. package/dist/templates/native-go/backend/internal/helper/supervisor_socket_test.go +45 -0
  235. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/create.json +23 -0
  236. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/frames.json +67 -0
  237. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/grant-store.json +52 -0
  238. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/intent.json +20 -0
  239. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/list.json +20 -0
  240. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/publish.json +20 -0
  241. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/read.json +22 -0
  242. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/stat.json +22 -0
  243. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/write-stream.json +22 -0
  244. package/dist/templates/native-go/backend/internal/helper/unit_connection.go +75 -0
  245. package/dist/templates/native-go/backend/internal/helper/unit_connection_linux_test.go +135 -0
  246. package/dist/templates/native-go/backend/internal/helper/unit_connection_test.go +133 -0
  247. package/dist/templates/native-go/backend/internal/helper/unit_frame_test.go +32 -0
  248. package/dist/templates/native-go/backend/internal/helper/unit_linux.go +364 -0
  249. package/dist/templates/native-go/backend/internal/helper/unit_linux_test.go +46 -0
  250. package/dist/templates/native-go/backend/internal/helper/unit_mechanisms_linux_test.go +217 -0
  251. package/dist/templates/native-go/backend/internal/helper/unit_padding_linux_test.go +178 -0
  252. package/dist/templates/native-go/backend/internal/helper/unit_query_linux.go +111 -0
  253. package/dist/templates/native-go/backend/internal/helper/unit_reload_linux_test.go +372 -0
  254. package/dist/templates/native-go/backend/internal/helper/unit_reload_sequence_linux_test.go +232 -0
  255. package/dist/templates/native-go/backend/internal/helper/write.go +77 -0
  256. package/dist/templates/native-go/backend/internal/helper/write_admission.go +260 -0
  257. package/dist/templates/native-go/backend/internal/helper/write_admission_test.go +135 -0
  258. package/dist/templates/native-go/backend/internal/helper/write_cohort_linux_test.go +218 -0
  259. package/dist/templates/native-go/backend/internal/helper/write_files_linux.go +202 -0
  260. package/dist/templates/native-go/backend/internal/helper/write_files_linux_test.go +199 -0
  261. package/dist/templates/native-go/backend/internal/helper/write_intent_linux.go +116 -0
  262. package/dist/templates/native-go/backend/internal/helper/write_intent_linux_test.go +74 -0
  263. package/dist/templates/native-go/backend/internal/helper/write_operation_linux.go +245 -0
  264. package/dist/templates/native-go/backend/internal/helper/write_test.go +53 -0
  265. package/dist/templates/native-go/dsm-package.yaml +58 -0
  266. package/dist/templates/native-go/gitignore +1 -0
  267. package/dist/templates/native-go/i18n/glossary.json +662 -0
  268. package/dist/templates/native-go/i18n/messages/de.json +28 -0
  269. package/dist/templates/native-go/i18n/messages/en.json +28 -0
  270. package/dist/templates/native-go/i18n/messages/es.json +28 -0
  271. package/dist/templates/native-go/i18n/messages/fr.json +28 -0
  272. package/dist/templates/native-go/i18n/messages/it.json +28 -0
  273. package/dist/templates/native-go/i18n/messages/ja.json +28 -0
  274. package/dist/templates/native-go/i18n/messages/ko.json +28 -0
  275. package/dist/templates/native-go/i18n/messages/zh-CN.json +28 -0
  276. package/dist/templates/native-go/i18n/messages/zh-TW.json +28 -0
  277. package/dist/templates/native-go/ui/app.css +35 -0
  278. package/dist/templates/native-go/ui/app.js +101 -0
  279. package/dist/templates/native-go-better-auth/backend/internal/app/identity.go +208 -0
  280. package/dist/templates/native-go-better-auth/backend/internal/app/identity_test.go +113 -0
  281. package/dist/templates/native-go-better-auth/node/app.mjs +72 -0
  282. package/dist/templates/native-go-better-auth/node/build.mjs +4 -0
  283. package/dist/templates/native-go-better-auth/node/package-lock.json +862 -0
  284. package/dist/templates/native-go-better-auth/node/package.json +1 -0
  285. package/dist/templates/native-go-better-auth/node/test/auth.test.mjs +31 -0
  286. package/dist/templates/native-go-integration/backend/internal/app/identity_none.go +6 -0
  287. package/dist/templates/native-go-integration/backend/internal/app/personal.go +203 -0
  288. package/dist/templates/native-go-integration/backend/internal/app/personal_test.go +119 -0
  289. package/dist/templates/native-go-root/backend/internal/app/root.go +107 -0
  290. package/dist/templates/native-go-root/backend/internal/app/root_test.go +124 -0
  291. package/dist/templates/native-go-root/root/whoami.sh +6 -0
  292. package/dist/templates/native-go-vue/README.md +224 -0
  293. package/dist/templates/native-go-vue/frontend/DESIGN.md +78 -0
  294. package/dist/templates/native-go-vue/frontend/package-lock.json +2410 -0
  295. package/dist/templates/native-go-vue/frontend/package.json +6 -0
  296. package/dist/templates/native-go-vue/frontend/src/App.vue +159 -0
  297. package/dist/templates/native-go-vue/frontend/src/context.ts +56 -0
  298. package/dist/templates/native-go-vue/frontend/src/main.ts +29 -0
  299. package/dist/templates/native-go-vue/frontend/src/nas/NasGrantSettings.vue +74 -0
  300. package/dist/templates/native-go-vue/frontend/src/nas/NasPathPicker.vue +106 -0
  301. package/dist/templates/native-go-vue/frontend/src/nas/NasUnavailable.vue +20 -0
  302. package/dist/templates/native-go-vue/frontend/src/nas/i18n/de.json +74 -0
  303. package/dist/templates/native-go-vue/frontend/src/nas/i18n/en.json +74 -0
  304. package/dist/templates/native-go-vue/frontend/src/nas/i18n/es.json +74 -0
  305. package/dist/templates/native-go-vue/frontend/src/nas/i18n/fr.json +74 -0
  306. package/dist/templates/native-go-vue/frontend/src/nas/i18n/it.json +74 -0
  307. package/dist/templates/native-go-vue/frontend/src/nas/i18n/ja.json +74 -0
  308. package/dist/templates/native-go-vue/frontend/src/nas/i18n/ko.json +74 -0
  309. package/dist/templates/native-go-vue/frontend/src/nas/i18n/zh-CN.json +74 -0
  310. package/dist/templates/native-go-vue/frontend/src/nas/i18n/zh-TW.json +74 -0
  311. package/dist/templates/native-go-vue/frontend/src/nas/i18n.ts +38 -0
  312. package/dist/templates/native-go-vue/frontend/src/nas/mock-provider.ts +119 -0
  313. package/dist/templates/native-go-vue/frontend/src/nas/provider.ts +59 -0
  314. package/dist/templates/native-go-vue/frontend/src/nas/use-request.ts +27 -0
  315. package/dist/templates/native-go-vue/frontend/src/style.css +31 -0
  316. package/dist/templates/native-go-vue/frontend/test/apps.test.ts +190 -0
  317. package/dist/templates/native-go-vue/frontend/test/nas-provider.test.ts +81 -0
  318. package/dist/templates/native-go-vue/frontend/test/nas-request.test.ts +21 -0
  319. package/dist/templates/native-go-vue/frontend/test/nas-ui.test.ts +261 -0
  320. package/dist/templates/native-go-vue/frontend/tsconfig.json +1 -0
  321. package/dist/templates/native-go-vue/frontend/vite.config.ts +10 -0
  322. package/dist/templates/native-go-vue/gitignore +2 -0
  323. package/dist/types.d.ts +1 -1
  324. package/dist/validate.js +11 -7
  325. package/package.json +5 -8
  326. package/schema/synology-app.schema.json +36 -37
  327. package/skills/SKILL.md +4 -48
  328. package/skills/reference/create.md +11 -83
  329. package/skills/reference/deploy.md +7 -78
  330. package/skills/reference/diagnose.md +4 -101
  331. package/skills/reference/files.md +5 -41
  332. package/skills/reference/identity.md +3 -29
  333. package/skills/reference/wrap.md +0 -2
  334. package/templates/_daemon/fixture_linux_test.go +15 -0
  335. package/templates/_daemon/fixture_other_test.go +7 -0
  336. package/templates/_daemon/go.mod +3 -0
  337. package/templates/_daemon/main.go +608 -0
  338. package/templates/_daemon/main_test.go +242 -0
  339. package/templates/_daemon/process_linux.go +55 -0
  340. package/templates/_daemon/process_linux_test.go +161 -0
  341. package/templates/_daemon/process_other.go +14 -0
  342. package/templates/_daemon/testdata/child.go +41 -0
  343. package/templates/_shared/GO-LICENSE +27 -0
  344. package/templates/_shared/GO-PATENTS +22 -0
  345. package/templates/_shared/LICENSES/TEMPLATE.txt +21 -0
  346. package/templates/_shared/notice-overrides/index.json +14 -0
  347. package/templates/_shared/notice-overrides/utils-0.4.2-LICENSE +21 -0
  348. package/templates/_shared/notice-overrides/utils-0.5.0-LICENSE +21 -0
  349. package/templates/_shared/third-party-notices.mjs +51 -0
  350. package/templates/binary/synology-app.yaml +7 -0
  351. package/templates/hello-files/compose.yaml +0 -1
  352. package/templates/hello-web/compose.yaml +13 -10
  353. package/templates/hello-web/html/app.js +1 -23
  354. package/templates/hello-web/html/index.html +1 -3
  355. package/templates/hello-web-page/compose.yaml +13 -10
  356. package/templates/hello-web-page/html/app.js +1 -23
  357. package/templates/hello-web-page/html/index.html +1 -3
  358. package/templates/native-go/README.md +324 -0
  359. package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +59 -0
  360. package/templates/native-go/backend/cmd/app/main.go +49 -0
  361. package/templates/native-go/backend/cmd/dsm-readonly-probe/main_linux.go +46 -0
  362. package/templates/native-go/backend/cmd/helper/main.go +38 -0
  363. package/templates/native-go/backend/go.mod +7 -0
  364. package/templates/native-go/backend/go.sum +4 -0
  365. package/templates/native-go/backend/internal/api/binary.go +154 -0
  366. package/templates/native-go/backend/internal/api/binary_test.go +165 -0
  367. package/templates/native-go/backend/internal/api/errors.go +33 -0
  368. package/templates/native-go/backend/internal/api/registry.go +104 -0
  369. package/templates/native-go/backend/internal/api/registry_test.go +329 -0
  370. package/templates/native-go/backend/internal/api/server.go +159 -0
  371. package/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +121 -0
  372. package/templates/native-go/backend/internal/app/nas_refusal_test.go +46 -0
  373. package/templates/native-go/backend/internal/app/root_none.go +9 -0
  374. package/templates/native-go/backend/internal/app/routes.go +138 -0
  375. package/templates/native-go/backend/internal/app/routes_test.go +172 -0
  376. package/templates/native-go/backend/internal/dsm/auth.go +118 -0
  377. package/templates/native-go/backend/internal/dsm/auth_test.go +139 -0
  378. package/templates/native-go/backend/internal/dsmprobe/collector_linux.go +335 -0
  379. package/templates/native-go/backend/internal/dsmprobe/collector_linux_test.go +41 -0
  380. package/templates/native-go/backend/internal/dsmprobe/protocol.go +179 -0
  381. package/templates/native-go/backend/internal/dsmprobe/protocol_test.go +29 -0
  382. package/templates/native-go/backend/internal/helper/cohort.go +393 -0
  383. package/templates/native-go/backend/internal/helper/cohort_publication.go +18 -0
  384. package/templates/native-go/backend/internal/helper/cohort_publication_test.go +105 -0
  385. package/templates/native-go/backend/internal/helper/cohort_test.go +372 -0
  386. package/templates/native-go/backend/internal/helper/control.go +424 -0
  387. package/templates/native-go/backend/internal/helper/control_test.go +250 -0
  388. package/templates/native-go/backend/internal/helper/data_contract.go +242 -0
  389. package/templates/native-go/backend/internal/helper/data_contract_test.go +51 -0
  390. package/templates/native-go/backend/internal/helper/data_decode.go +184 -0
  391. package/templates/native-go/backend/internal/helper/data_decode_pointer_test.go +30 -0
  392. package/templates/native-go/backend/internal/helper/data_protocol.go +416 -0
  393. package/templates/native-go/backend/internal/helper/data_protocol_test.go +449 -0
  394. package/templates/native-go/backend/internal/helper/dsm_acl_linux.go +139 -0
  395. package/templates/native-go/backend/internal/helper/dsm_acl_linux_test.go +121 -0
  396. package/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux.go +95 -0
  397. package/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux_test.go +56 -0
  398. package/templates/native-go/backend/internal/helper/dsm_bridge_linux.go +144 -0
  399. package/templates/native-go/backend/internal/helper/dsm_bridge_linux_test.go +89 -0
  400. package/templates/native-go/backend/internal/helper/dsm_home_linux.go +107 -0
  401. package/templates/native-go/backend/internal/helper/dsm_home_linux_test.go +82 -0
  402. package/templates/native-go/backend/internal/helper/dsm_probe_transport_linux.go +151 -0
  403. package/templates/native-go/backend/internal/helper/dsm_probe_transport_linux_test.go +66 -0
  404. package/templates/native-go/backend/internal/helper/grant_authority.go +516 -0
  405. package/templates/native-go/backend/internal/helper/grant_authority_contract.go +88 -0
  406. package/templates/native-go/backend/internal/helper/grant_authority_test.go +510 -0
  407. package/templates/native-go/backend/internal/helper/grant_cohort.go +389 -0
  408. package/templates/native-go/backend/internal/helper/grant_cohort_test.go +239 -0
  409. package/templates/native-go/backend/internal/helper/grant_delivery.go +49 -0
  410. package/templates/native-go/backend/internal/helper/grant_delivery_methods.go +273 -0
  411. package/templates/native-go/backend/internal/helper/grant_delivery_test.go +322 -0
  412. package/templates/native-go/backend/internal/helper/grant_operation_contract.go +47 -0
  413. package/templates/native-go/backend/internal/helper/grant_readonly_test.go +180 -0
  414. package/templates/native-go/backend/internal/helper/grant_repository_linux.go +415 -0
  415. package/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +468 -0
  416. package/templates/native-go/backend/internal/helper/grant_rpc.go +147 -0
  417. package/templates/native-go/backend/internal/helper/grant_rpc_test.go +51 -0
  418. package/templates/native-go/backend/internal/helper/grant_snapshot.go +75 -0
  419. package/templates/native-go/backend/internal/helper/grant_supervisor_linux.go +134 -0
  420. package/templates/native-go/backend/internal/helper/grant_supervisor_linux_test.go +254 -0
  421. package/templates/native-go/backend/internal/helper/lease.go +112 -0
  422. package/templates/native-go/backend/internal/helper/lease_linux.go +44 -0
  423. package/templates/native-go/backend/internal/helper/lease_other.go +8 -0
  424. package/templates/native-go/backend/internal/helper/lifecycle.go +234 -0
  425. package/templates/native-go/backend/internal/helper/lifecycle_test.go +473 -0
  426. package/templates/native-go/backend/internal/helper/managed_pilot.go +284 -0
  427. package/templates/native-go/backend/internal/helper/managed_pilot_repository_linux.go +74 -0
  428. package/templates/native-go/backend/internal/helper/managed_pilot_repository_linux_test.go +40 -0
  429. package/templates/native-go/backend/internal/helper/managed_pilot_test.go +210 -0
  430. package/templates/native-go/backend/internal/helper/nas_shipped_refusal_linux_test.go +97 -0
  431. package/templates/native-go/backend/internal/helper/native_discovery.go +79 -0
  432. package/templates/native-go/backend/internal/helper/native_identity.go +89 -0
  433. package/templates/native-go/backend/internal/helper/native_provider.go +159 -0
  434. package/templates/native-go/backend/internal/helper/native_provider_test.go +421 -0
  435. package/templates/native-go/backend/internal/helper/observation.go +204 -0
  436. package/templates/native-go/backend/internal/helper/observation_health_test.go +115 -0
  437. package/templates/native-go/backend/internal/helper/observation_reload_budget_test.go +117 -0
  438. package/templates/native-go/backend/internal/helper/observation_test.go +196 -0
  439. package/templates/native-go/backend/internal/helper/observer_diagnostic.go +109 -0
  440. package/templates/native-go/backend/internal/helper/observer_diagnostic_linux.go +76 -0
  441. package/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +124 -0
  442. package/templates/native-go/backend/internal/helper/observer_diagnostic_test.go +98 -0
  443. package/templates/native-go/backend/internal/helper/operation_bootstrap_linux.go +193 -0
  444. package/templates/native-go/backend/internal/helper/operation_credentials_linux.go +56 -0
  445. package/templates/native-go/backend/internal/helper/operation_linux.go +480 -0
  446. package/templates/native-go/backend/internal/helper/operation_linux_test.go +528 -0
  447. package/templates/native-go/backend/internal/helper/peer_linux.go +44 -0
  448. package/templates/native-go/backend/internal/helper/peer_other.go +7 -0
  449. package/templates/native-go/backend/internal/helper/process_linux.go +177 -0
  450. package/templates/native-go/backend/internal/helper/process_other.go +5 -0
  451. package/templates/native-go/backend/internal/helper/publication_test.go +178 -0
  452. package/templates/native-go/backend/internal/helper/read_stream_cohort_linux_test.go +156 -0
  453. package/templates/native-go/backend/internal/helper/read_transfer.go +40 -0
  454. package/templates/native-go/backend/internal/helper/read_transfer_linux.go +109 -0
  455. package/templates/native-go/backend/internal/helper/read_transfer_linux_test.go +118 -0
  456. package/templates/native-go/backend/internal/helper/read_transfer_test.go +177 -0
  457. package/templates/native-go/backend/internal/helper/readonly.go +105 -0
  458. package/templates/native-go/backend/internal/helper/readonly_admission.go +85 -0
  459. package/templates/native-go/backend/internal/helper/readonly_cohort_linux_test.go +253 -0
  460. package/templates/native-go/backend/internal/helper/readonly_linux_test.go +378 -0
  461. package/templates/native-go/backend/internal/helper/readonly_mount_linux.go +65 -0
  462. package/templates/native-go/backend/internal/helper/readonly_mount_proxy_linux.go +113 -0
  463. package/templates/native-go/backend/internal/helper/readonly_operations_linux.go +168 -0
  464. package/templates/native-go/backend/internal/helper/readonly_resolver_linux.go +241 -0
  465. package/templates/native-go/backend/internal/helper/readonly_test.go +40 -0
  466. package/templates/native-go/backend/internal/helper/relaxed_identity.go +252 -0
  467. package/templates/native-go/backend/internal/helper/relaxed_identity_contract.go +105 -0
  468. package/templates/native-go/backend/internal/helper/relaxed_identity_test.go +406 -0
  469. package/templates/native-go/backend/internal/helper/relaxed_invalidation.go +200 -0
  470. package/templates/native-go/backend/internal/helper/repair.go +132 -0
  471. package/templates/native-go/backend/internal/helper/repair_test.go +271 -0
  472. package/templates/native-go/backend/internal/helper/s1r_actor_acl_linux_test.go +303 -0
  473. package/templates/native-go/backend/internal/helper/s1r_actor_fixture_linux_test.go +184 -0
  474. package/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +231 -0
  475. package/templates/native-go/backend/internal/helper/s1r_fixture_contract_linux_test.go +18 -0
  476. package/templates/native-go/backend/internal/helper/server_linux.go +124 -0
  477. package/templates/native-go/backend/internal/helper/status.go +334 -0
  478. package/templates/native-go/backend/internal/helper/status_test.go +288 -0
  479. package/templates/native-go/backend/internal/helper/supervision.go +107 -0
  480. package/templates/native-go/backend/internal/helper/supervision_test.go +124 -0
  481. package/templates/native-go/backend/internal/helper/supervisor_frame.go +76 -0
  482. package/templates/native-go/backend/internal/helper/supervisor_frame_linux_test.go +69 -0
  483. package/templates/native-go/backend/internal/helper/supervisor_frame_test.go +107 -0
  484. package/templates/native-go/backend/internal/helper/supervisor_linux.go +363 -0
  485. package/templates/native-go/backend/internal/helper/supervisor_linux_test.go +913 -0
  486. package/templates/native-go/backend/internal/helper/supervisor_socket_eof_test.go +74 -0
  487. package/templates/native-go/backend/internal/helper/supervisor_socket_test.go +45 -0
  488. package/templates/native-go/backend/internal/helper/testdata/protocol2/create.json +23 -0
  489. package/templates/native-go/backend/internal/helper/testdata/protocol2/frames.json +67 -0
  490. package/templates/native-go/backend/internal/helper/testdata/protocol2/grant-store.json +52 -0
  491. package/templates/native-go/backend/internal/helper/testdata/protocol2/intent.json +20 -0
  492. package/templates/native-go/backend/internal/helper/testdata/protocol2/list.json +20 -0
  493. package/templates/native-go/backend/internal/helper/testdata/protocol2/publish.json +20 -0
  494. package/templates/native-go/backend/internal/helper/testdata/protocol2/read.json +22 -0
  495. package/templates/native-go/backend/internal/helper/testdata/protocol2/stat.json +22 -0
  496. package/templates/native-go/backend/internal/helper/testdata/protocol2/write-stream.json +22 -0
  497. package/templates/native-go/backend/internal/helper/unit_connection.go +75 -0
  498. package/templates/native-go/backend/internal/helper/unit_connection_linux_test.go +135 -0
  499. package/templates/native-go/backend/internal/helper/unit_connection_test.go +133 -0
  500. package/templates/native-go/backend/internal/helper/unit_frame_test.go +32 -0
  501. package/templates/native-go/backend/internal/helper/unit_linux.go +364 -0
  502. package/templates/native-go/backend/internal/helper/unit_linux_test.go +46 -0
  503. package/templates/native-go/backend/internal/helper/unit_mechanisms_linux_test.go +217 -0
  504. package/templates/native-go/backend/internal/helper/unit_padding_linux_test.go +178 -0
  505. package/templates/native-go/backend/internal/helper/unit_query_linux.go +111 -0
  506. package/templates/native-go/backend/internal/helper/unit_reload_linux_test.go +372 -0
  507. package/templates/native-go/backend/internal/helper/unit_reload_sequence_linux_test.go +232 -0
  508. package/templates/native-go/backend/internal/helper/write.go +77 -0
  509. package/templates/native-go/backend/internal/helper/write_admission.go +260 -0
  510. package/templates/native-go/backend/internal/helper/write_admission_test.go +135 -0
  511. package/templates/native-go/backend/internal/helper/write_cohort_linux_test.go +218 -0
  512. package/templates/native-go/backend/internal/helper/write_files_linux.go +202 -0
  513. package/templates/native-go/backend/internal/helper/write_files_linux_test.go +199 -0
  514. package/templates/native-go/backend/internal/helper/write_intent_linux.go +116 -0
  515. package/templates/native-go/backend/internal/helper/write_intent_linux_test.go +74 -0
  516. package/templates/native-go/backend/internal/helper/write_operation_linux.go +245 -0
  517. package/templates/native-go/backend/internal/helper/write_test.go +53 -0
  518. package/templates/native-go/dsm-package.yaml +58 -0
  519. package/templates/native-go/gitignore +1 -0
  520. package/templates/native-go/i18n/glossary.json +662 -0
  521. package/templates/native-go/i18n/messages/de.json +28 -0
  522. package/templates/native-go/i18n/messages/en.json +28 -0
  523. package/templates/native-go/i18n/messages/es.json +28 -0
  524. package/templates/native-go/i18n/messages/fr.json +28 -0
  525. package/templates/native-go/i18n/messages/it.json +28 -0
  526. package/templates/native-go/i18n/messages/ja.json +28 -0
  527. package/templates/native-go/i18n/messages/ko.json +28 -0
  528. package/templates/native-go/i18n/messages/zh-CN.json +28 -0
  529. package/templates/native-go/i18n/messages/zh-TW.json +28 -0
  530. package/templates/native-go/ui/app.css +35 -0
  531. package/templates/native-go/ui/app.js +101 -0
  532. package/templates/native-go-better-auth/backend/internal/app/identity.go +208 -0
  533. package/templates/native-go-better-auth/backend/internal/app/identity_test.go +113 -0
  534. package/templates/native-go-better-auth/node/app.mjs +72 -0
  535. package/templates/native-go-better-auth/node/build.mjs +4 -0
  536. package/templates/native-go-better-auth/node/package-lock.json +862 -0
  537. package/templates/native-go-better-auth/node/package.json +1 -0
  538. package/templates/native-go-better-auth/node/test/auth.test.mjs +31 -0
  539. package/templates/native-go-integration/backend/internal/app/identity_none.go +6 -0
  540. package/templates/native-go-integration/backend/internal/app/personal.go +203 -0
  541. package/templates/native-go-integration/backend/internal/app/personal_test.go +119 -0
  542. package/templates/native-go-root/backend/internal/app/root.go +107 -0
  543. package/templates/native-go-root/backend/internal/app/root_test.go +124 -0
  544. package/templates/native-go-root/root/whoami.sh +6 -0
  545. package/templates/native-go-vue/README.md +224 -0
  546. package/templates/native-go-vue/frontend/DESIGN.md +78 -0
  547. package/templates/native-go-vue/frontend/package-lock.json +2410 -0
  548. package/templates/native-go-vue/frontend/package.json +6 -0
  549. package/templates/native-go-vue/frontend/src/App.vue +159 -0
  550. package/templates/native-go-vue/frontend/src/context.ts +56 -0
  551. package/templates/native-go-vue/frontend/src/main.ts +29 -0
  552. package/templates/native-go-vue/frontend/src/nas/NasGrantSettings.vue +74 -0
  553. package/templates/native-go-vue/frontend/src/nas/NasPathPicker.vue +106 -0
  554. package/templates/native-go-vue/frontend/src/nas/NasUnavailable.vue +20 -0
  555. package/templates/native-go-vue/frontend/src/nas/i18n/de.json +74 -0
  556. package/templates/native-go-vue/frontend/src/nas/i18n/en.json +74 -0
  557. package/templates/native-go-vue/frontend/src/nas/i18n/es.json +74 -0
  558. package/templates/native-go-vue/frontend/src/nas/i18n/fr.json +74 -0
  559. package/templates/native-go-vue/frontend/src/nas/i18n/it.json +74 -0
  560. package/templates/native-go-vue/frontend/src/nas/i18n/ja.json +74 -0
  561. package/templates/native-go-vue/frontend/src/nas/i18n/ko.json +74 -0
  562. package/templates/native-go-vue/frontend/src/nas/i18n/zh-CN.json +74 -0
  563. package/templates/native-go-vue/frontend/src/nas/i18n/zh-TW.json +74 -0
  564. package/templates/native-go-vue/frontend/src/nas/i18n.ts +38 -0
  565. package/templates/native-go-vue/frontend/src/nas/mock-provider.ts +119 -0
  566. package/templates/native-go-vue/frontend/src/nas/provider.ts +59 -0
  567. package/templates/native-go-vue/frontend/src/nas/use-request.ts +27 -0
  568. package/templates/native-go-vue/frontend/src/style.css +31 -0
  569. package/templates/native-go-vue/frontend/test/apps.test.ts +190 -0
  570. package/templates/native-go-vue/frontend/test/nas-provider.test.ts +81 -0
  571. package/templates/native-go-vue/frontend/test/nas-request.test.ts +21 -0
  572. package/templates/native-go-vue/frontend/test/nas-ui.test.ts +261 -0
  573. package/templates/native-go-vue/frontend/tsconfig.json +1 -0
  574. package/templates/native-go-vue/frontend/vite.config.ts +10 -0
  575. package/templates/native-go-vue/gitignore +2 -0
  576. package/dist/attestation/app-package.d.ts +0 -86
  577. package/dist/attestation/app-package.js +0 -206
  578. package/dist/attestation/install-on-host.d.ts +0 -14
  579. package/dist/attestation/install-on-host.js +0 -52
  580. package/dist/attestation/keyring.d.ts +0 -21
  581. package/dist/attestation/keyring.js +0 -168
  582. package/dist/attestation/platform-service.d.ts +0 -70
  583. package/dist/attestation/platform-service.js +0 -250
  584. package/dist/build-spk/broker-glue.d.ts +0 -16
  585. package/dist/build-spk/broker-glue.js +0 -40
  586. package/dist/deploy/catalog-publish.d.ts +0 -3
  587. package/dist/deploy/catalog-publish.js +0 -7
  588. package/dist/doctor.d.ts +0 -22
  589. package/dist/doctor.js +0 -822
  590. package/dist/error-collector.d.ts +0 -2
  591. package/dist/error-collector.js +0 -46
  592. package/dist/host/broker-paths.d.ts +0 -1
  593. package/dist/host/broker-paths.js +0 -1
  594. package/dist/host/broker-upgrade-preflight.d.ts +0 -61
  595. package/dist/host/broker-upgrade-preflight.js +0 -156
  596. package/dist/host/digests.d.ts +0 -5
  597. package/dist/host/digests.js +0 -63
  598. package/dist/host/fake-nas.d.ts +0 -49
  599. package/dist/host/fake-nas.js +0 -193
  600. package/dist/mock-broker/bootstrap.d.ts +0 -2
  601. package/dist/mock-broker/bootstrap.js +0 -8
  602. package/dist/mock-broker/files.d.ts +0 -60
  603. package/dist/mock-broker/files.js +0 -408
  604. package/dist/mock-broker/oidc.d.ts +0 -31
  605. package/dist/mock-broker/oidc.js +0 -161
  606. package/dist/mock-broker/path.d.ts +0 -9
  607. package/dist/mock-broker/path.js +0 -50
  608. package/dist/mock-broker/server.d.ts +0 -19
  609. package/dist/mock-broker/server.js +0 -350
  610. package/dist/publish/build-ledger.d.ts +0 -22
  611. package/dist/publish/build-ledger.js +0 -26
  612. package/dist/publish/community-path.d.ts +0 -6
  613. package/dist/publish/community-path.js +0 -41
  614. package/dist/publish/curated-release.d.ts +0 -78
  615. package/dist/publish/curated-release.js +0 -883
  616. package/dist/publish/file-build-ledger.d.ts +0 -18
  617. package/dist/publish/file-build-ledger.js +0 -268
  618. package/dist/publish/github-pr.d.ts +0 -25
  619. package/dist/publish/github-pr.js +0 -85
  620. package/dist/publish/github-repo.d.ts +0 -8
  621. package/dist/publish/github-repo.js +0 -21
  622. package/dist/publish/platform-service-release.d.ts +0 -60
  623. package/dist/publish/platform-service-release.js +0 -333
  624. package/dist/publish/preflight.d.ts +0 -24
  625. package/dist/publish/preflight.js +0 -138
  626. package/dist/publish/publish.d.ts +0 -27
  627. package/dist/publish/publish.js +0 -136
  628. package/dist/publish/sync-definition.d.ts +0 -4
  629. package/dist/publish/sync-definition.js +0 -48
  630. package/dist/release-bin.d.ts +0 -2
  631. package/dist/release-bin.js +0 -23
  632. package/dist/templates/hello-web/html/sdk.js +0 -68
  633. package/dist/templates/hello-web-page/html/sdk.js +0 -68
  634. package/dist/templates/native/synology-app.yaml +0 -7
  635. package/dist/test-host.d.ts +0 -15
  636. package/dist/test-host.js +0 -37
  637. package/templates/hello-web/html/sdk.js +0 -68
  638. package/templates/hello-web-page/html/sdk.js +0 -68
  639. package/templates/native/synology-app.yaml +0 -7
  640. /package/dist/templates/{native → binary}/native.yaml +0 -0
  641. /package/templates/{native → binary}/native.yaml +0 -0
@@ -0,0 +1,389 @@
1
+ package helper
2
+
3
+ import (
4
+ "bytes"
5
+ "context"
6
+ "encoding/json"
7
+ "slices"
8
+ )
9
+
10
+ type cohortReceipt struct {
11
+ binding operationBinding
12
+ bytes uint64
13
+ write *retiredWriteReceipt
14
+ }
15
+
16
+ func (c *operationCohort) retire(id string, op *cohortOperation) {
17
+ if c.receipts == nil {
18
+ c.receipts = map[string]cohortReceipt{}
19
+ }
20
+ receipt := cohortReceipt{binding: op.binding, bytes: op.bytes}
21
+ if op.writeWork != nil {
22
+ value, code, known := MutationReceipt{}, ErrCleanupRequired, false
23
+ if p, ok := op.process.(writeMutationProcess); ok {
24
+ value, code, known = p.mutationResult()
25
+ }
26
+ value.EffectsUnknown = !known
27
+ retired := *op
28
+ retired.process = nil
29
+ receipt.write = &retiredWriteReceipt{retired, value, code, !known}
30
+ }
31
+ c.receipts[id] = receipt
32
+ delete(c.operations, id)
33
+ c.reaped++
34
+ }
35
+ func (q GrantDrainProof) valid() bool {
36
+ return allReferences(q.Key.Epoch, q.Key.GrantID) && q.Key.Revision > 0 && q.Started <= MaxReplayEntries && q.Started == q.Reaped && q.AdmittedBytes <= MaxReplayEntries*MaxTransferBytes && q.BytesWritten <= q.AdmittedBytes && q.WriteOperations <= q.Started && q.PublishedOperations <= q.WriteOperations && q.CommittedOperations <= q.PublishedOperations && (!q.WriteEffectsUnknown || q.WriteOperations > 0)
37
+ }
38
+
39
+ // Sole supervisor owner/reaper only. This derives Q from S2's actual removal
40
+ // condition (Wait4 + stopped relay/FDs), including operations previously polled.
41
+ func (c *operationCohort) DrainGrant(ctx context.Context, key GrantDrainKey) (GrantQuiescence, Code) {
42
+ if key.Epoch != c.epoch || !allReferences(key.GrantID) || key.Revision == 0 {
43
+ return GrantQuiescence{}, ErrStale
44
+ }
45
+ if err := c.cancelGrant(ctx, key.GrantID, key.Revision); err != nil {
46
+ return GrantQuiescence{}, ErrCleanupRequired
47
+ }
48
+ if ctx.Err() != nil {
49
+ return GrantQuiescence{}, ErrCleanupRequired
50
+ }
51
+ for _, op := range c.operations {
52
+ if op.binding.GrantID == key.GrantID {
53
+ return GrantQuiescence{}, ErrCleanupRequired
54
+ }
55
+ }
56
+ proof := GrantDrainProof{Key: key}
57
+ for _, receipt := range c.receipts {
58
+ if receipt.binding.GrantID != key.GrantID {
59
+ continue
60
+ }
61
+ if receipt.binding.Epoch != key.Epoch || receipt.binding.GrantRevision >= key.Revision {
62
+ return GrantQuiescence{}, ErrStale
63
+ }
64
+ proof.Started++
65
+ proof.Reaped++
66
+ proof.AdmittedBytes += receipt.bytes
67
+ if receipt.write != nil {
68
+ proof.WriteOperations++
69
+ proof.BytesWritten += receipt.write.receipt.BytesWritten
70
+ if receipt.write.unknown || receipt.write.code == ErrCommitUncertain {
71
+ proof.WriteEffectsUnknown = true
72
+ }
73
+ if receipt.write.receipt.Published {
74
+ proof.PublishedOperations++
75
+ }
76
+ if receipt.write.receipt.Committed {
77
+ proof.CommittedOperations++
78
+ }
79
+ }
80
+ }
81
+ if !proof.valid() {
82
+ return GrantQuiescence{}, ErrCleanupRequired
83
+ }
84
+ return GrantQuiescence{Key: key, Cohort: &proof, ChildrenReaped: true, RelayClosed: true, LeasesClosed: true, FDsClosed: true, EffectsRecorded: true}, ""
85
+ }
86
+
87
+ type supervisorGrants struct {
88
+ authority *GrantAuthority
89
+ cohort *operationCohort
90
+ services supervisorGrantServices
91
+ tickets, nonces map[string]bool // one bounded window/epoch, never evicted
92
+ streamTickets, streamNonces map[string]bool
93
+ streamRPCNonces map[string]bool
94
+ rpcNonces map[string]bool
95
+ }
96
+
97
+ func newSupervisorGrants(repo GrantRepository, cohort *operationCohort, services supervisorGrantServices) (*supervisorGrants, Code) {
98
+ if cohort == nil || cohort.gate == nil {
99
+ return nil, ErrUnavailable
100
+ }
101
+ authority, code := NewGrantAuthority(repo, services.native, services.consent, cohort)
102
+ if code != "" {
103
+ return nil, code
104
+ }
105
+ if authority.policy.Inventory != cohort.inventory || authority.policy.Epoch != cohort.epoch {
106
+ return nil, ErrIncompatible
107
+ }
108
+ // Set before publishing the runtime; observer fencing and all grant mutations
109
+ // now share the SAME mutex. No helper-local or cross-process mutex claim.
110
+ authority.mu = &cohort.gate.mu
111
+ authority.gate = cohort.gate
112
+ authority.writes = services.writes
113
+ return &supervisorGrants{authority: authority, cohort: cohort, services: services, tickets: map[string]bool{}, nonces: map[string]bool{}, rpcNonces: map[string]bool{}, streamTickets: map[string]bool{}, streamNonces: map[string]bool{}, streamRPCNonces: map[string]bool{}}, ""
114
+ }
115
+ func (a *GrantAuthority) grantForActor(actor NativeActor, r DataRequest) (Grant, Code) {
116
+ a.mu.Lock()
117
+ defer a.mu.Unlock()
118
+ var result Grant
119
+ code := a.transaction(func(s *GrantStore) (bool, Code) {
120
+ g := findGrant(s, r.GrantID)
121
+ if g == nil {
122
+ return false, ErrDenied
123
+ }
124
+ if g.Scope.Kind == ScopePersonal && g.Owner != actor.Principal() {
125
+ return false, ErrDenied
126
+ }
127
+ if g.State == GrantRevoked {
128
+ return false, ErrRevoked
129
+ }
130
+ if g.Revision != r.GrantRevision {
131
+ return false, ErrStale
132
+ }
133
+ if g.State == GrantSuspended {
134
+ return false, ErrSuspended
135
+ }
136
+ if !slices.Contains(g.Actions, r.Op) {
137
+ return false, ErrDenied
138
+ }
139
+ result = cloneAuthorityGrant(*g)
140
+ return false, ""
141
+ })
142
+ return result, code
143
+ }
144
+ func (s *supervisorGrants) validate(ctx context.Context, carriers SessionCarriers, r DataRequest, old *NativeActor) (NativeActor, GrantUseValidation, Code) {
145
+ if code := validateOperationRequest(r, s.services.writes); code != "" {
146
+ return NativeActor{}, GrantUseValidation{}, code
147
+ }
148
+ if !r.Op.ReadOnly() && !s.services.writes.allows(r.Op) {
149
+ return NativeActor{}, GrantUseValidation{}, ErrUnsupported
150
+ }
151
+ if r.Inventory != s.cohort.inventory || r.Epoch != s.cohort.epoch {
152
+ return NativeActor{}, GrantUseValidation{}, ErrStale
153
+ }
154
+ actor, code := s.authority.actor(ctx, carriers, old)
155
+ if code != "" {
156
+ return NativeActor{}, GrantUseValidation{}, code
157
+ }
158
+ g, code := s.authority.grantForActor(actor, r)
159
+ if code != "" {
160
+ return NativeActor{}, GrantUseValidation{}, code
161
+ }
162
+ if s.services.operations == nil {
163
+ return NativeActor{}, GrantUseValidation{}, ErrUnavailable
164
+ }
165
+ proof, code := s.services.operations.ValidateOperation(ctx, actor, r, g)
166
+ if code = nativeObservationCode(ctx, code); code != "" {
167
+ return NativeActor{}, GrantUseValidation{}, code
168
+ }
169
+ actor, code = s.authority.actor(ctx, carriers, &actor)
170
+ if code != "" {
171
+ return NativeActor{}, GrantUseValidation{}, code
172
+ }
173
+ return actor, proof, ""
174
+ }
175
+ func (s *supervisorGrants) ticketLocked(r DataRequest, b TicketBinding, actor NativeActor) Code {
176
+ if b.Inventory != r.Inventory || b.Epoch != r.Epoch || b.SubjectRef != actor.Principal().SubjectRef || b.SessionRef != actor.SessionRef() || b.Action != r.Op || b.GrantID != r.GrantID || b.GrantRevision != r.GrantRevision || b.OperationID != r.OperationID || b.Nonce != r.Nonce || b.Ticket != r.Ticket || b.RequestDigest != r.Digest() {
177
+ return ErrDenied
178
+ }
179
+ now := s.authority.now()
180
+ if !now.Before(b.ExpiresAt) {
181
+ return ErrExpired
182
+ }
183
+ if b.ExpiresAt.Sub(now) > IntentTTL {
184
+ return ErrInvalid
185
+ }
186
+ if s.tickets[r.Ticket] || s.nonces[r.Nonce] || s.streamTickets[r.Ticket] || s.streamNonces[r.Nonce] {
187
+ return ErrReplay
188
+ }
189
+ full := len(s.tickets) >= MaxReplayEntries
190
+ if r.Op == ActionReadStream || r.Op == ActionWriteStream {
191
+ full = len(s.streamTickets) >= MaxStreamReplayEntries
192
+ }
193
+ if full {
194
+ return ErrBusy
195
+ }
196
+ return ""
197
+ }
198
+ func (s *supervisorGrants) burnTicket(r DataRequest) {
199
+ if r.Op == ActionReadStream || r.Op == ActionWriteStream {
200
+ s.streamTickets[r.Ticket] = true
201
+ s.streamNonces[r.Nonce] = true
202
+ return
203
+ }
204
+ s.tickets[r.Ticket] = true
205
+ s.nonces[r.Nonce] = true
206
+ }
207
+ func (s *supervisorGrants) start(ctx context.Context, peer operationPeer, carriers SessionCarriers, r DataRequest) Code {
208
+ if !r.Op.ReadOnly() {
209
+ return s.startWrite(ctx, peer, carriers, r)
210
+ }
211
+ if !s.cohort.peerAllowed(peer) {
212
+ return ErrDenied
213
+ }
214
+ actor, proof, code := s.validate(ctx, carriers, r, nil)
215
+ if code != "" {
216
+ return code
217
+ }
218
+ work, code := readOnlyRequestWork(r, proof.root)
219
+ if code != "" {
220
+ return code
221
+ }
222
+ binding := operationBinding{r.Inventory, r.Epoch, r.OperationID, r.Nonce, r.GrantID, r.GrantRevision}
223
+ var op *cohortOperation
224
+ code = s.authority.WithGrantAdmission(GrantAdmission{actor, r.GrantID, r.GrantRevision, r.Op, proof.Binding, proof.Continuous}, func(g Grant, a NativeActor) Code {
225
+ if ctx.Err() != nil {
226
+ return nativeContextCode(ctx)
227
+ }
228
+ if code := s.ticketLocked(r, proof.Ticket, a); code != "" {
229
+ return code
230
+ }
231
+ var code Code
232
+ op, code = s.cohort.reserveLocked(a, binding)
233
+ if code != "" {
234
+ return code
235
+ }
236
+ op.maxBytes = work.MaxBytes
237
+ op.segments = slices.Clone(work.Segments)
238
+ op.work = work
239
+ op.root = proof.root
240
+ s.burnTicket(r)
241
+ return ""
242
+ })
243
+ if code != "" {
244
+ return code
245
+ }
246
+ return s.cohort.launchReserved(op)
247
+ }
248
+ func (s *supervisorGrants) chunk(ctx context.Context, peer operationPeer, carriers SessionCarriers, r DataRequest) Code {
249
+ if !r.Op.ReadOnly() {
250
+ return s.writeControl(ctx, peer, carriers, r, false)
251
+ }
252
+ if !s.cohort.peerAllowed(peer) {
253
+ return ErrDenied
254
+ }
255
+ op := s.cohort.operations[r.OperationID]
256
+ if op == nil || op.binding.Inventory != r.Inventory || op.binding.Epoch != r.Epoch || op.binding.GrantID != r.GrantID || op.binding.GrantRevision != r.GrantRevision {
257
+ return ErrDenied
258
+ }
259
+ if op.canceled || op.process == nil {
260
+ return ErrCanceled
261
+ }
262
+ if op.expired(s.cohort.now()) {
263
+ op.canceled = true
264
+ op.process.stopRelay()
265
+ return ErrTimeout
266
+ }
267
+ actor, proof, code := s.validate(ctx, carriers, r, &op.actor)
268
+ if code != "" {
269
+ op.canceled = true
270
+ op.process.stopRelay()
271
+ return code
272
+ }
273
+ work, code := readOnlyRequestWork(r, proof.root)
274
+ if code != "" {
275
+ return code
276
+ }
277
+ if (r.Op != ActionRead && r.Op != ActionReadStream) || !sameReadOnlyRequest(op, work, proof.root, false) {
278
+ return ErrDenied
279
+ }
280
+ if work.MaxBytes > MaxChunkBytes {
281
+ return ErrLimit
282
+ }
283
+ if p, ok := op.process.(readOnlyMetadataProcess); ok {
284
+ if code := p.readOnlyLeaseReady(uint32(work.MaxBytes)); code != "" {
285
+ return code
286
+ }
287
+ }
288
+ code = s.authority.WithGrantAdmission(GrantAdmission{actor, r.GrantID, r.GrantRevision, r.Op, proof.Binding, proof.Continuous}, func(g Grant, a NativeActor) Code {
289
+ if ctx.Err() != nil {
290
+ return nativeContextCode(ctx)
291
+ }
292
+ if code := s.ticketLocked(r, proof.Ticket, a); code != "" {
293
+ return code
294
+ }
295
+ if code := s.cohort.reserveChunkLocked(op, a, uint32(work.MaxBytes)); code != "" {
296
+ return code
297
+ }
298
+ s.burnTicket(r)
299
+ return ""
300
+ })
301
+ if code != "" {
302
+ return code
303
+ }
304
+ return s.cohort.deliverChunk(op, uint32(work.MaxBytes))
305
+ }
306
+
307
+ // JSON-only, bounded decoded controls; no credential serialization here.
308
+ func bytesReader(b json.RawMessage) *bytes.Reader { return bytes.NewReader(b) }
309
+
310
+ // Nonblocking metadata polling on the SAME S3 owner/admission/ticket path.
311
+ // Filesystem IO has already run in the actor child; metadata is never published
312
+ // until fresh identity, grant, continuity, action, decoded args and ticket pass.
313
+ func (s *supervisorGrants) result(ctx context.Context, peer operationPeer, carriers SessionCarriers, r DataRequest) (*readOnlyResult, Code) {
314
+ if !s.cohort.peerAllowed(peer) {
315
+ return nil, ErrDenied
316
+ }
317
+ op := s.cohort.operations[r.OperationID]
318
+ if op == nil || op.binding.Inventory != r.Inventory || op.binding.Epoch != r.Epoch || op.binding.GrantID != r.GrantID || op.binding.GrantRevision != r.GrantRevision {
319
+ return nil, ErrDenied
320
+ }
321
+ if op.canceled || op.process == nil {
322
+ return nil, ErrCanceled
323
+ }
324
+ if op.expired(s.cohort.now()) {
325
+ op.canceled = true
326
+ op.process.stopRelay()
327
+ return nil, ErrTimeout
328
+ }
329
+ actor, proof, code := s.validate(ctx, carriers, r, &op.actor)
330
+ if code != "" {
331
+ op.canceled = true
332
+ op.process.stopRelay()
333
+ return nil, code
334
+ }
335
+ work, code := readOnlyRequestWork(r, proof.root)
336
+ if code != "" {
337
+ return nil, code
338
+ }
339
+ if !sameReadOnlyRequest(op, work, proof.root, true) {
340
+ return nil, ErrDenied
341
+ }
342
+ p, ok := op.process.(readOnlyMetadataProcess)
343
+ if !ok {
344
+ return nil, ErrUnavailable
345
+ }
346
+ value, ready, err := p.readOnlyMetadata()
347
+ if err != nil {
348
+ op.canceled = true
349
+ op.process.stopRelay()
350
+ return nil, ErrCleanupRequired
351
+ }
352
+ if !ready {
353
+ return nil, ErrBusy
354
+ }
355
+ var result *readOnlyResult
356
+ code = s.authority.WithGrantAdmission(GrantAdmission{actor, r.GrantID, r.GrantRevision, r.Op, proof.Binding, proof.Continuous}, func(_ Grant, a NativeActor) Code {
357
+ if ctx.Err() != nil {
358
+ return nativeContextCode(ctx)
359
+ }
360
+ if op.canceled {
361
+ return ErrCanceled
362
+ }
363
+ if op.expired(s.cohort.now()) {
364
+ op.canceled = true
365
+ op.process.stopRelay()
366
+ return ErrTimeout
367
+ }
368
+ if code := s.ticketLocked(r, proof.Ticket, a); code != "" {
369
+ return code
370
+ }
371
+ result = cloneReadOnlyResult(value)
372
+ if result == nil {
373
+ return ErrUnavailable
374
+ }
375
+ op.actor = a
376
+ s.burnTicket(r)
377
+ return ""
378
+ })
379
+ if code != "" {
380
+ return nil, code
381
+ }
382
+ // Private completion ACK/IO stays outside grant/policy/admission locks.
383
+ if err := p.releaseReadOnlyMetadata(); err != nil {
384
+ op.canceled = true
385
+ op.process.stopRelay()
386
+ return nil, ErrCleanupRequired
387
+ }
388
+ return result, ""
389
+ }
@@ -0,0 +1,239 @@
1
+ package helper
2
+
3
+ import (
4
+ "context"
5
+ "encoding/json"
6
+ "syscall"
7
+ "testing"
8
+ "time"
9
+ )
10
+
11
+ type grantOperationStub struct {
12
+ after func()
13
+ code Code
14
+ }
15
+
16
+ func (v grantOperationStub) ValidateOperation(_ context.Context, a NativeActor, r DataRequest, g Grant) (GrantUseValidation, Code) {
17
+ if v.after != nil {
18
+ v.after()
19
+ }
20
+ return GrantUseValidation{Binding: g.LastValidated, Continuous: true, Ticket: TicketBinding{Inventory: r.Inventory, Epoch: r.Epoch, SubjectRef: a.Principal().SubjectRef, SessionRef: a.SessionRef(), Action: r.Op, GrantID: r.GrantID, GrantRevision: r.GrantRevision, OperationID: r.OperationID, Nonce: r.Nonce, Ticket: r.Ticket, RequestDigest: r.Digest(), ExpiresAt: a.account.CheckedAt.Add(IntentTTL)}}, v.code
21
+ }
22
+ func grantCohortFixture(t *testing.T) (*supervisorGrants, *memoryGrantRepository, *operationCohort, SessionCarriers, Grant, *[]*operationFixture) {
23
+ t.Helper()
24
+ a, r, p, _, _, consent, carriers, now := grantAuthorityFixture(t)
25
+ gate := newAdmission(Binding{Boot: "boot", Install: "install"})
26
+ gate.observe(gate.binding, 1, true, now)
27
+ children := new([]*operationFixture)
28
+ cohort := newOperationCohort(r.policy.Inventory, r.policy.Epoch, 42, gate, func() bool { return true })
29
+ cohort.now = func() time.Time { return now }
30
+ cohort.startChild = func(NativeActor, operationBinding) (operationProcess, error) {
31
+ child := &operationFixture{childFixture: childFixture{exitOn: syscall.SIGTERM}}
32
+ *children = append(*children, child)
33
+ return child, nil
34
+ }
35
+ runtime, code := newSupervisorGrants(r, cohort, supervisorGrantServices{native: p, consent: consent, operations: grantOperationStub{}})
36
+ if code != "" {
37
+ t.Fatal(code)
38
+ }
39
+ runtime.authority.now = a.now
40
+ grant := confirmGrant(t, runtime.authority, r, carriers, prepareGrant(t, runtime.authority, carriers, ScopePersonal))
41
+ return runtime, r, cohort, carriers, grant, children
42
+ }
43
+ func grantControl(t *testing.T, g Grant, op, nonce, ticket byte, n uint64) DataRequest {
44
+ t.Helper()
45
+ args, _ := json.Marshal(ReadArgs{Segments: []string{"fixture"}, MaxBytes: n})
46
+ return DataRequest{Inventory: g.Inventory, Op: ActionRead, Epoch: g.LastValidated.Epoch, GrantID: g.ID, GrantRevision: g.Revision, OperationID: grantRef(op), Nonce: grantRef(nonce), Ticket: grantRef(ticket), Args: args}
47
+ }
48
+ func TestGrantCohortReservationRevokeAndS2Proof(t *testing.T) {
49
+ runtime, r, c, carriers, g, children := grantCohortFixture(t)
50
+ request := grantControl(t, g, '1', '2', '3', MaxBoundedBytes)
51
+ if code := runtime.start(context.Background(), operationPeer{42, 0}, carriers, request); code != "" {
52
+ t.Fatal(code)
53
+ }
54
+ chunk := grantControl(t, g, '1', '4', '5', MaxChunkBytes)
55
+ if code := runtime.chunk(context.Background(), operationPeer{42, 0}, carriers, chunk); code != "" {
56
+ t.Fatal(code)
57
+ }
58
+ result, code := runtime.authority.Revoke(context.Background(), carriers, g.ID, 1, r.store.Revision)
59
+ if code != "" || !result.Revoked || !result.Drained || !(*children)[0].reaped || len(c.operations) != 0 {
60
+ t.Fatal(result, code)
61
+ }
62
+ if r.q.Cohort == nil || r.q.Cohort.Started != 1 || r.q.Cohort.Reaped != 1 || r.q.Cohort.AdmittedBytes != MaxChunkBytes {
63
+ t.Fatal("Q did not carry S2 proof", r.q)
64
+ }
65
+ if code := runtime.chunk(context.Background(), operationPeer{42, 0}, carriers, grantControl(t, g, '1', '6', '7', 1)); code == "" {
66
+ t.Fatal("lease after R")
67
+ }
68
+ }
69
+ func TestGrantCohortSharedFenceAndNoBootstrapInDiskLocks(t *testing.T) {
70
+ runtime, repo, cohort, carriers, g, children := grantCohortFixture(t)
71
+ if runtime.authority.mu != &cohort.gate.mu {
72
+ t.Fatal("independent ordering mutex")
73
+ }
74
+ original := cohort.startChild
75
+ cohort.startChild = func(a NativeActor, b operationBinding) (operationProcess, error) {
76
+ if repo.inTransaction {
77
+ t.Fatal("bootstrap while disk locks held")
78
+ }
79
+ cohort.gate.fence("during-bootstrap")
80
+ return original(a, b)
81
+ }
82
+ if code := runtime.start(context.Background(), operationPeer{42, 0}, carriers, grantControl(t, g, '1', '2', '3', 1)); code != ErrFenced {
83
+ t.Fatal(code)
84
+ }
85
+ if len(*children) != 1 || !(*children)[0].stopped || len((*children)[0].signals) != 0 {
86
+ t.Fatal("lost owned child or signalled before durable fence")
87
+ }
88
+
89
+ }
90
+ func TestGrantCohortPeerTicketAndGrantChecks(t *testing.T) {
91
+ for _, kind := range []string{"peer", "uid", "revision", "suspended", "fence", "ticket", "nil-validator", "replay"} {
92
+ t.Run(kind, func(t *testing.T) {
93
+ runtime, r, c, carriers, g, children := grantCohortFixture(t)
94
+ request := grantControl(t, g, '1', '2', '3', 1)
95
+ peer := operationPeer{42, 0}
96
+ switch kind {
97
+ case "peer":
98
+ peer.PID++
99
+ case "uid":
100
+ peer.UID++
101
+ case "revision":
102
+ request.GrantRevision++
103
+ case "suspended":
104
+ r.store.Grants[0].State = GrantSuspended
105
+ r.store.Grants[0].Reason = ErrSuspended
106
+ case "fence":
107
+ c.gate.fence("test")
108
+ case "ticket":
109
+ runtime.services.operations = grantOperationStub{code: ErrDenied}
110
+ case "nil-validator":
111
+ runtime.services.operations = nil
112
+ case "replay":
113
+ if code := runtime.start(context.Background(), peer, carriers, request); code != "" {
114
+ t.Fatal(code)
115
+ }
116
+ }
117
+ before := len(*children)
118
+ if code := runtime.start(context.Background(), peer, carriers, request); code == "" || len(*children) != before {
119
+ t.Fatal("invalid reservation launched", kind, code)
120
+ }
121
+ })
122
+ }
123
+ }
124
+ func TestGrantCohortChunkRevalidatesGrantAndTicket(t *testing.T) {
125
+ runtime, r, c, carriers, g, children := grantCohortFixture(t)
126
+ if code := runtime.start(context.Background(), operationPeer{42, 0}, carriers, grantControl(t, g, '1', '2', '3', 10)); code != "" {
127
+ t.Fatal(code)
128
+ }
129
+ if code := runtime.chunk(context.Background(), operationPeer{42, 0}, carriers, grantControl(t, g, '1', '4', '5', 11)); code != ErrLimit {
130
+ t.Fatal("requested byte ceiling", code)
131
+ }
132
+ chunk := grantControl(t, g, '1', '6', '7', 1)
133
+ if code := runtime.chunk(context.Background(), operationPeer{42, 0}, carriers, chunk); code != "" {
134
+ t.Fatal(code)
135
+ }
136
+ if code := runtime.chunk(context.Background(), operationPeer{42, 0}, carriers, chunk); code != ErrReplay {
137
+ t.Fatal("ticket replay", code)
138
+ }
139
+ (*children)[0].pending = false
140
+ r.store.Grants[0].State = GrantRevoked
141
+ r.store.Grants[0].Reason = ErrRevoked
142
+ r.store.Grants[0].RevokedAt = g.CreatedAt
143
+ r.store.Grants[0].Revision++
144
+ if code := runtime.chunk(context.Background(), operationPeer{42, 0}, carriers, grantControl(t, g, '1', '8', '9', 1)); code != ErrRevoked {
145
+ t.Fatal(code)
146
+ }
147
+ if err := c.cancelGrant(context.Background(), g.ID, 2); err != nil {
148
+ t.Fatal(err)
149
+ }
150
+ }
151
+ func TestGrantCohortNoQForUnknownChildOrRelay(t *testing.T) {
152
+ for _, kind := range []string{"child", "relay"} {
153
+ t.Run(kind, func(t *testing.T) {
154
+ runtime, r, _, carriers, g, children := grantCohortFixture(t)
155
+ if code := runtime.start(context.Background(), operationPeer{42, 0}, carriers, grantControl(t, g, '1', '2', '3', 1)); code != "" {
156
+ t.Fatal(code)
157
+ }
158
+ if kind == "child" {
159
+ (*children)[0].err = syscall.ECHILD
160
+ } else {
161
+ (*children)[0].stuck = true
162
+ (*children)[0].pending = true
163
+ }
164
+ ctx, cancel := context.WithTimeout(context.Background(), 20*time.Millisecond)
165
+ defer cancel()
166
+ result, code := runtime.authority.Revoke(ctx, carriers, g.ID, 1, r.store.Revision)
167
+ if code != ErrCleanupRequired || !result.Revoked || result.Drained {
168
+ t.Fatal("false Q", result, code)
169
+ }
170
+ if kind == "child" && len((*children)[0].signals) != 0 {
171
+ t.Fatal("foreign signal")
172
+ }
173
+ })
174
+ }
175
+ }
176
+
177
+ func TestGrantCohortRejectsInvalidReceipt(t *testing.T) {
178
+ key := GrantDrainKey{grantRef('e'), grantRef('f'), 2}
179
+ q := completeGrantProof(key)
180
+ q.Cohort = &GrantDrainProof{Key: key, Started: 1, Reaped: 0}
181
+ if completeQuiescence(q) {
182
+ t.Fatal("unreaped child accepted")
183
+ }
184
+ q.Cohort.Reaped = 1
185
+ q.Cohort.Key.Revision++
186
+ if completeQuiescence(q) {
187
+ t.Fatal("foreign receipt accepted")
188
+ }
189
+ }
190
+
191
+ type alteredGrantTicket struct{ grantOperationStub }
192
+
193
+ func (v alteredGrantTicket) ValidateOperation(ctx context.Context, a NativeActor, r DataRequest, g Grant) (GrantUseValidation, Code) {
194
+ p, c := v.grantOperationStub.ValidateOperation(ctx, a, r, g)
195
+ p.Ticket.RequestDigest = grantRef('f')
196
+ return p, c
197
+ }
198
+ func TestGrantCohortBindsCompleteTicketDigest(t *testing.T) {
199
+ s, _, _, carriers, g, children := grantCohortFixture(t)
200
+ s.services.operations = alteredGrantTicket{}
201
+ if code := s.start(context.Background(), operationPeer{42, 0}, carriers, grantControl(t, g, '1', '2', '3', 1)); code != ErrDenied || len(*children) != 0 {
202
+ t.Fatal("substituted control ticket", code)
203
+ }
204
+ }
205
+
206
+ func TestReloadSuspensionBlocksGrantAndCohortWithoutRevokingEpoch(t *testing.T) {
207
+ runtime, repo, c, carriers, g, children := grantCohortFixture(t)
208
+ now := c.now()
209
+ c.gate.requestUnitCheck(true, now)
210
+ commits := repo.commits
211
+ c.gate.mu.Lock()
212
+ code := runtime.authority.transaction(func(*GrantStore) (bool, Code) { t.Fatal("disk transaction during suspension"); return true, "" })
213
+ c.gate.mu.Unlock()
214
+ if code != ErrFenced || runtime.authority.fenced || c.fenced || repo.commits != commits {
215
+ t.Fatal("suspension permanently revoked authority")
216
+ }
217
+ if code = c.start(context.Background(), operationPeer{42, 0}, runtime.authority.native, carriers, NativeActor{}, operationBinding{}); code == "" {
218
+ t.Fatal("start admitted during suspension")
219
+ }
220
+ c.gate.mu.Lock()
221
+ allowed := c.allowed()
222
+ c.gate.mu.Unlock()
223
+ if allowed || len(*children) != 0 {
224
+ t.Fatal("cohort bypassed suspension")
225
+ }
226
+ c.gate.requestUnitCheck(false, now)
227
+ serial, _ := c.gate.unitProbe(now)
228
+ c.gate.observeUnit(c.gate.binding, 1, "", false, true, serial, now)
229
+ if code = runtime.start(context.Background(), operationPeer{42, 0}, carriers, grantControl(t, g, '1', '2', '3', 1)); code != "" || len(*children) != 1 {
230
+ t.Fatal("verified reload could not resume original grant/epoch", code)
231
+ }
232
+ c.gate.fence("unit-stopped")
233
+ c.gate.mu.Lock()
234
+ code = runtime.authority.transaction(func(*GrantStore) (bool, Code) { return false, "" })
235
+ c.gate.mu.Unlock()
236
+ if code != ErrFenced || !runtime.authority.fenced {
237
+ t.Fatal("real stop did not permanently fence authority")
238
+ }
239
+ }
@@ -0,0 +1,49 @@
1
+ package helper
2
+
3
+ import (
4
+ "io"
5
+ "net"
6
+ "sync"
7
+ "time"
8
+ )
9
+
10
+ // Private epoch-owned delivery state. These are not RPCs, identity providers,
11
+ // or admission authority. Only a trusted native/ACL validator may issue tickets;
12
+ // the S3 owner still consumes its replay window at the common admission order.
13
+ // Missing DSM proof must not be replaced with these delivery bindings.
14
+ type operationTickets struct {
15
+ writes writeGates
16
+ mu sync.Mutex
17
+ inventory Inventory
18
+ epoch string
19
+ now func() time.Time
20
+ random io.Reader
21
+ issued map[string]issuedOperationTicket
22
+ closed bool
23
+ streamIssued int
24
+ }
25
+
26
+ type issuedOperationTicket struct {
27
+ binding TicketBinding
28
+ principal Principal
29
+ used bool
30
+ }
31
+
32
+ // outputHandoff transfers an already authenticated, owned transport to the S2
33
+ // relay exactly once. It never dials a caller address or publishes data itself.
34
+ // The registering transport owns peer authentication and disconnect observation.
35
+ type outputHandoff struct {
36
+ mu sync.Mutex
37
+ inventory Inventory
38
+ epoch string
39
+ now func() time.Time
40
+ entries map[string]operationOutput
41
+ closed bool
42
+ }
43
+
44
+ type operationOutput struct {
45
+ binding operationBinding
46
+ conn net.Conn
47
+ expires time.Time
48
+ taken bool
49
+ }