• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / async / 634
77%

Build:
DEFAULT BRANCH: main
Ran 29 Jun 2026 02:22AM UTC
Jobs 1
Files 151
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Jun 2026 02:18AM UTC coverage: 77.088% (+0.007%) from 77.081%
634

push

github

web-flow
tls: load OpenSSL lazily on first TLS use, not at startup (#453)

* tls: load OpenSSL lazily on first TLS use, not at startup

Load libssl (dlopen + ~50 dlsym) and build the shared client/server SSL_CTX
lazily on first use, not at process startup, so a program that links this
package but never touches TLS pays nothing before main. A single guarded
load_openssl() does the loading + BIO method setup, the shared contexts are
memoized in Ref[SSL_CTX?] cells, and every raw-symbol FFI wrapper
(SSL_CTX::client/server, create_bio, rand_bytes, sha1) calls it first so
standalone crypto entry points like @tls.rand_bytes / @tls.sha1 still load
correctly without a TLS connection.

* tls: raise instead of abort on OpenSSL load failure, cache the outcome

Now that OpenSSL is loaded lazily on first TLS use rather than at startup,
a load failure can be reported as a recoverable error instead of killing the
program. Turn every `abort` in `load_openssl` and the SSL context init into
`raise TlsError`, and propagate `raise` up the call chain (SSL_CTX::client/
server, client_ctx/server_ctx, create_bio, from_pair, sha1).

`openssl_loaded` becomes `Result[Unit, Error]?` so a failed load is cached and
re-raised immediately on subsequent calls instead of retrying every time.

Addresses review feedback on #453.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* tls: simplify cached-outcome handling with Result::unwrap_or_error

Replace the two explicit `match`es in `load_openssl` (cached-outcome check and
post-attempt re-raise) with `Result::unwrap_or_error`.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

29 of 36 new or added lines in 3 files covered. (80.56%)

2 existing lines in 2 files now uncovered.

3590 of 4657 relevant lines covered (77.09%)

72436.03 hits per line

Uncovered Changes

Lines Coverage ∆ File
5
62.5
4.17% src/tls/openssl_loader.mbt
2
76.33
0.69% src/tls/openssl.mbt

Coverage Regressions

Lines Coverage ∆ File
1
77.78
-3.7% src/internal/event_loop/signal.mbt
1
62.5
4.17% src/tls/openssl_loader.mbt
Jobs
ID Job ID Ran Files Coverage
1 634.1 29 Jun 2026 02:22AM UTC 151
77.09
GitHub Action Run
Source Files on build 634
  • Tree
  • List 151
  • Changed 4
  • Source Changed 3
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • e551ade8 on github
  • Prev Build on main (#618)
  • Next Build on main (#638)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc