letify 2.12.0__tar.gz → 2.12.1__tar.gz

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 (320) hide show
  1. {letify-2.12.0 → letify-2.12.1}/PKG-INFO +1 -1
  2. {letify-2.12.0 → letify-2.12.1}/docs/SPEC.md +1 -1
  3. {letify-2.12.0 → letify-2.12.1}/letify/__init__.py +1 -1
  4. {letify-2.12.0 → letify-2.12.1}/letify/transport/linkmailbox.py +10 -1
  5. {letify-2.12.0 → letify-2.12.1}/letify/transport/linkpump.py +60 -3
  6. {letify-2.12.0 → letify-2.12.1}/letify/transport/linkshim.py +12 -7
  7. {letify-2.12.0 → letify-2.12.1}/letify-core/Cargo.lock +3 -3
  8. {letify-2.12.0 → letify-2.12.1}/letify-core/Cargo.toml +1 -1
  9. {letify-2.12.0 → letify-2.12.1}/letify-ext/package-lock.json +2 -2
  10. {letify-2.12.0 → letify-2.12.1}/letify-ext/package.json +1 -1
  11. {letify-2.12.0 → letify-2.12.1}/pyproject.toml +1 -1
  12. letify-2.12.1/tests/test_link_mailbox_close.py +167 -0
  13. {letify-2.12.0 → letify-2.12.1}/.github/workflows/ci.yml +0 -0
  14. {letify-2.12.0 → letify-2.12.1}/.github/workflows/docs.yml +0 -0
  15. {letify-2.12.0 → letify-2.12.1}/.github/workflows/letify-link.yml +0 -0
  16. {letify-2.12.0 → letify-2.12.1}/.github/workflows/publish-crates.yml +0 -0
  17. {letify-2.12.0 → letify-2.12.1}/.github/workflows/publish.yml +0 -0
  18. {letify-2.12.0 → letify-2.12.1}/.github/workflows/reserve-crates.yml +0 -0
  19. {letify-2.12.0 → letify-2.12.1}/.gitignore +0 -0
  20. {letify-2.12.0 → letify-2.12.1}/.researchtree +0 -0
  21. {letify-2.12.0 → letify-2.12.1}/CLAUDE.md +0 -0
  22. {letify-2.12.0 → letify-2.12.1}/LICENSE +0 -0
  23. {letify-2.12.0 → letify-2.12.1}/PROJECT.md +0 -0
  24. {letify-2.12.0 → letify-2.12.1}/README.md +0 -0
  25. {letify-2.12.0 → letify-2.12.1}/docs/COMPONENT.md +0 -0
  26. {letify-2.12.0 → letify-2.12.1}/docs/INTENT.md +0 -0
  27. {letify-2.12.0 → letify-2.12.1}/docs/NETWORK.md +0 -0
  28. {letify-2.12.0 → letify-2.12.1}/docs/ROADMAP-3.0.md +0 -0
  29. {letify-2.12.0 → letify-2.12.1}/docs/guide/01-getting-started.md +0 -0
  30. {letify-2.12.0 → letify-2.12.1}/docs/guide/02-providers.md +0 -0
  31. {letify-2.12.0 → letify-2.12.1}/docs/guide/03-execution-modes.md +0 -0
  32. {letify-2.12.0 → letify-2.12.1}/docs/guide/04-environments-and-data.md +0 -0
  33. {letify-2.12.0 → letify-2.12.1}/docs/guide/05-concurrency.md +0 -0
  34. {letify-2.12.0 → letify-2.12.1}/docs/guide/06-cost.md +0 -0
  35. {letify-2.12.0 → letify-2.12.1}/docs/guide/07-troubleshooting.md +0 -0
  36. {letify-2.12.0 → letify-2.12.1}/docs/guide/08-releasing.md +0 -0
  37. {letify-2.12.0 → letify-2.12.1}/docs/guide/09-agent.md +0 -0
  38. {letify-2.12.0 → letify-2.12.1}/docs/guide/README.md +0 -0
  39. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/01-/354/213/234/354/236/221/355/225/230/352/270/260.md" +0 -0
  40. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/02-/355/224/204/353/241/234/353/260/224/354/235/264/353/215/224.md" +0 -0
  41. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/03-/354/213/244/355/226/211-/353/260/251/354/213/235.md" +0 -0
  42. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/04-/355/231/230/352/262/275/352/263/274-/353/215/260/354/235/264/355/204/260.md" +0 -0
  43. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/05-/353/217/231/354/213/234-/354/213/244/355/226/211.md" +0 -0
  44. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/06-/353/271/204/354/232/251.md" +0 -0
  45. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/07-/353/254/270/354/240/234-/355/225/264/352/262/260.md" +0 -0
  46. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/08-/353/246/264/353/246/254/354/212/244.md" +0 -0
  47. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/09-/354/227/220/354/235/264/354/240/204/355/212/270.md" +0 -0
  48. {letify-2.12.0 → letify-2.12.1}/docs/guide/ko/README.md +0 -0
  49. {letify-2.12.0 → letify-2.12.1}/docs/locales/README_ko.md +0 -0
  50. {letify-2.12.0 → letify-2.12.1}/docs/mkdocs.yml +0 -0
  51. {letify-2.12.0 → letify-2.12.1}/examples/README.md +0 -0
  52. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/.letify.example +0 -0
  53. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/00_smoke.py +0 -0
  54. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/01_sweep.py +0 -0
  55. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/02_resume.py +0 -0
  56. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/03_watch.py +0 -0
  57. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/README.md +0 -0
  58. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/README_ko.md +0 -0
  59. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/common.py +0 -0
  60. {letify-2.12.0 → letify-2.12.1}/examples/nvfp4-lora/recipe.py +0 -0
  61. {letify-2.12.0 → letify-2.12.1}/letify/cli.py +0 -0
  62. {letify-2.12.0 → letify-2.12.1}/letify/config/__init__.py +0 -0
  63. {letify-2.12.0 → letify-2.12.1}/letify/config/inventory.py +0 -0
  64. {letify-2.12.0 → letify-2.12.1}/letify/config/login.py +0 -0
  65. {letify-2.12.0 → letify-2.12.1}/letify/config/schema.py +0 -0
  66. {letify-2.12.0 → letify-2.12.1}/letify/config/secrets.py +0 -0
  67. {letify-2.12.0 → letify-2.12.1}/letify/config/writer.py +0 -0
  68. {letify-2.12.0 → letify-2.12.1}/letify/declare/__init__.py +0 -0
  69. {letify-2.12.0 → letify-2.12.1}/letify/declare/cache.py +0 -0
  70. {letify-2.12.0 → letify-2.12.1}/letify/declare/env.py +0 -0
  71. {letify-2.12.0 → letify-2.12.1}/letify/declare/exit.py +0 -0
  72. {letify-2.12.0 → letify-2.12.1}/letify/declare/function.py +0 -0
  73. {letify-2.12.0 → letify-2.12.1}/letify/declare/instance.py +0 -0
  74. {letify-2.12.0 → letify-2.12.1}/letify/declare/reduce.py +0 -0
  75. {letify-2.12.0 → letify-2.12.1}/letify/declare/replicas.py +0 -0
  76. {letify-2.12.0 → letify-2.12.1}/letify/errors.py +0 -0
  77. {letify-2.12.0 → letify-2.12.1}/letify/install.py +0 -0
  78. {letify-2.12.0 → letify-2.12.1}/letify/launcher.py +0 -0
  79. {letify-2.12.0 → letify-2.12.1}/letify/paths.py +0 -0
  80. {letify-2.12.0 → letify-2.12.1}/letify/protocol/__init__.py +0 -0
  81. {letify-2.12.0 → letify-2.12.1}/letify/protocol/codec.py +0 -0
  82. {letify-2.12.0 → letify-2.12.1}/letify/protocol/driver.py +0 -0
  83. {letify-2.12.0 → letify-2.12.1}/letify/protocol/handle.py +0 -0
  84. {letify-2.12.0 → letify-2.12.1}/letify/protocol/wire.py +0 -0
  85. {letify-2.12.0 → letify-2.12.1}/letify/protocol/worker.py +0 -0
  86. {letify-2.12.0 → letify-2.12.1}/letify/providers/__init__.py +0 -0
  87. {letify-2.12.0 → letify-2.12.1}/letify/providers/base.py +0 -0
  88. {letify-2.12.0 → letify-2.12.1}/letify/providers/colab.py +0 -0
  89. {letify-2.12.0 → letify-2.12.1}/letify/providers/colab_files.py +0 -0
  90. {letify-2.12.0 → letify-2.12.1}/letify/providers/colab_keepalive.py +0 -0
  91. {letify-2.12.0 → letify-2.12.1}/letify/providers/elice.py +0 -0
  92. {letify-2.12.0 → letify-2.12.1}/letify/providers/kaggle.py +0 -0
  93. {letify-2.12.0 → letify-2.12.1}/letify/providers/kaggle_adapter.py +0 -0
  94. {letify-2.12.0 → letify-2.12.1}/letify/providers/local.py +0 -0
  95. {letify-2.12.0 → letify-2.12.1}/letify/providers/modal.py +0 -0
  96. {letify-2.12.0 → letify-2.12.1}/letify/providers/modal_adapter.py +0 -0
  97. {letify-2.12.0 → letify-2.12.1}/letify/providers/naming.py +0 -0
  98. {letify-2.12.0 → letify-2.12.1}/letify/providers/shell.py +0 -0
  99. {letify-2.12.0 → letify-2.12.1}/letify/providers/tunnel.py +0 -0
  100. {letify-2.12.0 → letify-2.12.1}/letify/providers/usage.py +0 -0
  101. {letify-2.12.0 → letify-2.12.1}/letify/remoting/__init__.py +0 -0
  102. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/__init__.py +0 -0
  103. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/client.py +0 -0
  104. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/cuda.py +0 -0
  105. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/executor.py +0 -0
  106. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/frames.py +0 -0
  107. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/guard.py +0 -0
  108. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/tensor.py +0 -0
  109. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/trace.py +0 -0
  110. {letify-2.12.0 → letify-2.12.1}/letify/remoting/device/value.py +0 -0
  111. {letify-2.12.0 → letify-2.12.1}/letify/render.py +0 -0
  112. {letify-2.12.0 → letify-2.12.1}/letify/runtime/__init__.py +0 -0
  113. {letify-2.12.0 → letify-2.12.1}/letify/runtime/bootstrap.py +0 -0
  114. {letify-2.12.0 → letify-2.12.1}/letify/runtime/broker.py +0 -0
  115. {letify-2.12.0 → letify-2.12.1}/letify/runtime/channel.py +0 -0
  116. {letify-2.12.0 → letify-2.12.1}/letify/runtime/control.py +0 -0
  117. {letify-2.12.0 → letify-2.12.1}/letify/runtime/lease.py +0 -0
  118. {letify-2.12.0 → letify-2.12.1}/letify/runtime/pool.py +0 -0
  119. {letify-2.12.0 → letify-2.12.1}/letify/runtime/reattach.py +0 -0
  120. {letify-2.12.0 → letify-2.12.1}/letify/runtime/session.py +0 -0
  121. {letify-2.12.0 → letify-2.12.1}/letify/runtime/takeover.py +0 -0
  122. {letify-2.12.0 → letify-2.12.1}/letify/runtime/telemetry.py +0 -0
  123. {letify-2.12.0 → letify-2.12.1}/letify/runtime/workers.py +0 -0
  124. {letify-2.12.0 → letify-2.12.1}/letify/store/__init__.py +0 -0
  125. {letify-2.12.0 → letify-2.12.1}/letify/store/backends/__init__.py +0 -0
  126. {letify-2.12.0 → letify-2.12.1}/letify/store/backends/drive.py +0 -0
  127. {letify-2.12.0 → letify-2.12.1}/letify/store/backends/filesystem.py +0 -0
  128. {letify-2.12.0 → letify-2.12.1}/letify/store/backends/google_auth.py +0 -0
  129. {letify-2.12.0 → letify-2.12.1}/letify/store/backends/layout.py +0 -0
  130. {letify-2.12.0 → letify-2.12.1}/letify/store/backends/objects.py +0 -0
  131. {letify-2.12.0 → letify-2.12.1}/letify/store/cas.py +0 -0
  132. {letify-2.12.0 → letify-2.12.1}/letify/store/handoff.py +0 -0
  133. {letify-2.12.0 → letify-2.12.1}/letify/store/pathdata.py +0 -0
  134. {letify-2.12.0 → letify-2.12.1}/letify/store/sendorder.py +0 -0
  135. {letify-2.12.0 → letify-2.12.1}/letify/store/volume.py +0 -0
  136. {letify-2.12.0 → letify-2.12.1}/letify/stubs.py +0 -0
  137. {letify-2.12.0 → letify-2.12.1}/letify/tools.py +0 -0
  138. {letify-2.12.0 → letify-2.12.1}/letify/transport/__init__.py +0 -0
  139. {letify-2.12.0 → letify-2.12.1}/letify/transport/agent.py +0 -0
  140. {letify-2.12.0 → letify-2.12.1}/letify/transport/announce.py +0 -0
  141. {letify-2.12.0 → letify-2.12.1}/letify/transport/link.py +0 -0
  142. {letify-2.12.0 → letify-2.12.1}/letify/transport/linkagent.py +0 -0
  143. {letify-2.12.0 → letify-2.12.1}/letify/transport/linkchannel.py +0 -0
  144. {letify-2.12.0 → letify-2.12.1}/letify/transport/linkd.py +0 -0
  145. {letify-2.12.0 → letify-2.12.1}/letify/transport/linksignal.py +0 -0
  146. {letify-2.12.0 → letify-2.12.1}/letify/transport/linkupload.py +0 -0
  147. {letify-2.12.0 → letify-2.12.1}/letify/transport/linkwebsocket.py +0 -0
  148. {letify-2.12.0 → letify-2.12.1}/letify/transport/nat.py +0 -0
  149. {letify-2.12.0 → letify-2.12.1}/letify/transport/pipeline.py +0 -0
  150. {letify-2.12.0 → letify-2.12.1}/letify/transport/portmap.py +0 -0
  151. {letify-2.12.0 → letify-2.12.1}/letify/transport/probe.py +0 -0
  152. {letify-2.12.0 → letify-2.12.1}/letify/transport/quic.py +0 -0
  153. {letify-2.12.0 → letify-2.12.1}/letify/transport/rendezvous.py +0 -0
  154. {letify-2.12.0 → letify-2.12.1}/letify/transport/setup.py +0 -0
  155. {letify-2.12.0 → letify-2.12.1}/letify/transport/sshopts.py +0 -0
  156. {letify-2.12.0 → letify-2.12.1}/letify/transport/strategies.py +0 -0
  157. {letify-2.12.0 → letify-2.12.1}/letify-core/.gitignore +0 -0
  158. {letify-2.12.0 → letify-2.12.1}/letify-core/build.py +0 -0
  159. {letify-2.12.0 → letify-2.12.1}/letify-core/letify/Cargo.toml +0 -0
  160. {letify-2.12.0 → letify-2.12.1}/letify-core/letify/LICENSE +0 -0
  161. {letify-2.12.0 → letify-2.12.1}/letify-core/letify/README.md +0 -0
  162. {letify-2.12.0 → letify-2.12.1}/letify-core/letify/src/lib.rs +0 -0
  163. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/Cargo.toml +0 -0
  164. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/examples/bench.rs +0 -0
  165. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/acceptor.rs +0 -0
  166. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/bin/letify-link.rs +0 -0
  167. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/config.rs +0 -0
  168. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/error.rs +0 -0
  169. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/frame.rs +0 -0
  170. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/handshake.rs +0 -0
  171. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/hysteresis.rs +0 -0
  172. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/identity.rs +0 -0
  173. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/keys.rs +0 -0
  174. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/lib.rs +0 -0
  175. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/observe.rs +0 -0
  176. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/paths.rs +0 -0
  177. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/plan.rs +0 -0
  178. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/policing.rs +0 -0
  179. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/punch.rs +0 -0
  180. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/record.rs +0 -0
  181. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/relay.rs +0 -0
  182. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/rendezvous.rs +0 -0
  183. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/replay.rs +0 -0
  184. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/session.rs +0 -0
  185. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/sidecar.rs +0 -0
  186. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/stream.rs +0 -0
  187. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/stun.rs +0 -0
  188. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/tcp.rs +0 -0
  189. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/trace.rs +0 -0
  190. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/src/udp.rs +0 -0
  191. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/acceptor.rs +0 -0
  192. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/api.rs +0 -0
  193. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/common/mod.rs +0 -0
  194. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/diag_sim.rs +0 -0
  195. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/fairness.rs +0 -0
  196. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/gauge.rs +0 -0
  197. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/handshake.rs +0 -0
  198. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/hysteresis.rs +0 -0
  199. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/keepalive.rs +0 -0
  200. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/mobile.rs +0 -0
  201. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/nat.rs +0 -0
  202. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/paths.rs +0 -0
  203. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/qad.rs +0 -0
  204. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/rekey.rs +0 -0
  205. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/relay.rs +0 -0
  206. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/relay_pairing.rs +0 -0
  207. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/rendezvous.rs +0 -0
  208. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/reorder.rs +0 -0
  209. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/replay.rs +0 -0
  210. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/resume.rs +0 -0
  211. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/revoke.rs +0 -0
  212. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/session.rs +0 -0
  213. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/sidecar.rs +0 -0
  214. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/startup.rs +0 -0
  215. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/subflows.rs +0 -0
  216. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/trace.rs +0 -0
  217. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/udp.rs +0 -0
  218. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-link/tests/udp_bench.rs +0 -0
  219. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-quic/Cargo.toml +0 -0
  220. {letify-2.12.0 → letify-2.12.1}/letify-core/letify-quic/src/main.rs +0 -0
  221. {letify-2.12.0 → letify-2.12.1}/letify-core/rust-toolchain.toml +0 -0
  222. {letify-2.12.0 → letify-2.12.1}/letify-ext/.vscodeignore +0 -0
  223. {letify-2.12.0 → letify-2.12.1}/letify-ext/LICENSE +0 -0
  224. {letify-2.12.0 → letify-2.12.1}/letify-ext/README.md +0 -0
  225. {letify-2.12.0 → letify-2.12.1}/letify-ext/media/icon.svg +0 -0
  226. {letify-2.12.0 → letify-2.12.1}/letify-ext/src/cli.ts +0 -0
  227. {letify-2.12.0 → letify-2.12.1}/letify-ext/src/extension.ts +0 -0
  228. {letify-2.12.0 → letify-2.12.1}/letify-ext/src/history.ts +0 -0
  229. {letify-2.12.0 → letify-2.12.1}/letify-ext/src/model.ts +0 -0
  230. {letify-2.12.0 → letify-2.12.1}/letify-ext/src/poll.ts +0 -0
  231. {letify-2.12.0 → letify-2.12.1}/letify-ext/src/render.ts +0 -0
  232. {letify-2.12.0 → letify-2.12.1}/letify-ext/test/cli.test.ts +0 -0
  233. {letify-2.12.0 → letify-2.12.1}/letify-ext/test/manifest.test.ts +0 -0
  234. {letify-2.12.0 → letify-2.12.1}/letify-ext/test/model.test.ts +0 -0
  235. {letify-2.12.0 → letify-2.12.1}/letify-ext/test/regressions.test.ts +0 -0
  236. {letify-2.12.0 → letify-2.12.1}/letify-ext/tsconfig.json +0 -0
  237. {letify-2.12.0 → letify-2.12.1}/letify-signal/README.md +0 -0
  238. {letify-2.12.0 → letify-2.12.1}/letify-signal/cloudflare.config.ts +0 -0
  239. {letify-2.12.0 → letify-2.12.1}/letify-signal/package-lock.json +0 -0
  240. {letify-2.12.0 → letify-2.12.1}/letify-signal/package.json +0 -0
  241. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/auth.ts +0 -0
  242. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/ed25519.ts +0 -0
  243. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/handler.ts +0 -0
  244. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/index.ts +0 -0
  245. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/limiter.ts +0 -0
  246. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/mailbox.ts +0 -0
  247. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/objects.ts +0 -0
  248. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/protocol.ts +0 -0
  249. {letify-2.12.0 → letify-2.12.1}/letify-signal/src/storage.ts +0 -0
  250. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/auth.test.ts +0 -0
  251. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/ed25519.test.ts +0 -0
  252. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/helpers.ts +0 -0
  253. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/interop.test.ts +0 -0
  254. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/limiter.test.ts +0 -0
  255. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/mailbox.test.ts +0 -0
  256. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/objects.test.ts +0 -0
  257. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/setup.ts +0 -0
  258. {letify-2.12.0 → letify-2.12.1}/letify-signal/test/worker.test.ts +0 -0
  259. {letify-2.12.0 → letify-2.12.1}/letify-signal/tsconfig.json +0 -0
  260. {letify-2.12.0 → letify-2.12.1}/letify-signal/vitest.config.ts +0 -0
  261. {letify-2.12.0 → letify-2.12.1}/letify_providers.py +0 -0
  262. {letify-2.12.0 → letify-2.12.1}/scripts/sync-main.sh +0 -0
  263. {letify-2.12.0 → letify-2.12.1}/scripts/version.py +0 -0
  264. {letify-2.12.0 → letify-2.12.1}/tests/conftest.py +0 -0
  265. {letify-2.12.0 → letify-2.12.1}/tests/fake_kaggle_adapter.py +0 -0
  266. {letify-2.12.0 → letify-2.12.1}/tests/fake_modal_adapter.py +0 -0
  267. {letify-2.12.0 → letify-2.12.1}/tests/test_cli.py +0 -0
  268. {letify-2.12.0 → letify-2.12.1}/tests/test_cli_output.py +0 -0
  269. {letify-2.12.0 → letify-2.12.1}/tests/test_colab_keepalive.py +0 -0
  270. {letify-2.12.0 → letify-2.12.1}/tests/test_config.py +0 -0
  271. {letify-2.12.0 → letify-2.12.1}/tests/test_core.py +0 -0
  272. {letify-2.12.0 → letify-2.12.1}/tests/test_data.py +0 -0
  273. {letify-2.12.0 → letify-2.12.1}/tests/test_data_in_place.py +0 -0
  274. {letify-2.12.0 → letify-2.12.1}/tests/test_data_streaming.py +0 -0
  275. {letify-2.12.0 → letify-2.12.1}/tests/test_declare.py +0 -0
  276. {letify-2.12.0 → letify-2.12.1}/tests/test_device.py +0 -0
  277. {letify-2.12.0 → letify-2.12.1}/tests/test_device_compile.py +0 -0
  278. {letify-2.12.0 → letify-2.12.1}/tests/test_distributed.py +0 -0
  279. {letify-2.12.0 → letify-2.12.1}/tests/test_drive_handoff.py +0 -0
  280. {letify-2.12.0 → letify-2.12.1}/tests/test_drive_store.py +0 -0
  281. {letify-2.12.0 → letify-2.12.1}/tests/test_editor_sessions.py +0 -0
  282. {letify-2.12.0 → letify-2.12.1}/tests/test_elice.py +0 -0
  283. {letify-2.12.0 → letify-2.12.1}/tests/test_frames.py +0 -0
  284. {letify-2.12.0 → letify-2.12.1}/tests/test_install.py +0 -0
  285. {letify-2.12.0 → letify-2.12.1}/tests/test_kaggle.py +0 -0
  286. {letify-2.12.0 → letify-2.12.1}/tests/test_kaggle_cookie.py +0 -0
  287. {letify-2.12.0 → letify-2.12.1}/tests/test_kaggle_link.py +0 -0
  288. {letify-2.12.0 → letify-2.12.1}/tests/test_link_agent.py +0 -0
  289. {letify-2.12.0 → letify-2.12.1}/tests/test_link_channel.py +0 -0
  290. {letify-2.12.0 → letify-2.12.1}/tests/test_link_command_channel.py +0 -0
  291. {letify-2.12.0 → letify-2.12.1}/tests/test_link_exec.py +0 -0
  292. {letify-2.12.0 → letify-2.12.1}/tests/test_link_log.py +0 -0
  293. {letify-2.12.0 → letify-2.12.1}/tests/test_link_opt_in.py +0 -0
  294. {letify-2.12.0 → letify-2.12.1}/tests/test_link_signal.py +0 -0
  295. {letify-2.12.0 → letify-2.12.1}/tests/test_link_ssh_stream.py +0 -0
  296. {letify-2.12.0 → letify-2.12.1}/tests/test_link_upload.py +0 -0
  297. {letify-2.12.0 → letify-2.12.1}/tests/test_linkd.py +0 -0
  298. {letify-2.12.0 → letify-2.12.1}/tests/test_notebook.py +0 -0
  299. {letify-2.12.0 → letify-2.12.1}/tests/test_parallel_placement.py +0 -0
  300. {letify-2.12.0 → letify-2.12.1}/tests/test_paths.py +0 -0
  301. {letify-2.12.0 → letify-2.12.1}/tests/test_portmap.py +0 -0
  302. {letify-2.12.0 → letify-2.12.1}/tests/test_protocol.py +0 -0
  303. {letify-2.12.0 → letify-2.12.1}/tests/test_providers.py +0 -0
  304. {letify-2.12.0 → letify-2.12.1}/tests/test_punch_sockets.py +0 -0
  305. {letify-2.12.0 → letify-2.12.1}/tests/test_quic.py +0 -0
  306. {letify-2.12.0 → letify-2.12.1}/tests/test_remoting.py +0 -0
  307. {letify-2.12.0 → letify-2.12.1}/tests/test_render.py +0 -0
  308. {letify-2.12.0 → letify-2.12.1}/tests/test_run_control.py +0 -0
  309. {letify-2.12.0 → letify-2.12.1}/tests/test_run_reattach.py +0 -0
  310. {letify-2.12.0 → letify-2.12.1}/tests/test_run_takeover.py +0 -0
  311. {letify-2.12.0 → letify-2.12.1}/tests/test_runtime.py +0 -0
  312. {letify-2.12.0 → letify-2.12.1}/tests/test_shell_workers.py +0 -0
  313. {letify-2.12.0 → letify-2.12.1}/tests/test_ship.py +0 -0
  314. {letify-2.12.0 → letify-2.12.1}/tests/test_store.py +0 -0
  315. {letify-2.12.0 → letify-2.12.1}/tests/test_strategies.py +0 -0
  316. {letify-2.12.0 → letify-2.12.1}/tests/test_stubs.py +0 -0
  317. {letify-2.12.0 → letify-2.12.1}/tests/test_transport.py +0 -0
  318. {letify-2.12.0 → letify-2.12.1}/tests/test_tunnel_agent_login.py +0 -0
  319. {letify-2.12.0 → letify-2.12.1}/tests/test_tunnel_setup.py +0 -0
  320. {letify-2.12.0 → letify-2.12.1}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: letify
