← Back to Pull requests

fix: Network.id now returns libpod lowercase 'id', add get_compatible… #660

Merged
VincentSamuelPaul merged 2 files (18 lines) on Oct 26, 2026 08:46 UTC
View on GitHub
VincentSamuelPaul VincentSamuelPaul commented on Sep 25, 2026 14:07 UTC
Author

Fixes #584

Network.id was looking for self.attrs["Id"] (uppercase), but Podman's
libpod API returns "id" (lowercase), causing it to always fall back to a
synthetic hash-based ID. Passing that fake ID to networks.get() would then fail.

Changes:
Network.id now correctly reads attrs["id"] (libpod format)
Added Network.get_compatible_id() for Docker-compatible endpoints that use attrs["Id"]
Network.connect() uses get_compatible_id() since it goes through the Docker-compatible endpoint
Updated test_id to use libpod format, added test_compatible_id

This follows the approach suggested by @inknos in #587, analogous to how
Network.name already handles both "Name" and "name".

Diff: 18 lines (+18 / -0) across 2 files Reviewer: Honny1 Review duration: 44319m
All Vouch review confidence checks passed
Residual risk 0.06 = Change Risk (0.22) × (1 − Review Confidence (0.72)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.22 · 18 lines diff across 2 files
0.22
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.47 · 5 substantive comment(s)
0.47
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
72%
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.176
Real PR Conversation Timeline
22 items
Copilot Copilot commented on code on Sep 25, 2026 14:10 UTC
Code Review
podman/domain/networks.py:1
@@ -36,14 +36,21 @@ class Network(PodmanResource):
     def id(self):  # pylint: disable=invalid-name
         """str: Returns the identifier of the network."""
         with suppress(KeyError):
-            return self.attrs["Id"]
+            return self.attrs["id"]

This removes the uppercase response path that the existing NetworksManager.get test (and Docker-compatible network responses) still use: FIRST_NETWORK has "Id" and "Name", so Network.id now skips both lookups and returns None instead of the network ID. Please retain an Id fallback here (or update every compatible caller/fixture to use the libpod shape) so fetching a compatible network does not lose its identifier.

copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Sep 25, 2026 14:10 UTC
Reviewer

<!-- ccr-overview-v2 -->

Copilot review overview

🟡 Changes recommended

Restore the uppercase Id fallback and address the requested test coverage and lint issue.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture>

<details open>
<summary><strong>Open (1)</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> [Restore uppercase Id fallback in Network.id](#discussion_r4105338241) · New

  • </details>

    <details>
    <summary><strong>What changed in this PR</strong></summary>

    Updates network ID handling for libpod’s lowercase id format while preserving Docker-compatible IDs for connect().

    Changes:

  • Uses lowercase id for Network.id.

  • Adds get_compatible_id() for compatible endpoints.

  • Updates connection handling and unit tests.
  • The uppercase Id fallback remains necessary for compatible network responses. Additional lowercase-ID coverage and trailing-whitespace cleanup are also required.

    | File | Description |
    |---|---|
    | podman/​tests/​unit/​test_network.py | Updates network ID tests and adds compatibility coverage. |
    | podman/​domain/​networks.py | Implements libpod and compatible network ID handling. |
    </details>

    ---

    💡 <a href="/containers/podman-py/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>

    VincentSamuelPaul VincentSamuelPaul commented on Sep 25, 2026 14:58 UTC
    Author

    The testing-farm:*:distro-fedora-all and testing-farm:fedora-44-x86_64:distro-sanity failures appear to be infrastructure errors unrelated to this change — they error out immediately with "1 plan errored out" and no test output, which is the same pattern seen in other recent PRs. No source logic was modified that would affect distro packaging or sanity checks.

    Honny1 Honny1 commented on code on Sep 25, 2026 15:43 UTC
    Code Review
    podman/domain/networks.py:1
    @@ -44,6 +47,13 @@ def id(self):  # pylint: disable=invalid-name
     
             return None
     
    +    def get_compatible_id(self):
    +        """str: Returns the identifier of the network (Docker-compatible format)."""
    +        with suppress(KeyError):
    +            return self.attrs["Id"]
    +        

    Can you please remove these white spaces?

    
    

    Honny1 Honny1 commented on code on Sep 25, 2026 15:45 UTC
    Code Review
    podman/domain/networks.py:1
    @@ -44,6 +47,13 @@ def id(self):  # pylint: disable=invalid-name
     
             return None
     
    +    def get_compatible_id(self):

    Should this be private function?

    Honny1 Honny1 requested changes on Sep 25, 2026 15:46 UTC
    Changes Requested Reviewer

    Thanks, I have some comments. Please also add in to commit Fixes: #NUMBER_OF_ISSUE. Thanks!

    VincentSamuelPaul VincentSamuelPaul commented on code on Sep 25, 2026 16:52 UTC
    Code Review
    podman/domain/networks.py:1
    @@ -44,6 +47,13 @@ def id(self):  # pylint: disable=invalid-name
     
             return None
     
    +    def get_compatible_id(self):
    +        """str: Returns the identifier of the network (Docker-compatible format)."""
    +        with suppress(KeyError):
    +            return self.attrs["Id"]
    +        

    I've fixed it, removed trailing whitespace.

    VincentSamuelPaul VincentSamuelPaul commented on code on Sep 25, 2026 16:52 UTC
    Code Review
    podman/domain/networks.py:1
    @@ -44,6 +47,13 @@ def id(self):  # pylint: disable=invalid-name
     
             return None
     
    +    def get_compatible_id(self):

    Made it private (_get_compatible_id)

    VincentSamuelPaul VincentSamuelPaul commented on Sep 28, 2026 14:19 UTC
    Author

    Hi @Honny1, I've addressed all the review comments — removed trailing whitespace, made the function private (_get_compatible_id), and added Fixes: #584 to the commit. Let me know if there's anything else needed. Thanks!

    Honny1 Honny1 commented on Sep 30, 2026 12:27 UTC
    Reviewer

    LGTM

    VincentSamuelPaul VincentSamuelPaul commented on Oct 01, 2026 07:43 UTC
    Author

    Thanks for the review!

    VincentSamuelPaul VincentSamuelPaul commented on Oct 16, 2026 13:47 UTC
    Author

    Hi @Honny1, just a heads up your earlier “changes requested” review is still showing as pending on GitHub’s end, which may be blocking the merge. Could you re-review or dismiss the old review when you get a chance? Thanks!

    Honny1 Honny1 commented on Oct 16, 2026 13:52 UTC
    Contributor

    Please rebase on upstream main.

    VincentSamuelPaul VincentSamuelPaul commented on Oct 16, 2026 13:55 UTC
    Author

    Please rebase on upstream main.

    Done, rebased on upstream main.

    VincentSamuelPaul VincentSamuelPaul commented on Oct 19, 2026 06:45 UTC
    Author

    Hi @Honny1, the two remaining pending checks (rpm-build:fedora-42 and testing-farm:fedora-42) appear to be stuck waiting on Packit infrastructure, they’ve been “Expected Waiting for status to be reported” for 3 days without progress. Could you trigger a retest or override them if they’re not blocking? Thanks!

    Honny1 Honny1 approved these changes on Oct 19, 2026 07:52 UTC
    Approved Reviewer

    LGTM

    simek-m simek-m commented on Oct 22, 2026 15:38 UTC
    Contributor

    @simek-m Reminder to review.

    TomSweeneyRedHat TomSweeneyRedHat commented on Oct 22, 2026 20:53 UTC
    Contributor

    LGTM

    Honny1 Honny1 commented on Oct 23, 2026 14:15 UTC
    Contributor

    @VincentSamuelPaul, can you please rebase on upstream main? Thanks!

    simek-m simek-m approved these changes on Oct 23, 2026 14:15 UTC
    Approved Reviewer

    LGTM.

    VincentSamuelPaul VincentSamuelPaul commented on Oct 23, 2026 16:58 UTC
    Author

    Done, rebased on upstream main. Resolved the conflict in connect() by keeping the upstream implementation which properly handles both libpod and Docker-compatible endpoints.

    Reviewers
    Assignees
    VincentSamuelPaul VincentSamuelPaul
    Labels
    risk: low confidence: 72.2% 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: 22.1% (LOW) · Higher = larger blast radius
    22.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: 72.2% · Lower = rushed or shallow review
    72.2%
    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: 6.1% · Safe to merge
    6.1%