Fix #41: Replace gconf with pydantic-settings#44
Merged
Conversation
- Add typed Settings class with nested models covering all config keys - Convert config.yml, tests/config.yml, local_config.yml to TOML - Create shard_core/settings.py with settings(), set_settings(), reset_settings() - Remove gconf dependency; add pydantic-settings>=2 - Replace all gconf.get() call sites with typed settings() attribute access - Rename spaced keys: dns.prefix_length, terminal.pairing_code_deadline, terminal.jwt_secret_length - Simplify app_factory.create_app() by removing CONFIG env var logic - Update tests/conftest.py: replace gconf.override_conf() with set_settings() using _TestSettings subclass that overlays tests/config.toml - Add settings_override() context manager for inline test overrides - Fix login_docker_registries() to also catch OSError (no docker installed) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
max-tet
requested changes
Mar 21, 2026
The function just delegated to _apply_model_dict directly, so call _apply_model_dict at both call sites instead.
Reformat code with black and split make_cert_resolver into make_http_cert_resolver and make_tcp_cert_resolver to use the correct TLS types for HTTP vs TCP routers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The id and name fields were typed as `str` with a default of None, which pydantic v1 allowed but v2 rejects. Use `str | None` to fix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The _find_app cache TTL was evaluated at module import time using default settings (ttl=3) rather than test settings (ttl=0), causing stale cached results with last_access=None to bypass the debounce check. Remove the test-only cache_ttl setting and hardcode the TTL. Clear the cache explicitly in the test between requests instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
One app's docker-compose failure in asyncio.gather would prevent all other apps from shutting down, leaving containers connected to the portal network. Subsequent tests then failed on network creation. - Use return_exceptions=True in docker_stop_all_apps/docker_shutdown_all_apps so one app failure doesn't block the rest - Force-disconnect all containers from portal network before removing it - Handle SubprocessError on network create for extra resilience Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- parse_obj() → model_validate() - parse_raw() → model_validate_json() - validate() → model_validate() - .dict() → .model_dump() - .json() → .model_dump_json() (on pydantic models) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
With pydantic v2's model_dump_json(), httpx's data= sends the string as form-encoded rather than JSON. Use content= with explicit Content-Type header to send raw JSON correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Closes #41
Replaced gconf with pydantic-settings: created shard_core/settings.py with typed Settings class and nested models; converted config.yml/tests/config.yml/local_config.yml to TOML; updated all 31 gconf.get() call sites across 18 files; simplified app_factory.create_app() removing CONFIG env var logic; replaced gconf.override_conf() in tests with set_settings()/reset_settings() pattern using _TestSettings subclass; added settings_override() context manager for inline test overrides; renamed spaced config keys (prefix length → prefix_length, etc.); removed gconf dependency; all 14 non-docker tests pass.