Replacing stdlib net with lori #6014
SeanTAllen
started this conversation in
Standard Library
Replies: 1 comment 5 replies
|
Phase 1 to 4 have been merged to main. Phases 5 and 6 are queued to merge on their relevant schedules. |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Replacing stdlib
netwith loriPlan for replacing ponyc's stdlib
netpackage with lori. Phase 0 (porting missing old-net tests into lori before the move) is tracked separately in lori.Phase 1: ponyc — Replace the net package
1.1 Remove old net package
Delete all 15 files from
packages/net/.1.2 Copy lori source into
packages/net/.ponyfiles from lori intopackages/net/lori.ponytonet.pony(package docstring file named after the package)use "lori"touse "net"in docstring code examples (5 occurrences in the package docstring file)net.pony— 43 type links from[TypeName](/lori/lori-TypeName/)to[TypeName](/net/net-TypeName/)plus the notifier package index link (/lori/notifier--index/→/net/notifier--index/)_unreachable.pony:https://github.com/ponylang/lori/issues→https://github.com/ponylang/ponyc/issues1.3 Copy notifier subpackage
lori/notifier/topackages/net/notifier/notifier.pony:use "lori"→use "net"use "lori/notifier"→use "net/notifier"plus 1use notifier = "lori/notifier"→use notifier = "net/notifier"use lori = ".."→use net = "..", and update all 201 qualified references (lori.TCPConnectionActor→net.TCPConnectionActor, etc.)use ".."relative import works in stdlib1.4 Copy lori tests into
packages/net/_test_*.ponyfiles from lori intopackages/net/notifier/_test*.ponyfiles too_test.pony— it already follows the stdlib convention (actor \nodoc\ Main is TestListwith bothnew create(env: Env) => PonyTest(env, this)andnew make() => None, plus notifier delegation)1.5 Update stdlib test runner
packages/stdlib/_test.ponyalready hasuse net = "net"andnet.Main.make().tests(test)— the new net's test runner follows the same convention, so no structural changes are needed.1.6 Update backpressure package
Rewrite the docstring example in
packages/backpressure/backpressure.pony— it uses old-net types (TCPConnectionNotify,TCPConnection,TCPConnectAuth). Rewrite to use lori'sTCPConnectionActorpattern. The actual backpressure code (primitives, FFI calls) doesn't reference net types and needs no code change.1.7 Replace/add stress tests
test/rt-stress/tcp-swarm/uses old-net types and will fail to compile. Replace it with lori'stcp-swarmstress test.udp-flood) totest/rt-stress/udp-swarm/(renamed for consistency withtcp-swarm).1.8 Remove ponyc CI breakage dispatches for lori
ponyc dispatches events to lori's repo via
cloudsmith-package-sychronised.yml. Since lori's code is now inside ponyc, remove the lori dispatch from this workflow.Phase 2: ponyc — Build system (CMake)
2.1 Add SSL detection
find_package(OpenSSL)or manual detection to CMake-Dflag:-Dopenssl_1.1.x-Dopenssl_3.0.x-Dopenssl_4.0.x-Dlibressl2.2 Pass SSL flag to ponyc invocations
Every script that invokes ponyc to compile code touching
packages/net/needs the SSL-Dflag, or_ssl_init.ponywillcompile_error. Specifically:cmake/RunStdlibTest.cmake— stdlib test compilationcmake/RunExamples.cmake— example compilationorchestrate_tcp.py,orchestrate_udp.py) — ponyc invocation for stress test binariesThe SSL version detected in 2.1 must flow through to all of these. Document the flag in BUILD.md.
2.3 CI
The SSL flag must be passed in all CI test and example build steps.
Phase 3: ponyc — Examples
3.1 Delete old network examples
Delete the three old-net examples — each has a lori equivalent coming over in 3.2:
examples/net/(ping/pong TCP) → replaced byinfinite-ping-pongexamples/echo/(echo server) → replaced byecho-serverexamples/under_pressure/(backpressure) → replaced bybackpressure3.2 Bring over all 19 lori examples
All lori examples come over, adapted for stdlib (change
use "lori"touse "net", etc.):backpressure, connection-timeout, echo-server, framed-protocol, idle-timeout, infinite-ping-pong, ip-version, net-ssl-echo-server, net-ssl-infinite-ping-pong, notifier-echo-server, notifier-ping-pong, notifier-udp-echo-server, read-buffer-size, send-completion, socket-options, starttls-ping-pong, timer, udp-echo-server, yield-read
Each example has its file-level docstring, follows the Listener/Server/Client actor structure, and uses a unique port. Update
examples/README.md.3.3 Update PonyCheck async TCP property example
examples/pony_check/async_tcp_property.ponyuses old net API — rewrite for new API.3.4 Example CMake integration
Examples using SSL need the SSL
-Dflag during build. Update CMakeLists.txt for examples accordingly.Phase 4: ponyc — Documentation
4.1 Update ponyc README
Note that the net package requires an SSL library. Document how to pass the SSL flag when building.
4.2 Update BUILD.md
Document the SSL detection in CMake. Explain how to specify SSL version if manual override is needed.
4.3 Release note and label
The PR gets a
changelog - changedlabel. Write a release note covering: what changed, why, how to migrate from old net, how to migrate from lori, how to migrate from ponylang/ssl. This is a breaking change — all code usinguse "net"must be updated.4.4 Carry over AGENTS.md
Copy lori's
AGENTS.mdtopackages/net/AGENTS.mdas a standalone file (not@-included from ponyc's top-level CLAUDE.md). Update lori→net references and convert bare#NNNissue/PR/discussion references to full URLs (e.g.,Discussion #219→https://github.com/ponylang/lori/discussions/219) so they resolve correctly from the ponyc repo. This scopes the architectural documentation (connection lifecycle, state machine, traps, platform differences, conventions) to load only when working on net package code.Phase 5: Downstream libraries (after ponyc release)
Each library that depends on lori needs a PR to switch to stdlib net. These can be done in parallel after a ponyc release containing the new net.
For each: remove lori from
corral.json, changeuse "lori"touse "net", verify the types match (they should — same names moving into stdlib).Other consumers
docs/object-capabilities/derived-authority.mdand its three code samples use old-net types (TCPConnectionNotify,TCPConnection). Rewrite to actor-trait pattern. Auth hierarchy discussion stays valid.docs/resource-management/disposable-actor.md— two full code examples withTCPListenNotify,TCPListener,TCPConnectionNotify,TCPConnection. Needs full rewrite.docs/testing/notifier-interactions.md— prose mention ofUDPNotify/TCPNotify.docs/code-sharing/embed-and-delegate.md— references lori as external library, update to "stdlib net".docs/async/batch-and-yield.md— one sentence aboutTCPConnection.received, update toon_received.Phase 6: Website updates
Update package descriptions for mare, stallion, redis in
docs/use/packages.mdif they mention lori as a dependency.Phase 7: Remove
netsubpackage from ponylang/sslponylang/ssl's
netsubpackage wraps the old stdlib net with SSL. Since SSL is now built into the new stdlib net, this subpackage is both broken (old API gone) and redundant. The rest of ponylang/ssl (crypto wrappers) stays.ssl/netsubpackage from ponylang/sslPhase 8: Archive ponylang/lori
netpackage. leave "what it was" and just say it graduated to the standard library.Phase 9: Website cleanup
After lori is archived:
docs/use/packages.md— remove lori entrydocs/contribute/ci/triggered-jobs.md— remove lori breakage CI job referencesdocs/contribute/ci/scheduled-jobs.md— remove lori stress test scheduledocs/contribute/labels.md— remove lori as example code repoExisting blog posts (pony-networking-take-two, LWIP posts) are historical records — leave as-is.
Phase 10: Rework ponylang/ssl into ponylang/crypto
After all the above, ponylang/ssl contains only crypto functionality — the networking SSL parts have been removed (Phase 7) and replaced by stdlib net. Rework the repo into ponylang/crypto:
Phase 11: Blog post
Write a blog post covering what changed and why, how to migrate from old net, how to migrate from lori, how to migrate from ponylang/ssl's net subpackage.
All reactions