3
- Version: 2.12.0
3
+ Version: 2.12.1
4
4
  Summary: Declarations that become infrastructure.
5
5
  Project-URL: Homepage, https://github.com/DarkPyonix/letify
6
6
  Project-URL: Documentation, https://github.com/DarkPyonix/letify/tree/main/docs
@@ -2457,7 +2457,7 @@ The sidecar is a binary named `letify-link`, built for each wheel and installed
2457
2457
  8. **Bootstrap over a command channel (Colab and Kaggle).** `link = "letify-link"` on a `colab` or `kaggle` account carries the worker channel and the transfer streams over a session, with no ssh server, no strategy race and no Tailcat. These runtimes have no inbound TCP and no address, so the session starts from punched candidates only, as item 7 says for an account with no address. The bootstrap is the provider's own command channel, which runs one Python program on the runtime and returns what it printed: `colab exec` for Colab, and `eval` on the open kernel bridge for Kaggle. That channel costs seconds per call and has no standard input, so three pieces replace the ssh command of item 7.
2458
2458
  - **The binary.** The same as item 7: the account's `link_binary`, or `letify-link` taken out of the wheel of letify's own version by running `install.remote_link_source` through the command channel, as `CommandRendezvous` does for `letify-quic`. A missing or non-executable file fails the connect with `<alias> cannot connect over letify-link: letify-link is not at <path>`.
