Skip to content

Commit 2216621

Browse files
abhizipstackclaude
andcommitted
fix: address Greptile review — name lookup safety, seed schema, field names
P1: Connection name-lookup before delete could block deletion on transient errors. Wrapped in try/except so deletion proceeds regardless; event falls back to connection_id. P2: SeedCompleted failure path had schema_name="". Now reads from self.context.schema_name with fallback to empty string. P2: Renamed misleading proto fields — connection_id → connection_name and environment_id → environment_name since they carry display names, not UUIDs. Updated event classes and all callers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f9c45eb commit 2216621

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

backend/backend/core/routers/connection/views.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ def connection_usage(request: Request, connection_id: str) -> Response:
121121
@handle_permission
122122
def delete_connection(request: Request, connection_id: str) -> Response:
123123
con_context = ConnectionContext()
124-
conn_data = con_context.get_connection(connection_id=connection_id)
125-
conn_name = conn_data.get("name", connection_id) if conn_data else connection_id
124+
conn_name = connection_id
125+
try:
126+
conn_data = con_context.get_connection(connection_id=connection_id)
127+
conn_name = conn_data.get("name", connection_id) if conn_data else connection_id
128+
except Exception:
129+
pass # Best-effort name lookup; deletion proceeds regardless
126130
con_context.delete_connection(connection_id=connection_id)
127-
fire_event(ConnectionDeletedEvt(connection_id=conn_name))
131+
fire_event(ConnectionDeletedEvt(connection_name=conn_name))
128132
response_data = {
129133
"status": "success",
130134
"data": f"{connection_id} is deleted successfully.",

backend/backend/core/routers/environment/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def delete_environment(request: Request, environment_id: str):
100100
job_names=", ".join(job_names) if job_names else "unknown",
101101
)
102102

103-
fire_event(EnvironmentDeleted(environment_id=env_name))
103+
fire_event(EnvironmentDeleted(environment_name=env_name))
104104
response_data = {"status": "success"}
105105
return Response(data=response_data, status=status.HTTP_200_OK)
106106

backend/visitran/events/proto_types.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/visitran/events/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ def code(self) -> str:
986986
return "U017"
987987

988988
def message(self) -> str:
989-
return f'Connection "{self.connection_id}" deleted'
989+
return f'Connection "{self.connection_name}" deleted'
990990

991991

992992
@dataclass
@@ -1004,4 +1004,4 @@ def code(self) -> str:
10041004
return "U019"
10051005

10061006
def message(self) -> str:
1007-
return f'Environment "{self.environment_id}" deleted'
1007+
return f'Environment "{self.environment_name}" deleted'

backend/visitran/visitran.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,9 @@ def validate_and_run_seed(self, seed_file, session_id: str) -> dict[str, str]:
865865
# Catches all kind of errors and raises with custom exceptions for seeds
866866
fire_event(SeedExecutionError(file_name, str(err)))
867867
fire_event(SeedCompleted(
868-
seed_name=file_name, schema_name="", status="Failed",
868+
seed_name=file_name,
869+
schema_name=getattr(self.context, "schema_name", "") or "",
870+
status="Failed",
869871
))
870872
logging.exception(f"validate and run seed failed with exception {err}")
871873
raise RunSeedFailedException(file_name=file_name, error_message=str(err))

0 commit comments

Comments
 (0)