Skip to content

Commit aa718a5

Browse files
committed
fix: remove result bool in Success response object since it's useless, remove sensitive data from the Success Response object, make the integration unit test compatible
1 parent a234adc commit aa718a5

File tree

4 files changed

+10
-44
lines changed

4 files changed

+10
-44
lines changed

src/server/models.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from enum import Enum
6-
from typing import Literal, Union
6+
from typing import Union
77

88
from pydantic import BaseModel, Field, field_validator
99

@@ -63,8 +63,6 @@ class IngestSuccessResponse(BaseModel):
6363
6464
Attributes
6565
----------
66-
result : Literal[True]
67-
Always True for successful responses.
6866
repo_url : str
6967
The original repository URL that was processed.
7068
short_repo_url : str
@@ -81,12 +79,9 @@ class IngestSuccessResponse(BaseModel):
8179
The pattern type used for filtering.
8280
pattern : str
8381
The pattern used for filtering.
84-
token : str | None
85-
The token used (if any).
8682
8783
"""
8884

89-
result: Literal[True] = True
9085
repo_url: str = Field(..., description="Original repository URL")
9186
short_repo_url: str = Field(..., description="Short repository URL (user/repo)")
9287
summary: str = Field(..., description="Ingestion summary with token estimates")
@@ -95,7 +90,6 @@ class IngestSuccessResponse(BaseModel):
9590
default_file_size: int = Field(..., description="File size slider position used")
9691
pattern_type: str = Field(..., description="Pattern type used")
9792
pattern: str = Field(..., description="Pattern used")
98-
token: str | None = Field(None, description="Token used (if any)")
9993

10094

10195
class IngestErrorResponse(BaseModel):
@@ -107,23 +101,11 @@ class IngestErrorResponse(BaseModel):
107101
Error message describing what went wrong.
108102
repo_url : str
109103
The repository URL that failed to process.
110-
default_file_size : int
111-
The file size slider position that was used.
112-
pattern_type : str
113-
The pattern type that was used.
114-
pattern : str
115-
The pattern that was used.
116-
token : str | None
117-
The token that was used (if any).
118104
119105
"""
120106

121107
error: str = Field(..., description="Error message")
122108
repo_url: str = Field(..., description="Repository URL that failed")
123-
default_file_size: int = Field(..., description="File size slider position used")
124-
pattern_type: str = Field(..., description="Pattern type used")
125-
pattern: str = Field(..., description="Pattern used")
126-
token: str | None = Field(None, description="Token used (if any)")
127109

128110

129111
# Union type for API responses

src/server/query_processor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ async def process_query(
134134

135135
context.update(
136136
{
137-
"result": True,
138137
"summary": summary,
139138
"tree": tree,
140139
"content": content,

src/server/routers/ingest.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ async def api_ingest(
7777
error_response = IngestErrorResponse(
7878
error=context["error"],
7979
repo_url=context.get("repo_url", input_text),
80-
default_file_size=context.get("default_file_size", max_file_size),
81-
pattern_type=context.get("pattern_type", pattern_type),
82-
pattern=context.get("pattern", pattern),
83-
token=token,
8480
)
8581
return JSONResponse(
8682
status_code=status.HTTP_400_BAD_REQUEST,
@@ -89,7 +85,6 @@ async def api_ingest(
8985

9086
# Return structured success response with 200 status code
9187
success_response = IngestSuccessResponse(
92-
result=True,
9388
repo_url=context["repo_url"],
9489
short_repo_url=context["short_repo_url"],
9590
summary=context["summary"],
@@ -98,7 +93,6 @@ async def api_ingest(
9893
default_file_size=context["default_file_size"],
9994
pattern_type=context["pattern_type"],
10095
pattern=context["pattern"],
101-
token=context.get("token"),
10296
)
10397
return JSONResponse(
10498
status_code=status.HTTP_200_OK,
@@ -110,10 +104,6 @@ async def api_ingest(
110104
error_response = IngestErrorResponse(
111105
error=f"Validation error: {ve!s}",
112106
repo_url=input_text,
113-
default_file_size=max_file_size,
114-
pattern_type=pattern_type,
115-
pattern=pattern,
116-
token=token,
117107
)
118108
return JSONResponse(
119109
status_code=status.HTTP_400_BAD_REQUEST,
@@ -125,10 +115,6 @@ async def api_ingest(
125115
error_response = IngestErrorResponse(
126116
error=f"Internal server error: {exc!s}",
127117
repo_url=input_text,
128-
default_file_size=max_file_size,
129-
pattern_type=pattern_type,
130-
pattern=pattern,
131-
token=token,
132118
)
133119
return JSONResponse(
134120
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,

tests/test_flow_integration.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ async def test_remote_repository_analysis(request: pytest.FixtureRequest) -> Non
6161

6262
# Check that response is JSON
6363
response_data = response.json()
64-
assert "result" in response_data
65-
assert response_data["result"]
64+
assert "content" in response_data
65+
assert response_data["content"]
6666
assert "repo_url" in response_data
6767
assert "summary" in response_data
6868
assert "tree" in response_data
@@ -110,8 +110,8 @@ async def test_large_repository(request: pytest.FixtureRequest) -> None:
110110

111111
response_data = response.json()
112112
if response.status_code == status.HTTP_200_OK:
113-
assert "result" in response_data
114-
assert response_data["result"]
113+
assert "content" in response_data
114+
assert response_data["content"]
115115
else:
116116
assert "error" in response_data
117117

@@ -135,8 +135,8 @@ def make_request() -> None:
135135

136136
response_data = response.json()
137137
if response.status_code == status.HTTP_200_OK:
138-
assert "result" in response_data
139-
assert response_data["result"]
138+
assert "content" in response_data
139+
assert response_data["content"]
140140
else:
141141
assert "error" in response_data
142142

@@ -164,8 +164,8 @@ async def test_large_file_handling(request: pytest.FixtureRequest) -> None:
164164

165165
response_data = response.json()
166166
if response.status_code == status.HTTP_200_OK:
167-
assert "result" in response_data
168-
assert response_data["result"]
167+
assert "content" in response_data
168+
assert response_data["content"]
169169
else:
170170
assert "error" in response_data
171171

@@ -188,8 +188,7 @@ async def test_repository_with_patterns(request: pytest.FixtureRequest) -> None:
188188

189189
response_data = response.json()
190190
if response.status_code == status.HTTP_200_OK:
191-
assert "result" in response_data
192-
assert response_data["result"]
191+
assert "content" in response_data
193192
assert "pattern_type" in response_data
194193
assert response_data["pattern_type"] == "include"
195194
assert "pattern" in response_data

0 commit comments

Comments
 (0)