plan-manager-client 0.2.134__tar.gz → 0.2.136__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 (41) hide show
  1. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/PKG-INFO +1 -1
  2. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/dispatch.py +36 -0
  3. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/facade_bug_project_mixin.py +11 -3
  4. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/facade_context_gate_mixin.py +8 -0
  5. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/server_api.py +5 -1
  6. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/server_api_mutating.py +2 -0
  7. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client.egg-info/PKG-INFO +1 -1
  8. plan_manager_client-0.2.136/tests/test_dispatch_validation_error_classification.py +132 -0
  9. plan_manager_client-0.2.134/tests/test_dispatch_validation_error_classification.py +0 -60
  10. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/__init__.py +0 -0
  11. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/_version.py +0 -0
  12. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/authoring_diagnostics.py +0 -0
  13. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/client.py +0 -0
  14. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/config.py +0 -0
  15. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/delivery/__init__.py +0 -0
  16. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/delivery/archive.py +0 -0
  17. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/delivery/atomicity.py +0 -0
  18. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/delivery/commit.py +0 -0
  19. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/delivery/destination.py +0 -0
  20. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/delivery/provenance.py +0 -0
  21. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/delivery/upload.py +0 -0
  22. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/export_fetch_chunks.py +0 -0
  23. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/export_fetch_request.py +0 -0
  24. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/export_fetch_unpack.py +0 -0
  25. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/export_fetch_verify.py +0 -0
  26. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/facade_agent_config_mixin.py +0 -0
  27. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/facade_entity_common_mixin.py +0 -0
  28. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/facade_hrs_file_mixin.py +0 -0
  29. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/facade_plan_hrs_mixin.py +0 -0
  30. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/facade_runtime_mixin.py +0 -0
  31. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/facade_step_graph_mixin.py +0 -0
  32. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/info_walker.py +0 -0
  33. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client/scenario_runtime.py +0 -0
  34. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client.egg-info/SOURCES.txt +0 -0
  35. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client.egg-info/dependency_links.txt +0 -0
  36. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client.egg-info/requires.txt +0 -0
  37. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/plan_manager_client.egg-info/top_level.txt +0 -0
  38. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/pyproject.toml +0 -0
  39. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/setup.cfg +0 -0
  40. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/tests/test_client_server_api_sync.py +0 -0
  41. {plan_manager_client-0.2.134 → plan_manager_client-0.2.136}/tests/test_contract_facade_passthrough.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plan-manager-client
3
- Version: 0.2.134
3
+ Version: 0.2.136
4
4
  Summary: First-class client library for the plan_manager JSON-RPC API: full command-surface facade plus export delivery module boundary.
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: mcp-proxy-adapter==8.11.3
@@ -32,6 +32,15 @@ def _adapter_validation_error_result(status: object) -> dict[str, Any] | None:
32
32
  result = status.get("result")
33
33
  if isinstance(result, dict):
34
34
  candidates.append(result.get("data"))
35
+ # A refused command run as a job keeps the ErrorResult one level deeper,
36
+ # at status.result.result and status.data.result.result, with
37
+ # command_execution true (bug ccb5f95f).
38
+ candidates.append(result.get("result"))
39
+ data = status.get("data")
40
+ if isinstance(data, dict):
41
+ data_result = data.get("result")
42
+ if isinstance(data_result, dict):
43
+ candidates.append(data_result.get("result"))
35
44
 
36
45
  for candidate in candidates:
37
46
  if not isinstance(candidate, dict):
@@ -44,6 +53,32 @@ def _adapter_validation_error_result(status: object) -> dict[str, Any] | None:
44
53
  ):
45
54
  return candidate
46
55
 
56
+ # The server's pre-execution refusals (command_execution false) and "Method not
57
+ # found" keep a bare ``{status: "error", code, message, data}`` result at
58
+ # status.data.result / status.result, with no success/error keys (bug ccb5f95f).
59
+ if isinstance(status, dict):
60
+ bare_candidates: list[object] = []
61
+ for holder in (status.get("result"), status.get("data")):
62
+ bare_candidates.append(holder)
63
+ if isinstance(holder, dict):
64
+ bare_candidates.append(holder.get("result"))
65
+ for bare in bare_candidates:
66
+ if (
67
+ isinstance(bare, dict)
68
+ and bare.get("status") == "error"
69
+ and bare.get("code") in _BARE_REFUSAL_CODES
70
+ and isinstance(bare.get("message"), str)
71
+ ):
72
+ bare_data = bare.get("data")
73
+ return {
74
+ "success": False,
75
+ "error": {
76
+ "code": bare["code"],
77
+ "message": bare["message"],
78
+ "data": bare_data if isinstance(bare_data, dict) else {},
79
+ },
80
+ }
81
+
47
82
  # A command-session failure persists the queue terminal status instead of
