code-analysis-client 1.6.242__tar.gz → 1.6.244__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/PKG-INFO +8 -3
  2. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/README.md +7 -2
  3. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/queue_wait.py +29 -5
  4. code_analysis_client-1.6.244/code_analysis_client/version.txt +1 -0
  5. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client.egg-info/PKG-INFO +8 -3
  6. code_analysis_client-1.6.242/code_analysis_client/version.txt +0 -1
  7. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/__init__.py +0 -0
  8. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/check_chain.py +0 -0
  9. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/client.py +0 -0
  10. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/commands_proxy.py +0 -0
  11. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/config.py +0 -0
  12. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/exceptions.py +0 -0
  13. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/file_session.py +0 -0
  14. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/py.typed +0 -0
  15. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/responses.py +0 -0
  16. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/schema_disk_cache.py +0 -0
  17. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/server_api.py +0 -0
  18. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/server_schema.py +0 -0
  19. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/universal_file.py +0 -0
  20. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/validation.py +0 -0
  21. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/vectorizer_state.py +0 -0
  22. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client/worktree.py +0 -0
  23. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client.egg-info/SOURCES.txt +0 -0
  24. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client.egg-info/dependency_links.txt +0 -0
  25. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client.egg-info/requires.txt +0 -0
  26. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/code_analysis_client.egg-info/top_level.txt +0 -0
  27. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/pyproject.toml +0 -0
  28. {code_analysis_client-1.6.242 → code_analysis_client-1.6.244}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-analysis-client
3
- Version: 1.6.242
3
+ Version: 1.6.244
4
4
  Summary: Async JSON-RPC client for the code-analysis MCP server (mcp-proxy-adapter JsonRpcClient)
5
5
  Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
6
6
  Requires-Python: >=3.10
@@ -80,8 +80,13 @@ Failures raise instead of returning an error envelope:
80
80
  and `.error` (always a structured error dict).
81
81
  * `JobTimeoutError` — only when a positive `timeout` elapses; the call detaches and
82
82
  the job keeps running server-side (`websocket.on_timeout` is `detach`).
83
- * `ClientValidationError` — the server refused the parameters (JSON-RPC `-32602`);
84
- `details` carries the server's `violation` payload.
83
+ * `ClientValidationError` — the server refused the parameters (JSON-RPC `-32602`),
84
+ answered at the top level or carried by the failed job of an in-process command
85
+ (same text `JSON-RPC error: <message> (code: -32602)`, `code` `VALIDATION_ERROR`);
86
+ `details` carries the server's error `data` (e.g. its `violation` payload). A
87
+ command the server refuses before starting it with its own error code (for
88
+ example `VALIDATION_ERROR` for an unknown `project_id`) raises it with that exact
89
+ `code` and the server's `data` as `details`.
85
90
  * `ValueError` — a negative `timeout` or a non-positive `poll_interval`, before
86
91
  anything is sent.
87
92
 
@@ -68,8 +68,13 @@ Failures raise instead of returning an error envelope:
68
68
  and `.error` (always a structured error dict).
69
69
  * `JobTimeoutError` — only when a positive `timeout` elapses; the call detaches and
70
70
  the job keeps running server-side (`websocket.on_timeout` is `detach`).
71
- * `ClientValidationError` — the server refused the parameters (JSON-RPC `-32602`);
72
- `details` carries the server's `violation` payload.
71
+ * `ClientValidationError` — the server refused the parameters (JSON-RPC `-32602`),
72
+ answered at the top level or carried by the failed job of an in-process command
73
+ (same text `JSON-RPC error: <message> (code: -32602)`, `code` `VALIDATION_ERROR`);
74
+ `details` carries the server's error `data` (e.g. its `violation` payload). A
75
+ command the server refuses before starting it with its own error code (for
76
+ example `VALIDATION_ERROR` for an unknown `project_id`) raises it with that exact
77
+ `code` and the server's `data` as `details`.
73
78
  * `ValueError` — a negative `timeout` or a non-positive `poll_interval`, before
74
79
  anything is sent.
75
80
 
@@ -87,13 +87,25 @@ def _extract_inner_command_error(status_data: Dict[str, Any]) -> Any:
87
87
  return None
88
88
 
89
89
 
90
+ def remote_error_text(message: Any, code: Any) -> str:
91
+ """Text of a server JSON-RPC error, identical to the adapter's ``ClientRemoteResponseError``.
92
+
93
+ ``"JSON-RPC error: <message> (code: <code>)"`` - used for an error carried by a failed job so
94
+ that it reads exactly like the same error answered at the top level.
95
+ """
96
+ return f"JSON-RPC error: {message} (code: {code})"
97
+
98
+
90
99
  def invalid_params_error(
91
- message: str, data: Any
100
+ message: str, data: Any, *, code: Optional[str] = None
92
101
  ) -> ClientValidationError:
