chore(django): move eval code off orm#66220
Conversation
| @@ -20,6 +20,7 @@ | |||
|
|
|||
| from posthog.hogql_queries.query_runner import get_query_runner | |||
| from posthog.models import GroupTypeMapping, Organization, PropertyDefinition, Team | |||
There was a problem hiding this comment.
can GroupTypeMapping be removed from imports here?
| def test_restores_models_counts(self): | ||
| _org, _user, _dataset, team = self._load_with_mocks() | ||
| self.assertEqual(PropertyDefinition.objects.filter(team_id=team.id).count(), 2) | ||
| self.assertEqual(GroupTypeMapping.objects.filter(team_id=team.id).count(), 2) |
There was a problem hiding this comment.
ah, there is still a call here
|
Reviews (1): Last reviewed commit: "chore(django): move eval code off orm" | Re-trigger Greptile |
| with persons_db_connection(writer=True, autocommit=True) as conn, conn.cursor() as cursor: | ||
| cursor.execute("DELETE FROM posthog_grouptypemapping") |
There was a problem hiding this comment.
Unscoped DELETE may wipe unrelated rows
The DELETE FROM posthog_grouptypemapping clears every row in the table, not just those belonging to the teams created by these tests. If the persons DB is ever shared — e.g., another test class also writes through persons_db_connection, or an eval integration test leaves data behind — all of it is silently deleted here. Scoping to the known team_ids (WHERE team_id IN (9990, 99990, ...)) or moving the cleanup to tearDown and filtering by the team.id created during the test would limit the blast radius to what this class actually wrote.
Query snapshots: Backend query snapshots updatedChanges: 1 snapshots (1 modified, 0 added, 0 deleted) What this means:
Next steps:
|
|
🎭 Playwright report · View test results →
These issues are not necessarily caused by your changes. |
Problem
demo eval call sites still hit the orm
Changes