: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(early-access-features): add resource access control (#65261)
Reece Jonesf9dcb7368d4c
diff --git a/common/storybook/.storybook/app-context.ts b/common/storybook/.storybook/app-context.tsindex 3814ae526c89..2b46cd32ce16 100644--- a/common/storybook/.storybook/app-context.ts+++ b/common/storybook/.storybook/app-context.ts@@ -82,6 +82,7 @@ export const getStorybookAppContext = (): AppContext => ({survey: 'manager',experiment: 'manager',export: 'manager',+ early_access_feature: 'manager',external_data_source: 'manager',web_analytics: 'manager',activity_log: 'viewer',diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex d5a763aebb30..eaf977e19a50 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -4889,9 +4889,9 @@ snapshots:scenes-app-customer-analytics-accounts--row-expanded-usage-populated--light:hash: v1.k794b7964.8480cd33c476381878cbf88f6b91ae617c71d2093d19983a83b082e39b2c60e2.q-ykZx3-XGsMNDO60MI74cTBmrklBZ1zqtMyk0U9CU8scenes-app-customer-analytics-accounts--row-expanded-with-note--dark:- hash: v1.k794b7964.3c9ce002ecb9931c56ef82618cc1625ee847a7f8df2a35c490006e4b356e6fb5.bK3yVZfb-U4TUMJHKvLemkMdqx6YNKdkFC2lnrWBgYg+ hash: v1.k794b7964.e9ab70fa0457e6c393b604d1b5b30f629e2289eb6927d425bd3db03f15bb5489.--4OCOopJ4QEpVwi7OYePgaUtQ7V01e5zLemRRb_pvUscenes-app-customer-analytics-accounts--row-expanded-with-note--light:- hash: v1.k794b7964.452b394edba2503e01cded37a8013ba927cbec10f6982ff95452d116a414e76f.QEGOESUmS51vqV3H72T6h8pP4_BPOtai3nUsv91coRU+ hash: v1.k794b7964.1ed394591d19feb1c807b938b2d1392b9d2eb90b003c20130c53aefd6d7b705c.1zP1uKSBl50DhKWWKtx7MylqgNAWEutJDBArHVA1Ay0scenes-app-customer-analytics-dashboard--b-2-b-mode-with-groups-enabled--dark:hash: v1.k794b7964.b1e7b3b4db44122983952ce49cdcb2721216d6e09cdda2e03d88250a66f9531d.XEmKGVDBb7ph1xN1zMKNGWDQAkJPR509WPM2orhsrZoscenes-app-customer-analytics-dashboard--b-2-b-mode-with-groups-enabled--light:@@ -6529,9 +6529,9 @@ snapshots:scenes-app-settings-authentication-domains--one-unverified-domain--light:hash: v1.k794b7964.f2136f46f5946ffdd00316ec9f195c08ccae540ab2e2f0022a22631ef6d20ff6.nUefq9IWQvO8EuUAwIcjmRcN9dqhOXqr_Pi83bQ8gDkscenes-app-settings-environment--settings-environment-access-control--dark:- hash: v1.k794b7964.fe21dadcd946453b78ebf77343fde3d2eae1f6150f3300aeccd1ee7788a55b80.p11YK6JgbyBBq_HdmzJSRd_ki7uunlNlYJ-IQER6tuw+ hash: v1.k794b7964.c01e6f10e4cfd95e3a3ab85c26057051a941e781e8f4b2aca3d2eaa0efa5abe2.cbaLgkNqcMhEUdTpEWlbd_K3huU0jt0FYbLt3oxrRWQscenes-app-settings-environment--settings-environment-access-control--light:- hash: v1.k794b7964.06a9b5bd8ad3c5edf91b807067fd375fa195561d58c41678433abcea9b6a05c8.Dh7Ln1uftVoaLbzidechIPEIKWfki53lR_IJ4cs0tn8+ hash: v1.k794b7964.eb84bc906df2f23bbb5446b0be868b65dc4d253fa3c00bc45a3c7d60eb22089d.PLZmJqvy4zTBScRA9QNE3RzmJWhIgsrP6_qN9VBzm-4scenes-app-settings-environment--settings-environment-autocapture--dark:hash: v1.k794b7964.9f86feacf66829a02d5c14b62d237c3abe5e96cc13f88dd9e1d32397c30d2112.i48i7eB2z6UfXa3VwFKDH0SjzebQXoZPcfON8C_SoCgscenes-app-settings-environment--settings-environment-autocapture--light:@@ -6801,9 +6801,9 @@ snapshots:scenes-app-surveys-surveyresponsekeysreference--webhook--light:hash: v1.k794b7964.9b5c484a3a1bd7a09c266a1f164e3ed9eef3ffabbcd12253f0843b3f0b69a808.cc6Rai2vShlFJA_KypMbVcc1IIaVX0nTcZ29RPEEZjoscenes-app-tasks--empty--dark:- hash: v1.k794b7964.7f9fa4b2a1f6a5e815eabb6b31a26a6e92f9b234fb1b1659d2f3ac54f3329d7b.dlRd6mWtBS4kYWDTRrmPGu7oJIiHkshrbo2UJZg2zME+ hash: v1.k794b7964.188b59271be5b59e184ba59255056ed2610623db6c58df056b4822cf9c65d976.zsyum3Ts_lWGSfSByid-8_bVLmZpCdNkt402jF4qKvQscenes-app-tasks--empty--light:- hash: v1.k794b7964.0f6cd8ff0b64d8ab73e1b52609e2d6f87831dad09bc8cef9e70cb1ad02721572.S-jlFvTMeb5xsf9f91lZsEXJikHQglCzmPq-dtm5U4g+ hash: v1.k794b7964.e4683fa0c5bf12787a47c57350ab65f71f4b4618fe3ff22d2463faea1cbf996d.QhQaQSNBsCwuJpVix2hjXkVSjVU8MN0CVGsyLj421Uoscenes-app-tasks--list-load-error--dark:hash: v1.k794b7964.679a98a2b40a0dd971f839bd05911a4731d9e260f7b3d84653444ba7f948d640.iWHOKIrhMSK9juLbhRrtU3MavkWhPELVhaAAMcqQ3Lwscenes-app-tasks--list-load-error--light:diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.tsindex a48f04fb45d8..161194d85e10 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts@@ -179,6 +179,7 @@ export const accessControlLogic = kea<accessControlLogicType>([// Resources whose API route doesn't match the naive `${resource}s` pluralizationconst resourceToRoute: Partial<Record<APIScopeObject, string>> = {warehouse_view: 'warehouse_saved_queries',+ early_access_feature: 'early_access_feature',}const route = resourceToRoute[resource] ?? `${resource}s`return `api/projects/${currentProjectId}/${route}/${resource_id}/access_controls`diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.tsindex e1e891c8cfa7..cbd847b29c3c 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts@@ -294,6 +294,7 @@ export const resourcesAccessControlLogic = kea<resourcesAccessControlLogicType>(AccessControlResourceType.Action,AccessControlResourceType.ActivityLog,AccessControlResourceType.Dashboard,+ AccessControlResourceType.EarlyAccessFeature,AccessControlResourceType.Endpoint,AccessControlResourceType.Experiment,AccessControlResourceType.Export,diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.tsindex 5325d7f605d9..44b62e7057da 100644--- a/frontend/src/scenes/sceneTypes.ts+++ b/frontend/src/scenes/sceneTypes.ts@@ -363,6 +363,10 @@ export const sceneToAccessControlResourceType: Partial<Record<Scene, AccessContr// Exports[Scene.Exports]: AccessControlResourceType.Export,+ // Early access features+ [Scene.EarlyAccessFeature]: AccessControlResourceType.EarlyAccessFeature,+ [Scene.EarlyAccessFeatures]: AccessControlResourceType.EarlyAccessFeature,+// Customer analytics (only journey scenes — configuration uses project-level admin)[Scene.CustomerJourneyBuilder]: AccessControlResourceType.CustomerAnalytics,[Scene.CustomerJourneyTemplates]: AccessControlResourceType.CustomerAnalytics,diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 569357e71764..a8003d088b39 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -286,6 +286,7 @@ export enum AccessControlResourceType {Survey = 'survey',Logs = 'logs',Endpoint = 'endpoint',+ EarlyAccessFeature = 'early_access_feature',ProductTour = 'product_tour',Experiment = 'experiment',ExperimentHoldout = 'experiment_holdout',@@ -4391,6 +4392,8 @@ export interface EarlyAccessFeatureType {payload?: Record<string, any>created_at: string_create_in_folder?: string | null+ /** The effective access level the user has for this early access feature. */+ user_access_level?: AccessControlLevel}export interface NewEarlyAccessFeatureType extends Omit<EarlyAccessFeatureType, 'id' | 'created_at' | 'feature_flag'> {diff --git a/posthog/rbac/user_access_control.py b/posthog/rbac/user_access_control.pyindex 8bee12b0e0be..7261511d0614 100644--- a/posthog/rbac/user_access_control.py+++ b/posthog/rbac/user_access_control.py@@ -60,6 +60,7 @@ ACCESS_CONTROL_RESOURCES: tuple[APIScopeObject, ...] = ("action","customer_analytics","dashboard",+ "early_access_feature","endpoint","experiment","export",diff --git a/products/early_access_features/backend/api.py b/products/early_access_features/backend/api.pyindex 88a234e803fe..8a1629d235df 100644--- a/products/early_access_features/backend/api.py+++ b/products/early_access_features/backend/api.py@@ -7,6 +7,7 @@ from django.views.decorators.csrf import csrf_exemptimport structlogfrom drf_spectacular.utils import extend_schema_fieldfrom rest_framework import serializers, status, viewsets+from rest_framework.exceptions import PermissionDeniedfrom rest_framework.request import Requestfrom rest_framework.response import Response@@ -17,6 +18,8 @@ from posthog.cdp.internal_events import InternalEventEvent, InternalEventPerson,from posthog.exceptions import generate_exception_responsefrom posthog.models.team.team import Teamfrom posthog.models.utils import uuid7+from posthog.rbac.access_control_api_mixin import AccessControlViewSetMixin+from posthog.rbac.user_access_control import UserAccessControl, UserAccessControlSerializerMixinfrom posthog.tasks.early_access_feature import send_events_for_early_access_feature_stage_changefrom posthog.utils_cors import cors_response@@ -38,6 +41,28 @@ def _set_enrollment_filters(existing: dict, *, enrolled: bool | None, **overridereturn filters+def assert_feature_flag_rbac_access(+ user_access_control: UserAccessControl | None,+ *,+ feature_flag: FeatureFlag | None = None,+) -> None:+ """Early access feature writes create or mutate a linked feature flag through the FeatureFlag+ serializer directly, bypassing the FeatureFlag viewset's RBAC gate. Enforce the same feature_flag+ access control here so early_access_feature editor access can't be used to write feature flags a+ user otherwise couldn't. Pass ``feature_flag`` to check editing that object; omit it to check+ creating a new flag (resource level). Fails open when access controls aren't enabled — the checks+ resolve to the default editor level."""+ if user_access_control is None:+ return+ has_access = (+ user_access_control.check_access_level_for_object(feature_flag, "editor")+ if feature_flag is not None+ else user_access_control.check_access_level_for_resource("feature_flag", "editor")+ )+ if not has_access:+ raise PermissionDenied("You don't have sufficient permissions to modify the linked feature flag.")++class MinimalEarlyAccessFeatureSerializer(serializers.ModelSerializer):"""A more minimal serializer, intended specificaly for non-generally-available features to be provided@@ -66,7 +91,7 @@ class MinimalEarlyAccessFeatureSerializer(serializers.ModelSerializer):return obj.payload if obj.payload else {}-class EarlyAccessFeatureSerializer(serializers.ModelSerializer):+class EarlyAccessFeatureSerializer(UserAccessControlSerializerMixin, serializers.ModelSerializer):feature_flag = MinimalFeatureFlagSerializer(read_only=True)name = serializers.CharField(max_length=200,@@ -100,6 +125,7 @@ class EarlyAccessFeatureSerializer(serializers.ModelSerializer):"documentation_url","payload","created_at",+ "user_access_level",]read_only_fields = ["id", "feature_flag", "created_at"]@@ -134,6 +160,7 @@ class EarlyAccessFeatureSerializer(serializers.ModelSerializer):team_id=instance.team_id,feature_flag_id=related_feature_flag.id,)+ assert_feature_flag_rbac_access(self.user_access_control, feature_flag=related_feature_flag)serialized_data_filters = _set_enrollment_filters(related_feature_flag.filters,enrolled=None,@@ -158,6 +185,7 @@ class EarlyAccessFeatureSerializer(serializers.ModelSerializer):team_id=instance.team_id,feature_flag_id=related_feature_flag.id,)+ assert_feature_flag_rbac_access(self.user_access_control, feature_flag=related_feature_flag)serialized_data_filters = _set_enrollment_filters(related_feature_flag.filters, enrolled=True)serializer = FeatureFlagSerializer(@@ -178,6 +206,7 @@ class EarlyAccessFeatureSerializer(serializers.ModelSerializer):team_id=instance.team_id,feature_flag_id=related_feature_flag.id,)+ assert_feature_flag_rbac_access(self.user_access_control, feature_flag=related_feature_flag)related_feature_flag.filters = _set_enrollment_filters(related_feature_flag.filters, enrolled=None)related_feature_flag.save()@@ -236,6 +265,7 @@ class EarlyAccessFeatureSerializerCreateOnly(EarlyAccessFeatureSerializer):"feature_flag_id","feature_flag","_create_in_folder",+ "user_access_level",]read_only_fields = ["id", "feature_flag", "created_at"]@@ -288,6 +318,7 @@ class EarlyAccessFeatureSerializerCreateOnly(EarlyAccessFeatureSerializer):team_id=self.context["team_id"],feature_flag_id=feature_flag.id,)+ assert_feature_flag_rbac_access(self.user_access_control, feature_flag=feature_flag)serialized_data_filters = _set_enrollment_filters(feature_flag.filters, enrolled=True)serializer = FeatureFlagSerializer(@@ -306,6 +337,7 @@ class EarlyAccessFeatureSerializerCreateOnly(EarlyAccessFeatureSerializer):resource_scope="early_access_feature:write",team_id=self.context["team_id"],)+ assert_feature_flag_rbac_access(self.user_access_control)feature_flag_key = slugify(validated_data["name"])filters: dict[str, Any] = {@@ -333,7 +365,7 @@ class EarlyAccessFeatureSerializerCreateOnly(EarlyAccessFeatureSerializer):return feature-class EarlyAccessFeatureViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):+class EarlyAccessFeatureViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, viewsets.ModelViewSet):scope_object = "early_access_feature"queryset = EarlyAccessFeature.objects.select_related("feature_flag").all()@@ -355,6 +387,7 @@ class EarlyAccessFeatureViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):feature_flag_id=related_feature_flag.id,resource_scope="early_access_feature:write",)+ assert_feature_flag_rbac_access(self.user_access_control, feature_flag=related_feature_flag)related_feature_flag.filters = _set_enrollment_filters(related_feature_flag.filters, enrolled=None)related_feature_flag.save()diff --git a/products/early_access_features/backend/test/test_early_access_feature.py b/products/early_access_features/backend/test/test_early_access_feature.pyindex 0cd905743198..bc3c7104b9d2 100644--- a/products/early_access_features/backend/test/test_early_access_feature.py+++ b/products/early_access_features/backend/test/test_early_access_feature.py@@ -12,11 +12,14 @@ from rest_framework import statusfrom posthog.api.test.test_personal_api_keys import PersonalAPIKeysBaseTestfrom posthog.models.team.team_caching import set_team_in_cache+from posthog.models.user import Userfrom posthog.test.persons import create_personfrom products.early_access_features.backend.models import EarlyAccessFeaturefrom products.feature_flags.backend.models.feature_flag import FeatureFlag+from ee.models.rbac.access_control import AccessControl+class TestEarlyAccessFeatureSiteAppTemplate(unittest.TestCase):def test_site_app_template_escapes_user_controlled_fields(self):@@ -655,6 +658,7 @@ class TestEarlyAccessFeature(APIBaseTest):"name": "Click counter","payload": {},"stage": "beta",+ "user_access_level": "editor",},],}@@ -1413,3 +1417,168 @@ class TestEarlyAccessFeatureScopeEnforcement(PersonalAPIKeysBaseTest, APIBaseTesformat="json",)assert response.status_code == status.HTTP_201_CREATED, response.json()+++class TestEarlyAccessFeatureResourceAccessControl(APIBaseTest):+ """Resource- and object-level access control for early access features."""++ def setUp(self) -> None:+ super().setUp()+ self.organization.available_product_features = [{"key": "access_control", "name": "Access control"}]+ self.organization.save()+ self.member = User.objects.create_and_join(self.organization, "[email protected]", "password")+ self.client.force_login(self.member)++ def _set_resource_level(self, access_level: str) -> None:+ AccessControl.objects.create(resource="early_access_feature", team=self.team, access_level=access_level)++ def _create_feature(self) -> EarlyAccessFeature:+ return EarlyAccessFeature.objects.create(team=self.team, name="Example feature", stage="concept")++ def _create_feature_with_flag(self) -> EarlyAccessFeature:+ # Flag created by the admin so the member is not the flag creator (creators get manager).+ flag = FeatureFlag.objects.create(+ team=self.team,+ key="eaf-linked-flag",+ name="EAF linked flag",+ created_by=self.user,+ filters={"groups": [{"properties": [], "rollout_percentage": 0}]},+ )+ return EarlyAccessFeature.objects.create(+ team=self.team, name="Linked feature", stage="concept", feature_flag=flag+ )++ def _restrict_feature_flag_access(self, access_level: str) -> None:+ AccessControl.objects.create(resource="feature_flag", team=self.team, access_level=access_level)++ @parameterized.expand([("none", status.HTTP_403_FORBIDDEN), ("viewer", status.HTTP_200_OK)])+ def test_list_access_by_resource_level(self, access_level: str, expected_status: int) -> None:+ self._set_resource_level(access_level)+ response = self.client.get(f"/api/projects/{self.team.id}/early_access_feature/")+ self.assertEqual(response.status_code, expected_status)++ @parameterized.expand([("viewer", status.HTTP_403_FORBIDDEN), ("editor", status.HTTP_201_CREATED)])+ def test_create_access_by_resource_level(self, access_level: str, expected_status: int) -> None:+ self._set_resource_level(access_level)+ response = self.client.post(+ f"/api/projects/{self.team.id}/early_access_feature/",+ {"name": f"Feature {access_level}", "stage": "concept"},+ format="json",+ )+ self.assertEqual(response.status_code, expected_status, response.json())++ @parameterized.expand([("viewer", status.HTTP_403_FORBIDDEN), ("editor", status.HTTP_200_OK)])+ def test_update_access_by_resource_level(self, access_level: str, expected_status: int) -> None:+ feature = self._create_feature()+ self._set_resource_level(access_level)+ response = self.client.patch(+ f"/api/projects/{self.team.id}/early_access_feature/{feature.id}",+ {"name": "Renamed"},+ format="json",+ )+ self.assertEqual(response.status_code, expected_status, response.json())++ @parameterized.expand([("viewer", status.HTTP_403_FORBIDDEN), ("editor", status.HTTP_204_NO_CONTENT)])+ def test_delete_access_by_resource_level(self, access_level: str, expected_status: int) -> None:+ feature = self._create_feature()+ self._set_resource_level(access_level)+ response = self.client.delete(f"/api/projects/{self.team.id}/early_access_feature/{feature.id}")+ self.assertEqual(response.status_code, expected_status)++ def test_user_access_level_reflects_resource_level(self) -> None:+ feature = self._create_feature()+ self._set_resource_level("viewer")+ response = self.client.get(f"/api/projects/{self.team.id}/early_access_feature/{feature.id}")+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ # No creator concept on this model, so the effective level is the resource-level floor.+ self.assertEqual(response.json()["user_access_level"], "viewer")++ def test_user_access_level_reflects_object_level(self) -> None:+ # An object-level grant for one feature should win over the lower resource-level floor.+ feature = self._create_feature()+ self._set_resource_level("viewer")+ AccessControl.objects.create(+ resource="early_access_feature",+ resource_id=str(feature.id),+ organization_member=self.member.organization_memberships.get(organization=self.organization),+ team=self.team,+ access_level="editor",+ )+ response = self.client.get(f"/api/projects/{self.team.id}/early_access_feature/{feature.id}")+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ self.assertEqual(response.json()["user_access_level"], "editor")++ def test_access_controls_endpoint_route_exists(self) -> None:+ feature = self._create_feature()+ # Grant the member viewer so the read still exercises the access_control:read gate as a non-admin.+ self._set_resource_level("viewer")+ response = self.client.get(f"/api/projects/{self.team.id}/early_access_feature/{feature.id}/access_controls")+ self.assertEqual(response.status_code, status.HTTP_200_OK)++ def test_non_manager_member_cannot_modify_object_access_controls(self) -> None:+ # Editor resource access passes write checks but does not grant manager on the object.+ feature = self._create_feature()+ self._set_resource_level("editor")+ response = self.client.put(+ f"/api/projects/{self.team.id}/early_access_feature/{feature.id}/access_controls",+ {"access_level": "viewer"},+ )+ self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)++ def test_manager_can_modify_object_access_controls(self) -> None:+ # A member with manager access to the object can change its access controls.+ feature = self._create_feature()+ AccessControl.objects.create(+ resource="early_access_feature",+ resource_id=str(feature.id),+ organization_member=self.member.organization_memberships.get(organization=self.organization),+ team=self.team,+ access_level="manager",+ )+ response = self.client.put(+ f"/api/projects/{self.team.id}/early_access_feature/{feature.id}/access_controls",+ {"access_level": "viewer"},+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.json())++ def test_eaf_editor_without_feature_flag_access_cannot_create_flag(self) -> None:+ # early_access_feature editor must not bypass feature_flag access control when creating a flag.+ self._set_resource_level("editor")+ self._restrict_feature_flag_access("viewer")+ response = self.client.post(+ f"/api/projects/{self.team.id}/early_access_feature/",+ {"name": "Bypass attempt", "stage": "concept"},+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN, response.json())++ def test_eaf_editor_without_feature_flag_access_cannot_activate_stage(self) -> None:+ # Promoting to an active stage mutates the linked flag, so it requires feature_flag editor.+ feature = self._create_feature_with_flag()+ self._set_resource_level("editor")+ self._restrict_feature_flag_access("viewer")+ response = self.client.patch(+ f"/api/projects/{self.team.id}/early_access_feature/{feature.id}",+ {"stage": "beta"},+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN, response.json())++ def test_eaf_editor_without_feature_flag_access_cannot_delete_with_linked_flag(self) -> None:+ # Deleting clears the linked flag's enrollment, so it requires feature_flag editor.+ feature = self._create_feature_with_flag()+ self._set_resource_level("editor")+ self._restrict_feature_flag_access("viewer")+ response = self.client.delete(f"/api/projects/{self.team.id}/early_access_feature/{feature.id}")+ self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)++ def test_eaf_editor_with_feature_flag_access_can_activate_stage(self) -> None:+ # With the default feature_flag editor access, the linked-flag write is allowed.+ feature = self._create_feature_with_flag()+ self._set_resource_level("editor")+ response = self.client.patch(+ f"/api/projects/{self.team.id}/early_access_feature/{feature.id}",+ {"stage": "beta"},+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.json())diff --git a/products/early_access_features/frontend/EarlyAccessFeature.tsx b/products/early_access_features/frontend/EarlyAccessFeature.tsxindex b61761745d35..0c0ea7535060 100644--- a/products/early_access_features/frontend/EarlyAccessFeature.tsx+++ b/products/early_access_features/frontend/EarlyAccessFeature.tsx@@ -15,6 +15,7 @@ import {Link,} from '@posthog/lemon-ui'+import { AccessControlAction } from 'lib/components/AccessControlAction'import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'import { FlagSelector } from 'lib/components/FlagSelector'import { NotFound } from 'lib/components/NotFound'@@ -29,6 +30,7 @@ import { LemonField } from 'lib/lemon-ui/LemonField'import { LemonTabs } from 'lib/lemon-ui/LemonTabs'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'import { JSONEditorInput } from 'scenes/feature-flags/JSONEditorInput'import { LinkedHogFunctions } from 'scenes/hog-functions/list/LinkedHogFunctions'import { PersonDisplay } from 'scenes/persons/PersonDisplay'@@ -58,6 +60,8 @@ import { Query } from '~/queries/Query/Query'import { Node, NodeKind, ProductIntentContext, ProductKey, QuerySchema } from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'import {+ AccessControlLevel,+ AccessControlResourceType,CyclotronJobFiltersType,EarlyAccessFeatureStage,EarlyAccessFeatureTabs,@@ -166,6 +170,13 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.Elconst wasOriginallyGA = originalEarlyAccessFeatureStage === EarlyAccessFeatureStage.GeneralAvailabilityconst canShowSaveButtons = !wasOriginallyGA && (isNewEarlyAccessFeature || isEditingFeature)+ const userAccessLevel = 'id' in earlyAccessFeature ? earlyAccessFeature.user_access_level : undefined+ const accessControlDisabledReason = getAccessControlDisabledReason(+ AccessControlResourceType.EarlyAccessFeature,+ AccessControlLevel.Editor,+ userAccessLevel+ )+const earlyAccessFeatureId =earlyAccessFeature && 'id' in earlyAccessFeature && earlyAccessFeature.id !== 'new'? earlyAccessFeature.id@@ -229,6 +240,8 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.El<SceneMenuBarItemvariant="destructive"opensFloatingUi+ disabled={!!accessControlDisabledReason}+ tooltip={accessControlDisabledReason ?? undefined}onClick={() => {LemonDialog.open({title: 'Permanently delete feature?',@@ -265,7 +278,7 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.ElresourceType={{type: 'early_access_feature',}}- canEdit={isNewEarlyAccessFeature || isEditingFeature}+ canEdit={(isNewEarlyAccessFeature || isEditingFeature) && !accessControlDisabledReason}onNameChange={(name) => {setEarlyAccessFeatureValue('name', name)}}@@ -294,15 +307,21 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.El>Cancel</LemonButton>- <LemonButton- type="primary"- onClick={submitEarlyAccessFeature}- data-attr="save-feature"- loading={isEarlyAccessFeatureSubmitting}- size="small"+ <AccessControlAction+ resourceType={AccessControlResourceType.EarlyAccessFeature}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={userAccessLevel}>- {isNewEarlyAccessFeature ? 'Save as draft' : 'Save'}- </LemonButton>+ <LemonButton+ type="primary"+ onClick={submitEarlyAccessFeature}+ data-attr="save-feature"+ loading={isEarlyAccessFeatureSubmitting}+ size="small"+ >+ {isNewEarlyAccessFeature ? 'Save as draft' : 'Save'}+ </LemonButton>+ </AccessControlAction></>) : (<>@@ -346,25 +365,35 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.El},]}>+ {/* The trigger must stay the direct child of LemonMenu — it+ clones the trigger to inject the menu-toggle onClick, which an+ AccessControlAction wrapper would swallow. Gate via disabledReason. */}<LemonButtontooltip="Publish this feature to make it available"type="primary"size="small"+ disabledReason={accessControlDisabledReason ?? undefined}>Release</LemonButton></LemonMenu>)}{earlyAccessFeature.stage != EarlyAccessFeatureStage.GeneralAvailability && (- <LemonButton- type="secondary"- onClick={() => editFeature(true)}- loading={false}- data-attr="edit-feature"- size="small"+ <AccessControlAction+ resourceType={AccessControlResourceType.EarlyAccessFeature}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={userAccessLevel}>- Edit- </LemonButton>+ <LemonButton+ type="secondary"+ onClick={() => editFeature(true)}+ loading={false}+ data-attr="edit-feature"+ size="small"+ >+ Edit+ </LemonButton>+ </AccessControlAction>)}</>)@@ -398,6 +427,8 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.Elvalue={earlyAccessFeature.stage}name="stage"dataAttrKey={RESOURCE_TYPE}+ canEdit={!accessControlDisabledReason}+ buttonProps={{ tooltip: accessControlDisabledReason ?? undefined }}options={[{label: 'Draft (default)',@@ -475,6 +506,8 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.El}}variant="danger"menuItem+ disabled={!!accessControlDisabledReason}+ tooltip={accessControlDisabledReason ?? undefined}data-attr={`${RESOURCE_TYPE}-delete`}><IconTrash />diff --git a/products/early_access_features/frontend/EarlyAccessFeatures.tsx b/products/early_access_features/frontend/EarlyAccessFeatures.tsxindex 3fb7248370b7..1bb730e4aeff 100644--- a/products/early_access_features/frontend/EarlyAccessFeatures.tsx+++ b/products/early_access_features/frontend/EarlyAccessFeatures.tsx@@ -7,6 +7,7 @@ import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIimport { Shortcut } from 'lib/components/Shortcuts/Shortcut'import { keyBinds } from 'lib/components/Shortcuts/shortcuts'import { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'import { sceneConfigurations } from 'scenes/scenes'import { Scene, SceneExport } from 'scenes/sceneTypes'import { urls } from 'scenes/urls'@@ -14,7 +15,7 @@ import { urls } from 'scenes/urls'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { ProductKey } from '~/queries/schema/schema-general'-import { EarlyAccessFeatureType } from '~/types'+import { AccessControlLevel, AccessControlResourceType, EarlyAccessFeatureType } from '~/types'import { earlyAccessFeaturesLogic } from './earlyAccessFeaturesLogic'@@ -38,6 +39,12 @@ export function EarlyAccessFeatures(): JSX.Element {const { setSearchTerm } = useActions(earlyAccessFeaturesLogic)const shouldShowEmptyState = filteredEarlyAccessFeatures.length == 0 && !earlyAccessFeaturesLoading && !searchTerm+ // Creating an early access feature requires editor access to the resource.+ const accessControlDisabledReason = getAccessControlDisabledReason(+ AccessControlResourceType.EarlyAccessFeature,+ AccessControlLevel.Editor+ )+return (<SceneContent><SceneTitleSection@@ -60,6 +67,7 @@ export function EarlyAccessFeatures(): JSX.Element {to={urls.earlyAccessFeature('new')}tooltip="New feature"data-attr="create-feature"+ disabledReason={accessControlDisabledReason ?? undefined}>New feature</LemonButton>diff --git a/products/early_access_features/frontend/earlyAccessFeatureLogic.ts b/products/early_access_features/frontend/earlyAccessFeatureLogic.tsindex 199ae381e7d1..27945669d208 100644--- a/products/early_access_features/frontend/earlyAccessFeatureLogic.ts+++ b/products/early_access_features/frontend/earlyAccessFeatureLogic.ts@@ -14,11 +14,13 @@ import { identifierToHuman } from 'lib/utils/strings'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'+import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'import { deleteFromTree, refreshTreeItem } from '~/layout/panel-layout/ProjectTree/projectTreeLogic'import { performQuery } from '~/queries/query'import { ActorsQuery, NodeKind } from '~/queries/schema/schema-general'import { setLatestVersionsOnQuery } from '~/queries/utils'import {+ ActivityScope,Breadcrumb,EarlyAccessFeatureStage,EarlyAccessFeatureTabs,@@ -276,6 +278,19 @@ export const earlyAccessFeatureLogic = kea<earlyAccessFeatureLogicType>([() => [(_, props: EarlyAccessFeatureLogicProps) => props.id],(id): ProjectTreeRef => ({ type: 'early_access_feature', ref: id === 'new' ? null : String(id) }),],+ [SIDE_PANEL_CONTEXT_KEY]: [+ (s) => [s.earlyAccessFeature],+ (earlyAccessFeature): SidePanelSceneContext | null => {+ return 'id' in earlyAccessFeature && earlyAccessFeature.id+ ? {+ activity_scope: ActivityScope.EARLY_ACCESS_FEATURE,+ activity_item_id: `${earlyAccessFeature.id}`,+ access_control_resource: 'early_access_feature',+ access_control_resource_id: `${earlyAccessFeature.id}`,+ }+ : null+ },+ ],optedInCount: [(s) => [s.personsCount],(personsCount: [number, number] | null): number | null => personsCount?.[0] ?? null,diff --git a/products/early_access_features/frontend/generated/api.schemas.ts b/products/early_access_features/frontend/generated/api.schemas.tsindex 971bd6a2c171..76b5e93a120d 100644--- a/products/early_access_features/frontend/generated/api.schemas.ts+++ b/products/early_access_features/frontend/generated/api.schemas.ts@@ -94,6 +94,9 @@ export const StageEnumApi = {*/export type EarlyAccessFeatureApiPayload = { [key: string]: unknown }+/**+ * Mixin for serializers to add user access control fields+ */export interface EarlyAccessFeatureApi {readonly id: stringreadonly feature_flag: MinimalFeatureFlagApi@@ -121,6 +124,11 @@ export interface EarlyAccessFeatureApi {/** Feature flag payload for this early access feature */readonly payload: EarlyAccessFeatureApiPayloadreadonly created_at: string+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level: string | null}export interface PaginatedEarlyAccessFeatureListApi {@@ -132,6 +140,9 @@ export interface PaginatedEarlyAccessFeatureListApi {results: EarlyAccessFeatureApi[]}+/**+ * Mixin for serializers to add user access control fields+ */export interface EarlyAccessFeatureSerializerCreateOnlyApi {readonly id: string/**@@ -162,6 +173,11 @@ export interface EarlyAccessFeatureSerializerCreateOnlyApi {feature_flag_id?: numberreadonly feature_flag: MinimalFeatureFlagApi_create_in_folder?: string+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level: string | null}/**@@ -169,6 +185,9 @@ export interface EarlyAccessFeatureSerializerCreateOnlyApi {*/export type PatchedEarlyAccessFeatureApiPayload = { [key: string]: unknown }+/**+ * Mixin for serializers to add user access control fields+ */export interface PatchedEarlyAccessFeatureApi {readonly id?: stringreadonly feature_flag?: MinimalFeatureFlagApi@@ -196,6 +215,11 @@ export interface PatchedEarlyAccessFeatureApi {/** Feature flag payload for this early access feature */readonly payload?: PatchedEarlyAccessFeatureApiPayloadreadonly created_at?: string+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level?: string | null}export type EarlyAccessFeatureListParams = {diff --git a/products/early_access_features/frontend/generated/api.zod.ts b/products/early_access_features/frontend/generated/api.zod.tsindex c9c69a61354d..bd6241381fbe 100644--- a/products/early_access_features/frontend/generated/api.zod.ts+++ b/products/early_access_features/frontend/generated/api.zod.ts@@ -13,86 +13,92 @@ export const earlyAccessFeatureCreateBodyNameMax = 200export const earlyAccessFeatureCreateBodyDocumentationUrlMax = 800-export const EarlyAccessFeatureCreateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(earlyAccessFeatureCreateBodyNameMax).describe('The name of the early access feature.'),- description: zod- .string()- .optional()- .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),- stage: zod- .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])- .describe(- '\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'- )- .describe(- 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha\/beta\/general-availability) enables the feature flag for opted-in users.\n\n\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'- ),- documentation_url: zod- .url()- .max(earlyAccessFeatureCreateBodyDocumentationUrlMax)- .optional()- .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),- payload: zod.unknown().optional().describe('Arbitrary JSON metadata associated with this feature.'),- feature_flag_id: zod- .number()- .optional()- .describe(- 'Optional ID of an existing feature flag to link. If omitted, a new flag is auto-created from the feature name. The flag must not already be linked to another feature, must not be group-based, and must not be multivariate.'- ),- _create_in_folder: zod.string().optional(),-})+export const EarlyAccessFeatureCreateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(earlyAccessFeatureCreateBodyNameMax).describe('The name of the early access feature.'),+ description: zod+ .string()+ .optional()+ .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),+ stage: zod+ .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])+ .describe(+ '\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'+ )+ .describe(+ 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha\/beta\/general-availability) enables the feature flag for opted-in users.\n\n\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'+ ),+ documentation_url: zod+ .url()+ .max(earlyAccessFeatureCreateBodyDocumentationUrlMax)+ .optional()+ .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),+ payload: zod.unknown().optional().describe('Arbitrary JSON metadata associated with this feature.'),+ feature_flag_id: zod+ .number()+ .optional()+ .describe(+ 'Optional ID of an existing feature flag to link. If omitted, a new flag is auto-created from the feature name. The flag must not already be linked to another feature, must not be group-based, and must not be multivariate.'+ ),+ _create_in_folder: zod.string().optional(),+ })+ .describe('Mixin for serializers to add user access control fields')export const earlyAccessFeatureUpdateBodyNameMax = 200export const earlyAccessFeatureUpdateBodyDocumentationUrlMax = 800-export const EarlyAccessFeatureUpdateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(earlyAccessFeatureUpdateBodyNameMax).describe('The name of the early access feature.'),- description: zod- .string()- .optional()- .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),- stage: zod- .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])- .describe(- '\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'- )- .describe(- 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha\/beta\/general-availability) enables the feature flag for opted-in users.\n\n\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'- ),- documentation_url: zod- .url()- .max(earlyAccessFeatureUpdateBodyDocumentationUrlMax)- .optional()- .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),-})+export const EarlyAccessFeatureUpdateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(earlyAccessFeatureUpdateBodyNameMax).describe('The name of the early access feature.'),+ description: zod+ .string()+ .optional()+ .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),+ stage: zod+ .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])+ .describe(+ '\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'+ )+ .describe(+ 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha\/beta\/general-availability) enables the feature flag for opted-in users.\n\n\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'+ ),+ documentation_url: zod+ .url()+ .max(earlyAccessFeatureUpdateBodyDocumentationUrlMax)+ .optional()+ .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),+ })+ .describe('Mixin for serializers to add user access control fields')export const earlyAccessFeaturePartialUpdateBodyNameMax = 200export const earlyAccessFeaturePartialUpdateBodyDocumentationUrlMax = 800-export const EarlyAccessFeaturePartialUpdateBody = /* @__PURE__ */ zod.object({- name: zod- .string()- .max(earlyAccessFeaturePartialUpdateBodyNameMax)- .optional()- .describe('The name of the early access feature.'),- description: zod- .string()- .optional()- .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),- stage: zod- .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])- .describe(- '\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'- )- .optional()- .describe(- 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha\/beta\/general-availability) enables the feature flag for opted-in users.\n\n\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'- ),- documentation_url: zod- .url()- .max(earlyAccessFeaturePartialUpdateBodyDocumentationUrlMax)- .optional()- .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),-})+export const EarlyAccessFeaturePartialUpdateBody = /* @__PURE__ */ zod+ .object({+ name: zod+ .string()+ .max(earlyAccessFeaturePartialUpdateBodyNameMax)+ .optional()+ .describe('The name of the early access feature.'),+ description: zod+ .string()+ .optional()+ .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),+ stage: zod+ .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])+ .describe(+ '\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'+ )+ .optional()+ .describe(+ 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha\/beta\/general-availability) enables the feature flag for opted-in users.\n\n\* `draft` - draft\n\* `concept` - concept\n\* `alpha` - alpha\n\* `beta` - beta\n\* `general-availability` - general availability\n\* `archived` - archived'+ ),+ documentation_url: zod+ .url()+ .max(earlyAccessFeaturePartialUpdateBodyDocumentationUrlMax)+ .optional()+ .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),+ })+ .describe('Mixin for serializers to add user access control fields')diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 16118252268d..a3c1a5a914d8 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -17897,6 +17897,9 @@ export namespace Schemas {Archived: 'archived',} as const;+ /**+ * Mixin for serializers to add user access control fields+ */export interface EarlyAccessFeature {readonly id: string;readonly feature_flag: MinimalFeatureFlag;@@ -17924,8 +17927,16 @@ export namespace Schemas {/** Feature flag payload for this early access feature */readonly payload: EarlyAccessFeaturePayload;readonly created_at: string;+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level: string | null;}+ /**+ * Mixin for serializers to add user access control fields+ */export interface EarlyAccessFeatureSerializerCreateOnly {readonly id: string;/**@@ -17956,6 +17967,11 @@ export namespace Schemas {feature_flag_id?: number;readonly feature_flag: MinimalFeatureFlag;_create_in_folder?: string;+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level: string | null;}export interface Edge {@@ -36565,6 +36581,9 @@ export namespace Schemas {*/export type PatchedEarlyAccessFeaturePayload = { [key: string]: unknown };+ /**+ * Mixin for serializers to add user access control fields+ */export interface PatchedEarlyAccessFeature {readonly id?: string;readonly feature_flag?: MinimalFeatureFlag;@@ -36592,6 +36611,11 @@ export namespace Schemas {/** Feature flag payload for this early access feature */readonly payload?: PatchedEarlyAccessFeaturePayload;readonly created_at?: string;+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level?: string | null;}export interface PatchedEdge {diff --git a/services/mcp/src/generated/early_access_features/api.ts b/services/mcp/src/generated/early_access_features/api.tsindex cd3515ae18e2..ea6c30e2a5f9 100644--- a/services/mcp/src/generated/early_access_features/api.ts+++ b/services/mcp/src/generated/early_access_features/api.ts@@ -33,34 +33,36 @@ export const earlyAccessFeatureCreateBodyNameMax = 200export const earlyAccessFeatureCreateBodyDocumentationUrlMax = 800-export const EarlyAccessFeatureCreateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(earlyAccessFeatureCreateBodyNameMax).describe('The name of the early access feature.'),- description: zod- .string()- .optional()- .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),- stage: zod- .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])- .describe(- '* `draft` - draft\n* `concept` - concept\n* `alpha` - alpha\n* `beta` - beta\n* `general-availability` - general availability\n* `archived` - archived'- )- .describe(- 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha/beta/general-availability) enables the feature flag for opted-in users.\n\n* `draft` - draft\n* `concept` - concept\n* `alpha` - alpha\n* `beta` - beta\n* `general-availability` - general availability\n* `archived` - archived'- ),- documentation_url: zod- .url()- .max(earlyAccessFeatureCreateBodyDocumentationUrlMax)- .optional()- .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),- payload: zod.unknown().optional().describe('Arbitrary JSON metadata associated with this feature.'),- feature_flag_id: zod- .number()- .optional()- .describe(- 'Optional ID of an existing feature flag to link. If omitted, a new flag is auto-created from the feature name. The flag must not already be linked to another feature, must not be group-based, and must not be multivariate.'- ),- _create_in_folder: zod.string().optional(),-})+export const EarlyAccessFeatureCreateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(earlyAccessFeatureCreateBodyNameMax).describe('The name of the early access feature.'),+ description: zod+ .string()+ .optional()+ .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),+ stage: zod+ .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])+ .describe(+ '* `draft` - draft\n* `concept` - concept\n* `alpha` - alpha\n* `beta` - beta\n* `general-availability` - general availability\n* `archived` - archived'+ )+ .describe(+ 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha/beta/general-availability) enables the feature flag for opted-in users.\n\n* `draft` - draft\n* `concept` - concept\n* `alpha` - alpha\n* `beta` - beta\n* `general-availability` - general availability\n* `archived` - archived'+ ),+ documentation_url: zod+ .url()+ .max(earlyAccessFeatureCreateBodyDocumentationUrlMax)+ .optional()+ .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),+ payload: zod.unknown().optional().describe('Arbitrary JSON metadata associated with this feature.'),+ feature_flag_id: zod+ .number()+ .optional()+ .describe(+ 'Optional ID of an existing feature flag to link. If omitted, a new flag is auto-created from the feature name. The flag must not already be linked to another feature, must not be group-based, and must not be multivariate.'+ ),+ _create_in_folder: zod.string().optional(),+ })+ .describe('Mixin for serializers to add user access control fields')export const EarlyAccessFeatureRetrieveParams = /* @__PURE__ */ zod.object({id: zod.string().describe('A UUID string identifying this early access feature.'),@@ -84,31 +86,33 @@ export const earlyAccessFeaturePartialUpdateBodyNameMax = 200export const earlyAccessFeaturePartialUpdateBodyDocumentationUrlMax = 800-export const EarlyAccessFeaturePartialUpdateBody = /* @__PURE__ */ zod.object({- name: zod- .string()- .max(earlyAccessFeaturePartialUpdateBodyNameMax)- .optional()- .describe('The name of the early access feature.'),- description: zod- .string()- .optional()- .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),- stage: zod- .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])- .describe(- '* `draft` - draft\n* `concept` - concept\n* `alpha` - alpha\n* `beta` - beta\n* `general-availability` - general availability\n* `archived` - archived'- )- .optional()- .describe(- 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha/beta/general-availability) enables the feature flag for opted-in users.\n\n* `draft` - draft\n* `concept` - concept\n* `alpha` - alpha\n* `beta` - beta\n* `general-availability` - general availability\n* `archived` - archived'- ),- documentation_url: zod- .url()- .max(earlyAccessFeaturePartialUpdateBodyDocumentationUrlMax)- .optional()- .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),-})+export const EarlyAccessFeaturePartialUpdateBody = /* @__PURE__ */ zod+ .object({+ name: zod+ .string()+ .max(earlyAccessFeaturePartialUpdateBodyNameMax)+ .optional()+ .describe('The name of the early access feature.'),+ description: zod+ .string()+ .optional()+ .describe('A longer description of what this early access feature does, shown to users in the opt-in UI.'),+ stage: zod+ .enum(['draft', 'concept', 'alpha', 'beta', 'general-availability', 'archived'])+ .describe(+ '* `draft` - draft\n* `concept` - concept\n* `alpha` - alpha\n* `beta` - beta\n* `general-availability` - general availability\n* `archived` - archived'+ )+ .optional()+ .describe(+ 'Lifecycle stage. Valid values: draft, concept, alpha, beta, general-availability, archived. Moving to an active stage (alpha/beta/general-availability) enables the feature flag for opted-in users.\n\n* `draft` - draft\n* `concept` - concept\n* `alpha` - alpha\n* `beta` - beta\n* `general-availability` - general availability\n* `archived` - archived'+ ),+ documentation_url: zod+ .url()+ .max(earlyAccessFeaturePartialUpdateBodyDocumentationUrlMax)+ .optional()+ .describe('URL to external documentation for this feature. Shown to users in the opt-in UI.'),+ })+ .describe('Mixin for serializers to add user access control fields')export const EarlyAccessFeatureDestroyParams = /* @__PURE__ */ zod.object({id: zod.string().describe('A UUID string identifying this early access feature.'),diff --git a/tach.toml b/tach.tomlindex 3e8468917a0a..c3d09a5ce6a4 100644--- a/tach.toml+++ b/tach.toml@@ -270,6 +270,7 @@ layer = "modules"path = "products.early_access_features"depends_on = ["posthog",+ "ee","products.feature_flags",]layer = "modules"