gitlab-api 27.3.21__tar.gz → 27.3.22__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 (88) hide show
  1. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/PKG-INFO +2 -2
  2. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/gitlab_gql.py +38 -2
  3. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/ontology/certification.json +1 -1
  4. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api.egg-info/PKG-INFO +2 -2
  5. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api.egg-info/SOURCES.txt +1 -0
  6. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api.egg-info/requires.txt +1 -1
  7. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/pyproject.toml +2 -2
  8. gitlab_api-27.3.22/tests/test_graphql_error_category.py +79 -0
  9. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/LICENSE +0 -0
  10. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/README.md +0 -0
  11. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/__init__.py +0 -0
  12. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/__main__.py +0 -0
  13. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/__init__.py +0 -0
  14. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_base.py +0 -0
  15. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_environments.py +0 -0
  16. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_issues.py +0 -0
  17. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_merge_requests.py +0 -0
  18. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_other.py +0 -0
  19. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_pipelines.py +0 -0
  20. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_projects.py +0 -0
  21. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_repositories.py +0 -0
  22. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_system.py +0 -0
  23. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_users_groups.py +0 -0
  24. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api/api_client_vulnerabilities.py +0 -0
  25. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/api_client.py +0 -0
  26. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/auth.py +0 -0
  27. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/connector_contracts.py +0 -0
  28. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/connector_prep.py +0 -0
  29. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/connector_sources.py +0 -0
  30. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/gitlab_input_models.py +0 -0
  31. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/gitlab_response_models.py +0 -0
  32. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/instances.py +0 -0
  33. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/kg_ingest.py +0 -0
  34. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/mcp_config.json +0 -0
  35. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/mcp_server.py +0 -0
  36. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/ontology/__init__.py +0 -0
  37. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/ontology/access_contracts.ttl +0 -0
  38. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/ontology/fixtures/records.json +0 -0
  39. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/ontology/gitlab.ttl +0 -0
  40. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/ontology/mappings/source.yaml +0 -0
  41. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/ontology/migrations/manifest.json +0 -0
  42. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/ontology/shapes/connector.shacl.ttl +0 -0
  43. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/prompts/gitlab-mcp-operator.json +0 -0
  44. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/prompts/gitlab-mcp-project-administrator.json +0 -0
  45. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/prompts/gitlab-mcp-release-manager.json +0 -0
  46. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/prompts/gitlab-mcp-triage-lead.json +0 -0
  47. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-api-development/SKILL.md +0 -0
  48. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-api-operations/SKILL.md +0 -0
  49. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-issues/SKILL.md +0 -0
  50. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-merge-request-create/SKILL.md +0 -0
  51. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-merge-request-review/SKILL.md +0 -0
  52. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-pipelines/SKILL.md +0 -0
  53. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-vulnerabilities/SKILL.md +0 -0
  54. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api.egg-info/dependency_links.txt +0 -0
  55. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api.egg-info/entry_points.txt +0 -0
  56. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/gitlab_api.egg-info/top_level.txt +0 -0
  57. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/scripts/check_import_safety.py +0 -0
  58. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/scripts/security_contract.py +0 -0
  59. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/setup.cfg +0 -0
  60. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/__init__.py +0 -0
  61. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/conftest.py +0 -0
  62. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_access_contracts.py +0 -0
  63. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_api_wrapper.py +0 -0
  64. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_auth.py +0 -0
  65. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_catalog_edges.py +0 -0
  66. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_connector_prep.py +0 -0
  67. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_cq_paths.py +0 -0
  68. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_fleet_name.py +0 -0
  69. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_gitlab_a2a_validation.py +0 -0
  70. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_gitlab_api_brute_force_coverage.py +0 -0
  71. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_gitlab_api_development_skill.py +0 -0
  72. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_gitlab_gql.py +0 -0
  73. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_gitlab_mcp_validation.py +0 -0
  74. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_gitlab_models.py +0 -0
  75. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_identity_context_scoping.py +0 -0
  76. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_ingest_sources.py +0 -0
  77. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_init_dynamics.py +0 -0
  78. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_instances.py +0 -0
  79. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_kg_ingest.py +0 -0
  80. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_mock_coverage.py +0 -0
  81. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_ontology_parent_link.py +0 -0
  82. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_paged_models_have_paging_fields.py +0 -0
  83. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_pages_workflow.py +0 -0
  84. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_response_models_hide_secrets.py +0 -0
  85. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_startup.py +0 -0
  86. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_tool_modes.py +0 -0
  87. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/test_verify_agent.py +0 -0
  88. {gitlab_api-27.3.21 → gitlab_api-27.3.22}/tests/verify_a2a_queries.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitlab-api
