Stabilize modern client compatibility and promote .github/agent.md to agent source of truth#71
Open
Copilot wants to merge 5 commits into
Open
Stabilize modern client compatibility and promote .github/agent.md to agent source of truth#71Copilot wants to merge 5 commits into
.github/agent.md to agent source of truth#71Copilot wants to merge 5 commits into
Conversation
Agent-Logs-Url: https://github.com/nullroute-commits/CMS-NBI-Client/sessions/564b3bc0-18f8-4f1d-92df-55912d6ca1f0 Co-authored-by: nullroute-commits <59403925+nullroute-commits@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nullroute-commits/CMS-NBI-Client/sessions/564b3bc0-18f8-4f1d-92df-55912d6ca1f0 Co-authored-by: nullroute-commits <59403925+nullroute-commits@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nullroute-commits/CMS-NBI-Client/sessions/564b3bc0-18f8-4f1d-92df-55912d6ca1f0 Co-authored-by: nullroute-commits <59403925+nullroute-commits@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nullroute-commits/CMS-NBI-Client/sessions/564b3bc0-18f8-4f1d-92df-55912d6ca1f0 Co-authored-by: nullroute-commits <59403925+nullroute-commits@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nullroute-commits/CMS-NBI-Client/sessions/564b3bc0-18f8-4f1d-92df-55912d6ca1f0 Co-authored-by: nullroute-commits <59403925+nullroute-commits@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
nullroute-commits
May 19, 2026 16:01
View session
There was a problem hiding this comment.
Pull request overview
This PR consolidates the repository’s agent configuration by promoting .github/agent.md as the canonical source, and stabilizes the “modern” CMSClient runtime compatibility layer by restoring legacy E7 and REST behaviors, improving transport response lifecycles, and tightening XML auth parsing.
Changes:
- Promote
.github/agent.mdas the agent source of truth and align docs to the current transitional API surface. - Restore modern-client compatibility by adding legacy fields/facades (
e7, REST defaults, compatibility config fields) and exposinge7/restviaSyncCMSClient. - Fix transport/auth correctness with live response returns, exception mapping, safer XML parsing, and added regression tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/unit/test_modern_client.py |
Adds regression tests covering transport lifecycle, XML auth parsing, REST defaults, and secure XML helpers. |
tests/unit/test_imports.py |
Ensures CMSClient exposes the documented legacy-compatibility surface. |
src/cmsnbiclient/security/xml.py |
Implements XML building and introduces a shared safe-parse helper. |
src/cmsnbiclient/REST/query.py |
Resolves REST defaults for legacy vs modern clients and supports multiple response envelopes. |
src/cmsnbiclient/core/transport.py |
Returns live aiohttp responses and maps transport failures to project exceptions. |
src/cmsnbiclient/client.py |
Enables legacy login/logout code paths for both HTTP and HTTPS without stubs. |
src/cmsnbiclient/client_v2.py |
Reintroduces e7 via a legacy facade, adds legacy-compatible fields, improves auth parsing, and exposes e7/rest on SyncCMSClient. |
src/cmsnbiclient/__init__.py |
Removes import-time logging initialization side effects. |
README.md |
Updates documentation to reflect the current transitional status and compatibility surface. |
.github/agent.md |
Establishes canonical agent definition plus provenance and sync policy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| default_node = config["cms_nodes"]["default"] | ||
| connection = default_node["connection"] | ||
| credentials = default_node["cms_creds"] | ||
| protocol = connection["protocol"]["http"] |
Comment on lines
111
to
+118
| response.raise_for_status() | ||
| return response | ||
| except asyncio.TimeoutError as exc: | ||
| raise TimeoutError(f"Request timed out for {method} {url}") from exc | ||
| except aiohttp.ClientResponseError as exc: | ||
| raise ConnectionError( | ||
| f"HTTP {exc.status} error for {method} {url}: {exc.message}" | ||
| ) from exc |
Comment on lines
+84
to
+90
| def _build_element(self, name: str, value: Any) -> str: | ||
| """Recursively build a safely escaped XML element string.""" | ||
| if isinstance(value, dict): | ||
| attributes = value.get("@attributes", {}) | ||
| attr_text = "".join( | ||
| f" {key}={quoteattr(str(attr_value))}" for key, attr_value in attributes.items() | ||
| ) |
| admin_state="enabled" | ||
| ) | ||
| print(result) | ||
| devices = client.rest.query.device(device_type="e7") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change addresses two gaps in the repo’s current state: the repository agent configuration was split between reference and active files, and the modern client path advertised capabilities that were not reliable at runtime. The update makes
.github/agent.mdthe canonical agent definition and fixes the highest-severity compatibility issues inCMSClient, transport handling, auth parsing, and REST defaults.Agent source of truth
/home/runner/work/CMS-NBI-Client/CMS-NBI-Client/.github/agent.mdto the canonical repository agent definitionnullroute-commits/agency-agentsprovenance, adopted skill families, and sync policyModern client runtime compatibility
CMSClient.e7through a compatibility facade over the legacy E7 operation modulescms_nbi_config,cms_netconf_url,session_id,cms_user_nm) so shared modules can operate againstCMSCliente7andrestthroughSyncCMSClientafter connectionTransport and auth correctness
AsyncHTTPTransportto return a live response object instead of one closed by anasync withscopeREST compatibility
dataordevicesCMSClientSecurity and package behavior
Docs alignment
README.mdto reflect the actual current API surface and transition statusRegression coverage
CMSClientExample of the restored compatibility surface: