Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(warehouse-suggestions): assign suggestions and notify the assignee (#123591)

Thiago Salvatorea5fe4a788b89
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 44b3f302c69e..4919fd1c992f 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -17105,13 +17105,13 @@ snapshots:
warehouse-suggestions-suggested-certifications--deprecate-dialog--light:
hash: v1.k794b7964.275d7a88a60faa93a269cf2845b2699cbfdf64e3e44915475a0b2bee1cd74d5f.NhxpoIwZXgvWwn3rUmWDa0TNkY2A7ZVGRJmHW1vAuBM
warehouse-suggestions-suggested-certifications--review-dialog--dark:
- hash: v1.k794b7964.c2b43a0d616ad1721b228b10987d7037c535206a67312f0f5232e1d654f5a60f.rdxQcav4UGFzP3u8nSdaulyhqN-7BhEZ0Rs9mfwcwBA
+ hash: v1.k794b7964.6dcbacf41e20c4bea01deeb9dfe4d35f2448360bf979c9b28a79fa2e70c9b093.vkNS26vk41QQyUFkJwTUZ6pxCQkisgogPmtUMRCOLQU
warehouse-suggestions-suggested-certifications--review-dialog--light:
- hash: v1.k794b7964.74c4fc0a2c87a70eb1977ff6bd0f70194222e0fa010c54bf0ea75b5080456701.9OjN8DSZcWSlxnK5UIhIIX4ZVQDVtP8e-mOT4Ou8EkA
+ hash: v1.k794b7964.10018e84324c52d7139e7329ad735059c12c23b62abd4da8c7b8db9ad04fb0f6.83Sg6I66DFRMw1gR9ZiuxhtiS1iRLdiTl-6B99FYlOw
warehouse-suggestions-suggested-certifications--review-dialog-narrow--dark:
- hash: v1.k794b7964.2344ac79fcee901cfbc8892f79a4631821485c3e289e2b89d47676033d4b4bcc.PaeOI1dpFwA7RrGpai9PDerfXQ2nesADnpDH5LvFz4o
+ hash: v1.k794b7964.09bce81ef734200f2bf6cb83ab6f721fe5bf3fa49baf8e7d3efc8ba2aef669b5.odxYkoZ6E1lVK5TmS2efjmW-Yc63cmsNvj01Tj1dVAY
warehouse-suggestions-suggested-certifications--review-dialog-narrow--light:
- hash: v1.k794b7964.f77388a8153d3551ce0de3d75b0346268f50c8ac70bc8b10e333b083a9f40cf3.x67YoR-C0-RrxNWsOM1Mv7QOmlMEJD4S2CmZBkwbLyk
+ hash: v1.k794b7964.b50eac0dbd82aa276d178cebb9041a89ba689f376f3b8509b910aa3a291a4441.6LJGfUarId3i8ZJYqoBfGZ1zaK_btz8bo1q6t4RSs38
warehouse-suggestions-suggested-models-strip--banner--dark:
hash: v1.k794b7964.95ba4716f680e32e7497d3f5d8dbcdca2f9da83d7e08e5b2bb8911a7ab2c39fb.ackP53GYozYXF74XgG1MVnH6degCJR3pkvrXGKJJ3hw
warehouse-suggestions-suggested-models-strip--banner--light:
diff --git a/frontend/src/lib/components/NotificationsMenu/NotificationRow.tsx b/frontend/src/lib/components/NotificationsMenu/NotificationRow.tsx
index 27bae17433b5..37d6299dec29 100644
--- a/frontend/src/lib/components/NotificationsMenu/NotificationRow.tsx
+++ b/frontend/src/lib/components/NotificationsMenu/NotificationRow.tsx
@@ -81,6 +81,10 @@ export const REALTIME_NOTIFICATION_TYPE_META: Record<string, { label: string; de
label: 'Workflow suggestions',
description: 'When PostHog suggests a change to a workflow you set up',
},
+ warehouse_suggestion_assigned: {
+ label: 'Warehouse suggestions',
+ description: 'When a suggestion for a view or table is assigned to you',
+ },
first_report_completed: {
label: 'First Self-Driving investigation',
description: 'When your first Self-Driving investigation finishes, including when it has no report.',
diff --git a/frontend/src/lib/components/NotificationsMenu/notificationToasts.tsx b/frontend/src/lib/components/NotificationsMenu/notificationToasts.tsx
index dc592a320d60..e75cd1fd9df4 100644
--- a/frontend/src/lib/components/NotificationsMenu/notificationToasts.tsx
+++ b/frontend/src/lib/components/NotificationsMenu/notificationToasts.tsx
@@ -41,6 +41,7 @@ const NOTIFICATION_TYPE_ICONS: Record<string, { Icon: ComponentType<{ className?
subscription_nudge: { Icon: IconBell, color: 'text-primary' },
data_quality_check_failure: { Icon: IconWarning, color: 'text-danger' },
workflow_suggestion: { Icon: IconSparkles, color: 'text-primary' },
+ warehouse_suggestion_assigned: { Icon: IconDatabase, color: 'text-primary' },
feature_flag_failure: { Icon: IconToggle, color: 'text-danger' },
first_report_completed: { Icon: IconSparkles, color: 'text-success' },
}
diff --git a/products/data_modeling/backend/facade/contracts.py b/products/data_modeling/backend/facade/contracts.py
index 74b8cf6ff851..b61bfe5ce164 100644
--- a/products/data_modeling/backend/facade/contracts.py
+++ b/products/data_modeling/backend/facade/contracts.py
@@ -63,6 +63,7 @@ class SavedQueryDefinition:
created_at: datetime
refreshes_incrementally: bool = False
calls_decision_functions: bool = False
+ created_by_id: int | None = None
@dataclass(frozen=True)
diff --git a/products/data_modeling/backend/logic/saved_query_reads.py b/products/data_modeling/backend/logic/saved_query_reads.py
index 8aff3c43d896..5982273372cc 100644
--- a/products/data_modeling/backend/logic/saved_query_reads.py
+++ b/products/data_modeling/backend/logic/saved_query_reads.py
@@ -124,7 +124,17 @@ def saved_query_definitions(team_id: int, *, ids: Collection[UUID] | None = None
saved_queries_in_team = saved_queries_in_team.filter(id__in=ids)
saved_queries = list(
saved_queries_in_team.exclude(deleted=True)
- .only("id", "name", "query", "is_test", "managed_viewset_id", "origin", "created_at", "incremental_config")
+ .only(
+ "id",
+ "name",
+ "query",
+ "is_test",
+ "managed_viewset_id",
+ "origin",
+ "created_at",
+ "created_by_id",
+ "incremental_config",
+ )
.order_by("created_at", "id")
)
materializing_ids = set(
@@ -150,6 +160,7 @@ def _definition(saved_query: DataWarehouseSavedQuery, *, materializes: bool) ->
created_at=saved_query.created_at,
refreshes_incrementally=get_incremental_config(saved_query) is not None,
calls_decision_functions=calls_decision_functions(hogql),
+ created_by_id=saved_query.created_by_id,
)
diff --git a/products/notifications/backend/facade/enums.py b/products/notifications/backend/facade/enums.py
index 83c281d57ddb..e6ce88df2f13 100644
--- a/products/notifications/backend/facade/enums.py
+++ b/products/notifications/backend/facade/enums.py
@@ -23,6 +23,7 @@ class NotificationType(str, Enum):
NOTIFICATION_SETTINGS_CHANGED = "notification_settings_changed"
DATA_QUALITY_CHECK_FAILURE = "data_quality_check_failure"
WORKFLOW_SUGGESTION = "workflow_suggestion"
+ WAREHOUSE_SUGGESTION_ASSIGNED = "warehouse_suggestion_assigned"
FEATURE_FLAG_FAILURE = "feature_flag_failure"
FIRST_REPORT_COMPLETED = "first_report_completed"
diff --git a/products/warehouse_suggestions/backend/facade/api.py b/products/warehouse_suggestions/backend/facade/api.py
index b909bb02bf1f..7232de5f38b5 100644
--- a/products/warehouse_suggestions/backend/facade/api.py
+++ b/products/warehouse_suggestions/backend/facade/api.py
@@ -8,8 +8,8 @@ from uuid import UUID
from products.warehouse_sources.backend.facade.api import source_locations_for_tables
from products.warehouse_sources.backend.facade.contracts import TableSourceLocation
-from ..logic import accept, suggestions
-from ..logic.access import SubjectAccess, readable_table_ids, visible_suggestions
+from ..logic import accept, assignment, suggestions
+from ..logic.access import CATALOG_KINDS, SubjectAccess, readable_table_ids, visible_suggestions
from ..logic.analytics import SuggestionOutcome, report_outcomes
from ..logic.flags import is_warehouse_suggestions_enabled
from ..logic.payloads import payload_from_json, payload_view, source_table_ids
@@ -43,6 +43,7 @@ if TYPE_CHECKING:
__all__ = [
"accept_suggestion",
+ "assign_suggestion",
"dismiss_suggestion",
"get_suggestion",
"is_warehouse_suggestions_enabled",
@@ -52,8 +53,6 @@ __all__ = [
"upsert_suggestions",
]
-CATALOG_KINDS = frozenset({WarehouseSuggestionKind.CERTIFY, WarehouseSuggestionKind.DEPRECATE})
-
def upsert_suggestions(team_id: int, drafts: Sequence[SuggestionDraft]) -> None:
suggestions.upsert_suggestions(team_id, drafts)
@@ -66,12 +65,19 @@ def list_suggestions(
kind: WarehouseSuggestionKind | None,
status: WarehouseSuggestionStatus | None,
subject_id: UUID | None,
+ assignee_id: int | None = None,
subject_kinds: SubjectKinds,
limit: int,
offset: int,
) -> SuggestionPage:
visible, access = visible_suggestions(
- team_id, user_access_control, kind=kind, status=status, subject_id=subject_id, subject_kinds=subject_kinds
+ team_id,
+ user_access_control,
+ kind=kind,
+ status=status,
+ subject_id=subject_id,
+ assignee_id=assignee_id,
+ subject_kinds=subject_kinds,
)
page = list(visible[offset : offset + limit])
return SuggestionPage(count=visible.count(), results=_to_contracts(team_id, user_access_control, page, access))
@@ -140,6 +146,28 @@ def resume_suggestion(
return _single_contract(team.pk, user_access_control, resumed, access)
+def assign_suggestion(
+ team: "Team",
+ user_access_control: "UserAccessControl",
+ suggestion_id: UUID,
+ *,
+ user: "User",
+ assignee_id: int | None,
+ subject_kinds: SubjectKinds,
+) -> Suggestion:
+ row, access = _actionable_suggestion(team.pk, user_access_control, suggestion_id, subject_kinds)
+ result = assignment.assign(team, row.id, assignee_id, assigned_by=user)
+ if result.changed:
+ report_outcomes(
+ SuggestionOutcome.ASSIGNED,
+ [result.suggestion],
+ team=team,
+ user=user,
+ properties={"unassigned": assignee_id is None, "self_assigned": assignee_id == user.id},
+ )
+ return _single_contract(team.pk, user_access_control, result.suggestion, access)
+
+
def accept_suggestion(
team: "Team",
user_access_control: "UserAccessControl",
@@ -245,7 +273,7 @@ def _to_contract(
last_seen_at=row.last_seen_at,
status=WarehouseSuggestionStatus(row.status),
surfaced_at=row.surfaced_at,
- reviewed_by=_to_reviewer(row),
+ reviewed_by=_to_user(row.reviewed_by),
reviewed_at=row.reviewed_at,
dismissal_reason=WarehouseSuggestionDismissalReason(row.dismissal_reason) if row.dismissal_reason else None,
dismissal_note=row.dismissal_note,
@@ -256,10 +284,11 @@ def _to_contract(
can_act=access.can_act_on(row),
subject_source_id=location.source_id if location else None,
subject_schema_id=location.schema_id if location else None,
+ assignee=_to_user(row.assignee),
)
-def _to_reviewer(row: WarehouseSuggestion) -> SuggestionReviewer | None:
- if row.reviewed_by is None:
+def _to_user(user: "User | None") -> SuggestionReviewer | None:
+ if user is None:
return None
- return SuggestionReviewer(id=row.reviewed_by.id, first_name=row.reviewed_by.first_name, email=row.reviewed_by.email)
+ return SuggestionReviewer(id=user.id, first_name=user.first_name, email=user.email)
diff --git a/products/warehouse_suggestions/backend/facade/contracts.py b/products/warehouse_suggestions/backend/facade/contracts.py
index 8e74b46afcdf..b8c5459de2d6 100644
--- a/products/warehouse_suggestions/backend/facade/contracts.py
+++ b/products/warehouse_suggestions/backend/facade/contracts.py
@@ -153,6 +153,7 @@ class Suggestion:
can_act: bool
subject_source_id: UUID | None = None
subject_schema_id: UUID | None = None
+ assignee: SuggestionReviewer | None = None
@frozen
@@ -253,5 +254,13 @@ class SuggestionOutdatedError(Exception):
pass
+class AssigneeCannotActError(Exception):
+ pass
+
+
+class SuggestionNotOpenError(Exception):
+ pass
+
+
class AcceptFailedError(Exception):
pass
diff --git a/products/warehouse_suggestions/backend/logic/access.py b/products/warehouse_suggestions/backend/logic/access.py
index 8dca2a9995f8..e8746487d941 100644
--- a/products/warehouse_suggestions/backend/logic/access.py
+++ b/products/warehouse_suggestions/backend/logic/access.py
@@ -7,6 +7,7 @@ from django.db.models import Case, IntegerField, Q, QuerySet, Value, When
from posthog.dataclasses import frozen
+from products.access_control.backend.facade.user_access_control import UserAccessControl
from products.data_modeling.backend.facade.api import allowed_saved_query_ids, backing_table_ids_by_saved_query
from products.warehouse_sources.backend.facade.api import allowed_table_ids
@@ -16,7 +17,9 @@ from ..models import WarehouseSuggestion
from .rules import RULES
if TYPE_CHECKING:
- from products.access_control.backend.facade.user_access_control import AccessControlLevel, UserAccessControl
+ from posthog.models import Team, User
+
+ from products.access_control.backend.facade.user_access_control import AccessControlLevel
class AllowedSubjectIds(Protocol):
@@ -34,6 +37,23 @@ ALLOWED_SUBJECT_IDS: Mapping[WarehouseSuggestionSubjectKind, AllowedSubjectIds]
WarehouseSuggestionSubjectKind.SAVED_QUERY: allowed_saved_query_ids,
WarehouseSuggestionSubjectKind.TABLE: allowed_table_ids,
}
+CATALOG_KINDS = frozenset({WarehouseSuggestionKind.CERTIFY, WarehouseSuggestionKind.DEPRECATE})
+EDITOR_LEVEL: "AccessControlLevel" = "editor"
+
+
+def can_take(team: "Team", user: "User", suggestion: WarehouseSuggestion) -> bool:
+ """Whether `user` has access to the project and every edit access accepting `suggestion` needs."""
+ if not team.all_users_with_access().filter(id=user.id).exists():
+ return False
+ user_access_control = UserAccessControl(user, team)
+ if suggestion.kind in CATALOG_KINDS and not user_access_control.check_access_level_for_resource(
+ "data_catalog", required_level=EDITOR_LEVEL
+ ):
+ return False
+ allowed_ids = ALLOWED_SUBJECT_IDS[WarehouseSuggestionSubjectKind(suggestion.subject_kind)]
+ return suggestion.subject_id in allowed_ids(
+ team.pk, user_access_control, required_level=EDITOR_LEVEL, ids=[suggestion.subject_id]
+ )
@frozen
@@ -61,6 +81,7 @@ def visible_suggestions(
kind: WarehouseSuggestionKind | None = None,
status: WarehouseSuggestionStatus | None = None,
subject_id: UUID | None = None,
+ assignee_id: int | None = None,
subject_kinds: SubjectKinds,
) -> tuple[QuerySet[WarehouseSuggestion], SubjectAccess]:
suggestions = (
@@ -76,10 +97,12 @@ def visible_suggestions(
suggestions = suggestions.filter(status=status)
if subject_id is not None:
suggestions = suggestions.filter(subject_id=subject_id)
+ if assignee_id is not None:
+ suggestions = suggestions.filter(assignee_id=assignee_id)
access = subject_access(team_id, user_access_control, suggestions, actionable_kinds=subject_kinds.actionable)
visible = (
suggestions.filter(access.readable_q())
- .select_related("reviewed_by")
+ .select_related("reviewed_by", "assignee")
.annotate(kind_position=_kind_position(RULES.lifecycle.kind_order))
.order_by("kind_position", "-score", "id")
)
diff --git a/products/warehouse_suggestions/backend/logic/analytics.py b/products/warehouse_suggestions/backend/logic/analytics.py
index e33a14d543c7..efa6085ff418 100644
--- a/products/warehouse_suggestions/backend/logic/analytics.py
+++ b/products/warehouse_suggestions/backend/logic/analytics.py
@@ -33,6 +33,7 @@ class SuggestionOutcome(StrEnum):
CREATED = "created"
SURFACED = "surfaced"
ACCEPTED = "accepted"
+ ASSIGNED = "assigned"
DISMISSED = "dismissed"
RESUMED = "resumed"
REPROPOSED = "reproposed"
@@ -77,4 +78,5 @@ def _properties(suggestion: WarehouseSuggestion, now: datetime, *, is_system: bo
if suggestion.surfaced_at
else None,
"is_system": is_system,
+ "has_assignee": suggestion.assignee_id is not None,
}
diff --git a/products/warehouse_suggestions/backend/logic/assignment.py b/products/warehouse_suggestions/backend/logic/assignment.py
new file mode 100644
index 000000000000..ca76b9e9fd0a
--- /dev/null
+++ b/products/warehouse_suggestions/backend/logic/assignment.py
@@ -0,0 +1,204 @@
+from collections import defaultdict
+from collections.abc import Mapping, Sequence
+from typing import TYPE_CHECKING
+from uuid import UUID
+
+from django.db import transaction
+
+import structlog
+
+from posthog.dataclasses import frozen
+from posthog.models import User
+from posthog.scopes import APIScopeObject
+
+from products.notifications.backend.facade.api import (
+ NotificationData,
+ NotificationType,
+ TargetType,
+ create_notification,
+)
+
+from ..facade.contracts import AssigneeCannotActError, SuggestionNotOpenError
+from ..facade.enums import WarehouseSuggestionKind, WarehouseSuggestionStatus, WarehouseSuggestionSubjectKind
+from ..models import WarehouseSuggestion
+from .access import CATALOG_KINDS, can_take
+from .candidates.base import CandidateContext
+from .payloads import payload_from_json
+
+if TYPE_CHECKING:
+ from posthog.models import Team
+
+LOGGER = structlog.get_logger(__name__)
+
+KIND_ACTIONS: Mapping[WarehouseSuggestionKind, str] = {
+ WarehouseSuggestionKind.CERTIFY: "certify",
+ WarehouseSuggestionKind.DEPRECATE: "deprecate",
+ WarehouseSuggestionKind.MATERIALIZE: "materialize",
+ WarehouseSuggestionKind.UNMATERIALIZE: "stop materializing",
+}
+NOTIFIED_RESOURCE: APIScopeObject = "warehouse_objects"
+NOTIFICATION_TITLE_MAX_LENGTH = 255
+ELLIPSIS = "…"
+MANUAL_ASSIGNMENT_BODY = "Open it to see why PostHog suggests it, then accept or dismiss it."
+
+Assignments = Mapping[User, Sequence[WarehouseSuggestion]]
+
+
+def assign_surfaced(
+ context: CandidateContext, team: "Team", surfaced: Sequence[WarehouseSuggestion]
+) -> dict[User, list[WarehouseSuggestion]]:
+ """Assign each unassigned surfaced view suggestion to the view's creator, when they can accept it."""
+ creators = _view_creators(context, surfaced)
+ assigned: defaultdict[User, list[WarehouseSuggestion]] = defaultdict(list)
+ for row in surfaced:
+ assignee = _surfaced_assignee(team, row, creators.get(row.subject_id))
+ if not _assign_if_unchanged(team, row, assignee):
+ continue
+ row.assignee = assignee
+ if assignee is not None:
+ assigned[assignee].append(row)
+ return assigned
+
+
+def _assign_if_unchanged(team: "Team", row: WarehouseSuggestion, assignee: User | None) -> bool:
+ """Write `assignee` only if nobody decided or reassigned the suggestion since the job read it."""
+ return bool(
+ WarehouseSuggestion.objects.for_team(team.pk)
+ .filter(id=row.id, status=WarehouseSuggestionStatus.PROPOSED, assignee_id=row.assignee_id)
+ .update(assignee=assignee)
+ )
+
+
+@frozen
+class Assignment:
+ suggestion: WarehouseSuggestion
+ changed: bool
+
+
+def assign(team: "Team", suggestion_id: UUID, assignee_id: int | None, *, assigned_by: User) -> Assignment:
+ with transaction.atomic():
+ suggestion = WarehouseSuggestion.objects.for_team(team.pk).select_for_update().get(id=suggestion_id)
+ if suggestion.status != WarehouseSuggestionStatus.PROPOSED:
+ raise SuggestionNotOpenError()
+ if suggestion.assignee_id == assignee_id:
+ return Assignment(suggestion=suggestion, changed=False)
+ assignee = _assignable_user(team, suggestion, assignee_id)
+ suggestion.assignee = assignee
+ suggestion.save(update_fields=["assignee"])
+ if assignee is not None and assignee != assigned_by:
+ notify_assigned(team, suggestion, assignee, assigned_by=assigned_by)
+ return Assignment(suggestion=suggestion, changed=True)
+
+
+def _assignable_user(team: "Team", suggestion: WarehouseSuggestion, assignee_id: int | None) -> User | None:
+ if assignee_id is None:
+ return None
+ assignee = User.objects.filter(id=assignee_id).first()
+ if assignee is None or not can_take(team, assignee, suggestion):
+ raise AssigneeCannotActError()
+ return assignee
+
+
+def notify_surfaced(team: "Team", assigned: Assignments, run_id: str) -> None:
+ for assignee, rows in assigned.items():
+ _notify(
+ team,
+ assignee,
+ title=_surfaced_title(rows),
+ body="\n".join(_sentence_case(_proposal(row)) for row in rows),
+ source_url=_source_url(team, rows[0]),
+ idempotency_key=f"warehouse-suggestions-{run_id}-{assignee.pk}",
+ )
+
+
+def notify_assigned(team: "Team", suggestion: WarehouseSuggestion, assignee: User, *, assigned_by: User) -> None:
+ proposal = _proposal(suggestion)
+ _notify(
+ team,
+ assignee,
+ title=f"{assigned_by.first_name} assigned you a suggestion to {proposal}",
+ body=f"{_sentence_case(proposal)}. {MANUAL_ASSIGNMENT_BODY}",
+ source_url=_source_url(team, suggestion),
+ resource_id=str(suggestion.subject_id),
+ )
+
+
+def _view_creators(context: CandidateContext, rows: Sequence[WarehouseSuggestion]) -> dict[UUID, User]:
+ creator_ids = {
+ row.subject_id: definition.created_by_id
+ for row in rows
+ if row.subject_kind == WarehouseSuggestionSubjectKind.SAVED_QUERY
+ and (definition := context.inventory.saved_queries.get(row.subject_id)) is not None
+ and definition.created_by_id is not None
+ }
+ users = User.objects.in_bulk(set(creator_ids.values()))
+ return {subject_id: users[user_id] for subject_id, user_id in creator_ids.items() if user_id in users}
+
+
+def _surfaced_assignee(team: "Team", row: WarehouseSuggestion, creator: User | None) -> User | None:
+ """The current assignee if they can still accept the suggestion, else the view's creator if they can."""
+ return next(
+ (
+ candidate
+ for candidate in (row.assignee, creator)
+ if candidate is not None and can_take(team, candidate, row)
+ ),
+ None,
+ )
+
+
+def _surfaced_title(rows: Sequence[WarehouseSuggestion]) -> str:
+ if len(rows) == 1:
+ return f"PostHog suggests you {_proposal(rows[0])}"
+ return f"PostHog has {len(rows)} new warehouse suggestions for you"
+
+
+def _proposal(row: WarehouseSuggestion) -> str:
+ kind = WarehouseSuggestionKind(row.kind)
+ subject_name = payload_from_json(kind, row.payload_version, row.payload).subject_name
+ return f"{KIND_ACTIONS[kind]} {subject_name}"
+
+
+def _sentence_case(text: str) -> str:
+ return text[:1].upper() + text[1:]
+
+
+def _source_url(team: "Team", row: WarehouseSuggestion) -> str:
+ if row.kind in CATALOG_KINDS:
+ return f"/project/{team.pk}/data-catalog?tab=certifications"
+ return f"/project/{team.pk}/models?tab=models"
+
+
+def _bounded_title(title: str) -> str:
+ if len(title) <= NOTIFICATION_TITLE_MAX_LENGTH:
+ return title
+ return title[: NOTIFICATION_TITLE_MAX_LENGTH - len(ELLIPSIS)] + ELLIPSIS
+
+
+def _notify(
+ team: "Team",
+ assignee: User,
+ *,
+ title: str,
+ body: str,
+ source_url: str,
+ resource_id: str = "",
+ idempotency_key: str | None = None,
+) -> None:
+ try:
+ create_notification(
+ NotificationData(
+ team_id=team.pk,
+ notification_type=NotificationType.WAREHOUSE_SUGGESTION_ASSIGNED,
+ title=_bounded_title(title),
+ body=body,
+ target_type=TargetType.USER,
+ target_id=str(assignee.pk),
+ resource_type=NOTIFIED_RESOURCE,
+ resource_id=resource_id,
+ source_url=source_url,
+ idempotency_key=idempotency_key,
+ )
+ )
+ except Exception:
+ LOGGER.exception("Could not send a warehouse suggestion notification", user_id=assignee.pk)
diff --git a/products/warehouse_suggestions/backend/logic/lifecycle.py b/products/warehouse_suggestions/backend/logic/lifecycle.py
index 370dd1424c3b..bc7076bb11df 100644
--- a/products/warehouse_suggestions/backend/logic/lifecycle.py
+++ b/products/warehouse_suggestions/backend/logic/lifecycle.py
@@ -19,6 +19,7 @@ from ..facade.enums import (
)
from ..models import WarehouseSuggestion
from .analytics import SuggestionOutcome, report_outcomes
+from .assignment import assign_surfaced, notify_surfaced
from .candidates.base import CandidateContext
from .candidates.registry import CANDIDATES
from .reads import Subject
@@ -59,6 +60,7 @@ def apply_run(
auto_resolved = _auto_resolve(context, fingerprints)
expired = _expire(context, fingerprints, now)
surfaced = _surface(context.team_id, context.rules.lifecycle, now) if surface else []
+ assigned = assign_surfaced(context, team, surfaced)
assets_reconciled = _reconcile_assets(context)
outcomes: OutcomeBatches = (
(SuggestionOutcome.CREATED, created),
@@ -69,6 +71,7 @@ def apply_run(
(SuggestionOutcome.SURFACED, surfaced),
)
transaction.on_commit(partial(_report_all, outcomes, team))
+ transaction.on_commit(partial(notify_surfaced, team, assigned, context.run_id))
return LifecycleResult(
created=len(created),
reproposed=len(reopened.reproposed),
@@ -209,7 +212,7 @@ def _surface(team_id: int, rules: LifecycleRules, now: datetime) -> list[Warehou
rules.max_open_per_kind,
)
suggestions.filter(id__in=chosen).update(surfaced_at=now)
- return list(suggestions.filter(id__in=chosen))
+ return list(suggestions.filter(id__in=chosen).select_related("assignee"))
def _pick_in_turns(
diff --git a/products/warehouse_suggestions/backend/migrations/0005_warehouse_suggestion_assignee.py b/products/warehouse_suggestions/backend/migrations/0005_warehouse_suggestion_assignee.py
new file mode 100644
index 000000000000..30406d756553
--- /dev/null
+++ b/products/warehouse_suggestions/backend/migrations/0005_warehouse_suggestion_assignee.py
@@ -0,0 +1,27 @@
+# Generated by Django 5.2.18 on 2026-10-26 17:41
+
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("warehouse_suggestions", "0004_realized_savings"),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="warehousesuggestion",
+ name="assignee",
+ field=models.ForeignKey(
+ blank=True,
+ db_constraint=False,
+ null=True,
+ on_delete=django.db.models.deletion.SET_NULL,
+ related_name="+",
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ ]
diff --git a/products/warehouse_suggestions/backend/migrations/max_migration.txt b/products/warehouse_suggestions/backend/migrations/max_migration.txt
index 92987d6c880e..dc53f208dead 100644
--- a/products/warehouse_suggestions/backend/migrations/max_migration.txt
+++ b/products/warehouse_suggestions/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0004_realized_savings
+0005_warehouse_suggestion_assignee
diff --git a/products/warehouse_suggestions/backend/models.py b/products/warehouse_suggestions/backend/models.py
index b4fa8a3a5bad..4795637f6dc0 100644
--- a/products/warehouse_suggestions/backend/models.py
+++ b/products/warehouse_suggestions/backend/models.py
@@ -37,6 +37,9 @@ class WarehouseSuggestion(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):
"posthog.User", on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False, related_name="+"
)
reviewed_at = models.DateTimeField(null=True, blank=True)
+ assignee = models.ForeignKey(
+ "posthog.User", on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False, related_name="+"
+ )
dismissal_reason = models.CharField(
max_length=16, choices=WarehouseSuggestionDismissalReason.choices, null=True, blank=True
)
diff --git a/products/warehouse_suggestions/backend/presentation/serializers.py b/products/warehouse_suggestions/backend/presentation/serializers.py
index 991f824432c3..7566d3383f8a 100644
--- a/products/warehouse_suggestions/backend/presentation/serializers.py
+++ b/products/warehouse_suggestions/backend/presentation/serializers.py
@@ -228,6 +228,11 @@ class WarehouseSuggestionSerializer(DataclassSerializer):
reviewed_by = WarehouseSuggestionReviewerSerializer(
allow_null=True, help_text="Who accepted or dismissed this suggestion. Null while it is open."
)
+ assignee = WarehouseSuggestionReviewerSerializer(
+ allow_null=True,
+ help_text="Who should accept or dismiss this suggestion. When a view's suggestion is first shown, it goes to "
+ "the person who created the view, if they can accept it. Null when nobody is assigned.",
+ )
kind = serializers.ChoiceField(
choices=WarehouseSuggestionKind.choices,
help_text="What the suggestion proposes: certify, deprecate, materialize or unmaterialize the subject. "
@@ -301,6 +306,18 @@ class WarehouseSuggestionListQuerySerializer(serializers.Serializer):
subject_id = serializers.UUIDField(
required=False, help_text="Only return suggestions about the view or table with this ID."
)
+ assignee_id = serializers.IntegerField(
+ required=False, help_text="Only return suggestions assigned to the user with this ID."
+ )
+
+
+class AssignWarehouseSuggestionSerializer(serializers.Serializer):
+ assignee_id = serializers.IntegerField(
+ allow_null=True,
+ help_text="ID of the user to assign. They must be able to accept the suggestion: edit access to the view or "
+ "table, and to the data catalog for certify and deprecate suggestions. Null removes the assignee. The "
+ "assignee gets a notification unless they assign themselves.",
+ )
class DismissWarehouseSuggestionSerializer(serializers.Serializer):
diff --git a/products/warehouse_suggestions/backend/presentation/views.py b/products/warehouse_suggestions/backend/presentation/views.py
index 5bd4a00201b0..7f27ab8608ca 100644
--- a/products/warehouse_suggestions/backend/presentation/views.py
+++ b/products/warehouse_suggestions/backend/presentation/views.py
@@ -30,6 +30,7 @@ from ..facade.contracts import (
AcceptFailedError,
AcceptOptionRefusedError,
AcceptOptions,
+ AssigneeCannotActError,
CatalogEditAccessRequiredError,
SubjectAlreadyCertifiedError,
SubjectEditAccessRequiredError,
@@ -37,6 +38,7 @@ from ..facade.contracts import (
Suggestion,
SuggestionAlreadyDecidedError,
SuggestionNotFoundError,
+ SuggestionNotOpenError,
SuggestionOutdatedError,
SuggestionPage,
SuggestionSubjectGoneError,
@@ -44,6 +46,7 @@ from ..facade.contracts import (
from ..facade.enums import WarehouseSuggestionKind, WarehouseSuggestionStatus, WarehouseSuggestionSubjectKind
from .serializers import (
AcceptWarehouseSuggestionSerializer,
+ AssignWarehouseSuggestionSerializer,
DismissWarehouseSuggestionSerializer,
WarehouseSuggestionListQuerySerializer,
WarehouseSuggestionSerializer,
@@ -66,6 +69,11 @@ ALREADY_CERTIFIED = {
WarehouseSuggestionSubjectKind.TABLE: "This table already has a certification.",
}
CATALOG_EDIT_ACCESS_REQUIRED = "You need edit access to the data catalog to accept this suggestion."
+ASSIGNEE_CANNOT_ACT = (
+ "This person can't accept this suggestion. Pick someone with edit access to the view or table, "
+ "and to the data catalog for certify and deprecate suggestions."
+)
+ONLY_OPEN_ASSIGNABLE = "Only open suggestions can be assigned."
ACCEPT_SCOPES = ["data_catalog_approval:write", "warehouse_view:write"]
ScopeLevel = Literal["read", "write"]
SUBJECT_SCOPE_OBJECTS = {
@@ -96,7 +104,7 @@ class ProjectAccessPermission(BasePermission):
class WarehouseSuggestionViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
scope_object = "warehouse_objects"
scope_object_read_actions = ["list", "retrieve", "status"]
- scope_object_write_actions = ["accept", "dismiss", "resume"]
+ scope_object_write_actions = ["accept", "assign", "dismiss", "resume"]
pagination_class = SuggestionPagination
lookup_value_regex = UUID_REGEX
@@ -153,6 +161,7 @@ class WarehouseSuggestionViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
kind=WarehouseSuggestionKind(kind) if kind else None,
status=WarehouseSuggestionStatus(status) if status else None,
subject_id=request.validated_query_data.get("subject_id"),
+ assignee_id=request.validated_query_data.get("assignee_id"),
subject_kinds=self._subject_kinds,
limit=limit,
offset=offset,
@@ -208,6 +217,23 @@ class WarehouseSuggestionViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
)
)
+ @validated_request(
+ request_serializer=AssignWarehouseSuggestionSerializer,
+ responses={200: OpenApiResponse(response=WarehouseSuggestionSerializer)},
+ )
+ @action(detail=True, methods=["post"])
+ def assign(self, request: ValidatedRequest, pk: str, **kwargs: Any) -> Response:
+ return self._respond(
+ lambda: api.assign_suggestion(
+ self.team,
+ self.user_access_control,
+ UUID(pk),
+ user=cast(User, request.user),
+ assignee_id=request.validated_data["assignee_id"],
+ subject_kinds=self._subject_kinds,
+ )
+ )
+
@extend_schema(request=None, responses={200: WarehouseSuggestionSerializer})
@action(detail=True, methods=["post"])
def resume(self, request: Request, pk: str, **kwargs: Any) -> Response:
@@ -242,3 +268,7 @@ class WarehouseSuggestionViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
raise Conflict(str(error))
except AcceptFailedError as error:
raise APIException(str(error))
+ except AssigneeCannotActError:
+ raise ValidationError({"assignee_id": ASSIGNEE_CANNOT_ACT})
+ except SuggestionNotOpenError:
+ raise Conflict(ONLY_OPEN_ASSIGNABLE)
diff --git a/products/warehouse_suggestions/backend/tests/test_api.py b/products/warehouse_suggestions/backend/tests/test_api.py
index 1836524f06e5..ac9d66f74d63 100644
--- a/products/warehouse_suggestions/backend/tests/test_api.py
+++ b/products/warehouse_suggestions/backend/tests/test_api.py
@@ -1,5 +1,6 @@
import json
from dataclasses import replace
+from typing import Any
from uuid import UUID
from posthog.test.base import APIBaseTest
@@ -13,6 +14,7 @@ from parameterized import parameterized
from rest_framework import status
from posthog.constants import AvailableFeature
+from posthog.models import User
from posthog.models.activity_logging.activity_log import ActivityLog
from posthog.models.personal_api_key import PersonalAPIKey
from posthog.models.utils import generate_random_token_personal, hash_key_value
@@ -20,6 +22,7 @@ from posthog.models.utils import generate_random_token_personal, hash_key_value
from products.access_control.backend.models.access_control import AccessControl
from products.data_modeling.backend.facade.models import DataWarehouseSavedQuery
from products.warehouse_sources.backend.facade.models import DataWarehouseTable, ExternalDataSchema, ExternalDataSource
+from products.warehouse_suggestions.backend.facade import api
from products.warehouse_suggestions.backend.facade.contracts import (
DeprecatePayload,
MaterializePayload,
@@ -40,6 +43,7 @@ from .test_suggestions import ingest_one, make_draft
REVIEW_FIELDS = ("reviewed_by_id", "reviewed_at", "dismissal_reason", "dismissal_note", "dismissed_at_score")
FLAG = "products.warehouse_suggestions.backend.presentation.views.is_warehouse_suggestions_enabled"
+NOTIFY = "products.warehouse_suggestions.backend.logic.assignment.create_notification"
def ingest_surfaced(team_id: int, draft: SuggestionDraft) -> WarehouseSuggestion:
@@ -192,6 +196,7 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
("dismiss_a_dismissed_one", WarehouseSuggestionStatus.DISMISSED, "dismiss"),
("resume_an_expired_one", WarehouseSuggestionStatus.EXPIRED, "resume"),
("accept_a_dismissed_one", WarehouseSuggestionStatus.DISMISSED, "accept"),
+ ("assign_an_accepted_one", WarehouseSuggestionStatus.ACCEPTED, "assign"),
]
)
def test_a_move_people_may_not_make_conflicts(
@@ -201,17 +206,81 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
WarehouseSuggestion.objects.for_team(self.team.id).filter(id=suggestion.id).update(status=current)
response = self.client.post(
- f"{self.url}/{suggestion.id}/{action}/", {"reason": WarehouseSuggestionDismissalReason.NOT_NOW}
+ f"{self.url}/{suggestion.id}/{action}/",
+ {"reason": WarehouseSuggestionDismissalReason.NOT_NOW, "assignee_id": self.user.id},
)
assert response.status_code == status.HTTP_409_CONFLICT, response.json()
+ @parameterized.expand(
+ [
+ ("a_teammate_who_can_edit", "teammate", "self", status.HTTP_200_OK, True),
+ ("themselves", "self", "teammate", status.HTTP_200_OK, False),
+ ("the_same_teammate_again", "teammate", "teammate", status.HTTP_200_OK, False),
+ ("nobody", "nobody", "self", status.HTTP_200_OK, False),
+ ("someone_outside_the_organization", "outsider", "self", status.HTTP_400_BAD_REQUEST, False),
+ ]
+ )
+ def test_assign(self, _name: str, who: str, current: str, expected_status: int, expect_notified: bool) -> None:
+ assignees = {
+ "teammate": User.objects.create_and_join(self.organization, "[email protected]", None).id,
+ "self": self.user.id,
+ "nobody": None,
+ "outsider": User.objects.create(email="[email protected]").id,
+ }
+ suggestion = self._suggest_materialize()
+ WarehouseSuggestion.objects.for_team(self.team.id).filter(id=suggestion.id).update(
+ assignee_id=assignees[current]
+ )
+
+ with patch(NOTIFY) as notify:
+ response = self.client.post(
+ f"{self.url}/{suggestion.id}/assign/",
+ json.dumps({"assignee_id": assignees[who]}),
+ content_type="application/json",
+ )
+
+ stored = WarehouseSuggestion.objects.for_team(self.team.id).get(id=suggestion.id).assignee_id
+ notified = [(call.args[0].target_id, call.args[0].resource_type) for call in notify.call_args_list]
+ expected_assignee = assignees[who] if expected_status == status.HTTP_200_OK else assignees[current]
+ assert (response.status_code, stored, notified) == (
+ expected_status,
+ expected_assignee,
+ [(str(assignees[who]), "warehouse_objects")] if expect_notified else [],
+ ), response.json()
+
+ def test_assign_refuses_a_suggestion_someone_decided_while_it_was_being_assigned(self) -> None:
+ teammate = User.objects.create_and_join(self.organization, "[email protected]", None)
+ suggestion = self._suggest_materialize()
+ read_suggestion = api._actionable_suggestion
+
+ def read_then_accepted_elsewhere(*args: Any, **kwargs: Any) -> Any:
+ read = read_suggestion(*args, **kwargs)
+ WarehouseSuggestion.objects.for_team(self.team.id).filter(id=suggestion.id).update(
+ status=WarehouseSuggestionStatus.ACCEPTED
+ )
+ return read
+
+ with (
+ patch.object(api, "_actionable_suggestion", side_effect=read_then_accepted_elsewhere),
+ patch(NOTIFY) as notify,
+ ):
+ response = self.client.post(
+ f"{self.url}/{suggestion.id}/assign/",
+ json.dumps({"assignee_id": teammate.id}),
+ content_type="application/json",
+ )
+
+ stored = WarehouseSuggestion.objects.for_team(self.team.id).get(id=suggestion.id).assignee_id
+ assert (response.status_code, stored, notify.call_count) == (status.HTTP_409_CONFLICT, None, 0)
+
@parameterized.expand(
[
("by_kind", "kind=deprecate", status.HTTP_200_OK, ["table"]),
("by_status", "status=dismissed", status.HTTP_200_OK, ["table"]),
("by_kind_and_status", "kind=certify&status=dismissed", status.HTTP_200_OK, []),
("by_subject", "subject_id={view_id}", status.HTTP_200_OK, ["view"]),
+ ("by_assignee", "assignee_id={user_id}", status.HTTP_200_OK, ["view"]),
("unknown_status", "status=bogus", status.HTTP_400_BAD_REQUEST, None),
]
)
@@ -220,6 +289,7 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
"view": self._suggest(self.view.id).id,
"table": self._suggest(self.table.id, subject_kind=WarehouseSuggestionSubjectKind.TABLE).id,
}
+ WarehouseSuggestion.objects.for_team(self.team.id).filter(id=ids["view"]).update(assignee=self.user)
WarehouseSuggestion.objects.for_team(self.team.id).filter(id=ids["table"]).update(
kind=WarehouseSuggestionKind.DEPRECATE,
status=WarehouseSuggestionStatus.DISMISSED,
@@ -228,7 +298,7 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
),
)
- response = self.client.get(f"{self.url}/?{query.format(view_id=self.view.id)}")
+ response = self.client.get(f"{self.url}/?{query.format(view_id=self.view.id, user_id=self.user.id)}")
assert response.status_code == expected_status, response.json()
if expected is not None:
@@ -265,13 +335,16 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
bearer = self._bearer(scopes)
listed = self.client.get(f"{self.url}/", HTTP_AUTHORIZATION=bearer)
- dismissed = {
- name: self.client.post(
- f"{self.url}/{suggestion_id}/dismiss/",
- {"reason": WarehouseSuggestionDismissalReason.NOT_NOW},
- HTTP_AUTHORIZATION=bearer,
- ).status_code
- for name, suggestion_id in ids.items()
+ decided = {
+ action: {
+ name: self.client.post(
+ f"{self.url}/{suggestion_id}/{action}/",
+ {"reason": WarehouseSuggestionDismissalReason.NOT_NOW, "assignee_id": self.user.id},
+ HTTP_AUTHORIZATION=bearer,
+ ).status_code
+ for name, suggestion_id in ids.items()
+ }
+ for action in ("assign", "dismiss")
}
if expected_can_act is None:
@@ -280,7 +353,7 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
names_by_id = {str(suggestion_id): name for name, suggestion_id in ids.items()}
listed_can_act = {names_by_id[row["id"]]: row["can_act"] for row in listed.json()["results"]}
assert listed_can_act == expected_can_act
- assert dismissed == expected_dismiss
+ assert decided == {"assign": expected_dismiss, "dismiss": expected_dismiss}
def test_a_token_without_a_write_scope_is_told_which_one_to_add(self) -> None:
suggestion = self._suggest(self.view.id)
@@ -392,6 +465,7 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
[
("dismiss_as_view_viewer", "dismiss", "warehouse_view", False),
("accept_as_view_viewer", "accept", "warehouse_view", False),
+ ("assign_as_view_viewer", "assign", "warehouse_view", False),
("certify_as_catalog_viewer", "accept", "data_catalog", True),
]
)
@@ -403,7 +477,8 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
listed = self.client.get(f"{self.url}/")
decided = self.client.post(
- f"{self.url}/{suggestion.id}/{action}/", {"reason": WarehouseSuggestionDismissalReason.NOT_USEFUL}
+ f"{self.url}/{suggestion.id}/{action}/",
+ {"reason": WarehouseSuggestionDismissalReason.NOT_USEFUL, "assignee_id": self.user.id},
)
assert listed.json()["results"][0]["can_act"] is expected_can_act
@@ -423,7 +498,7 @@ class TestWarehouseSuggestionAPI(APIBaseTest):
def test_listing_runs_a_constant_number_of_queries(self) -> None:
def count_list_queries() -> int:
- WarehouseSuggestion.objects.for_team(self.team.id).update(reviewed_by=self.user)
+ WarehouseSuggestion.objects.for_team(self.team.id).update(reviewed_by=self.user, assignee=self.user)
with CaptureQueriesContext(connection) as queries:
assert self.client.get(f"{self.url}/").status_code == status.HTTP_200_OK
return len(queries)
diff --git a/products/warehouse_suggestions/backend/tests/test_lifecycle.py b/products/warehouse_suggestions/backend/tests/test_lifecycle.py
index 13f181e6e10a..95b8a5938ac5 100644
--- a/products/warehouse_suggestions/backend/tests/test_lifecycle.py
+++ b/products/warehouse_suggestions/backend/tests/test_lifecycle.py
@@ -10,6 +10,11 @@ from django.test import SimpleTestCase
from parameterized import parameterized
+from posthog.constants import AvailableFeature
+from posthog.models import Team, User
+
+from products.access_control.backend.models.access_control import AccessControl
+from products.data_modeling.backend.facade.models import DataWarehouseSavedQuery
from products.warehouse_suggestions.backend.facade.contracts import (
CertifyPayload,
DeprecatePayload,
@@ -24,6 +29,7 @@ from products.warehouse_suggestions.backend.facade.enums import (
WarehouseSuggestionKind,
WarehouseSuggestionStatus,
)
+from products.warehouse_suggestions.backend.logic.access import can_take
from products.warehouse_suggestions.backend.logic.candidates.base import CandidateContext
from products.warehouse_suggestions.backend.logic.candidates.registry import CANDIDATES
from products.warehouse_suggestions.backend.logic.lifecycle import _pick_in_turns, apply_run
@@ -34,6 +40,8 @@ from products.warehouse_suggestions.backend.tests.factories import busy_reads, c
from .test_accept import REPORT
+NOTIFY = "products.warehouse_suggestions.backend.logic.assignment.create_notification"
+CAN_TAKE = "products.warehouse_suggestions.backend.logic.assignment.can_take"
NOW = datetime(2026, 10, 7, 9, tzinfo=UTC)
READ_COST_BEFORE = {"read_seconds_per_month": 5000.0, "read_bytes_per_month": 5e12, "human_reads_per_month": 200.0}
REFRESH_COST_BEFORE = {"refresh_seconds_per_month": 5000.0, "refresh_bytes_per_month": 5e12}
@@ -254,6 +262,130 @@ class TestApplyRun(BaseTest):
revived = WarehouseSuggestion.objects.for_team(self.team.pk).get()
assert (revived.status, revived.surfaced_at) == (WarehouseSuggestionStatus.PROPOSED, None)
+ @parameterized.expand(
+ [
+ ("creator_who_can_edit", "member", WarehouseSuggestionKind.MATERIALIZE, True),
+ ("creator_who_left_the_organization", "left", WarehouseSuggestionKind.MATERIALIZE, False),
+ ("creator_who_cannot_edit_the_catalog", "catalog_viewer", WarehouseSuggestionKind.CERTIFY, False),
+ ("no_creator", "none", WarehouseSuggestionKind.MATERIALIZE, False),
+ ]
+ )
+ def test_assigns_surfaced_view_suggestions_to_a_creator_who_can_accept_them(
+ self, _name: str, creator_state: str, kind: WarehouseSuggestionKind, expect_assigned: bool
+ ) -> None:
+ creator = self._creator(creator_state)
+ views = [
+ DataWarehouseSavedQuery.objects.create(
+ team=self.team, name=name, query={"kind": "HogQLQuery", "query": "SELECT 1"}, created_by=creator
+ )
+ for name in ("orders", "refunds")
+ ]
+ if creator_state == "catalog_viewer":
+ self._restrict_catalog_to_viewer()
+ ctx = context(
+ team_reads({}),
+ views=[view(saved_query.id, created_by_id=creator.pk if creator else None) for saved_query in views],
+ team_id=self.team.pk,
+ )
+ drafts = [self._draft(ctx, kind, saved_query.id, 1) for saved_query in views]
+
+ with patch(NOTIFY) as notify, self.captureOnCommitCallbacks(execute=True):
+ apply_run(ctx, self.team, drafts, NOW, surface=True)
+
+ assignee_ids = set(WarehouseSuggestion.objects.for_team(self.team.pk).values_list("assignee_id", flat=True))
+ notified = [call.args[0].target_id for call in notify.call_args_list]
+ expected_assignee = creator.pk if expect_assigned and creator else None
+ assert (assignee_ids, notified) == (
+ {expected_assignee},
+ [str(expected_assignee)] if expect_assigned else [],
+ )
+
+ @parameterized.expand([("kept_access_to_the_view", False), ("lost_access_to_the_view", True)])
+ def test_a_resurfaced_suggestion_keeps_its_assignee_only_while_they_can_accept_it(
+ self, _name: str, access_revoked: bool
+ ) -> None:
+ teammate = User.objects.create_and_join(self.organization, "[email protected]", None)
+ saved_query = DataWarehouseSavedQuery.objects.create(
+ team=self.team, name="orders", query={"kind": "HogQLQuery", "query": "SELECT 1"}
+ )
+ ctx = context(team_reads({}), views=[view(saved_query.id)], team_id=self.team.pk)
+ draft = self._draft(ctx, WarehouseSuggestionKind.MATERIALIZE, saved_query.id, 1)
+ apply_run(ctx, self.team, [draft], NOW, surface=False)
+ WarehouseSuggestion.objects.for_team(self.team.pk).update(assignee=teammate)
+ if access_revoked:
+ self._enable_access_control()
+ AccessControl.objects.create(
+ team=self.team,
+ resource="warehouse_view",
+ resource_id=str(saved_query.id),
+ organization_member=teammate.organization_memberships.get(),
+ access_level="none",
+ )
+
+ with patch(NOTIFY) as notify, self.captureOnCommitCallbacks(execute=True):
+ apply_run(ctx, self.team, [draft], NOW, surface=True)
+
+ row = WarehouseSuggestion.objects.for_team(self.team.pk).get()
+ notified = [call.args[0].target_id for call in notify.call_args_list]
+ assert (row.surfaced_at is not None, row.assignee_id, notified) == (
+ True,
+ None if access_revoked else teammate.pk,
+ [] if access_revoked else [str(teammate.pk)],
+ )
+
+ @parameterized.expand(
+ [
+ ("accepted_during_the_run", {"status": WarehouseSuggestionStatus.ACCEPTED}, None),
+ ("reassigned_during_the_run", {"assignee_id": "teammate"}, "teammate"),
+ ]
+ )
+ def test_the_job_leaves_a_suggestion_someone_changed_while_it_was_assigning(
+ self, _name: str, change: dict[str, object], expected_assignee: str | None
+ ) -> None:
+ teammate = User.objects.create_and_join(self.organization, "[email protected]", None)
+ saved_query = DataWarehouseSavedQuery.objects.create(
+ team=self.team, name="orders", query={"kind": "HogQLQuery", "query": "SELECT 1"}, created_by=self.user
+ )
+ ctx = context(team_reads({}), views=[view(saved_query.id, created_by_id=self.user.pk)], team_id=self.team.pk)
+ draft = self._draft(ctx, WarehouseSuggestionKind.MATERIALIZE, saved_query.id, 1)
+ concurrent_change = {key: teammate.pk if value == "teammate" else value for key, value in change.items()}
+
+ def checked_while_someone_changes_it(team: Team, user: User, suggestion: WarehouseSuggestion) -> bool:
+ WarehouseSuggestion.objects.for_team(self.team.pk).update(**concurrent_change)
+ return can_take(team, user, suggestion)
+
+ with (
+ patch(CAN_TAKE, side_effect=checked_while_someone_changes_it),
+ patch(NOTIFY) as notify,
+ self.captureOnCommitCallbacks(execute=True),
+ ):
+ apply_run(ctx, self.team, [draft], NOW, surface=True)
+
+ row = WarehouseSuggestion.objects.for_team(self.team.pk).get()
+ assert (row.assignee_id, notify.call_count) == (teammate.pk if expected_assignee else None, 0)
+
+ def _enable_access_control(self) -> None:
+ self.organization.available_product_features = [
+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL}
+ ]
+ self.organization.save(update_fields=["available_product_features"])
+
+ def _creator(self, creator_state: str) -> User | None:
+ if creator_state == "none":
+ return None
+ if creator_state == "left":
+ return User.objects.create(email="[email protected]", first_name="Left")
+ return self.user
+
+ def _restrict_catalog_to_viewer(self) -> None:
+ self._enable_access_control()
+ AccessControl.objects.create(
+ team=self.team,
+ resource="data_catalog",
+ organization_member=self.organization_membership,
+ access_level="viewer",
+ )
+
def test_auto_resolves_when_the_view_is_gone_or_already_handled(self) -> None:
deleted_id, materialized_id = uuid4(), uuid4()
ctx = self._context(deleted_id, materialized_id)
diff --git a/products/warehouse_suggestions/frontend/components/CertificationSuggestionRow.tsx b/products/warehouse_suggestions/frontend/components/CertificationSuggestionRow.tsx
index 64a9824409bc..d00011ade1be 100644
--- a/products/warehouse_suggestions/frontend/components/CertificationSuggestionRow.tsx
+++ b/products/warehouse_suggestions/frontend/components/CertificationSuggestionRow.tsx
@@ -43,6 +43,8 @@ export function CertificationSuggestionRow({ suggestion, windowDays }: Certifica
return (
<SuggestionRow
suggestionId={suggestion.id}
+ assignee={suggestion.assignee}
+ canAct={suggestion.can_act}
leaving={leaving}
icon={
<Tooltip title={isTable ? 'Table' : 'View'}>
diff --git a/products/warehouse_suggestions/frontend/components/MaterializeSuggestionRow.tsx b/products/warehouse_suggestions/frontend/components/MaterializeSuggestionRow.tsx
index 86531bfd184b..39c1ed8961b4 100644
--- a/products/warehouse_suggestions/frontend/components/MaterializeSuggestionRow.tsx
+++ b/products/warehouse_suggestions/frontend/components/MaterializeSuggestionRow.tsx
@@ -40,6 +40,8 @@ export function MaterializeSuggestionRow({
return (
<SuggestionRow
suggestionId={suggestion.id}
+ assignee={suggestion.assignee}
+ canAct={suggestion.can_act}
leaving={leaving}
icon={iconForType('data_modeling')}
title={<SuggestionSubjectLink suggestion={suggestion} />}
diff --git a/products/warehouse_suggestions/frontend/components/SuggestedCertificationsTable.stories.tsx b/products/warehouse_suggestions/frontend/components/SuggestedCertificationsTable.stories.tsx
index b9d67ee219ca..f9706fbb1835 100644
--- a/products/warehouse_suggestions/frontend/components/SuggestedCertificationsTable.stories.tsx
+++ b/products/warehouse_suggestions/frontend/components/SuggestedCertificationsTable.stories.tsx
@@ -57,6 +57,7 @@ function suggestion(
realized_seconds_saved_per_month: null,
realized_bytes_saved_per_month: null,
can_act: canAct,
+ assignee: null,
}
}
diff --git a/products/warehouse_suggestions/frontend/components/SuggestedModelsStrip.stories.tsx b/products/warehouse_suggestions/frontend/components/SuggestedModelsStrip.stories.tsx
index fee5af17f905..7c3e81a1f30f 100644
--- a/products/warehouse_suggestions/frontend/components/SuggestedModelsStrip.stories.tsx
+++ b/products/warehouse_suggestions/frontend/components/SuggestedModelsStrip.stories.tsx
@@ -80,6 +80,7 @@ function materialize(
realized_seconds_saved_per_month: null,
realized_bytes_saved_per_month: null,
can_act: canAct,
+ assignee: null,
}
}
diff --git a/products/warehouse_suggestions/frontend/components/SuggestionAssigneeSelect.tsx b/products/warehouse_suggestions/frontend/components/SuggestionAssigneeSelect.tsx
new file mode 100644
index 000000000000..4d4cc1d8c3f4
--- /dev/null
+++ b/products/warehouse_suggestions/frontend/components/SuggestionAssigneeSelect.tsx
@@ -0,0 +1,48 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { MemberSelect } from 'lib/components/MemberSelect'
+
+import type { WarehouseSuggestionApi } from '../generated/api.schemas'
+import { warehouseSuggestionsLogic } from '../warehouseSuggestionsLogic'
+
+const EDIT_ACCESS_REASON = 'You need edit access to this view or table to assign its suggestion'
+
+export interface SuggestionAssigneeSelectProps {
+ suggestionId: string
+ assignee: WarehouseSuggestionApi['assignee']
+ canAct: boolean
+}
+
+export function SuggestionAssigneeSelect({
+ suggestionId,
+ assignee,
+ canAct,
+}: SuggestionAssigneeSelectProps): JSX.Element {
+ const { actionsInFlight } = useValues(warehouseSuggestionsLogic)
+ const { assignSuggestion } = useActions(warehouseSuggestionsLogic)
+
+ return (
+ <MemberSelect
+ value={assignee?.id ?? null}
+ defaultLabel="Unassigned"
+ onChange={(user) => assignSuggestion(suggestionId, user?.id ?? null)}
+ >
+ {() => (
+ <LemonButton
+ size="xsmall"
+ type="tertiary"
+ noPadding
+ loading={!!actionsInFlight[suggestionId]}
+ disabledReason={canAct ? undefined : EDIT_ACCESS_REASON}
+ data-attr="warehouse-suggestions-assign"
+ >
+ <span className="text-xs font-normal text-secondary">
+ {assignee ? `Assigned to ${assignee.first_name || assignee.email}` : 'Assign'}
+ </span>
+ </LemonButton>
+ )}
+ </MemberSelect>
+ )
+}
diff --git a/products/warehouse_suggestions/frontend/components/SuggestionRow.tsx b/products/warehouse_suggestions/frontend/components/SuggestionRow.tsx
index c3c3005f655e..de88e77fecac 100644
--- a/products/warehouse_suggestions/frontend/components/SuggestionRow.tsx
+++ b/products/warehouse_suggestions/frontend/components/SuggestionRow.tsx
@@ -2,7 +2,9 @@ import { ReactNode } from 'react'
import { cn } from 'lib/utils/css-classes'
+import type { WarehouseSuggestionApi } from '../generated/api.schemas'
import { SavingHighlight } from '../suggestionCopy'
+import { SuggestionAssigneeSelect } from './SuggestionAssigneeSelect'
const AMOUNT_CLASS = 'text-sm font-semibold tabular-nums text-success'
export const SAVING_COLUMNS_CLASS =
@@ -10,6 +12,8 @@ export const SAVING_COLUMNS_CLASS =
export interface SuggestionRowProps {
suggestionId: string
+ assignee: WarehouseSuggestionApi['assignee']
+ canAct: boolean
icon: ReactNode
title: ReactNode
meta: ReactNode[]
@@ -20,6 +24,8 @@ export interface SuggestionRowProps {
export function SuggestionRow({
suggestionId,
+ assignee,
+ canAct,
icon,
title,
meta,
@@ -57,7 +63,15 @@ export function SuggestionRow({
</div>
)}
<div className="flex flex-wrap items-baseline gap-x-4 gap-y-0.5 overflow-hidden text-xs text-secondary">
- {meta.map((item, index) => (
+ {[
+ ...meta,
+ <SuggestionAssigneeSelect
+ key="assignee"
+ suggestionId={suggestionId}
+ assignee={assignee}
+ canAct={canAct}
+ />,
+ ].map((item, index) => (
<span key={index} className="-ml-4 inline-flex items-baseline">
<span aria-hidden className="w-4 shrink-0 text-center text-muted">
·
diff --git a/products/warehouse_suggestions/frontend/components/UnmaterializeSuggestionRow.tsx b/products/warehouse_suggestions/frontend/components/UnmaterializeSuggestionRow.tsx
index 6f8a68b0dd8c..3154e4a75c58 100644
--- a/products/warehouse_suggestions/frontend/components/UnmaterializeSuggestionRow.tsx
+++ b/products/warehouse_suggestions/frontend/components/UnmaterializeSuggestionRow.tsx
@@ -40,6 +40,8 @@ export function UnmaterializeSuggestionRow({
return (
<SuggestionRow
suggestionId={suggestion.id}
+ assignee={suggestion.assignee}
+ canAct={suggestion.can_act}
leaving={leaving}
icon={iconForType('data_modeling')}
title={<SuggestionSubjectLink suggestion={suggestion} />}
diff --git a/products/warehouse_suggestions/frontend/generated/api.schemas.ts b/products/warehouse_suggestions/frontend/generated/api.schemas.ts
index 2b43f0ec9c93..e13e3bb7a673 100644
--- a/products/warehouse_suggestions/frontend/generated/api.schemas.ts
+++ b/products/warehouse_suggestions/frontend/generated/api.schemas.ts
@@ -243,6 +243,8 @@ export interface WarehouseSuggestionApi {
created_asset: WarehouseSuggestionApiCreatedAsset
/** Who accepted or dismissed this suggestion. Null while it is open. */
reviewed_by: WarehouseSuggestionReviewerApi | null
+ /** Who should accept or dismiss this suggestion. When a view's suggestion is first shown, it goes to the person who created the view, if they can accept it. Null when nobody is assigned. */
+ assignee: WarehouseSuggestionReviewerApi | null
/** What the suggestion proposes: certify, deprecate, materialize or unmaterialize the subject. unmaterialize turns a rarely read materialized view back into a plain view computed on read.
*
* * `certify` - Certify
@@ -361,6 +363,14 @@ export interface AcceptWarehouseSuggestionApi {
keep_materialized?: boolean
}
+export interface AssignWarehouseSuggestionApi {
+ /**
+ * ID of the user to assign. They must be able to accept the suggestion: edit access to the view or table, and to the data catalog for certify and deprecate suggestions. Null removes the assignee. The assignee gets a notification unless they assign themselves.
+ * @nullable
+ */
+ assignee_id: number | null
+}
+
export interface DismissWarehouseSuggestionApi {
/** Why the suggestion is dismissed.
*
@@ -397,6 +407,10 @@ export interface WarehouseSuggestionStatusApi {
}
export type WarehouseSuggestionsListParams = {
+ /**
+ * Only return suggestions assigned to the user with this ID.
+ */
+ assignee_id?: number
/**
* Only return suggestions of this kind.
*
diff --git a/products/warehouse_suggestions/frontend/generated/api.ts b/products/warehouse_suggestions/frontend/generated/api.ts
index efba48811146..073cccbc2f15 100644
--- a/products/warehouse_suggestions/frontend/generated/api.ts
+++ b/products/warehouse_suggestions/frontend/generated/api.ts
@@ -10,6 +10,7 @@ import { apiMutator } from '../../../../frontend/src/lib/api-orval-mutator'
*/
import type {
AcceptWarehouseSuggestionApi,
+ AssignWarehouseSuggestionApi,
DismissWarehouseSuggestionApi,
PaginatedWarehouseSuggestionListApi,
WarehouseSuggestionApi,
@@ -77,6 +78,24 @@ export const warehouseSuggestionsAcceptCreate = async (
})
}
+export const getWarehouseSuggestionsAssignCreateUrl = (projectId: string, id: string) => {
+ return `/api/projects/${projectId}/warehouse_suggestions/${id}/assign/`
+}
+
+export const warehouseSuggestionsAssignCreate = async (
+ projectId: string,
+ id: string,
+ assignWarehouseSuggestionApi: AssignWarehouseSuggestionApi,
+ options?: RequestInit
+): Promise<WarehouseSuggestionApi> => {
+ return apiMutator<WarehouseSuggestionApi>(getWarehouseSuggestionsAssignCreateUrl(projectId, id), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(assignWarehouseSuggestionApi),
+ })
+}
+
export const getWarehouseSuggestionsDismissCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_suggestions/${id}/dismiss/`
}
diff --git a/products/warehouse_suggestions/frontend/generated/api.zod.ts b/products/warehouse_suggestions/frontend/generated/api.zod.ts
index f613afd0349f..0d288c0cf6a3 100644
--- a/products/warehouse_suggestions/frontend/generated/api.zod.ts
+++ b/products/warehouse_suggestions/frontend/generated/api.zod.ts
@@ -58,6 +58,15 @@ export const WarehouseSuggestionsAcceptCreateBody = /* @__PURE__ */ zod.object({
),
})
+export const WarehouseSuggestionsAssignCreateBody = /* @__PURE__ */ zod.object({
+ assignee_id: zod
+ .number()
+ .nullable()
+ .describe(
+ 'ID of the user to assign. They must be able to accept the suggestion: edit access to the view or table, and to the data catalog for certify and deprecate suggestions. Null removes the assignee. The assignee gets a notification unless they assign themselves.'
+ ),
+})
+
export const warehouseSuggestionsDismissCreateBodyNoteMax = 1000
export const WarehouseSuggestionsDismissCreateBody = /* @__PURE__ */ zod.object({
diff --git a/products/warehouse_suggestions/frontend/warehouseSuggestionActivityDescriber.tsx b/products/warehouse_suggestions/frontend/warehouseSuggestionActivityDescriber.tsx
index 46966b5a99a4..d5ce2ec02b36 100644
--- a/products/warehouse_suggestions/frontend/warehouseSuggestionActivityDescriber.tsx
+++ b/products/warehouse_suggestions/frontend/warehouseSuggestionActivityDescriber.tsx
@@ -14,12 +14,24 @@ const STATUS_VERBS: Record<string, string> = {
auto_resolved: 'resolved',
}
+function statusVerb(logItem: ActivityLogItem): string | undefined {
+ const statusChange = logItem.detail.changes?.find((change) => change.field === 'status')
+ return statusChange ? STATUS_VERBS[String(statusChange.after)] : undefined
+}
+
+function assigneeVerb(logItem: ActivityLogItem): string | undefined {
+ const assigneeChange = logItem.detail.changes?.find((change) => change.field === 'assignee')
+ if (!assigneeChange) {
+ return undefined
+ }
+ return assigneeChange.after ? 'assigned' : 'unassigned'
+}
+
export function warehouseSuggestionActivityDescriber(
logItem: ActivityLogItem,
asNotification?: boolean
): HumanizedChange {
- const statusChange = logItem.detail.changes?.find((change) => change.field === 'status')
- const verb = statusChange ? STATUS_VERBS[String(statusChange.after)] : undefined
+ const verb = statusVerb(logItem) ?? assigneeVerb(logItem)
if (!verb) {
return defaultDescriber(logItem, asNotification)
}
diff --git a/products/warehouse_suggestions/frontend/warehouseSuggestionsLogic.test.ts b/products/warehouse_suggestions/frontend/warehouseSuggestionsLogic.test.ts
index cdcfa0ecb72c..c6931df45bc1 100644
--- a/products/warehouse_suggestions/frontend/warehouseSuggestionsLogic.test.ts
+++ b/products/warehouse_suggestions/frontend/warehouseSuggestionsLogic.test.ts
@@ -14,6 +14,7 @@ import {
import {
warehouseSuggestionsAcceptCreate,
+ warehouseSuggestionsAssignCreate,
warehouseSuggestionsDismissCreate,
warehouseSuggestionsList,
warehouseSuggestionsResumeCreate,
@@ -25,6 +26,7 @@ import { ROW_LEAVE_MS, StripState, SuggestionSurface, warehouseSuggestionsLogic
jest.mock('./generated/api', () => ({
warehouseSuggestionsAcceptCreate: jest.fn(),
+ warehouseSuggestionsAssignCreate: jest.fn(),
warehouseSuggestionsDismissCreate: jest.fn(),
warehouseSuggestionsList: jest.fn(),
warehouseSuggestionsResumeCreate: jest.fn(),
@@ -38,6 +40,7 @@ jest.mock('products/data_warehouse/frontend/generated/api', () => ({
const mockList = warehouseSuggestionsList as jest.MockedFunction<typeof warehouseSuggestionsList>
const mockStatus = warehouseSuggestionsStatusRetrieve as jest.MockedFunction<typeof warehouseSuggestionsStatusRetrieve>
const mockAccept = warehouseSuggestionsAcceptCreate as jest.MockedFunction<typeof warehouseSuggestionsAcceptCreate>
+const mockAssign = warehouseSuggestionsAssignCreate as jest.MockedFunction<typeof warehouseSuggestionsAssignCreate>
const mockDismiss = warehouseSuggestionsDismissCreate as jest.MockedFunction<typeof warehouseSuggestionsDismissCreate>
const mockResume = warehouseSuggestionsResumeCreate as jest.MockedFunction<typeof warehouseSuggestionsResumeCreate>
const mockSavedQuery = warehouseSavedQueriesRetrieve as jest.MockedFunction<typeof warehouseSavedQueriesRetrieve>
@@ -87,6 +90,7 @@ const MATERIALIZE: WarehouseSuggestionApi = {
realized_seconds_saved_per_month: null,
realized_bytes_saved_per_month: null,
can_act: true,
+ assignee: null,
}
function materialize(id: string, savesSeconds: number, savesBytes = 0): WarehouseSuggestionApi {
@@ -258,6 +262,18 @@ describe('warehouseSuggestionsLogic', () => {
finish({ ...MATERIALIZE, status: 'dismissed' })
})
+ it('shows the new assignee on the row and keeps the row listed', async () => {
+ const assignee = { id: 7, first_name: 'Ana', email: '[email protected]' }
+ mockAssign.mockResolvedValue({ ...MATERIALIZE, assignee })
+ await mountLogic()
+
+ logic.actions.assignSuggestion(MATERIALIZE.id, assignee.id)
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(mockAssign).toHaveBeenCalledWith(expect.any(String), MATERIALIZE.id, { assignee_id: assignee.id })
+ expect(logic.values.surfaceSuggestions.map((suggestion) => suggestion.assignee)).toEqual([assignee])
+ })
+
it('ignores a second accept while the first is in flight', async () => {
let finish: (value: WarehouseSuggestionApi) => void = () => {}
mockAccept.mockReturnValue(new Promise((resolve) => (finish = resolve)))
diff --git a/products/warehouse_suggestions/frontend/warehouseSuggestionsLogic.ts b/products/warehouse_suggestions/frontend/warehouseSuggestionsLogic.ts
index 399c87d79173..78d5435175c2 100644
--- a/products/warehouse_suggestions/frontend/warehouseSuggestionsLogic.ts
+++ b/products/warehouse_suggestions/frontend/warehouseSuggestionsLogic.ts
@@ -30,6 +30,7 @@ import type { IncrementalEligibilityApi } from 'products/data_warehouse/frontend
import {
warehouseSuggestionsAcceptCreate,
+ warehouseSuggestionsAssignCreate,
warehouseSuggestionsDismissCreate,
warehouseSuggestionsList,
warehouseSuggestionsResumeCreate,
@@ -104,6 +105,10 @@ function dismissedMessage(reason: DismissWarehouseSuggestionApi['reason'], kind:
return reason === 'not_now' ? `Dismissed. ${notNowCondition(kind)}` : NOT_SUGGESTED_AGAIN
}
+function assignedMessage({ assignee }: WarehouseSuggestionApi): string {
+ return assignee ? `Assigned to ${assignee.first_name || assignee.email}.` : 'Unassigned.'
+}
+
function suggestionWorth(suggestion: WarehouseSuggestionApi): [number, number] {
const saving = monthlySaving(suggestion.payload)
if (!saving) {
@@ -227,6 +232,13 @@ export interface warehouseSuggestionsLogicActions {
acceptSuggestionFailed: (id: string) => {
id: string
}
+ assignSuggestion: (
+ id: string,
+ assigneeId: number | null
+ ) => {
+ assigneeId: number | null
+ id: string
+ }
closeAcceptConfirm: () => {
value: true
}
@@ -360,6 +372,9 @@ export interface warehouseSuggestionsLogicActions {
suggestionResumed: (suggestion: WarehouseSuggestionApi) => {
suggestion: WarehouseSuggestionApi
}
+ suggestionUpdated: (suggestion: WarehouseSuggestionApi) => {
+ suggestion: WarehouseSuggestionApi
+ }
undoDismiss: (id: string) => {
id: string
}
@@ -436,6 +451,8 @@ export const warehouseSuggestionsLogic: LogicWrapper<warehouseSuggestionsLogicTy
restoreSuggestion: (id: string) => ({ id }),
undoDismiss: (id: string) => ({ id }),
suggestionResumed: (suggestion: WarehouseSuggestionApi) => ({ suggestion }),
+ assignSuggestion: (id: string, assigneeId: number | null) => ({ id, assigneeId }),
+ suggestionUpdated: (suggestion: WarehouseSuggestionApi) => ({ suggestion }),
openReview: true,
closeReview: true,
openMaterializeModal: (id: string) => ({ id }),
@@ -482,6 +499,8 @@ export const warehouseSuggestionsLogic: LogicWrapper<warehouseSuggestionsLogicTy
...(state ?? []).filter((existing) => existing.id !== suggestion.id),
suggestion,
],
+ suggestionUpdated: (state: WarehouseSuggestionApi[] | null, { suggestion }) =>
+ (state ?? []).map((existing) => (existing.id === suggestion.id ? suggestion : existing)),
},
actionsInFlight: [
{} as Record<string, boolean>,
@@ -874,6 +893,28 @@ export const warehouseSuggestionsLogic: LogicWrapper<warehouseSuggestionsLogicTy
actions.setActionInFlight(id, false)
}
},
+ assignSuggestion: async ({ id, assigneeId }) => {
+ if (values.actionsInFlight[id]) {
+ return
+ }
+ actions.setActionInFlight(id, true)
+ try {
+ const updated = await warehouseSuggestionsAssignCreate(projectId(), id, {
+ assignee_id: assigneeId,
+ })
+ actions.suggestionUpdated(updated)
+ lemonToast.success(assignedMessage(updated), {
+ toastId: `warehouse-suggestion-assigned-${id}`,
+ })
+ } catch (error) {
+ reportFailure(error, 'Could not assign the suggestion.')
+ if (isStale(error)) {
+ actions.loadSuggestions()
+ }
+ } finally {
+ actions.setActionInFlight(id, false)
+ }
+ },
undoDismiss: async ({ id }) => {
await resumeDismissedSuggestion(props.surface, projectId(), id)
},
diff --git a/products/warehouse_suggestions/mcp/tools.yaml b/products/warehouse_suggestions/mcp/tools.yaml
index 46b2ae9f3586..62e45aca0253 100644
--- a/products/warehouse_suggestions/mcp/tools.yaml
+++ b/products/warehouse_suggestions/mcp/tools.yaml
@@ -46,6 +46,21 @@ tools:
deleted, unless keep_materialized is true. If it is an unmaterialize suggestion, the view's refreshes
stop, its stored table is deleted, and each read computes the view instead. Reply 'confirm' to proceed.
action_label: accept warehouse suggestion
+ warehouse-suggestions-assign:
+ operation: warehouse_suggestions_assign_create
+ enabled: true
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: true
+ title: Assign a warehouse suggestion
+ description: >
+ Assign a proposed warehouse suggestion to the person who should accept or dismiss it, or pass
+ assignee_id=null to remove the assignee. The caller needs edit access to the view or table, the same as for
+ dismiss. The assignee must be able to accept it: edit access to the view or table, and to the data catalog
+ for certify and deprecate suggestions. A 400 means they cannot. They get a notification unless they assign
+ themselves or already are the assignee. Nothing changes on the view or table. Find user ids with the
+ organization member tools.
warehouse-suggestions-dismiss:
operation: warehouse_suggestions_dismiss_create
enabled: true
@@ -87,7 +102,8 @@ tools:
the numbers in `payload`, the time and bytes saved or spent per month. For an unmaterialize suggestion,
compare refresh_seconds_per_month with live_seconds_per_month and say how long one read would take
(`read_seconds`). For a certify suggestion, use the read counts in `evidence` from
- warehouse-suggestions-get.
+ warehouse-suggestions-get. `assignee` is the person who should decide it; pass assignee_id to list only one
+ person's suggestions.
response:
include:
- id
@@ -97,6 +113,7 @@ tools:
- payload
- status
- can_act
+ - assignee
warehouse-suggestions-resume:
operation: warehouse_suggestions_resume_create
enabled: true
diff --git a/products/warehouse_suggestions/skills/reviewing-warehouse-suggestions/SKILL.md b/products/warehouse_suggestions/skills/reviewing-warehouse-suggestions/SKILL.md
index 8d2213a10a99..32abda5cea97 100644
--- a/products/warehouse_suggestions/skills/reviewing-warehouse-suggestions/SKILL.md
+++ b/products/warehouse_suggestions/skills/reviewing-warehouse-suggestions/SKILL.md
@@ -4,9 +4,9 @@ description: >
Reviews PostHog's warehouse suggestions with a person and acts on them.
Explains why a view should be materialized, unmaterialized, certified or deprecated using the numbers in the suggestion,
changes a materialize suggestion's refresh mode, keys or interval when the person wants something else,
- then accepts or dismisses it.
+ then accepts, dismisses or assigns it.
Use when the user asks what PostHog suggests for their data warehouse, whether to materialize a view,
- why a view should refresh incrementally or every few hours, or wants to accept, change or dismiss a warehouse suggestion.
+ why a view should refresh incrementally or every few hours, or wants to accept, change, dismiss or assign a warehouse suggestion.
---
# Reviewing warehouse suggestions
@@ -73,3 +73,15 @@ The server checks every choice against the view's current query:
Dismiss with `warehouse-suggestions-dismiss` and a reason (`not_useful`, `not_now` or `other`).
`warehouse-suggestions-resume` brings a dismissed suggestion back.
+
+## 5. Hand it to someone else
+
+A suggestion's `assignee` is the person who should decide it.
+When a view's suggestion is first shown, PostHog assigns it to the person who created the view, if they can accept it.
+To see one person's suggestions, pass `assignee_id` to `warehouse-suggestions-list`.
+
+When the user is not the right person to decide, assign it with `warehouse-suggestions-assign`.
+The user needs edit access to the view or table, the same as for dismissing it (`can_act`).
+The assignee gets a notification.
+They need edit access to the view or table, and to the data catalog for certify and deprecate suggestions.
+A 400 means they do not have it. Tell the user and ask who else should get it.
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 577cc7ddfe6a..803e0089324a 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -16246,6 +16246,22 @@
},
"feature_flag": "warehouse-suggestions"
},
+ "warehouse-suggestions-assign": {
+ "description": "Assign a proposed warehouse suggestion to the person who should accept or dismiss it, or pass assignee_id=null to remove the assignee. The caller needs edit access to the view or table, the same as for dismiss. The assignee must be able to accept it: edit access to the view or table, and to the data catalog for certify and deprecate suggestions. A 400 means they cannot. They get a notification unless they assign themselves or already are the assignee. Nothing changes on the view or table. Find user ids with the organization member tools.",
+ "category": "Warehouse suggestions",
+ "feature": "warehouse_suggestions",
+ "summary": "Assign a warehouse suggestion",
+ "title": "Assign a warehouse suggestion",
+ "required_scopes": ["warehouse_view:write"],
+ "api_operations": ["POST /api/projects/{project_id}/warehouse_suggestions/{id}/assign/"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "warehouse-suggestions"
+ },
"warehouse-suggestions-dismiss": {
"description": "Dismiss a proposed warehouse suggestion with a reason: not_useful, not_now or other, plus an optional note. Nothing changes on the view or table. warehouse-suggestions-resume brings it back.",
"category": "Warehouse suggestions",
@@ -16279,7 +16295,7 @@
"feature_flag": "warehouse-suggestions"
},
"warehouse-suggestions-list": {
- "description": "Recommendations to certify, deprecate, materialize or unmaterialize data warehouse views and tables, computed daily from how often the project reads them. Pass status=proposed for the suggestions still waiting for a decision. `payload` says what accepting would create or change. `can_act` says whether the caller can edit the view or table, which accept, dismiss and resume require. Accepting a certify or deprecate suggestion also requires edit access to the data catalog. Use warehouse-suggestions-get for the usage evidence behind one suggestion. If the list is empty, call warehouse-suggestions-status to learn why. Results come in priority order, the one most worth acting on first. Explain a suggestion to the user with the numbers in `payload`, the time and bytes saved or spent per month. For an unmaterialize suggestion, compare refresh_seconds_per_month with live_seconds_per_month and say how long one read would take (`read_seconds`). For a certify suggestion, use the read counts in `evidence` from warehouse-suggestions-get.",
+ "description": "Recommendations to certify, deprecate, materialize or unmaterialize data warehouse views and tables, computed daily from how often the project reads them. Pass status=proposed for the suggestions still waiting for a decision. `payload` says what accepting would create or change. `can_act` says whether the caller can edit the view or table, which accept, dismiss and resume require. Accepting a certify or deprecate suggestion also requires edit access to the data catalog. Use warehouse-suggestions-get for the usage evidence behind one suggestion. If the list is empty, call warehouse-suggestions-status to learn why. Results come in priority order, the one most worth acting on first. Explain a suggestion to the user with the numbers in `payload`, the time and bytes saved or spent per month. For an unmaterialize suggestion, compare refresh_seconds_per_month with live_seconds_per_month and say how long one read would take (`read_seconds`). For a certify suggestion, use the read counts in `evidence` from warehouse-suggestions-get. `assignee` is the person who should decide it; pass assignee_id to list only one person's suggestions.",
"category": "Warehouse suggestions",
"feature": "warehouse_suggestions",
"summary": "List warehouse suggestions",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index e347876e78be..59e9bf5ab89d 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -16992,6 +16992,22 @@
},
"feature_flag": "warehouse-suggestions"
},
+ "warehouse-suggestions-assign": {
+ "description": "Assign a proposed warehouse suggestion to the person who should accept or dismiss it, or pass assignee_id=null to remove the assignee. The caller needs edit access to the view or table, the same as for dismiss. The assignee must be able to accept it: edit access to the view or table, and to the data catalog for certify and deprecate suggestions. A 400 means they cannot. They get a notification unless they assign themselves or already are the assignee. Nothing changes on the view or table. Find user ids with the organization member tools.",
+ "category": "Warehouse suggestions",
+ "feature": "warehouse_suggestions",
+ "summary": "Assign a warehouse suggestion",
+ "title": "Assign a warehouse suggestion",
+ "required_scopes": ["warehouse_view:write"],
+ "api_operations": ["POST /api/projects/{project_id}/warehouse_suggestions/{id}/assign/"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "warehouse-suggestions"
+ },
"warehouse-suggestions-dismiss": {
"description": "Dismiss a proposed warehouse suggestion with a reason: not_useful, not_now or other, plus an optional note. Nothing changes on the view or table. warehouse-suggestions-resume brings it back.",
"category": "Warehouse suggestions",
@@ -17025,7 +17041,7 @@
"feature_flag": "warehouse-suggestions"
},
"warehouse-suggestions-list": {
- "description": "Recommendations to certify, deprecate, materialize or unmaterialize data warehouse views and tables, computed daily from how often the project reads them. Pass status=proposed for the suggestions still waiting for a decision. `payload` says what accepting would create or change. `can_act` says whether the caller can edit the view or table, which accept, dismiss and resume require. Accepting a certify or deprecate suggestion also requires edit access to the data catalog. Use warehouse-suggestions-get for the usage evidence behind one suggestion. If the list is empty, call warehouse-suggestions-status to learn why. Results come in priority order, the one most worth acting on first. Explain a suggestion to the user with the numbers in `payload`, the time and bytes saved or spent per month. For an unmaterialize suggestion, compare refresh_seconds_per_month with live_seconds_per_month and say how long one read would take (`read_seconds`). For a certify suggestion, use the read counts in `evidence` from warehouse-suggestions-get.",
+ "description": "Recommendations to certify, deprecate, materialize or unmaterialize data warehouse views and tables, computed daily from how often the project reads them. Pass status=proposed for the suggestions still waiting for a decision. `payload` says what accepting would create or change. `can_act` says whether the caller can edit the view or table, which accept, dismiss and resume require. Accepting a certify or deprecate suggestion also requires edit access to the data catalog. Use warehouse-suggestions-get for the usage evidence behind one suggestion. If the list is empty, call warehouse-suggestions-status to learn why. Results come in priority order, the one most worth acting on first. Explain a suggestion to the user with the numbers in `payload`, the time and bytes saved or spent per month. For an unmaterialize suggestion, compare refresh_seconds_per_month with live_seconds_per_month and say how long one read would take (`read_seconds`). For a certify suggestion, use the read counts in `evidence` from warehouse-suggestions-get. `assignee` is the person who should decide it; pass assignee_id to list only one person's suggestions.",
"category": "Warehouse suggestions",
"feature": "warehouse_suggestions",
"summary": "List warehouse suggestions",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 5c88e6fa4bf0..8d5cfdda469f 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -14044,6 +14044,14 @@ export namespace Schemas {
created: string | null;
}
+ export interface AssignWarehouseSuggestion {
+ /**
+ * ID of the user to assign. They must be able to accept the suggestion: edit access to the view or table, and to the data catalog for certify and deprecate suggestions. Null removes the assignee. The assignee gets a notification unless they assign themselves.
+ * @nullable
+ */
+ assignee_id: number | null;
+ }
+
/**
* * `user` - user
* * `role` - role
@@ -83056,6 +83064,8 @@ export namespace Schemas {
created_asset: WarehouseSuggestionCreatedAsset;
/** Who accepted or dismissed this suggestion. Null while it is open. */
reviewed_by: WarehouseSuggestionReviewer | null;
+ /** Who should accept or dismiss this suggestion. When a view's suggestion is first shown, it goes to the person who created the view, if they can accept it. Null when nobody is assigned. */
+ assignee: WarehouseSuggestionReviewer | null;
/** What the suggestion proposes: certify, deprecate, materialize or unmaterialize the subject. unmaterialize turns a rarely read materialized view back into a plain view computed on read.
*
* * `certify` - Certify
@@ -141506,6 +141516,10 @@ export namespace Schemas {
};
export type WarehouseSuggestionsListParams = {
+ /**
+ * Only return suggestions assigned to the user with this ID.
+ */
+ assignee_id?: number;
/**
* Only return suggestions of this kind.
*
diff --git a/services/mcp/src/generated/warehouse_suggestions/api.ts b/services/mcp/src/generated/warehouse_suggestions/api.ts
index c84147903eac..08326cf52745 100644
--- a/services/mcp/src/generated/warehouse_suggestions/api.ts
+++ b/services/mcp/src/generated/warehouse_suggestions/api.ts
@@ -3,7 +3,7 @@
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
- * PostHog API - MCP 6 enabled ops
+ * PostHog API - MCP 7 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
@@ -17,6 +17,7 @@ export const WarehouseSuggestionsListParams = () => zod.object({
})
export const WarehouseSuggestionsListQueryParams = () => zod.object({
+ assignee_id: zod.number().optional().describe('Only return suggestions assigned to the user with this ID.'),
kind: zod
.enum(['certify', 'deprecate', 'materialize', 'unmaterialize'])
.optional()
@@ -109,6 +110,28 @@ export const WarehouseSuggestionsAcceptCreateBody = () => zod.object({
),
})
+export const warehouseSuggestionsAssignCreatePathIdRegExp = new RegExp(
+ '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
+)
+
+export const WarehouseSuggestionsAssignCreateParams = () => zod.object({
+ id: zod.string().regex(warehouseSuggestionsAssignCreatePathIdRegExp),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const WarehouseSuggestionsAssignCreateBody = () => zod.object({
+ assignee_id: zod
+ .number()
+ .nullable()
+ .describe(
+ 'ID of the user to assign. They must be able to accept the suggestion: edit access to the view or table, and to the data catalog for certify and deprecate suggestions. Null removes the assignee. The assignee gets a notification unless they assign themselves.'
+ ),
+})
+
export const warehouseSuggestionsDismissCreatePathIdRegExp = new RegExp(
'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
)
diff --git a/services/mcp/src/tools/generated/warehouse_suggestions.ts b/services/mcp/src/tools/generated/warehouse_suggestions.ts
index d5c6c139a001..c112e12ab2ff 100644
--- a/services/mcp/src/tools/generated/warehouse_suggestions.ts
+++ b/services/mcp/src/tools/generated/warehouse_suggestions.ts
@@ -102,6 +102,35 @@ const warehouseSuggestionsAcceptExecute = (): ToolBase<
},
})
+const WarehouseSuggestionsAssignSchema = () => {
+ const WarehouseSuggestionsAssignCreateBody = orvalSchemas.WarehouseSuggestionsAssignCreateBody()
+ const WarehouseSuggestionsAssignCreateParams = orvalSchemas.WarehouseSuggestionsAssignCreateParams()
+ return WarehouseSuggestionsAssignCreateParams.omit({ project_id: true }).extend(
+ WarehouseSuggestionsAssignCreateBody.shape
+ )
+}
+
+const warehouseSuggestionsAssign = (): ToolBase<
+ ReturnType<typeof WarehouseSuggestionsAssignSchema>,
+ Schemas.WarehouseSuggestion
+> => ({
+ name: 'warehouse-suggestions-assign',
+ schema: WarehouseSuggestionsAssignSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof WarehouseSuggestionsAssignSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.assignee_id !== undefined) {
+ body['assignee_id'] = params.assignee_id
+ }
+ const result = await context.api.request<Schemas.WarehouseSuggestion>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/warehouse_suggestions/${encodeURIComponent(String(params.id))}/assign/`,
+ body,
+ })
+ return result
+ },
+})
+
const WarehouseSuggestionsDismissSchema = () => {
const WarehouseSuggestionsDismissCreateBody = orvalSchemas.WarehouseSuggestionsDismissCreateBody()
const WarehouseSuggestionsDismissCreateParams = orvalSchemas.WarehouseSuggestionsDismissCreateParams()
@@ -172,6 +201,7 @@ const warehouseSuggestionsList = (): ToolBase<
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/warehouse_suggestions/`,
query: {
+ assignee_id: params.assignee_id,
kind: params.kind,
limit: params.limit,
offset: params.offset,
@@ -182,7 +212,16 @@ const warehouseSuggestionsList = (): ToolBase<
const filtered = {
...result,
results: (result.results ?? []).map((item: any) =>
- pickResponseFields(item, ['id', 'kind', 'subject_kind', 'subject_id', 'payload', 'status', 'can_act'])
+ pickResponseFields(item, [
+ 'id',
+ 'kind',
+ 'subject_kind',
+ 'subject_id',
+ 'payload',
+ 'status',
+ 'can_act',
+ 'assignee',
+ ])
),
} as typeof result
return await withPostHogUrl(context, filtered, '/models')
@@ -231,6 +270,7 @@ const warehouseSuggestionsStatus = (): ToolBase<
export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'warehouse-suggestions-accept-prepare': warehouseSuggestionsAcceptPrepare,
'warehouse-suggestions-accept-execute': warehouseSuggestionsAcceptExecute,
+ 'warehouse-suggestions-assign': warehouseSuggestionsAssign,
'warehouse-suggestions-dismiss': warehouseSuggestionsDismiss,
'warehouse-suggestions-get': warehouseSuggestionsGet,
'warehouse-suggestions-list': warehouseSuggestionsList,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/warehouse-suggestions-assign.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/warehouse-suggestions-assign.json
new file mode 100644
index 000000000000..6a50d0a302b3
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/warehouse-suggestions-assign.json
@@ -0,0 +1,22 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "assignee_id": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "ID of the user to assign. They must be able to accept the suggestion: edit access to the view or table, and to the data catalog for certify and deprecate suggestions. Null removes the assignee. The assignee gets a notification unless they assign themselves."
+ },
+ "id": {
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
+ "type": "string"
+ }
+ },
+ "required": ["id", "assignee_id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/warehouse-suggestions-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/warehouse-suggestions-list.json
index a7dba107d108..6c689fce39a6 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/warehouse-suggestions-list.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/warehouse-suggestions-list.json
@@ -1,6 +1,10 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
+ "assignee_id": {
+ "description": "Only return suggestions assigned to the user with this ID.",
+ "type": "number"
+ },
"kind": {
"description": "Only return suggestions of this kind.\n\n* `certify` - Certify\n* `deprecate` - Deprecate\n* `materialize` - Materialize\n* `unmaterialize` - Unmaterialize",
"enum": ["certify", "deprecate", "materialize", "unmaterialize"],
diff --git a/tach.toml b/tach.toml
index 32f5eb6f90a9..c3b1464303ac 100644
--- a/tach.toml
+++ b/tach.toml
@@ -1778,6 +1778,7 @@ depends_on = [
"products.access_control",
"products.data_catalog",
"products.data_modeling",
+ "products.notifications",
"products.warehouse_sources",
]
layer = "modules"