mirror of
https://github.com/baz-scm/awesome-reviewers.git
synced 2025-08-20 18:58:52 +03:00
260 lines
19 KiB
JSON
260 lines
19 KiB
JSON
[
|
|
{
|
|
"discussion_id": "2283612109",
|
|
"pr_number": 36693,
|
|
"pr_file": "posthog/api/feature_flag.py",
|
|
"created_at": "2025-08-18T22:12:11+00:00",
|
|
"commented_code": "except FeatureFlag.DoesNotExist:\n raise serializers.ValidationError(f\"Flag dependency references non-existent flag with ID {flag_id}\")\n \n+ def _get_properties_from_filters(self, filters: dict, property_type: str | None = None):\n+ \"\"\"\n+ Extract properties from filters by iterating through groups.\n+\n+ Args:\n+ filters: The filters dictionary containing groups\n+ property_type: Optional filter by property type (e.g., 'flag', 'cohort')",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2283612109",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36693,
|
|
"pr_file": "posthog/api/feature_flag.py",
|
|
"discussion_id": "2283612109",
|
|
"commented_code": "@@ -422,16 +425,34 @@ def _validate_flag_reference(self, flag_reference):\n except FeatureFlag.DoesNotExist:\n raise serializers.ValidationError(f\"Flag dependency references non-existent flag with ID {flag_id}\")\n \n+ def _get_properties_from_filters(self, filters: dict, property_type: str | None = None):\n+ \"\"\"\n+ Extract properties from filters by iterating through groups.\n+\n+ Args:\n+ filters: The filters dictionary containing groups\n+ property_type: Optional filter by property type (e.g., 'flag', 'cohort')",
|
|
"comment_created_at": "2025-08-18T22:12:11+00:00",
|
|
"comment_author": "dmarticus",
|
|
"comment_body": "[nit] this property type could probably be an StrEnum instead of a string.",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"discussion_id": "2272750415",
|
|
"pr_number": 36480,
|
|
"pr_file": "posthog/hogql/database/join_functions.py",
|
|
"created_at": "2025-08-13T09:46:09+00:00",
|
|
"commented_code": "+from collections.abc import Callable\n+from typing import Any, Literal, Optional, TypeVar, overload, cast\n+from pydantic import BaseModel\n+\n+\n+class LazyJoinFunctionSerialConfig(BaseModel):\n+ type: Literal[\"join_function\"] = \"join_function\"\n+ name: str\n+\n+\n+class LazyJoinClosureSerialConfig(BaseModel):\n+ type: Literal[\"closure\"] = \"closure\"\n+ name: str\n+ args: tuple[Any, ...]\n+\n+\n+REGISTERED_JOIN_FUNCTIONS: dict[str, Callable] = {}\n+\n+\n+REGISTERED_JOIN_CLOSURES: dict[str, Callable] = {}\n+\n+_F = TypeVar(\"_F\", bound=Callable)\n+\n+\n+@overload\n+def register_join_function(_func: _F) -> _F: ...\n+\n+\n+@overload\n+def register_join_function(*, name: Optional[str] = ..., closure: bool = ...) -> Callable[[_F], _F]: ...\n+\n+\n+def register_join_function(_func: Optional[_F] = None, *, name: Optional[str] = None, closure: bool = False):\n+ \"\"\"\n+ Decorator to register a join function in the allowlist.\n+\n+ Usage:\n+ - @register_join_function\n+ - @register_join_function()\n+ - @register_join_function(name=\"custom_name\")\n+ - @register_join_function(closure=True) # for factory functions returning a join callable",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2272750415",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36480,
|
|
"pr_file": "posthog/hogql/database/join_functions.py",
|
|
"discussion_id": "2272750415",
|
|
"commented_code": "@@ -0,0 +1,63 @@\n+from collections.abc import Callable\n+from typing import Any, Literal, Optional, TypeVar, overload, cast\n+from pydantic import BaseModel\n+\n+\n+class LazyJoinFunctionSerialConfig(BaseModel):\n+ type: Literal[\"join_function\"] = \"join_function\"\n+ name: str\n+\n+\n+class LazyJoinClosureSerialConfig(BaseModel):\n+ type: Literal[\"closure\"] = \"closure\"\n+ name: str\n+ args: tuple[Any, ...]\n+\n+\n+REGISTERED_JOIN_FUNCTIONS: dict[str, Callable] = {}\n+\n+\n+REGISTERED_JOIN_CLOSURES: dict[str, Callable] = {}\n+\n+_F = TypeVar(\"_F\", bound=Callable)\n+\n+\n+@overload\n+def register_join_function(_func: _F) -> _F: ...\n+\n+\n+@overload\n+def register_join_function(*, name: Optional[str] = ..., closure: bool = ...) -> Callable[[_F], _F]: ...\n+\n+\n+def register_join_function(_func: Optional[_F] = None, *, name: Optional[str] = None, closure: bool = False):\n+ \"\"\"\n+ Decorator to register a join function in the allowlist.\n+\n+ Usage:\n+ - @register_join_function\n+ - @register_join_function()\n+ - @register_join_function(name=\"custom_name\")\n+ - @register_join_function(closure=True) # for factory functions returning a join callable",
|
|
"comment_created_at": "2025-08-13T09:46:09+00:00",
|
|
"comment_author": "Gilbert09",
|
|
"comment_body": "I wasn't sure what the closure param meant until I read this comment - renaming it to `is_factory=True` is probably more familiar language here?",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"discussion_id": "2278675298",
|
|
"pr_number": 36608,
|
|
"pr_file": "posthog/models/cache.py",
|
|
"created_at": "2025-08-15T09:24:17+00:00",
|
|
"commented_code": "+from typing import TYPE_CHECKING, Optional\n+from django.core import serializers\n+from django.db.models import QuerySet, Manager\n+import posthoganalytics\n+from prometheus_client import Counter\n+\n+from posthog.exceptions_capture import capture_exception\n+from posthog.git import get_git_commit_short\n+from posthog.redis import get_client\n+from posthog.settings import TEST\n+\n+if TYPE_CHECKING:\n+ from posthog.models import Team\n+\n+\n+DATABASE_CACHE_COUNTER = Counter(\n+ \"posthog_get_model_cache\",",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2278675298",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36608,
|
|
"pr_file": "posthog/models/cache.py",
|
|
"discussion_id": "2278675298",
|
|
"commented_code": "@@ -0,0 +1,104 @@\n+from typing import TYPE_CHECKING, Optional\n+from django.core import serializers\n+from django.db.models import QuerySet, Manager\n+import posthoganalytics\n+from prometheus_client import Counter\n+\n+from posthog.exceptions_capture import capture_exception\n+from posthog.git import get_git_commit_short\n+from posthog.redis import get_client\n+from posthog.settings import TEST\n+\n+if TYPE_CHECKING:\n+ from posthog.models import Team\n+\n+\n+DATABASE_CACHE_COUNTER = Counter(\n+ \"posthog_get_model_cache\",",
|
|
"comment_created_at": "2025-08-15T09:24:17+00:00",
|
|
"comment_author": "Gilbert09",
|
|
"comment_body": "`cache_hit` and `cache_miss` are the more typical terms for whether an item was found in the cache or not ",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"discussion_id": "2270732761",
|
|
"pr_number": 36374,
|
|
"pr_file": "products/surveys/backend/max_tools.py",
|
|
"created_at": "2025-08-12T18:11:32+00:00",
|
|
"commented_code": "survey_data[\"appearance\"] = appearance\n \n return survey_data\n+\n+\n+class FeatureFlagToolkit(TaxonomyAgentToolkit):",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2270732761",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36374,
|
|
"pr_file": "products/surveys/backend/max_tools.py",
|
|
"discussion_id": "2270732761",
|
|
"commented_code": "@@ -167,3 +151,133 @@ def _prepare_survey_data(self, survey_schema: SurveyCreationSchema, team: Team)\n survey_data[\"appearance\"] = appearance\n \n return survey_data\n+\n+\n+class FeatureFlagToolkit(TaxonomyAgentToolkit):",
|
|
"comment_created_at": "2025-08-12T18:11:32+00:00",
|
|
"comment_author": "lucasheriques",
|
|
"comment_body": "I think the naming here is confusing. This doesn't seem to be a FeatureFlagToolkit, but instead `SurveyToolkit`. Reasoning:\r\n\r\n- Looks like this is responsible for executing sending the system prompt about survey creation, plus having other tools to help find more information\r\n- One of these tools is looking up a freature flag id\r\n- But in the future, we might add more tools to look up more things I think?\r\n\r\nfar from an expert here, so let me know if this makes sense. cc @denakorita ",
|
|
"pr_file_module": null
|
|
},
|
|
{
|
|
"comment_id": "2272473578",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36374,
|
|
"pr_file": "products/surveys/backend/max_tools.py",
|
|
"discussion_id": "2270732761",
|
|
"commented_code": "@@ -167,3 +151,133 @@ def _prepare_survey_data(self, survey_schema: SurveyCreationSchema, team: Team)\n survey_data[\"appearance\"] = appearance\n \n return survey_data\n+\n+\n+class FeatureFlagToolkit(TaxonomyAgentToolkit):",
|
|
"comment_created_at": "2025-08-13T08:18:40+00:00",
|
|
"comment_author": "denakorita",
|
|
"comment_body": "Yeap, agreed ",
|
|
"pr_file_module": null
|
|
},
|
|
{
|
|
"comment_id": "2272538049",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36374,
|
|
"pr_file": "products/surveys/backend/max_tools.py",
|
|
"discussion_id": "2270732761",
|
|
"commented_code": "@@ -167,3 +151,133 @@ def _prepare_survey_data(self, survey_schema: SurveyCreationSchema, team: Team)\n survey_data[\"appearance\"] = appearance\n \n return survey_data\n+\n+\n+class FeatureFlagToolkit(TaxonomyAgentToolkit):",
|
|
"comment_created_at": "2025-08-13T08:42:32+00:00",
|
|
"comment_author": "marandaneto",
|
|
"comment_body": "will rename",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"discussion_id": "2247447902",
|
|
"pr_number": 35401,
|
|
"pr_file": "products/issue_tracker/backend/models.py",
|
|
"created_at": "2025-08-01T09:29:22+00:00",
|
|
"commented_code": "+from django.db import models\n+from django.utils import timezone\n+import uuid\n+\n+\n+class Issue(models.Model):\n+ class Status(models.TextChoices):\n+ BACKLOG = \"backlog\", \"Backlog\"\n+ TODO = \"todo\", \"To Do\"\n+ IN_PROGRESS = \"in_progress\", \"In Progress\"\n+ TESTING = \"testing\", \"Testing\"\n+ DONE = \"done\", \"Done\"\n+\n+ class OriginProduct(models.TextChoices):",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2247447902",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 35401,
|
|
"pr_file": "products/issue_tracker/backend/models.py",
|
|
"discussion_id": "2247447902",
|
|
"commented_code": "@@ -0,0 +1,184 @@\n+from django.db import models\n+from django.utils import timezone\n+import uuid\n+\n+\n+class Issue(models.Model):\n+ class Status(models.TextChoices):\n+ BACKLOG = \"backlog\", \"Backlog\"\n+ TODO = \"todo\", \"To Do\"\n+ IN_PROGRESS = \"in_progress\", \"In Progress\"\n+ TESTING = \"testing\", \"Testing\"\n+ DONE = \"done\", \"Done\"\n+\n+ class OriginProduct(models.TextChoices):",
|
|
"comment_created_at": "2025-08-01T09:29:22+00:00",
|
|
"comment_author": "daibhin",
|
|
"comment_body": "Not all of these are products\r\n```suggestion\r\n class Origin(models.TextChoices):\r\n```",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"discussion_id": "2263656715",
|
|
"pr_number": 36354,
|
|
"pr_file": "posthog/models/feature_flag/local_evaluation.py",
|
|
"created_at": "2025-08-08T17:38:25+00:00",
|
|
"commented_code": "+from django.conf import settings",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2263656715",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36354,
|
|
"pr_file": "posthog/models/feature_flag/local_evaluation.py",
|
|
"discussion_id": "2263656715",
|
|
"commented_code": "@@ -0,0 +1,174 @@\n+from django.conf import settings",
|
|
"comment_created_at": "2025-08-08T17:38:25+00:00",
|
|
"comment_author": "haacked",
|
|
"comment_body": "This doesn't have to happen in this PR. I'm more trying to get more people's opinion on this:\r\n\r\nI've been wanting to change the name to `flag_definitions` because \"local evaluation\" is the process that happens in the SDKs, but \"flag definitions\" is what the SDKs are requesting and what this code generates.\r\n\r\nThoughts?",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"discussion_id": "2263660225",
|
|
"pr_number": 36354,
|
|
"pr_file": "posthog/models/feature_flag/local_evaluation.py",
|
|
"created_at": "2025-08-08T17:40:38+00:00",
|
|
"commented_code": "+from django.conf import settings\n+from django.db.models.signals import post_save\n+from django.dispatch import receiver\n+import structlog\n+\n+from django.db.models import Q\n+\n+from posthog.models.cohort.cohort import Cohort, CohortOrEmpty\n+from posthog.models.feature_flag import FeatureFlag\n+from posthog.models.group_type_mapping import GroupTypeMapping\n+from posthog.models.team import Team\n+from posthog.storage.hypercache import HyperCache\n+\n+logger = structlog.get_logger(__name__)\n+\n+DATABASE_FOR_LOCAL_EVALUATION = (\n+ \"default\"\n+ if (\"local_evaluation\" not in settings.READ_REPLICA_OPT_IN or \"replica\" not in settings.DATABASES) # noqa: F821\n+ else \"replica\"\n+)\n+\n+flags_hypercache = HyperCache(",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2263660225",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36354,
|
|
"pr_file": "posthog/models/feature_flag/local_evaluation.py",
|
|
"discussion_id": "2263660225",
|
|
"commented_code": "@@ -0,0 +1,174 @@\n+from django.conf import settings\n+from django.db.models.signals import post_save\n+from django.dispatch import receiver\n+import structlog\n+\n+from django.db.models import Q\n+\n+from posthog.models.cohort.cohort import Cohort, CohortOrEmpty\n+from posthog.models.feature_flag import FeatureFlag\n+from posthog.models.group_type_mapping import GroupTypeMapping\n+from posthog.models.team import Team\n+from posthog.storage.hypercache import HyperCache\n+\n+logger = structlog.get_logger(__name__)\n+\n+DATABASE_FOR_LOCAL_EVALUATION = (\n+ \"default\"\n+ if (\"local_evaluation\" not in settings.READ_REPLICA_OPT_IN or \"replica\" not in settings.DATABASES) # noqa: F821\n+ else \"replica\"\n+)\n+\n+flags_hypercache = HyperCache(",
|
|
"comment_created_at": "2025-08-08T17:40:38+00:00",
|
|
"comment_author": "haacked",
|
|
"comment_body": "It'd be a little clearer to name this `flags_with_cohorts_hypercache`.",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"discussion_id": "2262245330",
|
|
"pr_number": 36339,
|
|
"pr_file": "posthog/models/personal_api_key.py",
|
|
"created_at": "2025-08-08T08:09:49+00:00",
|
|
"commented_code": "null=True,\n blank=True,\n )\n+\n+\n+def find(token: str) -> tuple[PersonalAPIKey, str] | None:",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2262245330",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36339,
|
|
"pr_file": "posthog/models/personal_api_key.py",
|
|
"discussion_id": "2262245330",
|
|
"commented_code": "@@ -62,3 +62,20 @@ class PersonalAPIKey(models.Model):\n null=True,\n blank=True,\n )\n+\n+\n+def find(token: str) -> tuple[PersonalAPIKey, str] | None:",
|
|
"comment_created_at": "2025-08-08T08:09:49+00:00",
|
|
"comment_author": "joshsny",
|
|
"comment_body": "nit: would be nice if this had a more descriptive name",
|
|
"pr_file_module": null
|
|
},
|
|
{
|
|
"comment_id": "2262525837",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36339,
|
|
"pr_file": "posthog/models/personal_api_key.py",
|
|
"discussion_id": "2262245330",
|
|
"commented_code": "@@ -62,3 +62,20 @@ class PersonalAPIKey(models.Model):\n null=True,\n blank=True,\n )\n+\n+\n+def find(token: str) -> tuple[PersonalAPIKey, str] | None:",
|
|
"comment_created_at": "2025-08-08T10:03:07+00:00",
|
|
"comment_author": "zlwaterfield",
|
|
"comment_body": "+1",
|
|
"pr_file_module": null
|
|
},
|
|
{
|
|
"comment_id": "2263655699",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 36339,
|
|
"pr_file": "posthog/models/personal_api_key.py",
|
|
"discussion_id": "2262245330",
|
|
"commented_code": "@@ -62,3 +62,20 @@ class PersonalAPIKey(models.Model):\n null=True,\n blank=True,\n )\n+\n+\n+def find(token: str) -> tuple[PersonalAPIKey, str] | None:",
|
|
"comment_created_at": "2025-08-08T17:37:43+00:00",
|
|
"comment_author": "Piccirello",
|
|
"comment_body": "I'm surprised given that this is already scoped to the `PersonalAPIKey` model. But will rename to `find_personal_api_key` - unless you had something else in mind?",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"discussion_id": "2247282068",
|
|
"pr_number": 35980,
|
|
"pr_file": "posthog/models/notebook/notebook_relationship.py",
|
|
"created_at": "2025-08-01T08:11:32+00:00",
|
|
"commented_code": "+from django.core.exceptions import ValidationError\n+from django.db import models\n+from posthog.models.utils import UUIDModel, build_unique_relationship_check, build_partial_uniqueness_constraint\n+\n+RELATED_OBJECTS = (\"group\",)\n+\n+\n+class NotebookRelationship(UUIDModel):",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"discussion_comments": [
|
|
{
|
|
"comment_id": "2247282068",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 35980,
|
|
"pr_file": "posthog/models/notebook/notebook_relationship.py",
|
|
"discussion_id": "2247282068",
|
|
"commented_code": "@@ -0,0 +1,73 @@\n+from django.core.exceptions import ValidationError\n+from django.db import models\n+from posthog.models.utils import UUIDModel, build_unique_relationship_check, build_partial_uniqueness_constraint\n+\n+RELATED_OBJECTS = (\"group\",)\n+\n+\n+class NotebookRelationship(UUIDModel):",
|
|
"comment_created_at": "2025-08-01T08:11:32+00:00",
|
|
"comment_author": "daibhin",
|
|
"comment_body": "Is `ResourceNotebook` a better name here? I think it's pretty clear this is a relationship so don't necessarily love it in the model name. We often call objects in posthog (groups, replays, issues) \"resources\"",
|
|
"pr_file_module": null
|
|
},
|
|
{
|
|
"comment_id": "2247817499",
|
|
"repo_full_name": "PostHog/posthog",
|
|
"pr_number": 35980,
|
|
"pr_file": "posthog/models/notebook/notebook_relationship.py",
|
|
"discussion_id": "2247282068",
|
|
"commented_code": "@@ -0,0 +1,73 @@\n+from django.core.exceptions import ValidationError\n+from django.db import models\n+from posthog.models.utils import UUIDModel, build_unique_relationship_check, build_partial_uniqueness_constraint\n+\n+RELATED_OBJECTS = (\"group\",)\n+\n+\n+class NotebookRelationship(UUIDModel):",
|
|
"comment_created_at": "2025-08-01T12:08:56+00:00",
|
|
"comment_author": "arthurdedeus",
|
|
"comment_body": "> We often call objects in posthog (groups, replays, issues) \"resources\"\r\n\r\nToday I learned! I think it makes sense to rename",
|
|
"pr_file_module": null
|
|
}
|
|
]
|
|
}
|
|
] |