48
83
  # the ErrorResult. Adapter pre-execution validation failures retain an
49
84
  # unambiguous status discriminator and the original ValidationError message.
@@ -177,6 +212,7 @@ def _relation_violation(lowered: str) -> str:
177
212
  return "value"
178
213
 
179
214
 
215
+ _BARE_REFUSAL_CODES = (-32602, -32601)
180
216
  _UNKNOWN_PARAMETERS_PREFIX = "Invalid parameters: "
181
217
  _NON_VALIDATION_MARKERS = (
182
218
  "timed out",
@@ -166,9 +166,17 @@ class BugProjectCommandsMixin:
166
166
  """List the projects that directly depend on a given project (reverse-dependency lookup)."""
167
167
  return await self._call("project_dependents", params)
168
168
 
169
- async def project_uuid_reserve(self, **params: Any) -> Any:
170
- """Reserve, release, or resolve an external project UUID namespace reservation."""
171
- return await self._call("project_uuid_reserve", params)
169
+ async def project_import(self, **params: Any) -> Any:
170
+ """Import a code-analysis-server project into the registry (the only way a project enters it; idempotent)."""
171
+ return await self._call("project_import", params)
172
+
173
+ async def project_list(self, **params: Any) -> Any:
174
+ """List the imported projects, filtered by imported_by or imported_by_prefix, with owned and referenced counts."""
175
+ return await self._call("project_list", params)
176
+
177
+ async def project_remove(self, **params: Any) -> Any:
178
+ """Remove an imported project from the registry; refused while records own or reference it."""
179
+ return await self._call("project_remove", params)
172
180
 
173
181
  async def project_view(self, **params: Any) -> Any:
174
182
  """Project-centric aggregate view: paginated todos/bugs (plus a comments count) scoped to one project, direct or transitive via bound plans."""
@@ -237,6 +237,14 @@ class ContextGateCommandsMixin:
237
237
  """Purge a batch of already soft-deleted rows of one entity type, reporting per-row removals and reference-blocked refusals."""
238
238
  return await self._call("runtime_purge_batch", params)
239
239
 
240
+ async def garbage_find(self, **params: Any) -> Any:
241
+ """List the lost records (owner, parent or anchor missing from the registry) or the surplus records (test leftovers by creator prefix and age) that garbage_purge would remove (read-only, paginated)."""
242
+ return await self._call("garbage_find", params)
243
+
244
+ async def garbage_purge(self, **params: Any) -> Any:
245
+ """Remove exactly the records garbage_find lists for the same parameters, with their dependants, in one transaction (dry_run=true by default; optional ids narrow the selection)."""
246
+ return await self._call("garbage_purge", params)
247
+
240
248
  async def reference_inspect(self, **params: Any) -> Any:
241
249
  """Inspect the cross-entity reference graph around one entity: which live rows point at it, optionally traversed transitively with cycle detection (read-only, paginated)."""
242
250
  return await self._call("reference_inspect", params)
@@ -247,7 +247,9 @@ COMMAND_NAMES: frozenset[str] = frozenset(
247
247
  "project_dependency_list",
248
248
  "project_dependency_discover",
249
249
  "project_dependents",
250
- "project_uuid_reserve",
250
+ "project_import",
251
+ "project_list",
252
+ "project_remove",
251
253
  "project_view",
252
254
  "command_catalog_dump",
253
255
  "graph_dependents",
@@ -257,6 +259,8 @@ COMMAND_NAMES: frozenset[str] = frozenset(
257
259
  "step_prompt_verify",
258
260
  "audit_list",
259
261
  "runtime_purge_batch",
262
+ "garbage_find",
263
+ "garbage_purge",
260
264
  "reference_inspect",
261
265
  "id_resolve",
262
266
  "reference_repair",
@@ -23,6 +23,8 @@ MUTATING_COMMAND_NAMES: frozenset[str] = frozenset(
23
23
  "plan_project_detach",
24
24
  "plan_project_set_primary",
25
25
  "plan_project_clear_primary",
26
+ "project_import",
27
+ "project_remove",
26
28
  "plan_import",
27
29
  "export_archive",
28
30
  "hrs_import",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plan-manager-client
3
- Version: 0.2.134
3
+ Version: 0.2.136
4
4
  Summary: First-class client library for the plan_manager JSON-RPC API: full command-surface facade plus export delivery module boundary.
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: mcp-proxy-adapter==8.11.3
@@ -0,0 +1,132 @@
1
+ """Test the real dispatch classification of adapter validation errors.
2
+
3
+ Author: Vasiliy Zdanovskiy
4
+ email: vasilyvz@gmail.com
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from plan_manager_client.dispatch import _adapter_validation_error_result
10
+
11
+
12
+ def _failed_status(message: str) -> dict:
13
+ """Build the queue terminal status the adapter persists for a pre-execution failure."""
14
+ return {
15
+ "data": {
16
+ "status": "failed",
17
+ "command_execution": False,
18
+ "job_success": False,
19
+ "error": message,
20
+ }
21
+ }
22
+
23
+
24
+ def _violation(message: str) -> dict:
25
+ result = _adapter_validation_error_result(_failed_status(message))
26
+ assert result is not None, f"message not classified: {message}"
27
+ assert result["error"]["code"] == -32602
28
+ return result["error"]["data"]
29
+
30
+
31
+ def test_wire_hard_recursive_message_is_value() -> None:
32
+ """The exact server wire message for hard=true with recursive=true is a value violation."""
33
+ message = (
34
+ "todo_delete: parameter 'recursive' must be false when hard=true "
35
+ "(recursive marks the referencing list; hard delete expands the list itself), got True"
36
+ )
37
+ data = _violation(message)
38
+ assert data["violation"] == "value"
39
+ assert data["field"] == "recursive"
40
+
41
+
42
+ def test_real_type_message_is_type() -> None:
43
+ """A real server type message stays a type violation."""
44
+ data = _violation("todo_delete: parameter 'hard' must be a boolean, got str")
45
+ assert data["violation"] == "type"
46
+ assert data["field"] == "hard"
47
+ assert data["got"] == "str"
48
+
49
+
50
+ def test_real_enum_message_is_value() -> None:
51
+ """A real server enum message is a value violation."""
52
+ data = _violation("plan_get: parameter 'view' must be one of [summary, full], got invalid")
53
+ assert data["violation"] == "value"
54
+ assert data["field"] == "view"
55
+
56
+
57
+ def test_unknown_parameter_message_is_unknown() -> None:
58
+ """Unknown-parameter message keeps the unknown class."""
59
+ data = _violation("Invalid parameters: bad_param. Allowed parameters: ['plan', 'limit']")
60
+ assert data["violation"] == "unknown"
61
+
62
+
63
+ def _nested_refusal_status(inner: dict | None) -> dict:
64
+ """Queue terminal status of a refused command run as a job (command_execution true).
65
+
66
+ The adapter keeps the command's ErrorResult at status.data.result.result (bug ccb5f95f).
67
+ """
68
+ return {
69
+ "data": {
70
+ "status": "failed",
71
+ "command_execution": True,
72
+ "job_success": False,
73
+ "error": "Invalid parameters: step_id. Allowed parameters: [plan, step]",
74
+ "result": {"job_id": "job-1", "command": "step_runtime_get", "result": inner, "status": "failed"},
75
+ }
76
+ }
77
+
78
+
79
+ def test_nested_job_error_result_is_surfaced() -> None:
80
+ """A -32602 ErrorResult inside status.data.result.result is returned as the server error."""
81
+ inner = {
82
+ "success": False,
83
+ "error": {
84
+ "code": -32602,
85
+ "message": "Invalid parameters: step_id. Allowed parameters: [plan, step]",
86
+ "data": {"invalid_parameters": ["step_id"], "violation": "unknown", "field": "step_id"},
87
+ },
88
+ }
89
+ result = _adapter_validation_error_result(_nested_refusal_status(inner))
90
+ assert result == inner
91
+
92
+
93
+ def test_genuine_session_failure_without_nested_error_is_not_recovered() -> None:
94
+ """A failed job with command_execution true and no nested ErrorResult stays a session failure."""
95
+ assert _adapter_validation_error_result(_nested_refusal_status({"success": True, "data": {}})) is None
96
+ assert _adapter_validation_error_result(_nested_refusal_status(None)) is None
97
+
98
+
99
+ def _bare_status(code: int, message: str, data: dict) -> dict:
100
+ """Recorded shape: status.data.result is a bare error dict, command_execution false."""
101
+ return {
102
+ "success": True,
103
+ "data": {
104
+ "status": "failed",
105
+ "command_execution": False,
106
+ "job_success": False,
107
+ "error": None,
108
+ "description": message,
109
+ "result": {"status": "error", "code": code, "message": message, "data": data},
110
+ },
111
+ }
112
+
113
+
114
+ def test_bare_invalid_parameters_refusal_is_surfaced() -> None:
115
+ """The bare -32602 refusal (no success/error keys, no prefix) returns the server error."""
116
+ data = {"invalid_parameters": ["gs_step_id"], "violation": "unknown"}
117
+ message = "Invalid parameters: gs_step_id. Allowed parameters: ['plan', 'scope']"
118
+ result = _adapter_validation_error_result(_bare_status(-32602, message, data))
119
+ assert result == {"success": False, "error": {"code": -32602, "message": message, "data": data}}
120
+
121
+
122
+ def test_bare_method_not_found_is_surfaced() -> None:
123
+ """The bare -32601 Method not found result returns the server error."""
124
+ result = _adapter_validation_error_result(_bare_status(-32601, "Method not found: matrix_call_move", {}))
125
+ assert result is not None
126
+ assert result["error"]["code"] == -32601
127
+ assert result["error"]["message"] == "Method not found: matrix_call_move"
128
+
129
+
130
+ def test_bare_domain_error_is_not_recovered() -> None:
131
+ """A bare error with another code is not treated as a refusal."""
132
+ assert _adapter_validation_error_result(_bare_status(-32000, "boom", {})) is None
@@ -1,60 +0,0 @@
1
- """Test the real dispatch classification of adapter validation errors.
2
-
3
- Author: Vasiliy Zdanovskiy
4
- email: vasilyvz@gmail.com
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- from plan_manager_client.dispatch import _adapter_validation_error_result
10
-
11
-
12
- def _failed_status(message: str) -> dict:
13
- """Build the queue terminal status the adapter persists for a pre-execution failure."""
14
- return {
15
- "data": {
16
- "status": "failed",
17
- "command_execution": False,
18
- "job_success": False,
19
- "error": message,
20
- }
21
- }
22
-
23
-
24
- def _violation(message: str) -> dict:
25
- result = _adapter_validation_error_result(_failed_status(message))
26
- assert result is not None, f"message not classified: {message}"
27
- assert result["error"]["code"] == -32602
28
- return result["error"]["data"]
29
-
30
-
31
- def test_wire_hard_recursive_message_is_value() -> None:
32
- """The exact server wire message for hard=true with recursive=true is a value violation."""
33
- message = (
34
- "todo_delete: parameter 'recursive' must be false when hard=true "
35
- "(recursive marks the referencing list; hard delete expands the list itself), got True"
36
- )
37
- data = _violation(message)
38
- assert data["violation"] == "value"
39
- assert data["field"] == "recursive"
40
-
41
-
42
- def test_real_type_message_is_type() -> None:
43
- """A real server type message stays a type violation."""
44
- data = _violation("todo_delete: parameter 'hard' must be a boolean, got str")
45
- assert data["violation"] == "type"
46
- assert data["field"] == "hard"
47
- assert data["got"] == "str"
48
-
49
-
50
- def test_real_enum_message_is_value() -> None:
51
- """A real server enum message is a value violation."""
52
- data = _violation("plan_get: parameter 'view' must be one of [summary, full], got invalid")
53
- assert data["violation"] == "value"
54
- assert data["field"] == "view"
55
-
56
-
57
- def test_unknown_parameter_message_is_unknown() -> None:
58
- """Unknown-parameter message keeps the unknown class."""
59
- data = _violation("Invalid parameters: bad_param. Allowed parameters: ['plan', 'limit']")
60
- assert data["violation"] == "unknown"