3
- Version: 27.3.21
3
+ Version: 27.3.22
4
4
  Summary: GitLab API + MCP Server
5
5
  Author-email: Repository Maintainers <maintainers@knuckles.team>
6
6
  License: MIT
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.12
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: scion-sdk[graphql,mcp]>=0.9.0
15
+ Requires-Dist: scion-sdk[graphql,mcp]>=0.10.1
16
16
  Requires-Dist: python-dotenv>=1.2.4
17
17
  Provides-Extra: mcp
18
18
  Provides-Extra: all
@@ -12,7 +12,11 @@ from scion_sdk.exceptions import (
12
12
  )
13
13
  from scion_sdk.tls.profile import ResolvedTLSProfile
14
14
  from scion_sdk.tls.resolve import resolve_tls_profile
15
- from scion_sdk.transports.graphql import GraphQLAuth, GraphQLClient
15
+ from scion_sdk.transports.graphql import (
16
+ GraphQLAuth,
17
+ GraphQLClient,
18
+ GraphQLExecutionError,
19
+ )
16
20
 
17
21
  from gitlab_api.api.api_client_base import request_timeout
18
22
  from gitlab_api.gitlab_input_models import (
@@ -35,6 +39,34 @@ from gitlab_api.gitlab_input_models import (
35
39
  )
36
40
 
37
41
 
42
+ def classify_gitlab_errors(entries: list[dict[str, Any]]) -> str:
43
+ """Map GitLab's stable query-error answers to one closed category.
44
+
45
+ Pure: reads the entries' text only to choose a category and returns
46
+ the category alone, so no GitLab text reaches the caller.
47
+ """
48
+ text = " ".join(str(entry.get("message", "")) for entry in entries).lower()
49
+ if "does not exist" in text or "not found" in text:
50
+ return "not_found"
51
+ if "permission" in text or "forbidden" in text:
52
+ return "forbidden"
53
+ if "invalid" in text or "argument" in text or "variable" in text:
54
+ return "invalid_input"
55
+ return "unknown"
56
+
57
+
58
+ def _mutation_errors_failure() -> GraphQLExecutionError:
59
+ """The typed failure for a mutation that answers its own ``errors`` list."""
60
+ from gql.transport.exceptions import TransportQueryError
61
+
62
+ return GraphQLExecutionError(
63
+ TransportQueryError(
64
+ "mutation errors",
65
+ errors=[{"extensions": {"code": "BAD_USER_INPUT"}}],
66
+ )
67
+ )
68
+
69
+
38
70
  @dataclass
39
71
  class ProjectListFilters:
40
72
  """Optional filters for a `projects` GraphQL list query."""
@@ -127,6 +159,7 @@ class GraphQL:
127
159
  tls_service="gitlab",
128
160
  timeout=request_timeout(),
129
161
  fetch_schema=True,
162
+ error_classifier=classify_gitlab_errors,
130
163
  )
131
164
 
132
165
  @require_auth
@@ -1248,7 +1281,10 @@ class GraphQL:
1248
1281
  variables["input"] = {
1249
1282
  k: v for k, v in variables["input"].items() if v is not None
1250
1283
  }
1251
- return self.execute_gql(query, variables=variables)
1284
+ result = self.execute_gql(query, variables=variables)
1285
+ if (result.get("mergeRequestUpdate") or {}).get("errors"):
1286
+ raise _mutation_errors_failure()
1287
+ return result
1252
1288
 
1253
1289
  @require_auth
