Skip to content

Improve the Config class and routes#34

Merged
skupriienko merged 28 commits intomainfrom
refactor-config-class
Apr 1, 2026
Merged

Improve the Config class and routes#34
skupriienko merged 28 commits intomainfrom
refactor-config-class

Conversation

@skupriienko
Copy link
Copy Markdown
Collaborator

@skupriienko skupriienko commented Mar 13, 2026

Links:

Actions:

  • Core SDK & Client:

    • Refactor Config class to use a deterministic, data-driven routing approach with EXACT_ROUTES and PREFIX_ROUTES.
    • Fix domain endpoint routing to correctly resolve and fallback between API versions (V1, V3, V4) without substring matching fallacies.
    • Update domains_handler to properly construct hierarchical and nested URLs (e.g., credentials, IPs, webhooks).
    • Implement smart logging (telemetry) in Endpoint and AsyncEndpoint to capture detailed request URLs and API errors.
    • Fix httpx DeprecationWarning in AsyncEndpoint by routing serialized string/byte payloads to the content= parameter instead of data=.
  • Integration Tests:

    • Fix OpenSSL key generation in DomainTests to use the -traditional flag, ensuring valid PKCS1 format for DKIM tests.
    • Fix RFC 6376 grammar violation by changing the DKIM selector name from test_selector to test-selector.
    • Fix AttributeError in AsyncKeysTests by correctly referencing self.domain instead of the uninitialized self.test_domain.
    • Mark tests affected by Mailgun Sandbox quota limits and eventual consistency delays with @pytest.mark.xfail(reason=...) (e.g., test_verify_domain, test_get_sending_queues, test_update_account_tag, test_delete_key).
  • Unit Tests:

    • Add tests/unit/test_routes.py to enforce strict schemas for routing dictionaries and prevent overlapping keys.
    • Update test_config.py to validate the new fallback and alias mapping logic.
    • Fix TypeError in test_client.py caused by comparing MagicMock objects to integer HTTP status codes.
    • Fix Windows CI FileNotFoundError in test_async_client.py by safely monkeypatching the broken SSL_CERT_FILE environment variable during httpx.AsyncClient initialization.
  • Linting & Formatting:

    • Apply refurb modernizations: replace try/except: pass with contextlib.suppress, optimize equality checks with the in operator, and utilize implicit truthiness for collection checks.
    • Resolve pyright strict typing errors: eliminate blanket # type: ignore comments, explicitly declare | None unions, and implement type narrowing for object attributes to prevent OptionalMemberAccess errors.
  • CI & Repository Management:

    • Update .github/dependabot.yml to group minor and patch updates and set an open PR limit.
    • Update .github/workflows/commit_checks.yaml to install test dependencies and execute unit tests during CI runs.

@skupriienko skupriienko self-assigned this Mar 13, 2026
@skupriienko skupriienko requested a review from erz9engel March 13, 2026 15:30
@skupriienko
Copy link
Copy Markdown
Collaborator Author

skupriienko commented Mar 19, 2026

@erz9engel I would wait for unit tests from #32 because it will be better to validate a new logic

@skupriienko skupriienko changed the title WIP: Improve the Config class Improve the Config class and routes Mar 25, 2026
@skupriienko skupriienko marked this pull request as ready for review March 25, 2026 08:00
@skupriienko skupriienko requested a review from erz9engel March 30, 2026 17:30
Copy link
Copy Markdown

@ybiletskyianaconda ybiletskyianaconda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@erz9engel erz9engel dismissed ybiletskyianaconda’s stale review March 31, 2026 22:38

this user is not authorized

@skupriienko skupriienko merged commit 2ab0add into main Apr 1, 2026
17 checks passed
@skupriienko skupriienko deleted the refactor-config-class branch April 1, 2026 08:28
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.

3 participants