Repository navigation
Preserve an empty TLS table in envconfig dict conversion - #2054
Open
Jackmeson1 wants to merge 1 commit into
Open
Jackmeson1 wants to merge 1 commit into
Jackmeson1 wants to merge 1 commit into
Conversation
ClientConfigProfile.to_dict() left out "tls" when the TLS config had no fields set, and ClientConfigTLS.from_dict() returned None for an empty dictionary, so an empty [profile.x.tls] table was lost when a loaded profile went through a dictionary. Keep "tls" whenever the profile has a TLS config, and return None only for None. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019TTGAv6fe859ebbCLLfLHP Signed-off-by: Jackmeson1 <130693642+Jackmeson1@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
ClientConfigProfile.to_dict()now keepstlswhenever the profile has a TLS config, andClientConfigTLS.from_dict()distinguishes an empty dictionary fromNone. This preserves an empty TLS table through profile and whole-config dictionary round trips.A hand-written
{"tls": {}}now givesClientConfigTLS(), matching an empty TLS table in TOML.Nonestill means no TLS configuration.Why?
On 01af1f6, an empty
[profile.default.tls]table loads asClientConfigTLS(), but two truthiness checks lose it during dictionary conversion:to_dict()omits the empty dictionary, andfrom_dict({})returnsNone.The reproduced round trip leaves the profile's connect config without a
tlskey. From the client configuration code, this disables TLS for a host:port address without an API key or an explicit TLS override. API-key profiles still enable TLS automatically. Direct loading, absent TLS, explicitdisabled = false/true, and populated TLS tables retain their behavior.Checklist
Related: none. This is a small bug fix.
How was this tested:
Outside-sandbox validation on Linux x86_64 (Colab), using the Rust bridge built from this checkout and pytest 9.1.1:
disabled = false/true. They use the real bridge loader and compare connection configurations; they do not make network connections.tlsis missing; the three controls pass. Fixing either conversion direction alone still leaves two failures.pytest tests/test_envconfig.py: 44 passed on 01af1f6; 49 passed with the fix on Python 3.13.16, 3.10.22 and 3.14.8.pytest -n 4 --dist=worksteal, on Python 3.13.16: 1549 passed, 5 skipped on 01af1f6; 1554 passed, 5 skipped with the fix. The saved JUnit reports show five added cases and no changed statuses among existing tests.poe lintpassed with ruff 0.15.22, pyright 1.1.403, mypy 1.18.2, basedpyright 1.34.0 and pydocstyle 6.3.0.Other operating systems were not run.
Any docs updates needed?
Updated the
ClientConfigTLS.from_dict()docstring and addedchangelog/fixed/persistent-pelican.md.AI disclosure: this was prepared with AI assistance (Claude Opus 5.5).
🤖 Generated with Claude Code