Skip to content

Add value equality for TLS configurations and trust stores - #34

Merged
samuel-williams-shopify merged 3 commits into
mainfrom
tls-value-equality
Sep 24, 2026
Merged

samuel-williams-shopify merged 3 commits into
mainfrom
tls-value-equality

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Equivalent TLS configurations currently compare by object identity, forcing connection caches to serialize and digest them to share clients by value. Add ==, eql?, and hash to TLS::Configuration and TLS::TrustStore so they can be used directly as cache keys.

Equality includes the exact PEM strings, certificate order, trust store system-certificate policy, and configuration verification policy. equal? retains its object-identity semantics. Freezing either object copies and freezes its nested certificate data, so a cache can retain an immutable snapshot without freezing the caller's configuration or its inputs:

configuration = tls_configuration&.dup&.freeze
key = [url, configuration]

This supports removing Marshal serialization and SHA-256 cache keys from async-grpc-compatible #10. Existing redacted inspect output keeps certificate and private-key material out of cache inspection.

Validation on Ruby 4.0.7:

  • io-endpoint: 121 tests, 260 assertions; both changed TLS classes have 100% line coverage.
  • PR Fix SSLServer#accept failures causing accept loop to exit. #10 with the direct configuration key and this io-endpoint branch: 116 tests, 390 assertions, 100% line coverage, including connection reuse, mutation isolation, and private-key redaction.
  • RuboCop passes in both repositories; io-endpoint API documentation coverage is 145/145.

@samuel-williams-shopify
samuel-williams-shopify merged commit e4da3c7 into main Sep 24, 2026
34 of 40 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the tls-value-equality branch September 24, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant