: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(signals): add report space ownership (#86773)
Dylan Martin3e84d3af9e4d
diff --git a/products/signals/backend/artefact_schemas.py b/products/signals/backend/artefact_schemas.pyindex fa564bb1c1ba..1b2466a7802c 100644--- a/products/signals/backend/artefact_schemas.py+++ b/products/signals/backend/artefact_schemas.py@@ -22,6 +22,7 @@ import refrom collections.abc import Mappingfrom enum import Enumfrom typing import Any, Literal, cast+from uuid import UUIDfrom pydantic import BaseModel, ConfigDict, Field, RootModel, ValidationError, field_validator, model_validator@@ -218,6 +219,12 @@ class SuggestedReviewers(RootModel[list[SuggestedReviewerEntry]]):"""Content schema for a `suggested_reviewers` artefact — the content root is a JSON list."""+class ChannelAssignment(BaseModel):+ """The space that currently owns a report. The latest assignment wins."""++ channel_id: UUID | None = Field(description="Channel UUID, or null to leave the report unassigned.")++class Dismissal(BaseModel):"""Content schema for a `dismissal` artefact: feedback captured when a report is dismissed/snoozed.@@ -532,7 +539,12 @@ class CodeReview(BaseModel):# entries that record discrete work (accumulate). `SignalFinding` (keyed by signal_id) and# `Dismissal` (stacking) have their own semantics; `VideoSegment` is a legacy plain append.StatusArtefactContent = (- SafetyJudgment | ActionabilityAssessment | PriorityAssessment | RepoSelectionResult | SuggestedReviewers+ SafetyJudgment+ | ActionabilityAssessment+ | PriorityAssessment+ | RepoSelectionResult+ | SuggestedReviewers+ | ChannelAssignment)LogArtefactContent = (CodeReference | Commit | TaskRunArtefact | NoteArtefact | TitleChange | SummaryChange | CodeReview | RelatedTo@@ -549,6 +561,7 @@ ARTEFACT_CONTENT_SCHEMAS: Mapping[str, type[BaseModel]] = {"signal_finding": SignalFinding,"repo_selection": RepoSelectionResult,"suggested_reviewers": SuggestedReviewers,+ "channel_assignment": ChannelAssignment,"dismissal": Dismissal,"code_reference": CodeReference,"commit": Commit,diff --git a/products/signals/backend/migrations/0106_signalreportartefact_channel.py b/products/signals/backend/migrations/0106_signalreportartefact_channel.pynew file mode 100644index 000000000000..15b8c258c51d--- /dev/null+++ b/products/signals/backend/migrations/0106_signalreportartefact_channel.py@@ -0,0 +1,27 @@+# Generated by Django 5.2.17 on 2026-08-26 22:07++import django.db.models.deletion+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("signals", "0105_signalscratchpad_expires_at"),+ ("tasks", "0102_channel_system_role"),+ ]++ operations = [+ migrations.AddField(+ model_name="signalreportartefact",+ name="channel",+ field=models.ForeignKey(+ blank=True,+ db_constraint=False,+ db_index=False,+ null=True,+ on_delete=django.db.models.deletion.SET_NULL,+ related_name="+",+ to="tasks.channel",+ ),+ ),+ ]diff --git a/products/signals/backend/migrations/0107_signalreportartefact_channel_index.py b/products/signals/backend/migrations/0107_signalreportartefact_channel_index.pynew file mode 100644index 000000000000..c8dd94b486a6--- /dev/null+++ b/products/signals/backend/migrations/0107_signalreportartefact_channel_index.py@@ -0,0 +1,18 @@+from django.db import migrations, models++from posthog.migration_helpers import SafeAddIndexConcurrently+++class Migration(migrations.Migration):+ atomic = False++ dependencies = [+ ("signals", "0106_signalreportartefact_channel"),+ ]++ operations = [+ SafeAddIndexConcurrently(+ model_name="signalreportartefact",+ index=models.Index(fields=["channel"], name="signals_sig_channel_idx"),+ ),+ ]diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txtindex 6db4da4013f6..fdb28224671f 100644--- a/products/signals/backend/migrations/max_migration.txt+++ b/products/signals/backend/migrations/max_migration.txt@@ -1 +1 @@-0105_signalscratchpad_expires_at+0107_signalreportartefact_channel_indexdiff --git a/products/signals/backend/models.py b/products/signals/backend/models.pyindex 6c252a2878fd..43ccd9332746 100644--- a/products/signals/backend/models.py+++ b/products/signals/backend/models.py@@ -23,6 +23,7 @@ from products.signals.backend.artefact_attribution import ArtefactAttributionfrom products.signals.backend.artefact_schemas import (ArtefactContent,ArtefactContentValidationError,+ ChannelAssignment,Dismissal,LogArtefactContent,RelatedTo,@@ -773,6 +774,7 @@ class SignalReportArtefact(UUIDModel):SIGNAL_FINDING = "signal_finding"REPO_SELECTION = "repo_selection"SUGGESTED_REVIEWERS = "suggested_reviewers"+ CHANNEL_ASSIGNMENT = "channel_assignment"DISMISSAL = "dismissal"CODE_REFERENCE = "code_reference"COMMIT = "commit"@@ -786,7 +788,7 @@ class SignalReportArtefact(UUIDModel):# Every artefact is an append-only, point-in-time log entry — nothing is mutated in place by# the producers. The two sets below classify *what an entry means*, not how it is written:# - status artefacts describe the report's current state (judgments, repo selection,- # suggested reviewers). They are appended on each (re)assessment via `append_status`; the+ # suggested reviewers, channel assignments). They are appended on each change; the# report's *current* status is the latest row of that type by `created_at` (the serializer# derives priority/actionability/reviewers with `order_by("-created_at")[:1]` subqueries).# - log artefacts record discrete work done on a report (code references, commits,@@ -801,6 +803,7 @@ class SignalReportArtefact(UUIDModel):ArtefactType.PRIORITY_JUDGMENT,ArtefactType.REPO_SELECTION,ArtefactType.SUGGESTED_REVIEWERS,+ ArtefactType.CHANNEL_ASSIGNMENT,})LOG_ARTEFACT_TYPES: frozenset[str] = frozenset(@@ -831,6 +834,15 @@ class SignalReportArtefact(UUIDModel):# destroying the report's work log.created_by = models.ForeignKey("posthog.User", on_delete=models.SET_NULL, null=True, blank=True, related_name="+")task = models.ForeignKey("tasks.Task", on_delete=models.SET_NULL, null=True, blank=True, related_name="+")+ channel = models.ForeignKey(+ "tasks.Channel",+ null=True,+ blank=True,+ on_delete=models.SET_NULL,+ db_constraint=False,+ db_index=False,+ related_name="+",+ )class Meta:indexes = [@@ -840,6 +852,7 @@ class SignalReportArtefact(UUIDModel):# Latest-wins lookups: artefacts are append-only, so deriving the current status / log# tail is `WHERE report=? AND type=? ORDER BY created_at DESC` — this makes it a seek.models.Index(fields=["report", "type", "-created_at"], name="signals_sig_rpt_type_ct_idx"),+ models.Index(fields=["channel"], name="signals_sig_channel_idx"),]@classmethod@@ -867,6 +880,7 @@ class SignalReportArtefact(UUIDModel):content=content.model_dump_json(),created_by_id=attribution.user_id,task_id=attribution.task_id,+ channel_id=content.channel_id if isinstance(content, ChannelAssignment) else None,)@classmethod@@ -1031,7 +1045,11 @@ class SignalReportArtefact(UUIDModel):"task_run content.product and content.type record what ran and cannot be changed by editing")self.content = parsed.model_dump_json()- self.save(update_fields=["content", "updated_at"])+ update_fields = ["content", "updated_at"]+ if isinstance(parsed, ChannelAssignment):+ self.channel_id = parsed.channel_id+ update_fields.append("channel_id")+ self.save(update_fields=update_fields)if self.type == SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS:self._schedule_autostart_reevaluation(team_id=self.team_id, report_id=str(self.report_id))diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.pyindex cd7523b475e8..b3451d542d51 100644--- a/products/signals/backend/serializers.py+++ b/products/signals/backend/serializers.py@@ -539,6 +539,14 @@ class SignalReportSerializer(serializers.ModelSerializer):refund = serializers.SerializerMethodField(help_text="The report's PR refund, when one exists. One refund per report, ever.",)+ channel_id = serializers.UUIDField(+ read_only=True,+ allow_null=True,+ help_text=(+ "The space (task channel) this report is assigned to, or null when unassigned. "+ "The general view lists every report regardless of this value."+ ),+ )class Meta:model = SignalReport@@ -568,6 +576,7 @@ class SignalReportSerializer(serializers.ModelSerializer):"refund","refund_ineligibility_reason","billing_exempt_reason",+ "channel_id",]read_only_fields = fieldsextra_kwargs = {@@ -933,7 +942,7 @@ _ARTEFACT_TYPES_HELP = ("The artefact type. One of: "+ ", ".join(_WRITABLE_ARTEFACT_TYPES)+ ". Log types accumulate; status types (safety_judgment, actionability_judgment, "- "priority_judgment, repo_selection, suggested_reviewers) are latest-wins — appending a new "+ "priority_judgment, repo_selection, suggested_reviewers, channel_assignment) are latest-wins — appending a new ""version supersedes the previous one as the report's canonical status.")diff --git a/products/signals/backend/test/test_artefact_schemas.py b/products/signals/backend/test/test_artefact_schemas.pyindex 13dc8a926319..998a8354b87d 100644--- a/products/signals/backend/test/test_artefact_schemas.py+++ b/products/signals/backend/test/test_artefact_schemas.py@@ -121,6 +121,7 @@ class TestValidateArtefactContent(SimpleTestCase):),("repo_selection", {"repository": None, "reason": "no candidates"}),("suggested_reviewers", [{"github_login": "octocat", "github_name": None, "relevant_commits": []}]),+ ("channel_assignment", {"channel_id": "00000000-0000-0000-0000-000000000001"}),("dismissal", {"reason": "not_a_bug", "note": None, "user_id": 1, "user_uuid": None}),("video_segment", {"anything": "goes"}),("note", {"note": "hello"}),@@ -153,6 +154,7 @@ class TestValidateArtefactContent(SimpleTestCase):("signal_finding", {"signal_id": "s1"}),("repo_selection", {"reason": 5}),("suggested_reviewers", [{"github_name": "no login"}]),+ ("channel_assignment", {"channel_id": "not-a-uuid"}),("note", {"note": " "}),("commit", {"repository": "PostHog/posthog", "branch": "b", "commit_sha": " ", "message": "m"}),("task_run", {"task_id": "t1", "product": "Not Safe!", "type": "research"}),diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.pyindex ce4fde98183a..0153329fb845 100644--- a/products/signals/backend/test/test_signal_report_api.py+++ b/products/signals/backend/test/test_signal_report_api.py@@ -30,11 +30,12 @@ from posthog.temporal.oauth import (create_oauth_access_token_for_user,)+from products.signals.backend.artefact_schemas import ChannelAssignmentfrom products.signals.backend.implementation_pr import (fetch_implementation_pr_state_for_reports,fetch_implementation_pr_urls_for_reports,)-from products.signals.backend.models import SignalReport, SignalReportArtefact, SignalReportTask+from products.signals.backend.models import ArtefactAttribution, SignalReport, SignalReportArtefact, SignalReportTaskfrom products.signals.backend.signal_metadata import ReportSignalMetafrom products.signals.backend.task_run_artefacts import (TASK_RUN_TYPE_DISCUSSION,@@ -46,6 +47,7 @@ from products.signals.backend.task_run_artefacts import (record_implementation_task,record_report_task,)+from products.tasks.backend.facade.api import Channelif TYPE_CHECKING:from products.tasks.backend.models import Task, TaskRun@@ -176,6 +178,14 @@ class TestSignalReportListAPI(APIBaseTest):art.save()return art+ def _assign_channel(self, report: SignalReport, channel: Channel | None) -> SignalReportArtefact:+ return SignalReportArtefact.append_status(+ team_id=self.team.id,+ report_id=str(report.id),+ content=ChannelAssignment(channel_id=channel.id if channel else None),+ attribution=ArtefactAttribution.system(),+ )+def _actionability_artefact(self, report: SignalReport, *, actionability: str) -> SignalReportArtefact:payload = {"explanation": "x", "actionability": actionability, "already_addressed": False}art = SignalReportArtefact(@@ -257,6 +267,59 @@ class TestSignalReportListAPI(APIBaseTest):assert response.status_code == status.HTTP_200_OKassert response.json()["priority"] == "P0"+ @parameterized.expand([("unassigned", False), ("assigned", True)])+ def test_retrieve_includes_channel_id(self, _name, assign):+ channel = Channel.objects.create(team=self.team, name="Reports") if assign else None+ report = self._create_report()+ if channel:+ self._assign_channel(report, channel)++ url = f"/api/projects/{self.team.id}/signals/reports/{report.id}/"+ response = self.client.get(url)+ assert response.status_code == status.HTTP_200_OK+ assert response.json()["channel_id"] == (str(channel.id) if channel else None)++ def test_filter_by_channel_id_narrows_to_that_space(self):+ channel = Channel.objects.create(team=self.team, name="Reports")+ in_space = self._create_report(title="In space")+ self._assign_channel(in_space, channel)+ self._create_report(title="Unassigned")++ response = self.client.get(self._list_url(channel_id=str(channel.id)))+ assert response.status_code == status.HTTP_200_OK+ ids = {row["id"] for row in response.json()["results"]}+ assert ids == {str(in_space.id)}++ def test_latest_channel_assignment_wins(self):+ first_channel = Channel.objects.create(team=self.team, name="First")+ second_channel = Channel.objects.create(team=self.team, name="Second")+ report = self._create_report()+ self._assign_channel(report, first_channel)+ self._assign_channel(report, second_channel)++ response = self.client.get(f"/api/projects/{self.team.id}/signals/reports/{report.id}/")+ assert response.status_code == status.HTTP_200_OK+ assert response.json()["channel_id"] == str(second_channel.id)++ first_response = self.client.get(self._list_url(channel_id=str(first_channel.id)))+ assert first_response.status_code == status.HTTP_200_OK+ assert all(row["id"] != str(report.id) for row in first_response.json()["results"])++ def test_soft_deleted_channel_is_returned_as_unassigned(self):+ channel = Channel.objects.create(team=self.team, name="Reports")+ report = self._create_report()+ self._assign_channel(report, channel)+ channel.deleted = True+ channel.save(update_fields=["deleted"])++ response = self.client.get(f"/api/projects/{self.team.id}/signals/reports/{report.id}/")+ assert response.status_code == status.HTTP_200_OK+ assert response.json()["channel_id"] is None++ def test_filter_by_channel_id_rejects_non_uuid(self):+ response = self.client.get(self._list_url(channel_id="not-a-uuid"))+ assert response.status_code == status.HTTP_400_BAD_REQUEST+# --- priority filter ---@parameterized.expand(diff --git a/products/signals/backend/test/test_signal_report_artefact_api.py b/products/signals/backend/test/test_signal_report_artefact_api.pyindex 96937f0466e4..665fb6770ab9 100644--- a/products/signals/backend/test/test_signal_report_artefact_api.py+++ b/products/signals/backend/test/test_signal_report_artefact_api.py@@ -25,7 +25,7 @@ from products.signals.backend.artefact_schemas import (from products.signals.backend.models import ArtefactAttribution, SignalReport, SignalReportArtefact# Task ORM model needed to build cross-product fixtures; the tasks facade exposes DTOs only.-from products.tasks.backend.models import Task # tach-ignore+from products.tasks.backend.models import Channel, Task # tach-ignoredef _attach_github_login(user: User, login: str, *, uid: str | None = None) -> None:@@ -659,6 +659,7 @@ class TestSignalReportArtefactViewSet(APIBaseTest):("priority_judgment", SignalReportArtefact.ArtefactType.PRIORITY_JUDGMENT),("signal_finding", SignalReportArtefact.ArtefactType.SIGNAL_FINDING),("repo_selection", SignalReportArtefact.ArtefactType.REPO_SELECTION),+ ("channel_assignment", SignalReportArtefact.ArtefactType.CHANNEL_ASSIGNMENT),("dismissal", SignalReportArtefact.ArtefactType.DISMISSAL),("code_reference", SignalReportArtefact.ArtefactType.CODE_REFERENCE),("commit", SignalReportArtefact.ArtefactType.COMMIT),@@ -951,6 +952,42 @@ class TestSignalReportArtefactLogWriteViewSet(APIBaseTest):assert report_response.status_code == status.HTTP_200_OKassert report_response.json()["priority"] == "P1"+ def test_post_channel_assignment_moves_report_and_keeps_history(self):+ report = self._create_report()+ first_channel = Channel.objects.create(team=self.team, name="First")+ second_channel = Channel.objects.create(team=self.team, name="Second")++ for channel in (first_channel, second_channel):+ response = self.client.post(+ self._list_url(str(report.id)),+ data=json.dumps({"artefact_type": "channel_assignment", "content": {"channel_id": str(channel.id)}}),+ content_type="application/json",+ )+ assert response.status_code == status.HTTP_201_CREATED, response.json()++ assignments = SignalReportArtefact.objects.filter(+ report=report,+ type=SignalReportArtefact.ArtefactType.CHANNEL_ASSIGNMENT,+ ).order_by("created_at")+ assert list(assignments.values_list("channel_id", flat=True)) == [first_channel.id, second_channel.id]++ report_response = self.client.get(f"/api/projects/{self.team.id}/signals/reports/{report.id}/")+ assert report_response.status_code == status.HTTP_200_OK+ assert report_response.json()["channel_id"] == str(second_channel.id)++ def test_post_channel_assignment_rejects_another_teams_channel(self):+ report = self._create_report()+ other_team = Team.objects.create(organization=self.organization, name="Other")+ channel = Channel.objects.create(team=other_team, name="Other")++ response = self.client.post(+ self._list_url(str(report.id)),+ data=json.dumps({"artefact_type": "channel_assignment", "content": {"channel_id": str(channel.id)}}),+ content_type="application/json",+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert not SignalReportArtefact.objects.filter(report=report).exists()+def test_post_status_type_with_invalid_content_returns_400(self):report = self._create_report()response = self.client.post(diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex 786aede7808e..d92ebf7a1cac 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -70,6 +70,7 @@ from products.signals.backend.artefact_schemas import (NON_WRITABLE_ARTEFACT_TYPES,SIGNALS_PRODUCT,ArtefactContentValidationError,+ ChannelAssignment,Dismissal,SuggestedReviewers,SummaryChange,@@ -795,6 +796,7 @@ class SignalReportViewSet(qs = self._apply_signal_report_scout_filter(qs)qs = self._apply_signal_report_scout_prefix_filter(qs)qs = self._apply_signal_report_implementation_pr_filter(qs)+ qs = self._apply_signal_report_channel_filter(qs)qs = self._apply_signal_report_suggested_reviewer_filter(qs)qs = self._apply_signal_report_task_filter(qs)qs = self._annotate_latest_actionability_value(qs)@@ -820,12 +822,29 @@ class SignalReportViewSet(.values("count"),output_field=IntegerField(),)+ channel_id_subquery = Subquery(+ SignalReportArtefact.objects.filter(+ report_id=OuterRef("id"),+ type=SignalReportArtefact.ArtefactType.CHANNEL_ASSIGNMENT,+ )+ .annotate(+ live_channel_id=Case(+ When(channel__deleted=False, then=F("channel_id")),+ default=Value(None),+ output_field=models.UUIDField(),+ )+ )+ .order_by("-created_at")+ .values("live_channel_id")[:1],+ output_field=models.UUIDField(),+ )# select_related("refund"): the serializer renders the reverse OneToOne inline.return (queryset.filter(team=self.team).select_related("refund").annotate(artefact_count=Coalesce(artefact_count_subquery, Value(0), output_field=IntegerField()),+ channel_id=channel_id_subquery,))@@ -1028,6 +1047,18 @@ class SignalReportViewSet(pr_filter = self._implementation_pr_report_filter()return queryset.filter(pr_filter) if wants_pr else queryset.exclude(pr_filter)+ def _apply_signal_report_channel_filter(self, queryset):+ # `channel_id=<uuid>` narrows to reports assigned to one space. Absent or empty+ # leaves the list unchanged (the general view lists every report); a non-UUID is a 400.+ raw = self.request.query_params.get("channel_id")+ if raw is None or not raw.strip():+ return queryset+ try:+ channel_id = uuid.UUID(raw.strip())+ except (ValueError, AttributeError):+ raise serializers.ValidationError({"channel_id": f"Invalid value: {raw!r}. Expected a UUID."})+ return queryset.filter(channel_id=channel_id)+def _apply_signal_report_suggested_reviewer_filter(self, queryset):suggested_reviewer_filter = self.request.query_params.get("suggested_reviewers")if not suggested_reviewer_filter:@@ -1443,6 +1474,16 @@ class SignalReportViewSet(required=False,description="Case-insensitive substring match against report title and summary.",),+ OpenApiParameter(+ name="channel_id",+ type=OpenApiTypes.UUID,+ location=OpenApiParameter.QUERY,+ required=False,+ description=(+ "Narrow to reports assigned to one space (channel). Absent or empty means all "+ "reports regardless of assignment."+ ),+ ),OpenApiParameter(name="source_product",type=OpenApiTypes.STR,@@ -3186,7 +3227,7 @@ class SignalReportArtefactViewSet(artefact (latest-wins, so the new row becomes current) with bespoke reviewer enrichment,merging commits/names forward from the current reviewers. Other types return 400.- POST / PATCH / DELETE manage artefacts of *any* type — no type is writer-restricted.- Log entries accumulate; status types (judgments, repo selection, suggested reviewers)+ Log entries accumulate; status types (judgments, repo selection, suggested reviewers, channel assignments)are latest-wins, so appending a new version supersedes the previous one as the report'scanonical status. Content is validated against the type's schema. Team scoping isenforced by `safely_get_queryset`, so an artefact id from another team / a deleted@@ -3215,6 +3256,12 @@ class SignalReportArtefactViewSet(raise NotFound()return report_id+ def _validate_channel_assignment(self, assignment: ChannelAssignment, request: Request) -> None:+ if assignment.channel_id is not None and not tasks_facade.channel_exists(+ self.team.id, assignment.channel_id, request.user.id+ ):+ raise serializers.ValidationError({"content": {"channel_id": "Unknown or inaccessible channel."}})+def safely_get_queryset(self, queryset):# Mirror SignalReportViewSet: a deleted parent report is unreachable, so# its artefacts must be too (otherwise a known UUID would bypass deletion).@@ -3345,7 +3392,7 @@ class SignalReportArtefactViewSet("Append an artefact to a report (see artefact_type for the writable types). Everything ""is append-only: log entries (code reference, commit, task run, note) accumulate, while ""status types (safety / actionability / priority judgments, repo selection, suggested "- "reviewers) are latest-wins — appending a new version supersedes the previous one as the "+ "reviewers, channel assignments) are latest-wins — appending a new version supersedes the previous one as the ""report's canonical status. Content is validated against the type's schema."),operation_id="signals_report_artefacts_create",@@ -3442,6 +3489,8 @@ class SignalReportArtefactViewSet({"error": f"content does not match the '{artefact_type}' schema: {e}"},status=status.HTTP_400_BAD_REQUEST,)+ if isinstance(parsed_content, ChannelAssignment):+ self._validate_channel_assignment(parsed_content, request)artefact = SignalReportArtefact.append(team_id=self.team.id,report_id=report_id,@@ -3529,6 +3578,9 @@ class SignalReportArtefactViewSet(status=status.HTTP_400_BAD_REQUEST,)try:+ parsed_content = parse_artefact_content(artefact.type, request.validated_data["content"])+ if isinstance(parsed_content, ChannelAssignment):+ self._validate_channel_assignment(parsed_content, request)artefact.update_content(request.validated_data["content"])except ArtefactContentValidationError as e:return Response(diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 36c44111b8f2..70ec51c32a24 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -255,6 +255,11 @@ export interface SignalReportApi {* * `posthog_onboarding` - PostHog onboarding* * `posthog_system` - PostHog system */readonly billing_exempt_reason: BillingExemptReasonEnumApi | null+ /**+ * The space (task channel) this report is assigned to, or null when unassigned. The general view lists every report regardless of this value.+ * @nullable+ */+ readonly channel_id: string | null}export interface PaginatedSignalReportListApi {@@ -1608,6 +1613,7 @@ export interface SignalReportStateRequestApi {* * `signal_finding` - Signal Finding* * `repo_selection` - Repo Selection* * `suggested_reviewers` - Suggested Reviewers+ * * `channel_assignment` - Channel Assignment* * `dismissal` - Dismissal* * `code_reference` - Code Reference* * `commit` - Commit@@ -1629,6 +1635,7 @@ export const SignalReportArtefactTypeEnumApi = {SignalFinding: 'signal_finding',RepoSelection: 'repo_selection',SuggestedReviewers: 'suggested_reviewers',+ ChannelAssignment: 'channel_assignment',Dismissal: 'dismissal',CodeReference: 'code_reference',Commit: 'commit',@@ -1683,7 +1690,7 @@ export interface PaginatedSignalReportArtefactListApi {* against the type's schema (see `products/signals/backend/artefact_schemas.py`).*/export interface SignalReportArtefactLogCreateApi {- /** The artefact type. One of: actionability_judgment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. */+ /** The artefact type. One of: actionability_judgment, channel_assignment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers, channel_assignment) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. */artefact_type: string/** The artefact payload as a JSON object or array; shape depends on artefact_type and is validated against its schema. */content: unknown@@ -4043,6 +4050,10 @@ export type SignalsProcessingListParams = {}export type SignalsReportsListParams = {+ /**+ * Narrow to reports assigned to one space (channel). Absent or empty means all reports regardless of assignment.+ */+ channel_id?: string/*** Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with limit=1 to count PR reports cheaply.*/diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.tsindex 91d5f09c443c..2542a76ef050 100644--- a/products/signals/frontend/generated/api.ts+++ b/products/signals/frontend/generated/api.ts@@ -553,7 +553,7 @@ export const getSignalsReportArtefactsCreateUrl = (projectId: string, reportId:}/**- * Append an artefact to a report (see artefact_type for the writable types). Everything is append-only: log entries (code reference, commit, task run, note) accumulate, while status types (safety / actionability / priority judgments, repo selection, suggested reviewers) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. Content is validated against the type's schema.+ * Append an artefact to a report (see artefact_type for the writable types). Everything is append-only: log entries (code reference, commit, task run, note) accumulate, while status types (safety / actionability / priority judgments, repo selection, suggested reviewers, channel assignments) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. Content is validated against the type's schema.* @summary Append an artefact to a report*/export const signalsReportArtefactsCreate = async (diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex af0e6b424b1c..674079757345 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -224,7 +224,7 @@ export const SignalsReportsStateCreateBody = /* @__PURE__ */ zod.object({})/**- * Append an artefact to a report (see artefact_type for the writable types). Everything is append-only: log entries (code reference, commit, task run, note) accumulate, while status types (safety / actionability / priority judgments, repo selection, suggested reviewers) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. Content is validated against the type's schema.+ * Append an artefact to a report (see artefact_type for the writable types). Everything is append-only: log entries (code reference, commit, task run, note) accumulate, while status types (safety / actionability / priority judgments, repo selection, suggested reviewers, channel assignments) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. Content is validated against the type's schema.* @summary Append an artefact to a report*/export const SignalsReportArtefactsCreateBody = /* @__PURE__ */ zod@@ -232,7 +232,7 @@ export const SignalsReportArtefactsCreateBody = /* @__PURE__ */ zodartefact_type: zod.string().describe(- "The artefact type. One of: actionability_judgment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers) are latest-wins — appending a new version supersedes the previous one as the report's canonical status."+ "The artefact type. One of: actionability_judgment, channel_assignment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers, channel_assignment) are latest-wins — appending a new version supersedes the previous one as the report's canonical status."),content: zod.unknown()diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 78eccb2afae1..b37a0658d310 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -54971,6 +54971,7 @@ export namespace Schemas {* * `signal_finding` - Signal Finding* * `repo_selection` - Repo Selection* * `suggested_reviewers` - Suggested Reviewers+ * * `channel_assignment` - Channel Assignment* * `dismissal` - Dismissal* * `code_reference` - Code Reference* * `commit` - Commit@@ -54992,6 +54993,7 @@ export namespace Schemas {SignalFinding: 'signal_finding',RepoSelection: 'repo_selection',SuggestedReviewers: 'suggested_reviewers',+ ChannelAssignment: 'channel_assignment',Dismissal: 'dismissal',CodeReference: 'code_reference',Commit: 'commit',@@ -55191,6 +55193,11 @@ export namespace Schemas {* * `posthog_onboarding` - PostHog onboarding* * `posthog_system` - PostHog system */readonly billing_exempt_reason: BillingExemptReasonEnum | null;+ /**+ * The space (task channel) this report is assigned to, or null when unassigned. The general view lists every report regardless of this value.+ * @nullable+ */+ readonly channel_id: string | null;}export interface PaginatedSignalReportList {@@ -75021,7 +75028,7 @@ export namespace Schemas {* against the type's schema (see `products/signals/backend/artefact_schemas.py`).*/export interface SignalReportArtefactLogCreate {- /** The artefact type. One of: actionability_judgment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. */+ /** The artefact type. One of: actionability_judgment, channel_assignment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers, channel_assignment) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. */artefact_type: string;/** The artefact payload as a JSON object or array; shape depends on artefact_type and is validated against its schema. */content: unknown;@@ -95507,6 +95514,10 @@ export namespace Schemas {};export type SignalsReportsListParams = {+ /**+ * Narrow to reports assigned to one space (channel). Absent or empty means all reports regardless of assignment.+ */+ channel_id?: string;/*** Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with limit=1 to count PR reports cheaply.*/diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 4b909fe65b42..ab0ff8d9a9c0 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -17,6 +17,12 @@ export const SignalsReportsListParams = /* @__PURE__ */ zod.object({})export const SignalsReportsListQueryParams = /* @__PURE__ */ zod.object({+ channel_id: zod+ .string()+ .optional()+ .describe(+ 'Narrow to reports assigned to one space (channel). Absent or empty means all reports regardless of assignment.'+ ),has_implementation_pr: zod.boolean().optional()@@ -224,7 +230,7 @@ export const SignalsReportArtefactsListQueryParams = /* @__PURE__ */ zod.object(})/**- * Append an artefact to a report (see artefact_type for the writable types). Everything is append-only: log entries (code reference, commit, task run, note) accumulate, while status types (safety / actionability / priority judgments, repo selection, suggested reviewers) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. Content is validated against the type's schema.+ * Append an artefact to a report (see artefact_type for the writable types). Everything is append-only: log entries (code reference, commit, task run, note) accumulate, while status types (safety / actionability / priority judgments, repo selection, suggested reviewers, channel assignments) are latest-wins — appending a new version supersedes the previous one as the report's canonical status. Content is validated against the type's schema.* @summary Append an artefact to a report*/export const SignalsReportArtefactsCreateParams = /* @__PURE__ */ zod.object({@@ -254,7 +260,7 @@ export const SignalsReportArtefactsCreateBody = /* @__PURE__ */ zodartefact_type: zod.string().describe(- "The artefact type. One of: actionability_judgment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers) are latest-wins — appending a new version supersedes the previous one as the report's canonical status."+ "The artefact type. One of: actionability_judgment, channel_assignment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers, channel_assignment) are latest-wins — appending a new version supersedes the previous one as the report's canonical status."),content: zod.unknown()diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex de0cd1265b9e..bcb4091923b3 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -230,6 +230,7 @@ const inboxReportsList = (): ToolBase<method: 'GET',path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reports/`,query: {+ channel_id: params.channel_id,has_implementation_pr: params.has_implementation_pr,include_all_statuses: params.include_all_statuses,limit: params.limit,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-report-artefacts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-report-artefacts-create.jsonindex aab36543eae9..c221e7230987 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-report-artefacts-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-report-artefacts-create.json@@ -2,7 +2,7 @@"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {"artefact_type": {- "description": "The artefact type. One of: actionability_judgment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers) are latest-wins — appending a new version supersedes the previous one as the report's canonical status.",+ "description": "The artefact type. One of: actionability_judgment, channel_assignment, code_reference, commit, dismissal, note, priority_judgment, related_to, repo_selection, safety_judgment, signal_finding, suggested_reviewers, task_run. Log types accumulate; status types (safety_judgment, actionability_judgment, priority_judgment, repo_selection, suggested_reviewers, channel_assignment) are latest-wins — appending a new version supersedes the previous one as the report's canonical status.","type": "string"},"content": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.jsonindex 612e4b2f65d4..25fd5bcc9ab6 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json@@ -1,6 +1,10 @@{"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {+ "channel_id": {+ "description": "Narrow to reports assigned to one space (channel). Absent or empty means all reports regardless of assignment.",+ "type": "string"+ },"has_implementation_pr": {"description": "Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with limit=1 to count PR reports cheaply.","type": "boolean"