Fix Sagemcom session recovery after manual modem login#286
Merged
Conversation
When a user manually logs into the modem web UI, the modem invalidates DOCSight's session. The modem returns HTTP 200 with XMO error codes (e.g. XMO_UNKNOWN_PATH_ERR) instead of HTTP errors. Previously, only error code 16777236 triggered a RuntimeError -- all other XMO errors were silently ignored, causing the driver to return empty channel data indefinitely until restart. Now _raw_post() raises RuntimeError for any non-success XMO response, which the existing re-auth mechanism in get_docsis_data() catches to automatically re-authenticate and retry. Fixes #285
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.
Summary
Fixes #285 - DOCSight falls back to "Generic Router Mode" when a user manually logs into the modem web UI.
Root cause: When the modem invalidates DOCSight's session (e.g. another client logs in), it returns HTTP 200 with XMO error codes like
XMO_UNKNOWN_PATH_ERRinstead of HTTP errors. The driver's_raw_post()only raised aRuntimeErrorfor one specific error code (16777236), silently ignoring all others. This meant:_logged_instayedTrue, preventing re-authenticationFix:
_raw_post()now raisesRuntimeErrorfor any non-success XMO response. The existing re-auth mechanism inget_docsis_data()catches this and automatically re-authenticates + retries.Test plan
test_docsis_retry_on_xmo_session_error- simulates HTTP 200 + XMO_UNKNOWN_PATH_ERR, verifies re-auth + successful retrytest_xmo_error_raises_runtime_error- verifies _raw_post raises for any XMO errortest_docsis_retry_on_failurestill passes (HTTP 401 path)