2459
2459
  - **Development upload.** The account's `link_binary_upload` (or `LETIFY_LINK_UPLOAD`) of item 7 applies to `colab` and `kaggle` accounts, and the binary goes through the command channel in chunks as item 7 describes.
2460
- - **The mailbox.** `letify/transport/linkpump.py`, a standard-library program, is started once through the command channel as a detached process. It starts the shim of item 7 with pipes, appends every complete line the shim prints to an outbox file, and feeds every line appended to an inbox file to the shim's standard input, so the shim is unchanged. The local side then loops on the command channel: each call appends the pending lines to the inbox, waits up to 0.5 s for the outbox to grow past the byte offset the caller holds, and returns the new lines and the new offset. Each call is a poll and a send in one, so nothing is lost when a call is slow. `letify/transport/linkchannel.py` defines `Bootstrap`, with `send_line`, `recv_line`, `stderr_text` and `close`, and `connect` takes a function that returns one. An ssh command is one implementation (`PopenBootstrap`) and the mailbox is the other (`MailboxBootstrap`), so the rest of the connect is the same code for both. If the pump or the shim exits, the outbox ends with an `eof` line holding the tail of the shim's standard error, and the connect fails with that tail.
2460
+ - **The mailbox.** `letify/transport/linkpump.py`, a standard-library program, is started once through the command channel as a detached process. It starts the shim of item 7 with pipes, appends every complete line the shim prints to an outbox file, and feeds every line appended to an inbox file to the shim's standard input, so the shim is unchanged. The local side then loops on the command channel: each call appends the pending lines to the inbox, waits up to 0.5 s for the outbox to grow past the byte offset the caller holds, and returns the new lines and the new offset. Each call is a poll and a send in one, so nothing is lost when a call is slow. `letify/transport/linkchannel.py` defines `Bootstrap`, with `send_line`, `recv_line`, `stderr_text` and `close`, and `connect` takes a function that returns one. An ssh command is one implementation (`PopenBootstrap`) and the mailbox is the other (`MailboxBootstrap`), so the rest of the connect is the same code for both. If the pump or the shim exits, the outbox ends with an `eof` line holding the tail of the shim's standard error, and the connect fails with that tail. **Close ends the runtime side.** `MailboxBootstrap.close` makes one last call, `op` `close`. The pump then stops the shim, which stops its sidecar, and removes its directory. When the shim has already said `handed_over`, the pump leaves the shim alone, because it serves the session and ends by itself under the idle rules of item 7, and only removes the directory and exits. A pump that no call has reached for `IDLE_S` (120 s) does the same, so a client that died leaves nothing behind. The shim, when its standard input ends before the hand-over, stops its sidecar before it exits. After a close before the hand-over, no process the bootstrap started is alive and its directory is gone within 5 s, and a test pins it.
2461
2461
  - **Timing from the measured round trip.** After the pump starts, the local side makes 2 calls that wait for nothing and takes the longer as the bootstrap round trip `rtt`. A message from one sidecar reaches the other in at most one `rtt` (the call that carries it is in flight for at most `rtt` and the next one carries it), so a punch offer and its answer need at most 2 `rtt`. The rules are:
2462
2462
  - `lead_ms = max(2000, ceil(3 * rtt_ms))`, passed to the sidecar's `punch` in place of its default of 2000, so the offer is at the responder, and the answer back, before the start time.
2463
2463
  - `answer_margin_ms = max(500, ceil(rtt_ms))`, passed to the responder's `punch` through the shim (and through the agent's `punch` command), so the responder names its own start as the Answer start bullet of this section says. The answer needs at most one `rtt` to reach the initiator, so the initiator holds the start before it is due, and the wait after the answer arrives is at most the margin less the time the answer took. `lead_ms` stays the initiator's bound on how long it waits for the answer. A shim of an older letify ignores the field and the punch starts at `lead_ms` as before.
@@ -70,7 +70,7 @@ distributed: Final = Host.distributed
70
70
  # The enum class stays importable from letify.declare.instance for letify's own use.
71
71
  del Host
72
72
 
73
- __version__ = "2.12.0"
73
+ __version__ = "2.12.1"
74
74
 
75
75
 
76
76
  def fetch(tensor): # type: ignore[no-untyped-def]
@@ -29,6 +29,8 @@ PINGS = 2
29
29
  SAMPLES = 3
30
30
  #: Seconds close waits for a call in flight to come back.
31
31
  JOIN_S = 30.0
