xai-review 0.31.0__py3-none-any.whl → 0.32.0__py3-none-any.whl
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.
Potentially problematic release.
This version of xai-review might be problematic. Click here for more details.
- ai_review/clients/gitea/pr/schema/comments.py +0 -2
- ai_review/services/vcs/gitea/client.py +25 -34
- ai_review/tests/fixtures/clients/gitea.py +0 -2
- ai_review/tests/suites/services/vcs/gitea/test_client.py +11 -10
- {xai_review-0.31.0.dist-info → xai_review-0.32.0.dist-info}/METADATA +2 -2
- {xai_review-0.31.0.dist-info → xai_review-0.32.0.dist-info}/RECORD +10 -10
- {xai_review-0.31.0.dist-info → xai_review-0.32.0.dist-info}/WHEEL +0 -0
- {xai_review-0.31.0.dist-info → xai_review-0.32.0.dist-info}/entry_points.txt +0 -0
- {xai_review-0.31.0.dist-info → xai_review-0.32.0.dist-info}/licenses/LICENSE +0 -0
- {xai_review-0.31.0.dist-info → xai_review-0.32.0.dist-info}/top_level.txt +0 -0
|
@@ -28,8 +28,6 @@ class GiteaGetPRCommentsResponseSchema(RootModel[list[GiteaPRCommentSchema]]):
|
|
|
28
28
|
|
|
29
29
|
class GiteaCreateCommentRequestSchema(BaseModel):
|
|
30
30
|
body: str
|
|
31
|
-
path: str | None = None
|
|
32
|
-
line: int | None = None
|
|
33
31
|
|
|
34
32
|
|
|
35
33
|
class GiteaCreateCommentResponseSchema(BaseModel):
|
|
@@ -2,7 +2,10 @@ from ai_review.clients.gitea.client import get_gitea_http_client
|
|
|
2
2
|
from ai_review.clients.gitea.pr.schema.comments import GiteaCreateCommentRequestSchema
|
|
3
3
|
from ai_review.config import settings
|
|
4
4
|
from ai_review.libs.logger import get_logger
|
|
5
|
-
from ai_review.services.vcs.gitea.adapter import
|
|
5
|
+
from ai_review.services.vcs.gitea.adapter import (
|
|
6
|
+
get_user_from_gitea_user,
|
|
7
|
+
get_review_comment_from_gitea_comment,
|
|
8
|
+
)
|
|
6
9
|
from ai_review.services.vcs.types import (
|
|
7
10
|
VCSClientProtocol,
|
|
8
11
|
ThreadKind,
|
|
@@ -67,12 +70,13 @@ class GiteaVCSClient(VCSClientProtocol):
|
|
|
67
70
|
return []
|
|
68
71
|
|
|
69
72
|
async def get_inline_comments(self) -> list[ReviewCommentSchema]:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
comments = await self.get_general_comments()
|
|
74
|
+
if comments:
|
|
75
|
+
logger.warning(
|
|
76
|
+
f"Gitea API does not support inline comments — "
|
|
77
|
+
f"returning {len(comments)} general comments as fallback inline comments"
|
|
78
|
+
)
|
|
79
|
+
return comments
|
|
76
80
|
|
|
77
81
|
async def create_general_comment(self, message: str) -> None:
|
|
78
82
|
try:
|
|
@@ -90,25 +94,15 @@ class GiteaVCSClient(VCSClientProtocol):
|
|
|
90
94
|
raise
|
|
91
95
|
|
|
92
96
|
async def create_inline_comment(self, file: str, line: int, message: str) -> None:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
100
|
-
await self.http_client.pr.create_comment(
|
|
101
|
-
owner=self.owner,
|
|
102
|
-
repo=self.repo,
|
|
103
|
-
pull_number=self.pull_number,
|
|
104
|
-
request=request,
|
|
105
|
-
)
|
|
106
|
-
logger.info(f"Created inline comment in {self.pull_request_ref} at {file}:{line}")
|
|
107
|
-
except Exception as error:
|
|
108
|
-
logger.exception(f"Failed to create inline comment in {self.pull_request_ref} at {file}:{line}: {error}")
|
|
109
|
-
raise
|
|
97
|
+
fallback_message = f"[{file}:{line}] {message}"
|
|
98
|
+
logger.warning(
|
|
99
|
+
f"Gitea does not support inline comments. "
|
|
100
|
+
f"Falling back to general comment: {fallback_message}"
|
|
101
|
+
)
|
|
102
|
+
await self.create_general_comment(fallback_message)
|
|
110
103
|
|
|
111
104
|
async def create_inline_reply(self, thread_id: int | str, message: str) -> None:
|
|
105
|
+
logger.warning("Gitea does not support threaded replies — posting new general comment instead")
|
|
112
106
|
await self.create_general_comment(message)
|
|
113
107
|
|
|
114
108
|
async def create_summary_reply(self, thread_id: int | str, message: str) -> None:
|
|
@@ -118,17 +112,15 @@ class GiteaVCSClient(VCSClientProtocol):
|
|
|
118
112
|
async def get_inline_threads(self) -> list[ReviewThreadSchema]:
|
|
119
113
|
try:
|
|
120
114
|
comments = await self.get_inline_comments()
|
|
121
|
-
threads = {comment.thread_id: [comment] for comment in comments}
|
|
122
|
-
|
|
123
115
|
return [
|
|
124
116
|
ReviewThreadSchema(
|
|
125
|
-
id=thread_id,
|
|
117
|
+
id=comment.thread_id,
|
|
126
118
|
kind=ThreadKind.INLINE,
|
|
127
|
-
file=
|
|
128
|
-
line=
|
|
129
|
-
comments=
|
|
119
|
+
file=comment.file,
|
|
120
|
+
line=comment.line,
|
|
121
|
+
comments=[comment],
|
|
130
122
|
)
|
|
131
|
-
for
|
|
123
|
+
for comment in comments
|
|
132
124
|
]
|
|
133
125
|
except Exception as error:
|
|
134
126
|
logger.exception(f"Failed to build inline threads for {self.pull_request_ref}: {error}")
|
|
@@ -137,15 +129,14 @@ class GiteaVCSClient(VCSClientProtocol):
|
|
|
137
129
|
async def get_general_threads(self) -> list[ReviewThreadSchema]:
|
|
138
130
|
try:
|
|
139
131
|
comments = await self.get_general_comments()
|
|
140
|
-
|
|
132
|
+
return [
|
|
141
133
|
ReviewThreadSchema(
|
|
142
134
|
id=comment.thread_id,
|
|
143
135
|
kind=ThreadKind.SUMMARY,
|
|
144
|
-
comments=[comment]
|
|
136
|
+
comments=[comment],
|
|
145
137
|
)
|
|
146
138
|
for comment in comments
|
|
147
139
|
]
|
|
148
|
-
return threads
|
|
149
140
|
except Exception as error:
|
|
150
141
|
logger.exception(f"Failed to build general threads for {self.pull_request_ref}: {error}")
|
|
151
142
|
return []
|
|
@@ -45,13 +45,11 @@ class FakeGiteaPullRequestsHTTPClient(GiteaPullRequestsHTTPClientProtocol):
|
|
|
45
45
|
return GiteaGetPRFilesResponseSchema(
|
|
46
46
|
root=[
|
|
47
47
|
GiteaPRFileSchema(
|
|
48
|
-
sha="abc",
|
|
49
48
|
status="modified",
|
|
50
49
|
filename="src/main.py",
|
|
51
50
|
patch="@@ -1,2 +1,2 @@\n- old\n+ new",
|
|
52
51
|
),
|
|
53
52
|
GiteaPRFileSchema(
|
|
54
|
-
sha="def",
|
|
55
53
|
status="added",
|
|
56
54
|
filename="utils/helper.py",
|
|
57
55
|
patch="+ print('Hello')",
|
|
@@ -29,19 +29,20 @@ async def test_get_general_comments_returns_list(
|
|
|
29
29
|
fake_gitea_pull_requests_http_client: FakeGiteaPullRequestsHTTPClient,
|
|
30
30
|
):
|
|
31
31
|
comments = await gitea_vcs_client.get_general_comments()
|
|
32
|
-
assert all(isinstance(
|
|
32
|
+
assert all(isinstance(comment, ReviewCommentSchema) for comment in comments)
|
|
33
33
|
assert len(comments) > 0
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
@pytest.mark.asyncio
|
|
37
37
|
@pytest.mark.usefixtures("gitea_http_client_config")
|
|
38
|
-
async def
|
|
38
|
+
async def test_get_inline_comments_returns_fallback_general_comments(
|
|
39
39
|
gitea_vcs_client: GiteaVCSClient,
|
|
40
40
|
fake_gitea_pull_requests_http_client: FakeGiteaPullRequestsHTTPClient,
|
|
41
41
|
):
|
|
42
42
|
comments = await gitea_vcs_client.get_inline_comments()
|
|
43
|
-
assert
|
|
44
|
-
assert all(isinstance(
|
|
43
|
+
assert isinstance(comments, list)
|
|
44
|
+
assert all(isinstance(comment, ReviewCommentSchema) for comment in comments)
|
|
45
|
+
assert len(comments) > 0
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
@pytest.mark.asyncio
|
|
@@ -57,11 +58,11 @@ async def test_create_general_comment_posts_comment(
|
|
|
57
58
|
|
|
58
59
|
@pytest.mark.asyncio
|
|
59
60
|
@pytest.mark.usefixtures("gitea_http_client_config")
|
|
60
|
-
async def
|
|
61
|
+
async def test_create_inline_comment_falls_back_to_general_comment(
|
|
61
62
|
gitea_vcs_client: GiteaVCSClient,
|
|
62
63
|
fake_gitea_pull_requests_http_client: FakeGiteaPullRequestsHTTPClient,
|
|
63
64
|
):
|
|
64
|
-
await gitea_vcs_client.create_inline_comment("src/main.py", 10, "Inline comment")
|
|
65
|
+
await gitea_vcs_client.create_inline_comment(file="src/main.py", line=10, message="Inline comment")
|
|
65
66
|
calls = [name for name, _ in fake_gitea_pull_requests_http_client.calls]
|
|
66
67
|
assert "create_comment" in calls
|
|
67
68
|
|
|
@@ -72,8 +73,8 @@ async def test_get_inline_threads_groups_by_comment(
|
|
|
72
73
|
gitea_vcs_client: GiteaVCSClient,
|
|
73
74
|
):
|
|
74
75
|
threads = await gitea_vcs_client.get_inline_threads()
|
|
75
|
-
assert all(isinstance(
|
|
76
|
-
assert all(
|
|
76
|
+
assert all(isinstance(thread, ReviewThreadSchema) for thread in threads)
|
|
77
|
+
assert all(thread.kind == ThreadKind.INLINE for thread in threads)
|
|
77
78
|
|
|
78
79
|
|
|
79
80
|
@pytest.mark.asyncio
|
|
@@ -82,5 +83,5 @@ async def test_get_general_threads_wraps_comments(
|
|
|
82
83
|
gitea_vcs_client: GiteaVCSClient,
|
|
83
84
|
):
|
|
84
85
|
threads = await gitea_vcs_client.get_general_threads()
|
|
85
|
-
assert all(isinstance(
|
|
86
|
-
assert all(
|
|
86
|
+
assert all(isinstance(thread, ReviewThreadSchema) for thread in threads)
|
|
87
|
+
assert all(thread.kind == ThreadKind.SUMMARY for thread in threads)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xai-review
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.32.0
|
|
4
4
|
Summary: AI-powered code review tool
|
|
5
5
|
Author-email: Nikita Filonov <nikita.filonov@example.com>
|
|
6
6
|
Maintainer-email: Nikita Filonov <nikita.filonov@example.com>
|
|
@@ -220,7 +220,7 @@ jobs:
|
|
|
220
220
|
with:
|
|
221
221
|
fetch-depth: 0
|
|
222
222
|
|
|
223
|
-
- uses: Nikita-Filonov/ai-review@v0.
|
|
223
|
+
- uses: Nikita-Filonov/ai-review@v0.32.0
|
|
224
224
|
with:
|
|
225
225
|
review-command: ${{ inputs.review-command }}
|
|
226
226
|
env:
|
|
@@ -36,7 +36,7 @@ ai_review/clients/gitea/pr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
36
36
|
ai_review/clients/gitea/pr/client.py,sha256=eFAZai2zinr7ZGscVHa0cZIaYJJucNcLb08f73cKo-o,4945
|
|
37
37
|
ai_review/clients/gitea/pr/types.py,sha256=hy4win_nDvnEi_aHAbysmHtymHDq-zIATYKSEbpDcYY,984
|
|
38
38
|
ai_review/clients/gitea/pr/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
ai_review/clients/gitea/pr/schema/comments.py,sha256=
|
|
39
|
+
ai_review/clients/gitea/pr/schema/comments.py,sha256=Xf07Z3PwuWiL9-xQtJ5QIrrorAwOyveD8yaaGAAIJiQ,866
|
|
40
40
|
ai_review/clients/gitea/pr/schema/files.py,sha256=O4c4Z3R775OuGOJgf5baMH5ivzHCVsSBFaPXEgVmKs0,341
|
|
41
41
|
ai_review/clients/gitea/pr/schema/pull_request.py,sha256=lT4r-Am5MmFQqB5WnQ0OWw6cB3e-NlBAi08Jw1fmAE8,361
|
|
42
42
|
ai_review/clients/gitea/pr/schema/user.py,sha256=5YIys_MFFm612hKMMQdjwlsH-FG_bS-vSQsPbBueEPU,94
|
|
@@ -215,7 +215,7 @@ ai_review/services/vcs/bitbucket/adapter.py,sha256=b-8KT46C8WT-Sos-gUGFJsxIWY7mX
|
|
|
215
215
|
ai_review/services/vcs/bitbucket/client.py,sha256=MhqkFDewutX7DFBCFBDhDopFznwf92dAdZsxy_oS_mc,10726
|
|
216
216
|
ai_review/services/vcs/gitea/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
217
217
|
ai_review/services/vcs/gitea/adapter.py,sha256=DxzcXReKTGHkw4DCJa8X3Mnczcg9hqx6sIAQYY-8HAI,784
|
|
218
|
-
ai_review/services/vcs/gitea/client.py,sha256=
|
|
218
|
+
ai_review/services/vcs/gitea/client.py,sha256=A2qpuk5kiPyeaPt-hYv0PcC_VlshMHhycED2nmB9bOE,5776
|
|
219
219
|
ai_review/services/vcs/github/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
220
220
|
ai_review/services/vcs/github/adapter.py,sha256=pxcbSLEXkOg1c1NtzB0hkZJVvyC4An9pCzNK5sPJKbA,1212
|
|
221
221
|
ai_review/services/vcs/github/client.py,sha256=rSVvpyovT1wDLq0fIQPe5UJqmgIgIFh2P-CPqIQ_sf0,9371
|
|
@@ -228,7 +228,7 @@ ai_review/tests/fixtures/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
228
228
|
ai_review/tests/fixtures/clients/bitbucket.py,sha256=K4Ez_hTOVKz5-KlXbgTOVDec6iewxkm8hqDJvebhnpE,7124
|
|
229
229
|
ai_review/tests/fixtures/clients/claude.py,sha256=6ldJlSSea0zsZV0hRDMi9mqWm0hWT3mp_ROwG_sVU1c,2203
|
|
230
230
|
ai_review/tests/fixtures/clients/gemini.py,sha256=zhLJhm49keKEBCPOf_pLu8_zCatsKKAWM4-gXOhaXeM,2429
|
|
231
|
-
ai_review/tests/fixtures/clients/gitea.py,sha256=
|
|
231
|
+
ai_review/tests/fixtures/clients/gitea.py,sha256=WQLbOyFTqqtVQGHuLFgk9qANYS03eeCdY6dtN3a7fIE,4965
|
|
232
232
|
ai_review/tests/fixtures/clients/github.py,sha256=kC1L-nWZMn9O_uRfuT_B8R4sn8FRvISlBJMkRKaioS0,7814
|
|
233
233
|
ai_review/tests/fixtures/clients/gitlab.py,sha256=AD6NJOJSw76hjAEiWewQ6Vu5g-cfQn0GTtdchuDBH9o,8042
|
|
234
234
|
ai_review/tests/fixtures/clients/ollama.py,sha256=UUHDDPUraQAG8gBC-0UvftaK0BDYir5cJDlRKJymSQg,2109
|
|
@@ -366,16 +366,16 @@ ai_review/tests/suites/services/vcs/bitbucket/test_adapter.py,sha256=zOjAOxtSSN0
|
|
|
366
366
|
ai_review/tests/suites/services/vcs/bitbucket/test_client.py,sha256=oIlUdUBPgO2bfNyAsodUsAU7kRnETQVqmRJimRtEfBU,7846
|
|
367
367
|
ai_review/tests/suites/services/vcs/gitea/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
368
368
|
ai_review/tests/suites/services/vcs/gitea/test_adapter.py,sha256=7UPsbDQhn99obPZZ2fKnLE3_h9uoY_ujMD0WbHGAegY,1782
|
|
369
|
-
ai_review/tests/suites/services/vcs/gitea/test_client.py,sha256=
|
|
369
|
+
ai_review/tests/suites/services/vcs/gitea/test_client.py,sha256=bUrc7QpqIgyehzYW4Yr5ewzNRzGAfvX2DQmx01GdYYo,3449
|
|
370
370
|
ai_review/tests/suites/services/vcs/github/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
371
371
|
ai_review/tests/suites/services/vcs/github/test_adapter.py,sha256=bK4k532v_8kDiud5RI9OlGetWMiLP8NaW1vEfHvcHfQ,4893
|
|
372
372
|
ai_review/tests/suites/services/vcs/github/test_client.py,sha256=mNt1bA6aVU3REsJiU_tK1PokQxQTaCKun0tNBHuvIp8,8039
|
|
373
373
|
ai_review/tests/suites/services/vcs/gitlab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
374
374
|
ai_review/tests/suites/services/vcs/gitlab/test_adapter.py,sha256=BYBP2g1AKF_jCSJYJj16pW7M_6PprwD9reYEpdw3StU,4340
|
|
375
375
|
ai_review/tests/suites/services/vcs/gitlab/test_client.py,sha256=dnI-YxYADmVF2GS9rp6-JPkcqsn4sN8Fjbe4MkeYMaE,8476
|
|
376
|
-
xai_review-0.
|
|
377
|
-
xai_review-0.
|
|
378
|
-
xai_review-0.
|
|
379
|
-
xai_review-0.
|
|
380
|
-
xai_review-0.
|
|
381
|
-
xai_review-0.
|
|
376
|
+
xai_review-0.32.0.dist-info/licenses/LICENSE,sha256=p-v8m7Kmz4KKc7PcvsGiGEmCw9AiSXY4_ylOPy_u--Y,11343
|
|
377
|
+
xai_review-0.32.0.dist-info/METADATA,sha256=zRXQ50EMX8ekmcWLN4F5E5jnNxVS-62t9zbiY9FqKus,12689
|
|
378
|
+
xai_review-0.32.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
379
|
+
xai_review-0.32.0.dist-info/entry_points.txt,sha256=JyC5URanMi5io5P_PXQf7H_I1OGIpk5cZQhaPQ0g4Zs,53
|
|
380
|
+
xai_review-0.32.0.dist-info/top_level.txt,sha256=sTsZbfzLoqvRZKdKa-BcxWvjlHdrpbeJ6DrGY0EuR0E,10
|
|
381
|
+
xai_review-0.32.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|