: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(error-tracking): sync issue status from linear by default (#127585)
Aleksander Błaszkiewiczc07f9423e098
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex e3bd6da77cd6..9b6464a35917 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -15471,9 +15471,9 @@ snapshots:scenes-app-settings-environment--settings-environment-details--light:hash: v1.k794b7964.6090a4ecd87046135d251b886324ecbe152effc733dce0bb2a8411a3b876ea59.jNzRUhHU4PRNOr0acvK8qpdkaGbLkdNUfbnlileSQ6Iscenes-app-settings-environment--settings-environment-error-tracking--dark:- hash: v1.k794b7964.de7da6a21bcac2a07929851a598ec3bb2a579b88e974dc7fcb1dad6fa26ce0dc.vJwPYHgMmxfVZZdEDXw3d7PuT811HvxOnjDW0CDUdj8+ hash: v1.k794b7964.a2ad11c04e832b42672c961240cbaa37a55d3257fd66fde9e186f8094eb78949.34qLdPvBNJzB4YLQbLNvcn4UCRm5k95ytw4qNXQJsYUscenes-app-settings-environment--settings-environment-error-tracking--light:- hash: v1.k794b7964.776ea55161274342194e9c67d46ed71176c367a7251c5d9d6d995706dea85c3d.mEZkNhmBmunU6WKhqV6-tHTy-7H2j-wPf3akfik5D70+ hash: v1.k794b7964.adb6fd411ffdc03ea8e1b9a29f01536d41a5af4b6224c37881d7ad6b06630f84.WGucFxYafyt1RqQ5e0M6MzvBxP4nGZseNtgVciGxRWcscenes-app-settings-environment--settings-environment-error-tracking-configuration--dark:hash: v1.k794b7964.fefec3bbacd088c88914a8fcb41ecb8cb2ab327cca2d73788d27450e592c35f9.S75BhNkh_Gx5uOCqbImr0kf0CYnsY3BDW_EnFvIuZ8kscenes-app-settings-environment--settings-environment-error-tracking-configuration--light:diff --git a/frontend/src/scenes/settings/environment/ErrorTrackingIntegrations.tsx b/frontend/src/scenes/settings/environment/ErrorTrackingIntegrations.tsxindex 4e1cea935818..b058f756f4e8 100644--- a/frontend/src/scenes/settings/environment/ErrorTrackingIntegrations.tsx+++ b/frontend/src/scenes/settings/environment/ErrorTrackingIntegrations.tsx@@ -11,8 +11,6 @@ import IconGitLab from 'public/services/gitlab.png'import IconJira from 'public/services/jira.svg'import IconLinear from 'public/services/linear.png'-import { LinearStatusSyncSetting } from 'products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/linear_status_sync/LinearStatusSyncSetting'-const NEXT_URL = urls.settings('environment-error-tracking', 'error-tracking-integrations')export function ErrorTrackingIntegrations(): JSX.Element {@@ -23,10 +21,7 @@ export function ErrorTrackingIntegrations(): JSX.Element {<img src={IconLinear} alt="" className="w-5 h-5" />Linear</h3>- <div className="flex flex-col gap-y-4">- <LinearIntegration next={NEXT_URL} />- <LinearStatusSyncSetting />- </div>+ <LinearIntegration next={NEXT_URL} /></div><div><h3 className="flex items-center gap-2">diff --git a/frontend/src/scenes/settings/stories/SettingsEnvironment.stories.tsx b/frontend/src/scenes/settings/stories/SettingsEnvironment.stories.tsxindex 3c7674627af8..e8b520f9c20a 100644--- a/frontend/src/scenes/settings/stories/SettingsEnvironment.stories.tsx+++ b/frontend/src/scenes/settings/stories/SettingsEnvironment.stories.tsx@@ -199,7 +199,6 @@ export const SettingsEnvironmentErrorTracking: Story = {per_issue_rate_limit_value: null,per_issue_rate_limit_bucket_size_minutes: null,ingestion_enabled: true,- linear_status_sync_enabled: false,},},}),diff --git a/products/error_tracking/backend/facade/api.py b/products/error_tracking/backend/facade/api.pyindex 5ea1785f6d30..c55082759190 100644--- a/products/error_tracking/backend/facade/api.py+++ b/products/error_tracking/backend/facade/api.py@@ -217,7 +217,6 @@ def _to_settings(settings, ingestion_enabled: bool) -> contracts.ErrorTrackingSeper_issue_rate_limit_value=settings.per_issue_rate_limit_value,per_issue_rate_limit_bucket_size_minutes=settings.per_issue_rate_limit_bucket_size_minutes,ingestion_enabled=ingestion_enabled,- linear_status_sync_enabled=settings.linear_status_sync_enabled,)diff --git a/products/error_tracking/backend/facade/contracts.py b/products/error_tracking/backend/facade/contracts.pyindex f7ee592a1a5d..5029db9784f2 100644--- a/products/error_tracking/backend/facade/contracts.py+++ b/products/error_tracking/backend/facade/contracts.py@@ -208,7 +208,6 @@ class ErrorTrackingSettings:per_issue_rate_limit_value: int | Noneper_issue_rate_limit_bucket_size_minutes: int | Noneingestion_enabled: bool- linear_status_sync_enabled: bool@dataclass(frozen=True)diff --git a/products/error_tracking/backend/logic/__init__.py b/products/error_tracking/backend/logic/__init__.pyindex 62346f48f480..dbf4945b1d04 100644--- a/products/error_tracking/backend/logic/__init__.py+++ b/products/error_tracking/backend/logic/__init__.py@@ -41,7 +41,6 @@ SETTINGS_FIELDS = ("project_rate_limit_bucket_size_minutes","per_issue_rate_limit_value","per_issue_rate_limit_bucket_size_minutes",- "linear_status_sync_enabled",)SPIKE_DETECTION_CONFIG_FIELDS = (diff --git a/products/error_tracking/backend/logic/issue_changes.py b/products/error_tracking/backend/logic/issue_changes.pyindex 0675ec614f2b..50092aa7f9c2 100644--- a/products/error_tracking/backend/logic/issue_changes.py+++ b/products/error_tracking/backend/logic/issue_changes.py@@ -238,6 +238,7 @@ class ChangeOperation:team_id: intactor_type: ErrorTrackingIssueChange.ActorTypeactor_user_id: int | None+ actor_automation_id: UUID | Nonebulk: bool@classmethod@@ -253,11 +254,12 @@ class ChangeOperation:team_id=team_id,actor_type=ErrorTrackingIssueChange.ActorType.USER,actor_user_id=user.id,+ actor_automation_id=None,bulk=bulk,)@classmethod- def for_automation(cls, team_id: int) -> "ChangeOperation | None":+ def for_automation(cls, team_id: int, automation_id: UUID) -> "ChangeOperation | None":"""Start an operation that no person made, or return None when the change log is off for the team."""if not issue_change_log_enabled(team_id):return None@@ -266,6 +268,7 @@ class ChangeOperation:team_id=team_id,actor_type=ErrorTrackingIssueChange.ActorType.AUTOMATION,actor_user_id=None,+ actor_automation_id=automation_id,bulk=False,)@@ -308,6 +311,7 @@ def record_issue_changes(operation: ChangeOperation | None, changes: Sequence[Isbulk=operation.bulk,actor_type=operation.actor_type,actor_user_id=operation.actor_user_id,+ actor_automation_id=operation.actor_automation_id,)for change in changes]diff --git a/products/error_tracking/backend/logic/issue_mutations.py b/products/error_tracking/backend/logic/issue_mutations.pyindex 0542db4baa48..ad08eeb3d636 100644--- a/products/error_tracking/backend/logic/issue_mutations.py+++ b/products/error_tracking/backend/logic/issue_mutations.py@@ -253,6 +253,7 @@ def transition_issue_status_by_automation(expected: "ErrorTrackingIssue.Status",status: "ErrorTrackingIssue.Status",trigger: Trigger,+ automation_id: UUID,) -> bool:"""Move an issue from `expected` to `status` for a change no person made.@@ -260,7 +261,7 @@ def transition_issue_status_by_automation(when the issue is no longer in `expected`. So a person or ingestion that changed the statusafter the automation decided is never overwritten."""- operation = ChangeOperation.for_automation(team_id)+ operation = ChangeOperation.for_automation(team_id, automation_id)with transaction.atomic():locked = _lock_issues(team_id, [issue_id], select_related=("team",))if not locked or locked[0].status != expected:diff --git a/products/error_tracking/backend/logic/linear_status_sync.py b/products/error_tracking/backend/logic/linear_status_sync.pyindex d6b96755c5fd..1a8d3c3ac5a9 100644--- a/products/error_tracking/backend/logic/linear_status_sync.py+++ b/products/error_tracking/backend/logic/linear_status_sync.py@@ -4,7 +4,7 @@ An issue resolves when every linked Linear ticket is closed and at least one ofcanceled ticket alone never resolves an issue, because it means nobody fixed anything. A linked ticketthat Linear does not return has no known state, so it keeps the issue open. A resolvedissue becomes active again when a linked ticket moves from a closed state back to an open one.-Only projects that turn on `linear_status_sync_enabled` in their error tracking settings take part.+Every project with a linked ticket takes part, unless the kill switch flag is off for that project.A delivery only says that one ticket changed state. The task reads the current state of everylinked ticket from Linear before it decides, so a late or reordered delivery cannot apply a state@@ -38,11 +38,8 @@ from posthog.redis import get_clientfrom products.error_tracking.backend.facade import contractsfrom products.error_tracking.backend.logic.issue_mutations import transition_issue_status_by_automation-from products.error_tracking.backend.models import (- ErrorTrackingExternalReference,- ErrorTrackingIssue,- ErrorTrackingSettings,-)+from products.error_tracking.backend.logic.team_flags import team_flag_explicitly_off+from products.error_tracking.backend.models import ErrorTrackingExternalReference, ErrorTrackingIssue# Linear groups every workflow state into one of these categories. A team can rename its states# and add more of them, but it cannot add a category, so the category is what the sync reads.@@ -52,6 +49,13 @@ _OPEN_STATE_TYPES = frozenset({"triage", "backlog", "unstarted", "started"})_TRIGGER_JOB_TYPE = "linear_status_sync"+# pinned: feature flag key, a renamed key is a new flag with its own rollout state+_ROLLOUT_FLAG = "error-tracking-linear-status-sync"++# pinned: change rows store this as their actor. The sync has no automation row, and the column is a+# plain id, so nothing resolves it.+_AUTOMATION_ID = UUID("0ae328e3-a2de-4999-b50f-dac5e1c1552e")+_WORKSPACE_LOOKUP_TIMEOUT_MS = 800# Long enough to read every linked ticket of one issue. A job that dies holding the lock frees it then.@@ -110,11 +114,11 @@ def delivery_ownership(payload: Mapping[str, Any]) -> DeliveryOwnership:def sync_status(job: contracts.LinearStatusSyncJob) -> None:- workspace_rows = _opted_in_workspace_rows(job)+ workspace_rows = IntegrationManager.linear.oauth.list_by_external_id(job.organization_id)if not workspace_rows:returnworkspace_integration_ids = [row.id for row in workspace_rows]- issues = (+ issues = list(ErrorTrackingIssue.objects.filter(team_id__in={row.team_id for row in workspace_rows},external_issue__integration_id__in=workspace_integration_ids,@@ -124,6 +128,11 @@ def sync_status(job: contracts.LinearStatusSyncJob) -> None:.order_by("id").select_related("team__organization"))+ # Once per project, because one ticket can link many issues of a project, and a lookup that misses+ # the local flag definitions waits on a remote request.+ switched_off_team_ids = {+ team_id for team_id in {issue.team_id for issue in issues} if team_flag_explicitly_off(_ROLLOUT_FLAG, team_id)+ }# Each project reads Linear with its own token, so one revoked token must not keep every other# project's issue from syncing. One failure is raised after the loop so the task retries, and a@@ -131,6 +140,8 @@ def sync_status(job: contracts.LinearStatusSyncJob) -> None:linear_reads = _LinearReads(job)failures: list[Exception] = []for issue in issues:+ if issue.team_id in switched_off_team_ids:+ continuetry:with _issue_lock(issue.id):_refresh_moved_identifiers(issue, job, workspace_integration_ids)@@ -180,19 +191,6 @@ def _failure_to_retry(failures: list[Exception]) -> Exception:return busy[0] if busy else failures[0]-def _opted_in_workspace_rows(job: contracts.LinearStatusSyncJob) -> list[IntegrationRecord]:- """The integration rows that connect the job's Linear workspace to a project that turned the sync on."""- rows = IntegrationManager.linear.oauth.list_by_external_id(job.organization_id)- if not rows:- return []- opted_in_team_ids = set(- ErrorTrackingSettings.objects.filter(- linear_status_sync_enabled=True, team_id__in={row.team_id for row in rows}- ).values_list("team_id", flat=True)- )- return [row for row in rows if row.team_id in opted_in_team_ids]--def _refresh_moved_identifiers(issue: ErrorTrackingIssue, job: contracts.LinearStatusSyncJob, workspace_integration_ids: list[int]) -> None:@@ -314,7 +312,7 @@ def _transition(trigger: Trigger,) -> None:changed = transition_issue_status_by_automation(- issue.team_id, issue.id, expected=expected, status=status, trigger=trigger+ issue.team_id, issue.id, expected=expected, status=status, trigger=trigger, automation_id=_AUTOMATION_ID)if not changed:returndiff --git a/products/error_tracking/backend/logic/team_flags.py b/products/error_tracking/backend/logic/team_flags.pyindex 088bde649834..011b349dbed4 100644--- a/products/error_tracking/backend/logic/team_flags.py+++ b/products/error_tracking/backend/logic/team_flags.py@@ -1,26 +1,44 @@+from typing import Any+from django.conf import settingsimport structlog+import posthoganalyticsfrom posthog.ph_client import feature_enabled_or_falselogger = structlog.get_logger(__name__)+def _project_flag_options(team_id: int) -> dict[str, Any]:+ return {+ "groups": {"project": str(team_id)},+ "group_properties": {"project": {"id": str(team_id)}},+ "only_evaluate_locally": False,+ "send_feature_flag_events": False,+ }++def team_flag_enabled(flag: str, team_id: int) -> bool:"""Evaluate a project-level rollout flag. Fails closed when the evaluation raises."""# The analytics SDK is disabled in local dev, so the flag always reads as off there.if settings.DEBUG:return Truetry:- return feature_enabled_or_false(- flag,- str(team_id),- groups={"project": str(team_id)},- group_properties={"project": {"id": str(team_id)}},- only_evaluate_locally=False,- send_feature_flag_events=False,- )+ return feature_enabled_or_false(flag, str(team_id), **_project_flag_options(team_id))+ except Exception:+ logger.exception("error_tracking_flag_check_failed", flag=flag, team_id=team_id)+ return False+++def team_flag_explicitly_off(flag: str, team_id: int) -> bool:+ """Whether a kill switch turns a released feature off for this project. Fails open.++ The SDK answers None when a lookup fails and when an instance opts out of telemetry, and it+ answers False only for a flag that is really off. The feature must keep working in the first two cases.+ """+ try:+ return posthoganalytics.feature_enabled(flag, str(team_id), **_project_flag_options(team_id)) is Falseexcept Exception:logger.exception("error_tracking_flag_check_failed", flag=flag, team_id=team_id)return Falsediff --git a/products/error_tracking/backend/migrations/0050_untrack_errortrackingsettings_linear_status_sync_enabled.py b/products/error_tracking/backend/migrations/0050_untrack_errortrackingsettings_linear_status_sync_enabled.pynew file mode 100644index 000000000000..887b71585f98--- /dev/null+++ b/products/error_tracking/backend/migrations/0050_untrack_errortrackingsettings_linear_status_sync_enabled.py@@ -0,0 +1,14 @@+from django.db import migrations++from posthog.migration_helpers import untrack_field+++class Migration(migrations.Migration):+ dependencies = [+ ("error_tracking", "0049_externalreference_integration_context_id_index"),+ ]++ operations = [+ # The column keeps its database default, so inserts that no longer name it still succeed.+ untrack_field("errortrackingsettings", "linear_status_sync_enabled"),+ ]diff --git a/products/error_tracking/backend/migrations/max_migration.txt b/products/error_tracking/backend/migrations/max_migration.txtindex e958734c8261..8ce95b1271c2 100644--- a/products/error_tracking/backend/migrations/max_migration.txt+++ b/products/error_tracking/backend/migrations/max_migration.txt@@ -1 +1 @@-0049_externalreference_integration_context_id_index+0050_untrack_errortrackingsettings_linear_status_sync_enableddiff --git a/products/error_tracking/backend/models.py b/products/error_tracking/backend/models.pyindex d29b2555aa6e..6bc777520380 100644--- a/products/error_tracking/backend/models.py+++ b/products/error_tracking/backend/models.py@@ -934,7 +934,6 @@ class ErrorTrackingSettings(models.Model):project_rate_limit_bucket_size_minutes = models.IntegerField(null=True, blank=True)per_issue_rate_limit_value = models.IntegerField(null=True, blank=True)per_issue_rate_limit_bucket_size_minutes = models.IntegerField(null=True, blank=True)- linear_status_sync_enabled = models.BooleanField(default=False, db_default=False)class Meta:db_table = "posthog_errortrackingsettings"diff --git a/products/error_tracking/backend/presentation/views/settings.py b/products/error_tracking/backend/presentation/views/settings.pyindex 51fc6b48c7b1..6b77d0ba6b9d 100644--- a/products/error_tracking/backend/presentation/views/settings.py+++ b/products/error_tracking/backend/presentation/views/settings.py@@ -40,14 +40,6 @@ class ErrorTrackingSettingsSerializer(serializers.Serializer):"for this project before it is stored or billed, and the events cannot be recovered."),)- linear_status_sync_enabled = serializers.BooleanField(- required=False,- help_text=(- "Whether status changes on linked Linear tickets update the issue. When true, an issue resolves once "- "every linked Linear ticket is closed and at least one is done, and a resolved issue becomes active "- "again when a linked ticket reopens."- ),- )class ErrorTrackingSettingsViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):diff --git a/products/error_tracking/backend/test/test_linear_status_sync.py b/products/error_tracking/backend/test/test_linear_status_sync.pyindex c4ffbb7fa576..54d7138fd15d 100644--- a/products/error_tracking/backend/test/test_linear_status_sync.py+++ b/products/error_tracking/backend/test/test_linear_status_sync.py@@ -23,7 +23,7 @@ from products.error_tracking.backend.facade import contracts, issuesfrom products.error_tracking.backend.models import (ErrorTrackingExternalReference,ErrorTrackingIssue,- ErrorTrackingSettings,+ ErrorTrackingIssueChange,)from products.error_tracking.backend.tasks.linear import process_linear_status_sync@@ -172,13 +172,6 @@ class TestErrorTrackingLinearWebhook(BaseTest):class TestLinearStatusSync(BaseTest):- def setUp(self) -> None:- super().setUp()- self._opt_in(self.team)-- def _opt_in(self, team: Team) -> None:- ErrorTrackingSettings.objects.create(team=team, linear_status_sync_enabled=True)-def _linear_integration(self, team: Team, organization_id: str = ORGANIZATION_ID, token: str = "linear-token") -> Integration:@@ -272,33 +265,83 @@ class TestLinearStatusSync(BaseTest):)assert system_status_changes.count() == (0 if expected_status == initial_status else 1)- def test_changes_only_opted_in_projects_linked_through_the_same_workspace(self) -> None:+ def test_changes_every_project_linked_through_the_same_workspace(self) -> None:linked_issue = self._linked_issue(self.team, self._linear_integration(self.team), ["ENG-1"])other_workspace_issue = self._linked_issue(self.team, self._linear_integration(self.team, organization_id="linear-org-2"), ["ENG-1"])- opted_in_team = Team.objects.create(organization=self.organization, name="Opted in")- self._opt_in(opted_in_team)- opted_in_issue = self._linked_issue(opted_in_team, self._linear_integration(opted_in_team), ["ENG-1"])- not_opted_in_team = Team.objects.create(organization=self.organization, name="Not opted in")- not_opted_in_issue = self._linked_issue(- not_opted_in_team, self._linear_integration(not_opted_in_team), ["ENG-1"]- )+ other_team = Team.objects.create(organization=self.organization, name="Other project")+ other_team_issue = self._linked_issue(other_team, self._linear_integration(other_team), ["ENG-1"])self._sync(_FakeLinear({"ENG-1": "completed"}, "started"))statuses = dict(ErrorTrackingIssue.objects.filter(- id__in=[linked_issue.id, other_workspace_issue.id, opted_in_issue.id, not_opted_in_issue.id]+ id__in=[linked_issue.id, other_workspace_issue.id, other_team_issue.id]).values_list("id", "status"))assert statuses == {linked_issue.id: "resolved",other_workspace_issue.id: "active",- opted_in_issue.id: "resolved",- not_opted_in_issue.id: "active",+ other_team_issue.id: "resolved",}+ @parameterized.expand(+ [+ ("flag_off_skips_the_project", False, "active"),+ ("flag_on_syncs_the_project", True, "resolved"),+ ("failed_lookup_or_disabled_sdk_syncs_the_project", None, "resolved"),+ ("raising_lookup_syncs_the_project", RuntimeError("flags are down"), "resolved"),+ ]+ )+ def test_kill_switch_decides_for_each_project(+ self, _name: str, flag_answer: bool | None | Exception, expected_status: str+ ) -> None:+ integration = self._linear_integration(self.team)+ issues = [self._linked_issue(self.team, integration, ["ENG-1"]) for _ in range(2)]+ other_team = Team.objects.create(organization=self.organization, name="Other project")+ other_team_issue = self._linked_issue(other_team, self._linear_integration(other_team), ["ENG-1"])+ lookups: Counter[str] = Counter()++ def answer(flag: str, distinct_id: str, **_kwargs: object) -> bool | None:+ if flag != "error-tracking-linear-status-sync":+ return None+ lookups[distinct_id] += 1+ if distinct_id != str(self.team.id):+ return None+ if isinstance(flag_answer, Exception):+ raise flag_answer+ return flag_answer++ with patch(+ "products.error_tracking.backend.logic.team_flags.posthoganalytics.feature_enabled", side_effect=answer+ ):+ self._sync(_FakeLinear({"ENG-1": "completed"}, "started"))++ statuses = dict(+ ErrorTrackingIssue.objects.filter(+ id__in=[*(issue.id for issue in issues), other_team_issue.id]+ ).values_list("id", "status")+ )+ assert statuses == {+ issues[0].id: expected_status,+ issues[1].id: expected_status,+ other_team_issue.id: "resolved",+ }+ assert lookups == {str(self.team.id): 1, str(other_team.id): 1}++ def test_records_the_sync_as_an_automation_in_the_change_log(self) -> None:+ issue = self._linked_issue(self.team, self._linear_integration(self.team), ["ENG-1"])++ with patch("products.error_tracking.backend.logic.issue_changes.issue_change_log_enabled", return_value=True):+ self._sync(_FakeLinear({"ENG-1": "completed"}, "started"))++ issue.refresh_from_db()+ assert issue.status == "resolved"+ change = ErrorTrackingIssueChange.objects.for_team(self.team.id).get(issue_id=issue.id)+ assert change.actor_type == "automation"+ assert change.actor_automation_id is not None+@parameterized.expand([("move_job_first", True), ("completion_job_first", False)])def test_a_ticket_that_moved_teams_holds_its_issue_open_until_it_closes(self, _name: str, move_job_first: bool@@ -319,7 +362,6 @@ class TestLinearStatusSync(BaseTest):def test_each_project_reads_the_previous_state_with_its_own_token(self) -> None:blind_team = Team.objects.create(organization=self.organization, name="Cannot see the previous team")- self._opt_in(blind_team)blind_issue = self._linked_issue(blind_team, self._linear_integration(blind_team, token="blind-token"), ["ENG-1"], status="resolved")@@ -337,7 +379,6 @@ class TestLinearStatusSync(BaseTest):def test_a_project_whose_linear_read_fails_raises_without_holding_back_the_others(self) -> None:revoked_team = Team.objects.create(organization=self.organization, name="Revoked token")- self._opt_in(revoked_team)failing_issue = self._linked_issue(revoked_team, self._linear_integration(revoked_team, token="revoked-token"), ["ENG-1"])@@ -365,7 +406,6 @@ class TestLinearStatusSync(BaseTest):) -> None:if failing_project_first:revoked_team = Team.objects.create(organization=self.organization, name="Revoked token")- self._opt_in(revoked_team)self._linked_issue(revoked_team, self._linear_integration(revoked_team, token="revoked-token"), ["ENG-1"])integration = self._linear_integration(self.team)self._linked_issue(self.team, integration, ["ENG-1"])diff --git a/products/error_tracking/backend/tests/api/test_settings.py b/products/error_tracking/backend/tests/api/test_settings.pyindex 61673cda77b9..354f0ea3199c 100644--- a/products/error_tracking/backend/tests/api/test_settings.py+++ b/products/error_tracking/backend/tests/api/test_settings.py@@ -35,18 +35,15 @@ class TestErrorTrackingSettingsAPI(APIBaseTest):{"project_rate_limit_value": 5000,"project_rate_limit_bucket_size_minutes": 60,- "linear_status_sync_enabled": True,},format="json",)self.assertEqual(response.status_code, status.HTTP_200_OK)self.assertEqual(response.json()["project_rate_limit_value"], 5000)- self.assertEqual(response.json()["linear_status_sync_enabled"], True)settings = ErrorTrackingSettings.objects.get(team=self.team)self.assertEqual(settings.project_rate_limit_value, 5000)self.assertEqual(settings.project_rate_limit_bucket_size_minutes, 60)- self.assertTrue(settings.linear_status_sync_enabled)def test_update_settings_only_changes_provided_fields(self):setup_response = self.client.patch(diff --git a/products/error_tracking/frontend/generated/api.schemas.ts b/products/error_tracking/frontend/generated/api.schemas.tsindex 67276ab61c8b..f7767488343f 100644--- a/products/error_tracking/frontend/generated/api.schemas.ts+++ b/products/error_tracking/frontend/generated/api.schemas.ts@@ -2246,8 +2246,6 @@ export interface ErrorTrackingSettingsApi {per_issue_rate_limit_bucket_size_minutes?: number | null/** Whether the project ingests exception events. When false, ingestion drops every $exception event for this project before it is stored or billed, and the events cannot be recovered. */ingestion_enabled?: boolean- /** Whether status changes on linked Linear tickets update the issue. When true, an issue resolves once every linked Linear ticket is closed and at least one is done, and a resolved issue becomes active again when a linked ticket reopens. */- linear_status_sync_enabled?: boolean}export interface PatchedErrorTrackingSettingsApi {@@ -2277,8 +2275,6 @@ export interface PatchedErrorTrackingSettingsApi {per_issue_rate_limit_bucket_size_minutes?: number | null/** Whether the project ingests exception events. When false, ingestion drops every $exception event for this project before it is stored or billed, and the events cannot be recovered. */ingestion_enabled?: boolean- /** Whether status changes on linked Linear tickets update the issue. When true, an issue resolves once every linked Linear ticket is closed and at least one is done, and a resolved issue becomes active again when a linked ticket reopens. */- linear_status_sync_enabled?: boolean}/**diff --git a/products/error_tracking/frontend/generated/api.zod.ts b/products/error_tracking/frontend/generated/api.zod.tsindex 291131ee5876..1826692d0c5b 100644--- a/products/error_tracking/frontend/generated/api.zod.ts+++ b/products/error_tracking/frontend/generated/api.zod.ts@@ -1124,12 +1124,6 @@ export const ErrorTrackingSettingsUpdateSettingsPartialUpdateBody = /* @__PURE__.describe('Whether the project ingests exception events. When false, ingestion drops every $exception event for this project before it is stored or billed, and the events cannot be recovered.'),- linear_status_sync_enabled: zod- .boolean()- .optional()- .describe(- 'Whether status changes on linked Linear tickets update the issue. When true, an issue resolves once every linked Linear ticket is closed and at least one is done, and a resolved issue becomes active again when a linked ticket reopens.'- ),})export const errorTrackingSeverityRulesCreateBodyOrderKeyDefault = 0diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/linear_status_sync/LinearStatusSyncSetting.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/linear_status_sync/LinearStatusSyncSetting.tsxdeleted file mode 100644index 517351c7f83d..000000000000--- a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/linear_status_sync/LinearStatusSyncSetting.tsx+++ /dev/null@@ -1,45 +0,0 @@-import { useActions, useValues } from 'kea'--import { LemonBanner, LemonSkeleton, LemonSwitch } from '@posthog/lemon-ui'--import { errorTrackingEditAccessDisabledReason } from '../../../utils'-import { linearStatusSyncLogic } from './linearStatusSyncLogic'--export function LinearStatusSyncSetting(): JSX.Element {- const { linearStatusSyncEnabled, settingsLoading, settingsLoadFailed, integrations, linearIntegrations } =- useValues(linearStatusSyncLogic)- const { setLinearStatusSyncEnabled } = useActions(linearStatusSyncLogic)-- if (linearStatusSyncEnabled === null) {- return settingsLoadFailed ? (- <LemonBanner type="error">Couldn't load this setting. Refresh the page to try again.</LemonBanner>- ) : (- <LemonSkeleton className="w-60 h-10" />- )- }-- // Turning the sync off stays possible after the workspace is disconnected.- const noWorkspaceReason =- integrations !== null && linearIntegrations.length === 0 && !linearStatusSyncEnabled- ? 'Connect a Linear workspace first'- : null-- return (- <div className="flex flex-col gap-y-2">- <LemonSwitch- id="error-tracking-linear-status-sync-switch"- data-attr="error-tracking-linear-status-sync-switch"- label="Sync error tracking issue status from Linear"- checked={linearStatusSyncEnabled}- onChange={setLinearStatusSyncEnabled}- loading={settingsLoading || integrations === null}- disabledReason={errorTrackingEditAccessDisabledReason() ?? noWorkspaceReason}- bordered- />- <p className="m-0 text-xs text-secondary">- Resolves an error tracking issue when all of its linked Linear tickets are closed and at least one of- them is done. Reopens the issue when a linked ticket is reopened.- </p>- </div>- )-}diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/linear_status_sync/linearStatusSyncLogic.ts b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/linear_status_sync/linearStatusSyncLogic.tsdeleted file mode 100644index 360f1e3b1beb..000000000000--- a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/linear_status_sync/linearStatusSyncLogic.ts+++ /dev/null@@ -1,135 +0,0 @@-import { MakeLogicType, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'-import { loaders } from 'kea-loaders'-import posthog from 'posthog-js'--import { integrationsLogic } from 'lib/integrations/integrationsLogic'-import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'-import { getCurrentTeamId } from 'lib/utils/getAppContext'--import { IntegrationType } from '~/types'--import {- errorTrackingSettingsRetrieveSettingsRetrieve,- errorTrackingSettingsUpdateSettingsPartialUpdate,-} from '../../../generated/api'-import type { ErrorTrackingSettingsApi } from '../../../generated/api.schemas'--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface linearStatusSyncLogicValues {- integrations: IntegrationType[] | null // integrationsLogic- linearIntegrations: IntegrationType[] // integrationsLogic- linearStatusSyncEnabled: boolean | null- settings: ErrorTrackingSettingsApi | null- settingsLoadFailed: boolean- settingsLoading: boolean-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface linearStatusSyncLogicActions {- loadSettings: () => any- loadSettingsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadSettingsSuccess: (- settings: ErrorTrackingSettingsApi,- payload?: any- ) => {- settings: ErrorTrackingSettingsApi- payload?: any- }- setLinearStatusSyncEnabled: (linearStatusSyncEnabled: boolean) => boolean- setLinearStatusSyncEnabledFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- setLinearStatusSyncEnabledSuccess: (- settings: ErrorTrackingSettingsApi,- payload?: boolean- ) => {- settings: ErrorTrackingSettingsApi- payload?: boolean- }-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface linearStatusSyncLogicMeta {- __keaTypeGenInternalSelectorTypes: {- linearStatusSyncEnabled: (settings: ErrorTrackingSettingsApi | null) => boolean | null- }-}--export type linearStatusSyncLogicType = MakeLogicType<- linearStatusSyncLogicValues,- linearStatusSyncLogicActions,- Record<string, any>,- linearStatusSyncLogicMeta->--export const linearStatusSyncLogic = kea<linearStatusSyncLogicType>([- path([- 'products',- 'error_tracking',- 'scenes',- 'ErrorTrackingConfigurationScene',- 'linear_status_sync',- 'linearStatusSyncLogic',- ]),-- connect(() => ({- values: [integrationsLogic, ['integrations', 'linearIntegrations']],- })),-- loaders({- settings: [- null as ErrorTrackingSettingsApi | null,- {- loadSettings: async () => {- return await errorTrackingSettingsRetrieveSettingsRetrieve(getCurrentTeamId().toString())- },- setLinearStatusSyncEnabled: async (linearStatusSyncEnabled: boolean) => {- return await errorTrackingSettingsUpdateSettingsPartialUpdate(getCurrentTeamId().toString(), {- linear_status_sync_enabled: linearStatusSyncEnabled,- })- },- },- ],- }),-- reducers({- settingsLoadFailed: [- false,- {- loadSettings: () => false,- loadSettingsFailure: () => true,- },- ],- }),-- selectors({- linearStatusSyncEnabled: [- (s) => [s.settings],- (settings: ErrorTrackingSettingsApi | null): boolean | null =>- settings ? settings.linear_status_sync_enabled === true : null,- ],- }),-- listeners({- setLinearStatusSyncEnabledSuccess: ({ settings }) => {- const enabled = settings.linear_status_sync_enabled === true- // pinned: analytics event name, renaming it breaks dashboards- posthog.capture('error_tracking_linear_status_sync_toggled', { enabled })- lemonToast.success(enabled ? 'Linear status sync turned on' : 'Linear status sync turned off')- },- }),-- afterMount(({ actions }) => {- actions.loadSettings()- }),-])diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 701a78ac9e5d..5850d9411678 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -45137,8 +45137,6 @@ export namespace Schemas {per_issue_rate_limit_bucket_size_minutes?: number | null;/** Whether the project ingests exception events. When false, ingestion drops every $exception event for this project before it is stored or billed, and the events cannot be recovered. */ingestion_enabled?: boolean;- /** Whether status changes on linked Linear tickets update the issue. When true, an issue resolves once every linked Linear ticket is closed and at least one is done, and a resolved issue becomes active again when a linked ticket reopens. */- linear_status_sync_enabled?: boolean;}/**@@ -88351,8 +88349,6 @@ export namespace Schemas {per_issue_rate_limit_bucket_size_minutes?: number | null;/** Whether the project ingests exception events. When false, ingestion drops every $exception event for this project before it is stored or billed, and the events cannot be recovered. */ingestion_enabled?: boolean;- /** Whether status changes on linked Linear tickets update the issue. When true, an issue resolves once every linked Linear ticket is closed and at least one is done, and a resolved issue becomes active again when a linked ticket reopens. */- linear_status_sync_enabled?: boolean;}/**diff --git a/services/mcp/src/generated/error_tracking/api.ts b/services/mcp/src/generated/error_tracking/api.tsindex 3a3ccaa58230..a00d2fa9d83d 100644--- a/services/mcp/src/generated/error_tracking/api.ts+++ b/services/mcp/src/generated/error_tracking/api.ts@@ -8821,12 +8821,6 @@ export const ErrorTrackingSettingsUpdateSettingsPartialUpdateBody = () => zod.ob.describe('Whether the project ingests exception events. When false, ingestion drops every $exception event for this project before it is stored or billed, and the events cannot be recovered.'),- linear_status_sync_enabled: zod- .boolean()- .optional()- .describe(- 'Whether status changes on linked Linear tickets update the issue. When true, an issue resolves once every linked Linear ticket is closed and at least one is done, and a resolved issue becomes active again when a linked ticket reopens.'- ),})export const ErrorTrackingSeverityRulesListParams = () => zod.object({diff --git a/services/mcp/src/tools/generated/error_tracking.ts b/services/mcp/src/tools/generated/error_tracking.tsindex 8be2a1df8756..7bc352b7c4a4 100644--- a/services/mcp/src/tools/generated/error_tracking.ts+++ b/services/mcp/src/tools/generated/error_tracking.ts@@ -464,9 +464,6 @@ const errorTrackingSettingsUpdate = (): ToolBase<if (params.ingestion_enabled !== undefined) {body['ingestion_enabled'] = params.ingestion_enabled}- if (params.linear_status_sync_enabled !== undefined) {- body['linear_status_sync_enabled'] = params.linear_status_sync_enabled- }const result = await context.api.request<Schemas.ErrorTrackingSettings>({method: 'PATCH',path: `/api/projects/${encodeURIComponent(String(projectId))}/error_tracking/settings/update_settings/`,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-settings-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-settings-update.jsonindex 57c781bddedc..cee30434d60c 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-settings-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-settings-update.json@@ -5,10 +5,6 @@"description": "Whether the project ingests exception events. When false, ingestion drops every $exception event for this project before it is stored or billed, and the events cannot be recovered.","type": "boolean"},- "linear_status_sync_enabled": {- "description": "Whether status changes on linked Linear tickets update the issue. When true, an issue resolves once every linked Linear ticket is closed and at least one is done, and a resolved issue becomes active again when a linked ticket reopens.",- "type": "boolean"- },"per_issue_rate_limit_bucket_size_minutes": {"anyOf": [{