32
+ #: Seconds the close call may take before close gives up on it.
33
+ CLOSE_TIMEOUT_S = 30.0
32
34
 
33
35
 
34
36
  def pump_source() -> str:
@@ -155,11 +157,18 @@ class MailboxBootstrap:
155
157
  return self._stderr
156
158
 
157
159
  def close(self) -> None:
158
- """Stop moving lines. The pump ends by itself once the shim has handed over or died."""
160
+ """Stop moving lines and tell the pump to end its runtime side.
161
+
162
+ The pump stops a shim that has not handed over and removes its directory. A pump the
163
+ call cannot reach ends the same way by itself after ``linkpump.IDLE_S``.
164
+ """
159
165
  self._stop.set()
160
166
  thread = self._thread
161
167
  if thread is not None and thread is not threading.current_thread():
162
168
  thread.join(timeout=JOIN_S)
169
+ if self._directory:
170
+ with contextlib.suppress(Exception):
171
+ self._call({"op": "close", "dir": self._directory}, CLOSE_TIMEOUT_S)
163
172
  self._inbound.put(None)
164
173
 
165
174
 
@@ -11,6 +11,8 @@ channel runs, so it imports nothing from letify and avoids syntax newer than Pyt
11
11
  # ruff: noqa: SIM115, UP031
