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.

chore(error-tracking): reject deprecated archived/pending_release statuses, add backfill command (#59542)

Catalin Irimie60f257bbae3e
diff --git a/products/error_tracking/backend/api/issues.py b/products/error_tracking/backend/api/issues.py
index 80e69430c706..d9ff3189f238 100644
--- a/products/error_tracking/backend/api/issues.py
+++ b/products/error_tracking/backend/api/issues.py
@@ -76,6 +76,14 @@ class ErrorTrackingIssuePreviewSerializer(serializers.ModelSerializer):
fields = ["id", "status", "name", "description", "first_seen", "assignee"]
+DEPRECATED_ISSUE_STATUSES = frozenset({ErrorTrackingIssue.Status.ARCHIVED, ErrorTrackingIssue.Status.PENDING_RELEASE})
+SUPPORTED_WRITE_STATUSES = (
+ ErrorTrackingIssue.Status.ACTIVE,
+ ErrorTrackingIssue.Status.RESOLVED,
+ ErrorTrackingIssue.Status.SUPPRESSED,
+)
+
+
class ErrorTrackingIssueFullSerializer(serializers.ModelSerializer):
first_seen = serializers.DateTimeField()
assignee = ErrorTrackingIssueAssignmentSerializer(source="assignment")
@@ -86,6 +94,12 @@ class ErrorTrackingIssueFullSerializer(serializers.ModelSerializer):
model = ErrorTrackingIssue
fields = ["id", "status", "name", "description", "first_seen", "assignee", "external_issues", "cohort"]
+ def validate_status(self, value: str) -> str:
+ # Reads of legacy archived/pending_release rows still pass through; only block new writes.
+ if value in DEPRECATED_ISSUE_STATUSES:
+ raise serializers.ValidationError(f"Status '{value}' is no longer supported. Use 'resolved' instead.")
+ return value
+
@extend_schema_field(
{
"type": "object",
@@ -147,6 +161,26 @@ class ErrorTrackingIssueFullSerializer(serializers.ModelSerializer):
return updated_instance
+class ErrorTrackingIssueWriteSerializer(serializers.Serializer):
+ status = serializers.ChoiceField(
+ choices=SUPPORTED_WRITE_STATUSES,
+ required=False,
+ help_text="Issue status to set. Deprecated archived and pending_release values are rejected.",
+ )
+ name = serializers.CharField(
+ required=False,
+ allow_null=True,
+ allow_blank=True,
+ help_text="Optional issue display name.",
+ )
+ description = serializers.CharField(
+ required=False,
+ allow_null=True,
+ allow_blank=True,
+ help_text="Optional issue description.",
+ )
+
+
class ErrorTrackingIssueMergeRequestSerializer(serializers.Serializer):
ids = serializers.ListField(
child=serializers.UUIDField(),
@@ -217,6 +251,24 @@ class ErrorTrackingIssueViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, view
.filter(team_id=self.team.id)
)
+ @extend_schema(request=ErrorTrackingIssueWriteSerializer, responses={200: ErrorTrackingIssueFullSerializer})
+ def update(self, request: request.Request, *args: object, **kwargs: object) -> Response:
+ return self._update_issue(request)
+
+ @extend_schema(request=ErrorTrackingIssueWriteSerializer, responses={200: ErrorTrackingIssueFullSerializer})
+ def partial_update(self, request: request.Request, *args: object, **kwargs: object) -> Response:
+ return self._update_issue(request)
+
+ def _update_issue(self, request: request.Request) -> Response:
+ issue = self.get_object()
+ request_serializer = ErrorTrackingIssueWriteSerializer(data=request.data)
+ request_serializer.is_valid(raise_exception=True)
+
+ serializer = self.get_serializer(issue, data=request_serializer.validated_data, partial=True)
+ serializer.is_valid(raise_exception=True)
+ self.perform_update(serializer)
+ return Response(serializer.data)
+
@action(methods=["GET"], detail=False)
def exists(self, request, **kwargs):
has_issues = ErrorTrackingIssue.objects.filter(team_id=self.team.id).exists()
diff --git a/products/error_tracking/backend/api/test/test_error_tracking_api.py b/products/error_tracking/backend/api/test/test_error_tracking_api.py
index 5d068b055ec3..71a2801a7ef5 100644
--- a/products/error_tracking/backend/api/test/test_error_tracking_api.py
+++ b/products/error_tracking/backend/api/test/test_error_tracking_api.py
@@ -157,6 +157,46 @@ class TestErrorTracking(APIBaseTest):
],
)
+ def test_issue_update_rejects_deprecated_status(self):
+ issue = self.create_issue(["fingerprint"])
+
+ for deprecated_status in ("archived", "pending_release"):
+ response = self.client.patch(
+ f"/api/environments/{self.team.id}/error_tracking/issues/{issue.id}",
+ data={"status": deprecated_status},
+ )
+ assert response.status_code == 400, response.json()
+ body = response.json()
+ assert body["type"] == "validation_error", body
+ assert body["attr"] == "status", body
+ assert deprecated_status in body["detail"], body
+
+ issue.refresh_from_db()
+ assert issue.status == ErrorTrackingIssue.Status.ACTIVE
+
+ def test_issue_bulk_rejects_deprecated_status(self):
+ issue = self.create_issue()
+
+ for deprecated_status in ("archived", "pending_release"):
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/error_tracking/issues/bulk",
+ data={"ids": [issue.id], "action": "set_status", "status": deprecated_status},
+ )
+ assert response.status_code == 400, response.json()
+
+ issue.refresh_from_db()
+ assert issue.status == ErrorTrackingIssue.Status.ACTIVE
+
+ def test_issue_update_serializes_legacy_status_for_reads(self):
+ # Legacy rows that still hold archived/pending_release should still serialize OK on read,
+ # so the cleanup is decoupled from the backfill.
+ issue = self.create_issue()
+ ErrorTrackingIssue.objects.filter(id=issue.id).update(status=ErrorTrackingIssue.Status.ARCHIVED)
+
+ response = self.client.get(f"/api/environments/{self.team.id}/error_tracking/issues/{issue.id}")
+ assert response.status_code == 200, response.json()
+ assert response.json()["status"] == "archived"
+
def test_issue_merge(self):
issue_one = self.create_issue(fingerprints=["fingerprint_one"])
issue_two = self.create_issue(fingerprints=["fingerprint_two"])
diff --git a/products/error_tracking/backend/management/commands/backfill_error_tracking_issue_legacy_statuses.py b/products/error_tracking/backend/management/commands/backfill_error_tracking_issue_legacy_statuses.py
new file mode 100644
index 000000000000..49d33ae5ccfa
--- /dev/null
+++ b/products/error_tracking/backend/management/commands/backfill_error_tracking_issue_legacy_statuses.py
@@ -0,0 +1,186 @@
+"""Backfill error tracking issues stuck on legacy `archived` or `pending_release` statuses to `resolved`.
+
+Both statuses were defined on `ErrorTrackingIssue.Status` but are no longer reachable from
+the PostHog UI — `archived` was used by a short-lived "Archive" button (Sep 2024 to Mar 2025)
+and later by an MCP tool, and `pending_release` was never wired up in the UI. The model
+still accepts both values via direct API writes, and a small number of rows ended up with
+them across teams.
+
+The fix is to migrate those rows to `resolved`, which most closely matches the cymbal
+"re-activate on next fingerprint" semantics so user-observable behavior is preserved. The
+companion serializer-level change rejects new writes of these values, so this backfill is
+a one-shot cleanup that becomes idempotent (re-running on a clean dataset is a no-op).
+
+Usage:
+ # Dry-run (default) — counts rows per team, writes nothing
+ python manage.py backfill_error_tracking_issue_legacy_statuses
+
+ # Live run — updates Postgres and re-syncs to ClickHouse
+ python manage.py backfill_error_tracking_issue_legacy_statuses --live-run
+
+ # Specific team
+ python manage.py backfill_error_tracking_issue_legacy_statuses --live-run --team-id 2
+
+ # Resume from a specific team_id (inclusive)
+ python manage.py backfill_error_tracking_issue_legacy_statuses --live-run --start-from-team-id 1234
+
+ # Limit to a single legacy status
+ python manage.py backfill_error_tracking_issue_legacy_statuses --live-run --status archived
+"""
+
+from __future__ import annotations
+
+import time
+import logging
+from uuid import UUID
+
+from django.core.management.base import BaseCommand
+from django.db import transaction
+
+import structlog
+
+from products.error_tracking.backend.models import ErrorTrackingIssue, sync_issues_to_clickhouse
+
+logger = structlog.get_logger(__name__)
+
+LEGACY_STATUSES: tuple[str, ...] = (
+ ErrorTrackingIssue.Status.ARCHIVED,
+ ErrorTrackingIssue.Status.PENDING_RELEASE,
+)
+TARGET_STATUS = ErrorTrackingIssue.Status.RESOLVED
+
+
+class Command(BaseCommand):
+ help = "Backfill error tracking issues stuck on legacy archived/pending_release statuses to resolved."
+
+ def add_arguments(self, parser):
+ parser.add_argument(
+ "--live-run",
+ action="store_true",
+ help="Actually update rows and re-sync to ClickHouse (default is dry-run).",
+ )
+ parser.add_argument(
+ "--team-id",
+ type=int,
+ default=None,
+ help="Backfill only this team.",
+ )
+ parser.add_argument(
+ "--start-from-team-id",
+ type=int,
+ default=None,
+ help="Resume from this team_id (inclusive). Skips all teams with id < this value.",
+ )
+ parser.add_argument(
+ "--end-team-id",
+ type=int,
+ default=None,
+ help="Only include teams with team_id <= this value (inclusive). Ignored when --team-id is set.",
+ )
+ parser.add_argument(
+ "--status",
+ type=str,
+ default=None,
+ choices=list(LEGACY_STATUSES),
+ help="Limit to a single legacy status (default: both archived and pending_release).",
+ )
+
+ def handle(
+ self,
+ *,
+ live_run: bool,
+ team_id: int | None,
+ start_from_team_id: int | None,
+ end_team_id: int | None,
+ status: str | None,
+ **options,
+ ):
+ logger.setLevel(logging.INFO)
+
+ statuses = (status,) if status else LEGACY_STATUSES
+ mode = "LIVE" if live_run else "DRY-RUN (use --live-run to apply)"
+ logger.info("backfill_starting", mode=mode, statuses=list(statuses))
+
+ per_team_counts = self._summarize(
+ statuses=statuses,
+ team_id=team_id,
+ start_from_team_id=start_from_team_id,
+ end_team_id=end_team_id,
+ )
+
+ total = sum(per_team_counts.values())
+ logger.info("backfill_summary", teams=len(per_team_counts), total_issues=total)
+
+ if total == 0:
+ logger.info("backfill_no_rows_found")
+ return
+
+ for tid, count in sorted(per_team_counts.items()):
+ logger.info("backfill_team_pending", team_id=tid, issue_count=count)
+
+ if not live_run:
+ logger.info("backfill_dry_run_complete", total=total)
+ return
+
+ start_time = time.monotonic()
+ updated_total = 0
+ for tid in sorted(per_team_counts):
+ updated = self._backfill_team(team_id=tid, statuses=statuses)
+ updated_total += updated
+ logger.info("backfill_team_done", team_id=tid, updated=updated)
+
+ elapsed = time.monotonic() - start_time
+ logger.info("backfill_complete", updated=updated_total, elapsed_s=round(elapsed, 2))
+
+ def _summarize(
+ self,
+ *,
+ statuses: tuple[str, ...],
+ team_id: int | None,
+ start_from_team_id: int | None,
+ end_team_id: int | None,
+ ) -> dict[int, int]:
+ qs = ErrorTrackingIssue.objects.filter(status__in=statuses)
+ if team_id is not None:
+ qs = qs.filter(team_id=team_id)
+ else:
+ if start_from_team_id is not None:
+ qs = qs.filter(team_id__gte=start_from_team_id)
+ if end_team_id is not None:
+ qs = qs.filter(team_id__lte=end_team_id)
+
+ counts: dict[int, int] = {}
+ for tid in qs.values_list("team_id", flat=True):
+ counts[tid] = counts.get(tid, 0) + 1
+ return counts
+
+ def _backfill_team(self, *, team_id: int, statuses: tuple[str, ...]) -> int:
+ with transaction.atomic():
+ issue_ids = self._get_legacy_issue_ids_for_update(team_id=team_id, statuses=statuses)
+ if not issue_ids:
+ return 0
+
+ updated_issue_ids = list(
+ ErrorTrackingIssue.objects.filter(team_id=team_id, id__in=issue_ids, status__in=statuses).values_list(
+ "id", flat=True
+ )
+ )
+ if not updated_issue_ids:
+ return 0
+
+ # Emit while the legacy status is still a durable retry marker.
+ # sync_issues_to_clickhouse maps deprecated statuses to resolved.
+ sync_issues_to_clickhouse(issue_ids=updated_issue_ids, team_id=team_id)
+
+ # Skip ModelActivityMixin signals — this is a janitorial fix, not user activity.
+ updated = ErrorTrackingIssue.objects.filter(
+ team_id=team_id, id__in=updated_issue_ids, status__in=statuses
+ ).update(status=TARGET_STATUS)
+ return updated
+
+ def _get_legacy_issue_ids_for_update(self, *, team_id: int, statuses: tuple[str, ...]) -> list[UUID]:
+ return list(
+ ErrorTrackingIssue.objects.select_for_update()
+ .filter(team_id=team_id, status__in=statuses)
+ .values_list("id", flat=True)
+ )
diff --git a/products/error_tracking/backend/management/commands/test/test_backfill_error_tracking_issue_legacy_statuses.py b/products/error_tracking/backend/management/commands/test/test_backfill_error_tracking_issue_legacy_statuses.py
new file mode 100644
index 000000000000..d04182cf7c34
--- /dev/null
+++ b/products/error_tracking/backend/management/commands/test/test_backfill_error_tracking_issue_legacy_statuses.py
@@ -0,0 +1,162 @@
+from uuid import UUID
+
+import pytest
+from posthog.test.base import BaseTest, ClickhouseTestMixin
+from unittest.mock import patch
+
+from posthog.clickhouse.client.execute import sync_execute
+from posthog.models import Organization, Team
+
+from products.error_tracking.backend.management.commands.backfill_error_tracking_issue_legacy_statuses import Command
+from products.error_tracking.backend.models import (
+ ErrorTrackingIssue,
+ ErrorTrackingIssueFingerprintV2,
+ sync_issues_to_clickhouse,
+)
+
+
+class TestBackfillErrorTrackingIssueLegacyStatuses(ClickhouseTestMixin, BaseTest):
+ def _run(
+ self,
+ *,
+ live_run: bool = True,
+ team_id: int | None = None,
+ start_from_team_id: int | None = None,
+ end_team_id: int | None = None,
+ status: str | None = None,
+ ) -> None:
+ Command().handle(
+ live_run=live_run,
+ team_id=team_id,
+ start_from_team_id=start_from_team_id,
+ end_team_id=end_team_id,
+ status=status,
+ )
+
+ def _make_issue(self, *, team: Team, status: str, fingerprint: str | None = None) -> ErrorTrackingIssue:
+ issue = ErrorTrackingIssue.objects.create(team=team, status=status)
+ if fingerprint is not None:
+ ErrorTrackingIssueFingerprintV2.objects.create(team=team, issue=issue, fingerprint=fingerprint)
+ return issue
+
+ def _ch_status_for(self, *, team_id: int, fingerprint: str) -> str | None:
+ rows = sync_execute(
+ """
+ SELECT issue_status
+ FROM error_tracking_fingerprint_issue_state FINAL
+ WHERE team_id = %(team_id)s AND fingerprint = %(fingerprint)s
+ """,
+ {"team_id": team_id, "fingerprint": fingerprint},
+ )
+ return rows[0][0] if rows else None
+
+ def test_dry_run_does_not_modify_rows(self):
+ archived = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.ARCHIVED, fingerprint="fp_a")
+ pending = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.PENDING_RELEASE, fingerprint="fp_p")
+
+ self._run(live_run=False)
+
+ archived.refresh_from_db()
+ pending.refresh_from_db()
+ assert archived.status == ErrorTrackingIssue.Status.ARCHIVED
+ assert pending.status == ErrorTrackingIssue.Status.PENDING_RELEASE
+
+ def test_live_run_resolves_legacy_statuses_and_syncs_to_clickhouse(self):
+ archived = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.ARCHIVED, fingerprint="fp_a")
+ pending = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.PENDING_RELEASE, fingerprint="fp_p")
+ active_unchanged = self._make_issue(
+ team=self.team, status=ErrorTrackingIssue.Status.ACTIVE, fingerprint="fp_active"
+ )
+
+ self._run(live_run=True)
+
+ archived.refresh_from_db()
+ pending.refresh_from_db()
+ active_unchanged.refresh_from_db()
+ assert archived.status == ErrorTrackingIssue.Status.RESOLVED
+ assert pending.status == ErrorTrackingIssue.Status.RESOLVED
+ assert active_unchanged.status == ErrorTrackingIssue.Status.ACTIVE
+
+ assert self._ch_status_for(team_id=self.team.pk, fingerprint="fp_a") == "resolved"
+ assert self._ch_status_for(team_id=self.team.pk, fingerprint="fp_p") == "resolved"
+ # The active issue was not touched, so no CH row was produced for it by the backfill.
+ assert self._ch_status_for(team_id=self.team.pk, fingerprint="fp_active") is None
+
+ def test_clickhouse_sync_maps_legacy_statuses_to_resolved(self):
+ archived = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.ARCHIVED, fingerprint="fp_a")
+
+ sync_issues_to_clickhouse(issue_ids=[archived.id], team_id=self.team.pk)
+
+ archived.refresh_from_db()
+ assert archived.status == ErrorTrackingIssue.Status.ARCHIVED
+ assert self._ch_status_for(team_id=self.team.pk, fingerprint="fp_a") == "resolved"
+
+ def test_status_filter_limits_scope(self):
+ archived = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.ARCHIVED, fingerprint="fp_a")
+ pending = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.PENDING_RELEASE, fingerprint="fp_p")
+
+ self._run(live_run=True, status=ErrorTrackingIssue.Status.ARCHIVED)
+
+ archived.refresh_from_db()
+ pending.refresh_from_db()
+ assert archived.status == ErrorTrackingIssue.Status.RESOLVED
+ assert pending.status == ErrorTrackingIssue.Status.PENDING_RELEASE
+
+ def test_team_id_filter_isolates_other_teams(self):
+ other_org = Organization.objects.create(name="other org")
+ other_team = Team.objects.create(organization=other_org, name="other team")
+
+ own = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.ARCHIVED)
+ other = self._make_issue(team=other_team, status=ErrorTrackingIssue.Status.ARCHIVED)
+
+ self._run(live_run=True, team_id=self.team.pk)
+
+ own.refresh_from_db()
+ other.refresh_from_db()
+ assert own.status == ErrorTrackingIssue.Status.RESOLVED
+ assert other.status == ErrorTrackingIssue.Status.ARCHIVED
+
+ def test_live_run_does_not_clobber_issue_changed_after_selection(self):
+ issue = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.ARCHIVED, fingerprint="fp_a")
+ command = Command()
+
+ def get_stale_issue_ids(**_kwargs: object) -> list[UUID]:
+ ErrorTrackingIssue.objects.filter(id=issue.id).update(status=ErrorTrackingIssue.Status.ACTIVE)
+ return [issue.id]
+
+ with patch.object(command, "_get_legacy_issue_ids_for_update", side_effect=get_stale_issue_ids):
+ updated = command._backfill_team(team_id=self.team.pk, statuses=(ErrorTrackingIssue.Status.ARCHIVED,))
+
+ issue.refresh_from_db()
+ assert updated == 0
+ assert issue.status == ErrorTrackingIssue.Status.ACTIVE
+ assert self._ch_status_for(team_id=self.team.pk, fingerprint="fp_a") is None
+
+ def test_live_run_rolls_back_status_update_when_clickhouse_sync_fails(self):
+ issue = self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.ARCHIVED, fingerprint="fp_a")
+
+ with (
+ patch(
+ "products.error_tracking.backend.management.commands.backfill_error_tracking_issue_legacy_statuses.sync_issues_to_clickhouse",
+ side_effect=RuntimeError("sync failed"),
+ ),
+ pytest.raises(RuntimeError, match="sync failed"),
+ ):
+ self._run(live_run=True)
+
+ issue.refresh_from_db()
+ assert issue.status == ErrorTrackingIssue.Status.ARCHIVED
+ assert self._ch_status_for(team_id=self.team.pk, fingerprint="fp_a") is None
+
+ self._run(live_run=True)
+ issue.refresh_from_db()
+ assert issue.status == ErrorTrackingIssue.Status.RESOLVED
+ assert self._ch_status_for(team_id=self.team.pk, fingerprint="fp_a") == "resolved"
+
+ def test_idempotent_on_clean_dataset(self):
+ # Re-running on a dataset with no legacy statuses should be a no-op.
+ self._make_issue(team=self.team, status=ErrorTrackingIssue.Status.ACTIVE)
+ self._run(live_run=True) # should not raise, should not change anything
+
+ counts = ErrorTrackingIssue.objects.filter(team=self.team).values_list("status", flat=True)
+ assert all(c == ErrorTrackingIssue.Status.ACTIVE for c in counts)
diff --git a/products/error_tracking/backend/models.py b/products/error_tracking/backend/models.py
index 8bc0587409b4..b2843deda0d1 100644
--- a/products/error_tracking/backend/models.py
+++ b/products/error_tracking/backend/models.py
@@ -503,6 +503,17 @@ def override_error_tracking_issue_fingerprint(
)
+DEPRECATED_CLICKHOUSE_STATUSES = frozenset(
+ {ErrorTrackingIssue.Status.ARCHIVED, ErrorTrackingIssue.Status.PENDING_RELEASE}
+)
+
+
+def _clickhouse_status(issue_status: str) -> str:
+ if issue_status in DEPRECATED_CLICKHOUSE_STATUSES:
+ return ErrorTrackingIssue.Status.RESOLVED
+ return issue_status
+
+
def sync_issues_to_clickhouse(*, issue_ids: list, team_id: int) -> None:
if not issue_ids:
return
@@ -543,7 +554,7 @@ def sync_issues_to_clickhouse(*, issue_ids: list, team_id: int) -> None:
"team_id": team_id,
"issue_name": issue.name,
"issue_description": issue.description,
- "issue_status": issue.status,
+ "issue_status": _clickhouse_status(issue.status),
"assigned_user_id": assigned_user_id,
"assigned_role_id": assigned_role_id,
"first_seen": first_seen,
diff --git a/products/error_tracking/frontend/generated/api.schemas.ts b/products/error_tracking/frontend/generated/api.schemas.ts
index e268bbe16c5b..2259eddd4555 100644
--- a/products/error_tracking/frontend/generated/api.schemas.ts
+++ b/products/error_tracking/frontend/generated/api.schemas.ts
@@ -589,6 +589,58 @@ export interface PaginatedErrorTrackingIssueFullListApi {
results: ErrorTrackingIssueFullApi[]
}
+/**
+ * * `active` - active
+ * * `resolved` - resolved
+ * * `suppressed` - suppressed
+ */
+export type ErrorTrackingIssueWriteStatusEnumApi =
+ (typeof ErrorTrackingIssueWriteStatusEnumApi)[keyof typeof ErrorTrackingIssueWriteStatusEnumApi]
+
+export const ErrorTrackingIssueWriteStatusEnumApi = {
+ Active: 'active',
+ Resolved: 'resolved',
+ Suppressed: 'suppressed',
+} as const
+
+export interface ErrorTrackingIssueWriteApi {
+ /** Issue status to set. Deprecated archived and pending_release values are rejected.
+ *
+ * * `active` - active
+ * * `resolved` - resolved
+ * * `suppressed` - suppressed */
+ status?: ErrorTrackingIssueWriteStatusEnumApi
+ /**
+ * Optional issue display name.
+ * @nullable
+ */
+ name?: string | null
+ /**
+ * Optional issue description.
+ * @nullable
+ */
+ description?: string | null
+}
+
+export interface PatchedErrorTrackingIssueWriteApi {
+ /** Issue status to set. Deprecated archived and pending_release values are rejected.
+ *
+ * * `active` - active
+ * * `resolved` - resolved
+ * * `suppressed` - suppressed */
+ status?: ErrorTrackingIssueWriteStatusEnumApi
+ /**
+ * Optional issue display name.
+ * @nullable
+ */
+ name?: string | null
+ /**
+ * Optional issue description.
+ * @nullable
+ */
+ description?: string | null
+}
+
/**
* @nullable
*/
diff --git a/products/error_tracking/frontend/generated/api.ts b/products/error_tracking/frontend/generated/api.ts
index 979a58d04890..790fdb264e03 100644
--- a/products/error_tracking/frontend/generated/api.ts
+++ b/products/error_tracking/frontend/generated/api.ts
@@ -32,6 +32,7 @@ import type {
ErrorTrackingIssueQueryRequestApi,
ErrorTrackingIssueSplitRequestApi,
ErrorTrackingIssueSplitResponseApi,
+ ErrorTrackingIssueWriteApi,
ErrorTrackingIssuesListParams,
ErrorTrackingIssuesListQueryRequestApi,
ErrorTrackingIssuesListResponseApi,
@@ -70,6 +71,7 @@ import type {
PatchedErrorTrackingGroupingRuleApi,
PatchedErrorTrackingGroupingRuleUpdateRequestApi,
PatchedErrorTrackingIssueFullApi,
+ PatchedErrorTrackingIssueWriteApi,
PatchedErrorTrackingReleaseApi,
PatchedErrorTrackingSettingsApi,
PatchedErrorTrackingSpikeDetectionConfigApi,
@@ -626,14 +628,14 @@ export const getErrorTrackingIssuesUpdateUrl = (projectId: string, id: string) =
export const errorTrackingIssuesUpdate = async (
projectId: string,
id: string,
- errorTrackingIssueFullApi: NonReadonly<ErrorTrackingIssueFullApi>,
+ errorTrackingIssueWriteApi?: ErrorTrackingIssueWriteApi,
options?: RequestInit
): Promise<ErrorTrackingIssueFullApi> => {
return apiMutator<ErrorTrackingIssueFullApi>(getErrorTrackingIssuesUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(errorTrackingIssueFullApi),
+ body: JSON.stringify(errorTrackingIssueWriteApi),
})
}
@@ -644,14 +646,14 @@ export const getErrorTrackingIssuesPartialUpdateUrl = (projectId: string, id: st
export const errorTrackingIssuesPartialUpdate = async (
projectId: string,
id: string,
- patchedErrorTrackingIssueFullApi?: NonReadonly<PatchedErrorTrackingIssueFullApi>,
+ patchedErrorTrackingIssueWriteApi?: PatchedErrorTrackingIssueWriteApi,
options?: RequestInit
): Promise<ErrorTrackingIssueFullApi> => {
return apiMutator<ErrorTrackingIssueFullApi>(getErrorTrackingIssuesPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(patchedErrorTrackingIssueFullApi),
+ body: JSON.stringify(patchedErrorTrackingIssueWriteApi),
})
}
diff --git a/products/error_tracking/frontend/generated/api.zod.ts b/products/error_tracking/frontend/generated/api.zod.ts
index ec4f7493fdfa..188746ce84ab 100644
--- a/products/error_tracking/frontend/generated/api.zod.ts
+++ b/products/error_tracking/frontend/generated/api.zod.ts
@@ -208,66 +208,26 @@ export const ErrorTrackingIssuesCreateBody = /* @__PURE__ */ zod.object({
export const ErrorTrackingIssuesUpdateBody = /* @__PURE__ */ zod.object({
status: zod
- .enum(['archived', 'active', 'resolved', 'pending_release', 'suppressed'])
+ .enum(['active', 'resolved', 'suppressed'])
+ .describe('\* `active` - active\n\* `resolved` - resolved\n\* `suppressed` - suppressed')
.optional()
.describe(
- '\* `archived` - Archived\n\* `active` - Active\n\* `resolved` - Resolved\n\* `pending_release` - Pending release\n\* `suppressed` - Suppressed'
+ 'Issue status to set. Deprecated archived and pending_release values are rejected.\n\n\* `active` - active\n\* `resolved` - resolved\n\* `suppressed` - suppressed'
),
- name: zod.string().nullish(),
- description: zod.string().nullish(),
- first_seen: zod.iso.datetime({ offset: true }),
- assignee: zod.object({
- id: zod.union([zod.number(), zod.string(), zod.null()]),
- type: zod.string(),
- }),
- external_issues: zod.array(
- zod.object({
- id: zod.uuid(),
- integration: zod.object({
- id: zod.number(),
- kind: zod.string(),
- display_name: zod.string(),
- }),
- integration_id: zod.number(),
- config: zod.unknown(),
- issue: zod.uuid(),
- external_url: zod.string(),
- })
- ),
+ name: zod.string().nullish().describe('Optional issue display name.'),
+ description: zod.string().nullish().describe('Optional issue description.'),
})
export const ErrorTrackingIssuesPartialUpdateBody = /* @__PURE__ */ zod.object({
status: zod
- .enum(['archived', 'active', 'resolved', 'pending_release', 'suppressed'])
+ .enum(['active', 'resolved', 'suppressed'])
+ .describe('\* `active` - active\n\* `resolved` - resolved\n\* `suppressed` - suppressed')
.optional()
.describe(
- '\* `archived` - Archived\n\* `active` - Active\n\* `resolved` - Resolved\n\* `pending_release` - Pending release\n\* `suppressed` - Suppressed'
+ 'Issue status to set. Deprecated archived and pending_release values are rejected.\n\n\* `active` - active\n\* `resolved` - resolved\n\* `suppressed` - suppressed'
),
- name: zod.string().nullish(),
- description: zod.string().nullish(),
- first_seen: zod.iso.datetime({ offset: true }).optional(),
- assignee: zod
- .object({
- id: zod.union([zod.number(), zod.string(), zod.null()]),
- type: zod.string(),
- })
- .optional(),
- external_issues: zod
- .array(
- zod.object({
- id: zod.uuid(),
- integration: zod.object({
- id: zod.number(),
- kind: zod.string(),
- display_name: zod.string(),
- }),
- integration_id: zod.number(),
- config: zod.unknown(),
- issue: zod.uuid(),
- external_url: zod.string(),
- })
- )
- .optional(),
+ name: zod.string().nullish().describe('Optional issue display name.'),
+ description: zod.string().nullish().describe('Optional issue description.'),
})
export const ErrorTrackingIssuesAssignPartialUpdateBody = /* @__PURE__ */ zod.object({
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index ad5d0273f2f3..9767d916fa58 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -15938,6 +15938,39 @@ export namespace Schemas {
All: 'all',
} as const;
+ /**
+ * * `active` - active
+ * * `resolved` - resolved
+ * * `suppressed` - suppressed
+ */
+ export type ErrorTrackingIssueWriteStatusEnum = typeof ErrorTrackingIssueWriteStatusEnum[keyof typeof ErrorTrackingIssueWriteStatusEnum];
+
+
+ export const ErrorTrackingIssueWriteStatusEnum = {
+ Active: 'active',
+ Resolved: 'resolved',
+ Suppressed: 'suppressed',
+ } as const;
+
+ export interface ErrorTrackingIssueWrite {
+ /** Issue status to set. Deprecated archived and pending_release values are rejected.
+ *
+ * * `active` - active
+ * * `resolved` - resolved
+ * * `suppressed` - suppressed */
+ status?: ErrorTrackingIssueWriteStatusEnum;
+ /**
+ * Optional issue display name.
+ * @nullable
+ */
+ name?: string | null;
+ /**
+ * Optional issue description.
+ * @nullable
+ */
+ description?: string | null;
+ }
+
export interface ErrorTrackingIssuesListQueryRequest {
/** Date range for issue aggregates. Defaults to the last 7 days. */
dateRange?: ErrorTrackingDateRange;
@@ -29765,6 +29798,25 @@ export namespace Schemas {
readonly cohort?: PatchedErrorTrackingIssueFullCohort;
}
+ export interface PatchedErrorTrackingIssueWrite {
+ /** Issue status to set. Deprecated archived and pending_release values are rejected.
+ *
+ * * `active` - active
+ * * `resolved` - resolved
+ * * `suppressed` - suppressed */
+ status?: ErrorTrackingIssueWriteStatusEnum;
+ /**
+ * Optional issue display name.
+ * @nullable
+ */
+ name?: string | null;
+ /**
+ * Optional issue description.
+ * @nullable
+ */
+ description?: string | null;
+ }
+
export interface PatchedErrorTrackingRelease {
readonly id?: string;
hash_id?: string;
diff --git a/services/mcp/src/generated/error_tracking/api.ts b/services/mcp/src/generated/error_tracking/api.ts
index 6e190e231b58..c3d8f6c1fd16 100644
--- a/services/mcp/src/generated/error_tracking/api.ts
+++ b/services/mcp/src/generated/error_tracking/api.ts
@@ -2994,38 +2994,14 @@ export const ErrorTrackingIssuesPartialUpdateParams = /* @__PURE__ */ zod.object
export const ErrorTrackingIssuesPartialUpdateBody = /* @__PURE__ */ zod.object({
status: zod
- .enum(['archived', 'active', 'resolved', 'pending_release', 'suppressed'])
+ .enum(['active', 'resolved', 'suppressed'])
+ .describe('* `active` - active\n* `resolved` - resolved\n* `suppressed` - suppressed')
.optional()
.describe(
- '* `archived` - Archived\n* `active` - Active\n* `resolved` - Resolved\n* `pending_release` - Pending release\n* `suppressed` - Suppressed'
+ 'Issue status to set. Deprecated archived and pending_release values are rejected.\n\n* `active` - active\n* `resolved` - resolved\n* `suppressed` - suppressed'
),
- name: zod.string().nullish(),
- description: zod.string().nullish(),
- first_seen: zod.iso.datetime({ offset: true }).optional(),
- assignee: zod
- .object({
- id: zod.union([zod.number(), zod.string(), zod.null()]).optional(),
- type: zod.string().optional(),
- })
- .optional(),
- external_issues: zod
- .array(
- zod.object({
- id: zod.string().optional(),
- integration: zod
- .object({
- id: zod.number().optional(),
- kind: zod.string().optional(),
- display_name: zod.string().optional(),
- })
- .optional(),
- integration_id: zod.number(),
- config: zod.unknown(),
- issue: zod.string(),
- external_url: zod.string().optional(),
- })
- )
- .optional(),
+ name: zod.string().nullish().describe('Optional issue display name.'),
+ description: zod.string().nullish().describe('Optional issue description.'),
})
export const ErrorTrackingIssuesMergeCreateParams = /* @__PURE__ */ zod.object({
diff --git a/services/mcp/src/tools/generated/error_tracking.ts b/services/mcp/src/tools/generated/error_tracking.ts
index 296de80d3ad2..369b4e414ac3 100644
--- a/services/mcp/src/tools/generated/error_tracking.ts
+++ b/services/mcp/src/tools/generated/error_tracking.ts
@@ -195,15 +195,6 @@ const errorTrackingIssuesPartialUpdate = (): ToolBase<
if (params.description !== undefined) {
body['description'] = params.description
}
- if (params.first_seen !== undefined) {
- body['first_seen'] = params.first_seen
- }
- if (params.assignee !== undefined) {
- body['assignee'] = params.assignee
- }
- if (params.external_issues !== undefined) {
- body['external_issues'] = params.external_issues
- }
const result = await context.api.request<Schemas.ErrorTrackingIssueFull>({
method: 'PATCH',
path: `/api/projects/${encodeURIComponent(String(projectId))}/error_tracking/issues/${encodeURIComponent(String(params.id))}/`,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-issues-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-issues-partial-update.json
index ac0d5c10fded..058204176695 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-issues-partial-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-issues-partial-update.json
@@ -1,27 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
- "assignee": {
- "properties": {
- "id": {
- "anyOf": [
- {
- "type": "number"
- },
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "type": {
- "type": "string"
- }
- },
- "type": "object"
- },
"description": {
"anyOf": [
{
@@ -30,48 +9,8 @@
{
"type": "null"
}
- ]
- },
- "external_issues": {
- "items": {
- "properties": {
- "config": {},
- "external_url": {
- "type": "string"
- },
- "id": {
- "type": "string"
- },
- "integration": {
- "properties": {
- "display_name": {
- "type": "string"
- },
- "id": {
- "type": "number"
- },
- "kind": {
- "type": "string"
- }
- },
- "type": "object"
- },
- "integration_id": {
- "type": "number"
- },
- "issue": {
- "type": "string"
- }
- },
- "required": ["integration_id", "config", "issue"],
- "type": "object"
- },
- "type": "array"
- },
- "first_seen": {
- "format": "date-time",
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
- "type": "string"
+ ],
+ "description": "Optional issue description."
},
"id": {
"description": "A UUID string identifying this error tracking issue.",
@@ -85,11 +24,12 @@
{
"type": "null"
}
- ]
+ ],
+ "description": "Optional issue display name."
},
"status": {
- "description": "* `archived` - Archived\n* `active` - Active\n* `resolved` - Resolved\n* `pending_release` - Pending release\n* `suppressed` - Suppressed",
- "enum": ["archived", "active", "resolved", "pending_release", "suppressed"],
+ "description": "Issue status to set. Deprecated archived and pending_release values are rejected.\n\n* `active` - active\n* `resolved` - resolved\n* `suppressed` - suppressed",
+ "enum": ["active", "resolved", "suppressed"],
"type": "string"
}
},