: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(tasks): add a basic list payload that drops description (#96642)
Paul D'Ambra271bbbbe7cd1
diff --git a/products/tasks/backend/presentation/serializers.py b/products/tasks/backend/presentation/serializers.pyindex 974722f927cb..3281aba5f65b 100644--- a/products/tasks/backend/presentation/serializers.py+++ b/products/tasks/backend/presentation/serializers.py@@ -608,6 +608,20 @@ class TaskSerializer(DataclassSerializer):]+class TaskBasicSerializer(TaskSerializer):+ """Basic list response for a task, returned when the list is asked for ``basic=true``.++ A surface that renders only a summary of each task asks for the basic payload and gets this+ smaller shape. It currently drops ``description``, which dominates the list payload; more+ heavy fields may follow. The default list response keeps every field, and ``retrieve``+ always returns the description. A client uses the ``search`` query parameter to match+ description text server-side.+ """++ class Meta(TaskSerializer.Meta):+ fields = [field for field in TaskSerializer.Meta.fields if field != "description"]++class TaskWriteSerializer(serializers.Serializer):title = serializers.CharField(max_length=255,@@ -2006,6 +2020,15 @@ class TaskListQuerySerializer(serializers.Serializer):required=False, help_text="Filter by repository name (can include org/repo format)")created_by = serializers.IntegerField(required=False, help_text="Filter by creator user ID")+ basic = serializers.BooleanField(+ required=False,+ default=False,+ help_text=(+ "Return a basic payload with heavy fields dropped, for surfaces that render only a summary "+ "of each task. Defaults to false. Currently this omits the description body, which dominates "+ "the list payload; the search parameter still matches description text server-side."+ ),+ )search = serializers.CharField(required=False,allow_blank=True,diff --git a/products/tasks/backend/presentation/views/api.py b/products/tasks/backend/presentation/views/api.pyindex 90912a9efbb3..9bb29d8179bd 100644--- a/products/tasks/backend/presentation/views/api.py+++ b/products/tasks/backend/presentation/views/api.py@@ -126,6 +126,7 @@ from products.tasks.backend.presentation.serializers import (SlackThreadContextThreadSerializer,StreamReadTokenResponseSerializer,TaskArtifactsResponseSerializer,+ TaskBasicSerializer,TaskCommentDetailQuerySerializer,TaskCommentDetailSerializer,TaskCommentsQuerySerializer,@@ -463,7 +464,7 @@ class TaskViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):200: OpenApiResponse(response=TaskSerializer, description="List of tasks"),},summary="List tasks",- description="Get a list of tasks for the current project, with optional filtering by origin product, stage, organization, repository, created_by, and the workflow (hog_flow_id) that created the task.",+ description="Get a list of tasks for the current project, with optional filtering by origin product, stage, organization, repository, created_by, and the workflow (hog_flow_id) that created the task. Pass basic=true for a summary payload that drops the description body from each row; use the search parameter to match description text server-side.",)def list(self, request, *args, **kwargs):filters = {key: request.query_params.get(key) for key in request.query_params}@@ -480,8 +481,12 @@ class TaskViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):)page = self.paginate_queryset(tasks)assert page is not None, "TaskViewSet list requires an active paginator"+ # Description bodies dominate the list payload. A summary surface asks for basic=true+ # and gets the smaller rows without them.+ basic = getattr(request, "validated_query_data", {}).get("basic", False)+ serializer_class = TaskBasicSerializer if basic else TaskSerializerreturn self.get_paginated_response(- TaskSerializer(tasks_facade._tasks_to_dtos(page, self.team_id), many=True).data+ serializer_class(tasks_facade._tasks_to_dtos(page, self.team_id), many=True).data)@validated_request(diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.pyindex de0ef5a028af..dc68f979c77a 100644--- a/products/tasks/backend/tests/test_api.py+++ b/products/tasks/backend/tests/test_api.py@@ -1216,6 +1216,28 @@ class TestTaskAPI(BaseTaskAPITest):self.assertIn("Task 1", task_titles)self.assertIn("Task 2", task_titles)+ @parameterized.expand(+ [+ ("default_full", None, True),+ ("basic_false_full", "false", True),+ ("basic_true_summary", "true", False),+ ]+ )+ def test_list_basic_omits_description(self, _name, basic_param, expect_description):+ self.create_task("Task 1")++ url = "/api/projects/@current/tasks/"+ if basic_param is not None:+ url += f"?basic={basic_param}"+ response = self.client.get(url)+ self.assertEqual(response.status_code, status.HTTP_200_OK)++ row = response.json()["results"][0]+ if expect_description:+ self.assertEqual(row["description"], "Test Description")+ else:+ self.assertNotIn("description", row)+def test_list_tasks_includes_latest_run(self):task1 = self.create_task("Task 1")task2 = self.create_task("Task 2")diff --git a/products/tasks/frontend/generated/api.schemas.ts b/products/tasks/frontend/generated/api.schemas.tsindex 9581ea0defd3..8870374f83a4 100644--- a/products/tasks/frontend/generated/api.schemas.ts+++ b/products/tasks/frontend/generated/api.schemas.ts@@ -5070,6 +5070,10 @@ export type TasksListParams = {* @minLength 1*/archived?: TasksListArchived+ /**+ * Return a basic payload with heavy fields dropped, for surfaces that render only a summary of each task. Defaults to false. Currently this omits the description body, which dominates the list payload; the search parameter still matches description text server-side.+ */+ basic?: boolean/*** Filter tasks to a channel's feed.*/diff --git a/products/tasks/frontend/generated/api.ts b/products/tasks/frontend/generated/api.tsindex 7f0e3337c6a6..50e28945fd12 100644--- a/products/tasks/frontend/generated/api.ts+++ b/products/tasks/frontend/generated/api.ts@@ -1260,7 +1260,7 @@ export const getTasksListUrl = (projectId: string, params?: TasksListParams) =>}/**- * Get a list of tasks for the current project, with optional filtering by origin product, stage, organization, repository, created_by, and the workflow (hog_flow_id) that created the task.+ * Get a list of tasks for the current project, with optional filtering by origin product, stage, organization, repository, created_by, and the workflow (hog_flow_id) that created the task. Pass basic=true for a summary payload that drops the description body from each row; use the search parameter to match description text server-side.* @summary List tasks*/export const tasksList = async (diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 62f1620b9293..78b242695c1a 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -101587,6 +101587,10 @@ export namespace Schemas {* @minLength 1*/archived?: TasksListArchived;+ /**+ * Return a basic payload with heavy fields dropped, for surfaces that render only a summary of each task. Defaults to false. Currently this omits the description body, which dominates the list payload; the search parameter still matches description text server-side.+ */+ basic?: boolean;/*** Filter tasks to a channel's feed.*/diff --git a/services/mcp/src/generated/tasks/api.ts b/services/mcp/src/generated/tasks/api.tsindex e52df6cbc528..855f724a43fe 100644--- a/services/mcp/src/generated/tasks/api.ts+++ b/services/mcp/src/generated/tasks/api.ts@@ -854,7 +854,7 @@ export const TaskChannelsInstructionsUpdateBody = () => zod.describe('Request body for publishing a new instructions version.')/**- * Get a list of tasks for the current project, with optional filtering by origin product, stage, organization, repository, created_by, and the workflow (hog_flow_id) that created the task.+ * Get a list of tasks for the current project, with optional filtering by origin product, stage, organization, repository, created_by, and the workflow (hog_flow_id) that created the task. Pass basic=true for a summary payload that drops the description body from each row; use the search parameter to match description text server-side.* @summary List tasks*/export const TasksListParams = () => zod.object({@@ -866,6 +866,7 @@ export const TasksListParams = () => zod.object({})export const tasksListQueryAllTeamTasksDefault = false+export const tasksListQueryBasicDefault = falseexport const tasksListQueryLimitDefault = 50export const tasksListQueryLimitMax = 100@@ -885,6 +886,12 @@ export const TasksListQueryParams = () => zod.object({.describe("Filter by archived state. Defaults to excluding archived tasks. Use 'true' to list only archived tasks, 'false' for the default, or 'all' to include both.\n\n\* `true` - true\n\* `false` - false\n\* `all` - all"),+ basic: zod+ .boolean()+ .default(tasksListQueryBasicDefault)+ .describe(+ 'Return a basic payload with heavy fields dropped, for surfaces that render only a summary of each task. Defaults to false. Currently this omits the description body, which dominates the list payload; the search parameter still matches description text server-side.'+ ),channel: zod.string().optional().describe("Filter tasks to a channel's feed."),ci_status: zod.enum(['passing', 'failing', 'pending', 'none'])diff --git a/services/mcp/src/tools/generated/tasks.ts b/services/mcp/src/tools/generated/tasks.tsindex ff57e3ab0061..f109b67efc11 100644--- a/services/mcp/src/tools/generated/tasks.ts+++ b/services/mcp/src/tools/generated/tasks.ts@@ -618,6 +618,7 @@ const tasksList = (): ToolBase<query: {all_team_tasks: params.all_team_tasks,archived: params.archived,+ basic: params.basic,channel: params.channel,ci_status: params.ci_status,commented_by: params.commented_by,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/tasks-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/tasks-list.jsonindex 713046bb92f5..d96d7b65d754 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/tasks-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/tasks-list.json@@ -11,6 +11,11 @@"enum": ["true", "false", "all"],"type": "string"},+ "basic": {+ "default": false,+ "description": "Return a basic payload with heavy fields dropped, for surfaces that render only a summary of each task. Defaults to false. Currently this omits the description body, which dominates the list payload; the search parameter still matches description text server-side.",+ "type": "boolean"+ },"channel": {"description": "Filter tasks to a channel's feed.","type": "string"