12
12
  import json
13
13
  import os
14
+ import shutil
15
+ import signal
14
16
  import subprocess
15
17
  import sys
16
18
  import tempfile
@@ -21,6 +23,10 @@ MARKER = "LETIFY-MAILBOX "
21
23
  POLL_S = 0.05
22
24
  STDERR_TAIL = 400
23
25
  EXIT_WAIT_S = 2.0
26
+ #: Seconds without a call after which the pump ends its runtime side, whoever is gone.
27
+ IDLE_S = 120.0
28
+ #: Seconds the shim gets to stop its sidecar after its input ends, before it is killed.
29
+ STOP_WAIT_S = 3.0
24
30
 
25
31
 
26
32
  def answer(**fields):
@@ -38,7 +44,7 @@ def start(request, source):
38
44
  ):
39
45
  with open(os.path.join(directory, name), "w") as handle:
40
46
  handle.write(text)
41
- for name in ("inbox", "outbox"):
47
+ for name in ("inbox", "outbox", "seen"):
42
48
  open(os.path.join(directory, name), "wb").close()
43
49
  errors = open(os.path.join(directory, "pump.err"), "wb")
44
50
  subprocess.Popen(
@@ -61,8 +67,46 @@ def pump(directory):
61
67
  stdout=subprocess.PIPE,
62
68
  stderr=errors,
63
69
  close_fds=True,
70
+ # Its own process group, so that everything the shim started can be ended together.
71
+ start_new_session=True,
64
72
  )
65
73
 
74
+ state = {"handed": False}
75
+
76
+ def stop_shim():
77
+ if shim.poll() is None and not state["handed"]:
78
+ try:
79
+ shim.stdin.close()
80
+ except (OSError, ValueError):
81
+ pass
82
+ try:
83
+ shim.wait(timeout=STOP_WAIT_S)
84
+ except subprocess.TimeoutExpired:
85
+ shim.terminate()
86
+ try:
87
+ shim.wait(timeout=STOP_WAIT_S)
88
+ except subprocess.TimeoutExpired:
89
+ shim.kill()
90
+ # Sweep the group: the sidecar must not outlive a shim that exited without it.
91
+ try:
92
+ os.killpg(shim.pid, signal.SIGKILL)
93
+ except OSError:
94
+ pass
95
+
96
+ def watch():
97
+ """End this side when the client closed the mailbox or no call has come for IDLE_S."""
98
+ seen = os.path.join(directory, "seen")
99
+ while True:
100
+ time.sleep(0.2)
101
+ try:
102
+ idle = time.time() - os.stat(seen).st_mtime > IDLE_S
103
+ except OSError:
104
+ idle = True
105
+ if idle or os.path.exists(os.path.join(directory, "closed")):
106
+ stop_shim()
107
+ shutil.rmtree(directory, ignore_errors=True)
108
+ os._exit(0)
109
+
66
110
  def feed():
67
111
  offset = 0
68
112
  pending = b""
@@ -84,6 +128,7 @@ def pump(directory):
84
128
  pass