1254
1290
  def delete_merge_request(
@@ -29,5 +29,5 @@
29
29
  "signer": "UNSIGNED-PREVIEW",
30
30
  "signing_public_key": "",
31
31
  "status": "source-validated",
32
- "validated_at": "2026-11-07T21:08:40Z"
32
+ "validated_at": "2026-11-08T00:16:55Z"
33
33
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitlab-api
3
- Version: 27.3.21
3
+ Version: 27.3.22
4
4
  Summary: GitLab API + MCP Server
5
5
  Author-email: Repository Maintainers <maintainers@knuckles.team>
6
6
  License: MIT
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.12
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: scion-sdk[graphql,mcp]>=0.9.0
15
+ Requires-Dist: scion-sdk[graphql,mcp]>=0.10.1
16
16
  Requires-Dist: python-dotenv>=1.2.4
17
17
  Provides-Extra: mcp
18
18
  Provides-Extra: all
@@ -69,6 +69,7 @@ tests/test_gitlab_api_development_skill.py
69
69
  tests/test_gitlab_gql.py
70
70
  tests/test_gitlab_mcp_validation.py
71
71
  tests/test_gitlab_models.py
72
+ tests/test_graphql_error_category.py
72
73
  tests/test_identity_context_scoping.py
73
74
  tests/test_ingest_sources.py
74
75
  tests/test_init_dynamics.py
@@ -1,4 +1,4 @@
1
- scion-sdk[graphql,mcp]>=0.9.0
1
+ scion-sdk[graphql,mcp]>=0.10.1
2
2
  python-dotenv>=1.2.4
3
3
 
4
4
  [all]
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gitlab-api"
7
- version = "27.3.21"
7
+ version = "27.3.22"
8
8
  description = "GitLab API + MCP Server"
9
9
  readme = "README.md"
10
10
  classifiers = [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Environment :: Console", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3",]
11
11
  requires-python = ">=3.12"
12
- dependencies = [ "scion-sdk[graphql,mcp]>=0.9.0", "python-dotenv>=1.2.4",]
12
+ dependencies = [ "scion-sdk[graphql,mcp]>=0.10.1", "python-dotenv>=1.2.4",]
13
13
  [[project.authors]]
14
14
  name = "Repository Maintainers"
15
15
  email = "maintainers@knuckles.team"
@@ -0,0 +1,79 @@
1
+ """GraphQL failures reach the caller as typed errors, without server text."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import pytest
8
+ from gql.transport.exceptions import TransportQueryError
9
+ from scion_sdk.transports.graphql import GraphQLExecutionError
10
+
11
+ from gitlab_api.gitlab_gql import GraphQL
12
+
13
+ _FIXTURE_AUTH = "-".join(["not", "a", "real", "credential"])
14
+ _SERVER_TEXT = "private-gitlab-text for group/secret-project"
15
+
16
+
17
+ class _Fake:
18
+ def __init__(self, outcome: Exception | dict[str, Any]) -> None:
19
+ self.outcome = outcome
20
+
21
+ def execute(self, *args: object, **kwargs: object) -> dict[str, Any]:
22
+ if isinstance(self.outcome, Exception):
23
+ raise self.outcome
24
+ return self.outcome
25
+
26
+
27
+ def _graphql(outcome: Exception | dict[str, Any]) -> GraphQL:
28
+ api = GraphQL(url="https://gitlab.example.invalid", token=_FIXTURE_AUTH)
29
+ api.client._client = _Fake(outcome)
30
+ api.client.max_retries = 0
31
+ return api
32
+
33
+
34
+ def _update(api: GraphQL) -> dict[str, Any]:
35
+ return api.update_merge_request("group/project", 999, title="new title")
36
+
37
+
38
+ @pytest.mark.spec("CONN-GITLAB-API-R006.1")
39
+ @pytest.mark.parametrize(
40
+ ("message", "category"),
41
+ [
42
+ (
43
+ "The resource that you are attempting to access does not exist "
44
+ f"or you don't have permission to perform this action {_SERVER_TEXT}",
45
+ "not_found",
46
+ ),
47
+ (f"You are forbidden to do that {_SERVER_TEXT}", "forbidden"),
48
+ (f"Variable $input of type is invalid {_SERVER_TEXT}", "invalid_input"),
49
+ (f"something else {_SERVER_TEXT}", "unknown"),
50
+ ],
51
+ )
52
+ def test_missing_merge_request_update_is_not_found_without_server_text(
53
+ message: str, category: str
54
+ ) -> None:
55
+ api = _graphql(TransportQueryError(message, errors=[{"message": message}]))
56
+ with pytest.raises(GraphQLExecutionError) as caught:
57
+ _update(api)
58
+ error = caught.value
59
+ assert error.category == category
60
+ assert str(error) == f"Query execution failed: TransportQueryError ({category})"
61
+ assert error.payload()["retryable"] is False
62
+ assert _SERVER_TEXT not in str(error.payload()) + str(error)
63
+
64
+
65
+ @pytest.mark.spec("CONN-GITLAB-API-R006.1")
66
+ def test_mutation_errors_list_raises_invalid_input() -> None:
67
+ api = _graphql(
68
+ {"mergeRequestUpdate": {"mergeRequest": None, "errors": [_SERVER_TEXT]}}
69
+ )
70
+ with pytest.raises(GraphQLExecutionError) as caught:
71
+ _update(api)
72
+ assert caught.value.category == "invalid_input"
73
+ assert _SERVER_TEXT not in str(caught.value.payload())
74
+
75
+
76
+ @pytest.mark.spec("CONN-GITLAB-API-R006.1")
77
+ def test_successful_update_returns_the_payload() -> None:
78
+ ok = {"mergeRequestUpdate": {"mergeRequest": {"iid": "1"}, "errors": []}}
79
+ assert _update(_graphql(ok)) == ok
File without changes
File without changes
File without changes