← Back to Pull requests

feat(python): expose get_me, get_client, get_clients #4020

Closed
unknown closed this pull request without merging on Sep 05, 2026 03:51 UTC
View on GitHub
unknown unknown commented on Sep 01, 2026 08:08 UTC
Author

Add system client methods to the Python SDK for parity with Rust SDK:

  • Add client_info.rs wrapping ClientInfo, ClientInfoDetails, ConsumerGroupInfo types with pyclass getters

  • Add get_me() -> ClientInfoDetails for current client info

  • Add get_client(client_id) -> ClientInfoDetails | None

  • Add get_clients() -> list[ClientInfo] for all connected clients

  • Register new types in lib.rs pymodule

  • Add iggy_common dependency for ClientInfo/ConsumerGroupInfo

  • Add integration tests for all three methods
  • Which issue does this PR address?

    <!--
    We generally require a GitHub issue for all bug fixes and enhancements. Link it with GitHub syntax, keep the line that applies and delete the other:

  • Closes #123 auto-closes the issue when this PR merges (full fix).

  • Relates to #123 links without closing (partial or related work).

  • -->

    Relates to #4015

    Rationale

    <!--
    Why is this change needed? If the issue explains it well, a one-liner is fine.
    -->

    The Rust SDK exposes get_me, get_client, and get_clients via SystemClient, but the Python SDK had none of them. Every other SDK (Java, .NET, Go, etc.) already exposes connection state — this closes the parity gap.

    What changed?

    <!--
    2-4 sentences. Problem first (before), then solution (after).

    GOOD:

    "Messages were unavailable when background message_saver committed the
    journal and started async disk I/O before completion. Polling during
    this window found neither journal nor disk data.

    The fix freezes journal batches in the in-flight buffer before async persist."

    GOOD:

    "When many small messages accumulate in the journal, the flush passes
    thousands of IO vectors to writev(), exceeding IOV_MAX (1024 on Linux)."

    BAD:

  • Walls of text

  • "This PR adds..." (we can see the diff)

  • -->

    The Python SDK had no way to inspect the currently connected client or enumerate all connected clients, while every other SDK could. This adds three methods (get_me, get_client, get_clients) and their associated wrapper types (ClientInfo, ClientInfoDetails, ConsumerGroupInfo) to the Python SDK, following the same pattern used for user types in user.rs.

    Local Execution

  • Passed: cargo check, cargo clippy --all-features --all-targets -- -D warnings, cargo fmt --all -- --check

  • Pre-commit hooks ran / not ran
  • <!--
    You must run your code locally before submitting.
    "Relying on CI" is not acceptable - PRs from authors who haven't run the code will be closed.

    Did you have prek installed? It runs automatically on commit and covers all project languages. See CONTRIBUTING.md.
    -->

    AI Usage

    <!--
    If AI tools were used, please answer:
    1. Which tools? (e.g., GitHub Copilot, Claude, ChatGPT)
    2. Scope of usage? (e.g., autocomplete, generated functions, entire implementation)
    3. How did you verify the generated code works correctly?
    4. Can you explain every line of the code if asked?

    If no AI tools were used, write "None" or delete this section.
    -->

    None

    Diff: 388 lines (+291 / -97) across 4 files Reviewer: yummyPancake2607 Review duration: 5503m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 388 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.357
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4020"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.1% (MEDIUM) · Higher = larger blast radius
    43.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17% · Safe to merge
    17%
    Repository