Skip to content

Fix #41: Replace gconf with pydantic-settings#44

Merged
max-tet merged 9 commits intomainfrom
clayde/issue-41-gconf-to-pydantic-settings
Mar 22, 2026
Merged

Fix #41: Replace gconf with pydantic-settings#44
max-tet merged 9 commits intomainfrom
clayde/issue-41-gconf-to-pydantic-settings

Conversation

@ClaydeCode
Copy link
Copy Markdown
Contributor

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.

- 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>
Comment thread tests/conftest.py Outdated
ClaydeCode and others added 8 commits March 21, 2026 13:35
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>
@max-tet max-tet merged commit 4f8b719 into main Mar 22, 2026
6 checks passed
@max-tet max-tet deleted the clayde/issue-41-gconf-to-pydantic-settings branch March 22, 2026 14:04
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.

Replace gconf with pydantic-settings

2 participants