85
129
 
86
130
  threading.Thread(target=feed, daemon=True).start()
131
+ threading.Thread(target=watch, daemon=True).start()
87
132
  with open(os.path.join(directory, "outbox"), "ab") as outbox:
88
133
  for line in shim.stdout:
89
134
  outbox.write(line)
@@ -92,7 +137,10 @@ def pump(directory):
92
137
  shim.wait(timeout=EXIT_WAIT_S)
93
138
  except subprocess.TimeoutExpired:
94
139
  # The shim closed its output and runs on: the hand-over, which ends the mailbox.
95
- return
140
+ # The directory stays until the client's close call or IDLE_S, so a late read works.
141
+ state["handed"] = True
142
+ while True:
143
+ time.sleep(1.0)
96
144
  try:
97
145
  with open(os.path.join(directory, "shim.err"), "rb") as handle:
98
146
  tail = handle.read()[-STDERR_TAIL:].decode("utf-8", "replace")
@@ -100,11 +148,14 @@ def pump(directory):
100
148
  tail = ""
101
149
  outbox.write((json.dumps({"event": "eof", "stderr": tail}) + "\n").encode())
102
150
  outbox.flush()
151
+ while True:
152
+ time.sleep(1.0)
103
153
 
104
154
 
105
155
  def exchange(request, source=None):
106
156
  """Append ``send`` to the inbox, wait up to ``wait_s`` for the outbox to pass ``offset``."""
107
157
  directory = request["dir"]
158
+ os.utime(os.path.join(directory, "seen"), None)
108
159
  if request.get("send"):
109
160
  with open(os.path.join(directory, "inbox"), "ab") as handle:
110
161
  for line in request["send"]:
@@ -125,8 +176,14 @@ def exchange(request, source=None):
125
176
  time.sleep(POLL_S)
126
177
 
127
178
 
179
+ def close(request, source=None):
180
+ """Tell the pump to end its side: stop a shim that has not handed over, remove the directory."""
181
+ open(os.path.join(request["dir"], "closed"), "wb").close()
182
+ answer(ok=True)
183
+
184
+
128
185
  def run(request, source):
129
186
  try:
130
- {"start": start, "exchange": exchange}[request["op"]](request, source)
187
+ {"start": start, "exchange": exchange, "close": close}[request["op"]](request, source)
131
188
  except Exception as error:
132
189
  answer(ok=False, error="%s: %s" % (type(error).__name__, error))
@@ -490,6 +490,7 @@ class Shim:
490
490
  return
491
491
  if not self.handed_over:
492
492
  # The local side went away before the session started: nothing to serve.
493
+ self.proc.kill()
493
494
  os._exit(0)
494
495
 
495
496
  def punch(self, command):
@@ -528,16 +529,20 @@ class Shim:
528
529
 
529
530
  def run(self):
530
531
  self.started = time.monotonic()
531
- self.start_sidecar()
532
- reply = self.control.request(self.listen_request())
533
- self.listener = reply["listener"]
534
- port = int(reply["addr"].rpartition(":")[2])
535
- say(event="ready", node_id=self.node_id, port=port)
536
- threading.Thread(target=self.stdin_loop, daemon=True).start()
532
+ signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(0))
537
533
  try:
534
+ self.start_sidecar()
535
+ reply = self.control.request(self.listen_request())
536
+ self.listener = reply["listener"]
537
+ port = int(reply["addr"].rpartition(":")[2])
538
+ say(event="ready", node_id=self.node_id, port=port)
539
+ threading.Thread(target=self.stdin_loop, daemon=True).start()
538
540
  self.pump()
539
541
  finally:
540
- self.proc.kill()
542
+ # Every exit path, a SIGTERM during start-up included, ends the sidecar.
543
+ proc = getattr(self, "proc", None)
544
+ if proc is not None:
545
+ proc.kill()
541
546
 
542
547
 
543
548
  def main():
