Skip to content

Conversation

@fderuiter
Copy link
Owner

๐Ÿ—๏ธ Design Change:

  • Authentication: Switched from hardcoded API Key headers in HTTPClientBase to a Strategy Pattern. Introduced AuthStrategy protocol and ApiKeyAuth implementation.
  • Records Endpoint: Refactored create and async_create to use a shared _prepare_create_request method.

โ™ป๏ธ DRY Gains:

  • Reduced duplicate logic in RecordsEndpoint.
  • Decoupled authentication headers from the HTTP client.

๐Ÿ›ก๏ธ Solidity:

  • Added RecordCreateInput TypedDict for better type safety of record creation payloads.
  • Fixed a generic TypeError in RequestExecutor where async with was used on a synchronous OpenTelemetry span context manager.

โš ๏ธ Breaking Changes:

  • BaseClient and HTTPClientBase now accept an optional auth parameter. _create_client signature in BaseClient subclasses must now accept auth: AuthStrategy. (Backward compatibility for initialization via config is maintained, but subclasses overriding _create_client will need updates).

PR created automatically by Jules for task 5549034634981583134 started by @fderuiter

- Implement `AuthStrategy` and `ApiKeyAuth`.
- Update `BaseClient` to use Auth Strategy.
- Refactor `RecordsEndpoint` to share creation logic.
- Fix OpenTelemetry span context manager usage in async requester.
- Add `RecordCreateInput` TypedDict.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

๐Ÿ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a ๐Ÿ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Update `tests/unit/test_core_async_client_extended.py` to mock `span_cm` as a synchronous context manager (using `__enter__`).
- This aligns the test with the previous fix in `imednet/core/_requester.py` where OpenTelemetry spans are consumed using `with`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
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.

2 participants