93
- """Build the :class:`ClientValidationError` for a server JSON-RPC -32602 refusal.
102
+ """Build the :class:`ClientValidationError` for a server refusal of a command's parameters.
94
103
 
95
- The single constructor for both the top-level refusal (``client.py``) and a refusal carried by
96
- a failed job (``job_failure``), so ``code`` / ``field`` / ``details`` have one shape.
104
+ The single constructor for the top-level -32602 refusal (``client.py``), a -32602 carried by a
105
+ failed job (``job_failure``) and a refused command-session open with the server's own error
106
+ code (``map_adapter_error``), so ``code`` / ``field`` / ``details`` have one shape: ``details``
107
+ is the server's error ``data`` object, ``field`` its ``field`` entry (else ``"command"``),
108
+ ``code`` ``VALIDATION_ERROR`` unless the server named its own code.
97
109
  """
98
110
  payload = data if isinstance(data, dict) else {}
99
111
  field = payload.get("field")
@@ -101,6 +113,7 @@ def invalid_params_error(
101
113
  message,
102
114
  field=field if isinstance(field, str) else "command",
103
115
  details=payload,
116
+ code=code,
104
117
  )
105
118
 
106
119
 
@@ -143,7 +156,7 @@ def job_failure(
143
156
  error = {"message": str(error) if error else f"job {status}", "status": status}
144
157
  if error.get("code") == -32602:
145
158
  return invalid_params_error(
146
- f"Invalid parameters: {error.get('message')}", error.get("data")
159
+ remote_error_text(error.get("message"), -32602), error.get("data")
147
160
  )
148
161
  return JobFailedError(job_id, error, status=status)
149
162
 
@@ -193,6 +206,11 @@ def map_adapter_error(
193
206
  * ``CommandSessionFailedError`` with a terminal event -> ``JobFailedError`` (structured error)
194
207
  * ``CommandSessionFailedError`` for a refused open (numeric ``code``) -> ``ClientRemoteResponseError``
195
208
  so the caller's JSON-RPC handling (-32602, -32601) is the same as on the HTTP path
209
+ * ``CommandSessionFailedError`` for a refused open carrying the server's own string error
210
+ ``code`` (the adapter forwards ``exc.code`` of the refusing exception, e.g. ``VALIDATION_ERROR``
211
+ from a command's ``validate_params`` before enqueue) -> ``ClientValidationError`` with that
212
+ exact ``code``, the server message and ``details`` = the server's ``data`` (the documented
213
+ refusal shape of :class:`ClientValidationError`)
196
214
  """
197
215
  if isinstance(exc, CommandSessionTimeoutError):
198
216
  details = exc.details if isinstance(exc.details, dict) else {}
@@ -231,6 +249,12 @@ def map_adapter_error(
231
249
  "command": command,
232
250
  },
233
251
  )
252
+ if isinstance(code, str) and code.strip():
253
+ return invalid_params_error(
254
+ str(details.get("error") or exc),
255
+ details.get("data"),
256
+ code=code.strip(),
257
+ )
234
258
  return None
235
259
 
236
260
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-analysis-client
3
- Version: 1.6.242
3
+ Version: 1.6.244
4
4
  Summary: Async JSON-RPC client for the code-analysis MCP server (mcp-proxy-adapter JsonRpcClient)
5
5
  Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
6
6
  Requires-Python: >=3.10
@@ -80,8 +80,13 @@ Failures raise instead of returning an error envelope:
80
80
  and `.error` (always a structured error dict).
81
81
  * `JobTimeoutError` — only when a positive `timeout` elapses; the call detaches and
82
82
  the job keeps running server-side (`websocket.on_timeout` is `detach`).
83
- * `ClientValidationError` — the server refused the parameters (JSON-RPC `-32602`);
84
- `details` carries the server's `violation` payload.
83
+ * `ClientValidationError` — the server refused the parameters (JSON-RPC `-32602`),
84
+ answered at the top level or carried by the failed job of an in-process command
85
+ (same text `JSON-RPC error: <message> (code: -32602)`, `code` `VALIDATION_ERROR`);
86
+ `details` carries the server's error `data` (e.g. its `violation` payload). A
87
+ command the server refuses before starting it with its own error code (for
88
+ example `VALIDATION_ERROR` for an unknown `project_id`) raises it with that exact
89
+ `code` and the server's `data` as `details`.
85
90
  * `ValueError` — a negative `timeout` or a non-positive `poll_interval`, before
86
91
  anything is sent.
87
92