@@ -396,11 +396,11 @@ dependencies = [
396
396
 
397
397
  [[package]]
398
398
  name = "letify"
399
- version = "2.12.0"
399
+ version = "2.12.1"
400
400
 
401
401
  [[package]]
402
402
  name = "letify-link"
403
- version = "2.12.0"
403
+ version = "2.12.1"
404
404
  dependencies = [
405
405
  "ed25519-dalek",
406
406
  "getrandom 0.2.17",
@@ -416,7 +416,7 @@ dependencies = [
416
416
 
417
417
  [[package]]
418
418
  name = "letify-quic"
419
- version = "2.12.0"
419
+ version = "2.12.1"
420
420
  dependencies = [
421
421
  "quinn",
422
422
  "rcgen",
@@ -8,7 +8,7 @@ resolver = "3"
8
8
  members = ["letify", "letify-quic", "letify-link"]
9
9
 
10
10
  [workspace.package]
11
- version = "2.12.0"
11
+ version = "2.12.1"
12
12
  edition = "2024"
13
13
  license = "MIT"
14
14
  repository = "https://github.com/DarkPyonix/letify"
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "letify-status",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "letify-status",
9
- "version": "2.12.0",
9
+ "version": "2.12.1",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "devDependencies": {
12
12
  "@types/node": "^18.19.0",
@@ -2,7 +2,7 @@
2
2
  "name": "letify-status",
3
3
  "displayName": "letify Status",
4
4
  "description": "letify quota and GPU activity in the status bar, read from the letify CLI.",
5
- "version": "2.12.0",
5
+ "version": "2.12.1",
6
6
  "publisher": "darkpyonix",
7
7
  "license": "SEE LICENSE IN LICENSE",
8
8
  "repository": {
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "letify"
3
- version = "2.12.0"
3
+ version = "2.12.1"
4
4
  description = "Declarations that become infrastructure."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -0,0 +1,167 @@
1
+ """Closing a mailbox bootstrap ends what it started on the runtime.
2
+
3
+ Spec "Sidecar interface" item 8, "Close before the hand-over ends the runtime side". The
4
+ command channel is this machine, as in tests/test_link_command_channel.py. The pump, the shim
5
+ and the sidecar are real.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import json
11
+ import os
12
+ import subprocess
13
+ import sys
14
+ import time
15
+ from pathlib import Path
16
+
17
+ import pytest
18
+
19
+ from letify.transport import linkd, linkmailbox
20
+
21
+
22
+ @pytest.fixture
23
+ def peer_id(sidecar_binary, tmp_path: Path):
24
+ daemon = linkd.LinkDaemon(tmp_path / "peer.key", binary=sidecar_binary)
25
+ try:
26
+ yield daemon.node_id
27
+ finally:
28
+ daemon.close()
29
+
30
+
31
+ def run_here(source: str, timeout: float) -> str:
32
+ done = subprocess.run(
33
+ [sys.executable, "-"], input=source, capture_output=True, text=True, timeout=timeout
34
+ )
35
+ return done.stdout + done.stderr
36
+
37
+
38
+ def pids_of(directory: str) -> list[int]:
39
+ listing = subprocess.run(
40
+ ["ps", "-eo", "pid,args"], capture_output=True, text=True, check=True
41
+ ).stdout
42
+ found = []
43
+ for row in listing.splitlines():
44
+ pid, _, args = row.strip().partition(" ")
45
+ if directory in args and int(pid) != os.getpid():
46
+ found.append(int(pid))
47
+ return found
48
+
49
+
50
+ def sidecars(binary: Path) -> set[int]:
51
+ found = set()
52
+ for name in os.listdir("/proc"):
53
+ if not name.isdigit():
54
+ continue
55
+ try:
56
+ raw = Path(f"/proc/{name}/cmdline").read_bytes()
57
+ except OSError:
58
+ continue
59
+ if raw.startswith(str(binary).encode() + b"\0serve"):
60
+ found.add(int(name))
61
+ return found
62
+
63
+
64
+ def children_of(parents: list[int], binary: Path) -> set[int]:
65
+ """The sidecars whose parent is one of ``parents``, so a parallel test's are not counted."""
66
+ found = set()
67
+ for pid in sidecars(binary):
68
+ try:
69
+ stat = Path(f"/proc/{pid}/stat").read_text()
70
+ except OSError:
71
+ continue
72
+ if int(stat.rpartition(")")[2].split()[1]) in parents:
73
+ found.add(pid)
74
+ return found
75
+
76
+
77
+ def wait_until(check, seconds: float = 5.0) -> bool:
78
+ end = time.monotonic() + seconds
79
+ while time.monotonic() < end:
80
+ if check():
81
+ return True
82
+ time.sleep(0.1)
83
+ return bool(check())
84
+
85
+
86
+ def started(sidecar_binary: Path, peer: str) -> linkmailbox.MailboxBootstrap:
87
+ bootstrap = linkmailbox.MailboxBootstrap(run_here, python=sys.executable)
88
+ bootstrap.start()
89
+ config = {
90
+ "binary": str(sidecar_binary),
91
+ "allow": peer,
92
+ "bind": "127.0.0.1:0",
93
+ "wait_s": 30,
94
+ "resume_s": 30,
95
+ }
96
+ bootstrap.send_line(json.dumps(config))
97
+ while True:
98
+ line = bootstrap.recv_line()
99
+ assert line is not None, bootstrap.stderr_text()
100
+ if json.loads(line).get("event") == "ready":
101
+ return bootstrap
102
+
103
+
104
+ def test_closing_before_the_hand_over_ends_the_pump_the_shim_and_the_sidecar(
105
+ sidecar_binary, peer_id
106
+ ) -> None:
107
+ bootstrap = started(sidecar_binary, peer_id)
108
+ directory = bootstrap._directory
109
+ assert len(pids_of(directory)) >= 2
110
+ mine = children_of(pids_of(directory), sidecar_binary)
111
+ assert mine
112
+ bootstrap.close()
113
+ assert wait_until(lambda: not pids_of(directory)), pids_of(directory)
114
+ assert wait_until(lambda: not (sidecars(sidecar_binary) & mine))
115
+ assert wait_until(lambda: not os.path.exists(directory))
116
+
117
+
118
+ def test_a_pump_that_no_call_reaches_ends_its_runtime_side(
119
+ sidecar_binary, peer_id, monkeypatch
120
+ ) -> None:
121
+ source = linkmailbox.pump_source().replace("IDLE_S = 120.0", "IDLE_S = 1.0")
122
+ monkeypatch.setattr(linkmailbox, "pump_source", lambda: source)
123
+ bootstrap = started(sidecar_binary, peer_id)
124
+ directory = bootstrap._directory
125
+ mine = children_of(pids_of(directory), sidecar_binary)
126
+ # Stop the poll thread without the close call, as a client that died would.
127
+ bootstrap._stop.set()
128
+ assert wait_until(lambda: not pids_of(directory), 15.0), pids_of(directory)
129
+ assert wait_until(lambda: not (sidecars(sidecar_binary) & mine))
130
+ assert wait_until(lambda: not os.path.exists(directory))
131
+
132
+
133
+ STUBBORN_SHIM = '''
134
+ import json, os, signal, subprocess, sys, time
135
+ child = subprocess.Popen(["sleep", "300"])
136
+ signal.signal(signal.SIGTERM, lambda signum, frame: os._exit(0))
137
+ sys.stdin.readline()
138
+ print(json.dumps({"event": "ready", "child": child.pid}), flush=True)
139
+ while True:
140
+ time.sleep(1)
141
+ '''
142
+
143
+
144
+ def alive(pid: int) -> bool:
145
+ try:
146
+ state = Path(f"/proc/{pid}/stat").read_text().rpartition(")")[2].split()[0]
147
+ except OSError:
148
+ return False
149
+ return state != "Z"
150
+
151
+
152
+ def test_a_child_of_a_shim_that_ignores_its_input_ending_is_still_ended() -> None:
153
+ bootstrap = linkmailbox.MailboxBootstrap(run_here, python=sys.executable, shim=STUBBORN_SHIM)
154
+ bootstrap.start()
155
+ bootstrap.send_line("{}")
156
+ child = 0
157
+ while not child:
158
+ line = bootstrap.recv_line()
159
+ assert line is not None, bootstrap.stderr_text()
160
+ child = int(json.loads(line).get("child", 0))
161
+ assert alive(child)
162
+ try:
163
+ bootstrap.close()
164
+ assert wait_until(lambda: not alive(child), 15.0)
165
+ finally:
166
+ if alive(child):
167
+ os.kill(child, 9)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes