Files
awesome-reviewers/_reviewers/posthog-api-response-standardization.json
2025-08-19 12:19:58 +00:00

126 lines
19 KiB
JSON

[
{
"discussion_id": "2280238487",
"pr_number": 36692,
"pr_file": "frontend/src/lib/api.ts",
"created_at": "2025-08-16T04:55:42+00:00",
"commented_code": "}> {\n return await new ApiRequest().dataWarehouse().withAction('total_rows_stats').get(options)\n },\n+\n+ async recentActivity(options?: ApiMethodOptions & { limit?: number }): Promise<{\n+ activities: Array<{\n+ id: string\n+ type: 'external_data_sync' | 'materialized_view'",
"repo_full_name": "PostHog/posthog",
"discussion_comments": [
{
"comment_id": "2280238487",
"repo_full_name": "PostHog/posthog",
"pr_number": 36692,
"pr_file": "frontend/src/lib/api.ts",
"discussion_id": "2280238487",
"commented_code": "@@ -3356,6 +3356,26 @@ const api = {\n }> {\n return await new ApiRequest().dataWarehouse().withAction('total_rows_stats').get(options)\n },\n+\n+ async recentActivity(options?: ApiMethodOptions & { limit?: number }): Promise<{\n+ activities: Array<{\n+ id: string\n+ type: 'external_data_sync' | 'materialized_view'",
"comment_created_at": "2025-08-16T04:55:42+00:00",
"comment_author": "naumaanh",
"comment_body": "this needs to be fixed. its not external_data_sync, its going to be the name of the sync, ex Stripe. probably best to set this as a String",
"pr_file_module": null
}
]
},
{
"discussion_id": "2283820469",
"pr_number": 36692,
"pr_file": "frontend/src/lib/api.ts",
"created_at": "2025-08-19T01:26:12+00:00",
"commented_code": "dataWarehouse: {\n async total_rows_stats(options?: ApiMethodOptions): Promise<{\n- billingAvailable: boolean\n- billingInterval: string\n- billingPeriodEnd: string\n- billingPeriodStart: string\n- materializedRowsInBillingPeriod: number\n- totalRows: number\n- trackedBillingRows: number\n- pendingBillingRows: number\n+ billing_available: boolean\n+ billing_interval: string\n+ billing_period_end: string\n+ billing_period_start: string\n+ materialized_rows_in_billing_period: number\n+ total_rows: number\n+ tracked_billing_rows: number\n+ pending_billing_rows: number\n }> {\n return await new ApiRequest().dataWarehouse().withAction('total_rows_stats').get(options)\n },\n+\n+ async recentActivity(options?: ApiMethodOptions & { limit?: number; offset?: number }): Promise<{\n+ results: Array<{",
"repo_full_name": "PostHog/posthog",
"discussion_comments": [
{
"comment_id": "2283820469",
"repo_full_name": "PostHog/posthog",
"pr_number": 36692,
"pr_file": "frontend/src/lib/api.ts",
"discussion_id": "2283820469",
"commented_code": "@@ -3348,17 +3348,49 @@ const api = {\n \n dataWarehouse: {\n async total_rows_stats(options?: ApiMethodOptions): Promise<{\n- billingAvailable: boolean\n- billingInterval: string\n- billingPeriodEnd: string\n- billingPeriodStart: string\n- materializedRowsInBillingPeriod: number\n- totalRows: number\n- trackedBillingRows: number\n- pendingBillingRows: number\n+ billing_available: boolean\n+ billing_interval: string\n+ billing_period_end: string\n+ billing_period_start: string\n+ materialized_rows_in_billing_period: number\n+ total_rows: number\n+ tracked_billing_rows: number\n+ pending_billing_rows: number\n }> {\n return await new ApiRequest().dataWarehouse().withAction('total_rows_stats').get(options)\n },\n+\n+ async recentActivity(options?: ApiMethodOptions & { limit?: number; offset?: number }): Promise<{\n+ results: Array<{",
"comment_created_at": "2025-08-19T01:26:12+00:00",
"comment_author": "EDsCODE",
"comment_body": "There's a `PaginatedResponse` type that is pretty standardized for all paginatable APIs. Should change this to match that. Also add a type for the result objects themselves",
"pr_file_module": null
}
]
},
{
"discussion_id": "2275714281",
"pr_number": 36271,
"pr_file": "plugin-server/src/cdp/services/hogflows/actions/hog_function.ts",
"created_at": "2025-08-14T07:23:12+00:00",
"commented_code": "} from '../../../types'\n import { HogExecutorService } from '../../hog-executor.service'\n import { HogFunctionTemplateManagerService } from '../../managers/hog-function-template-manager.service'\n+import { RecipientPreferencesService } from '../../messaging/recipient-preferences.service'\n import { findContinueAction } from '../hogflow-utils'\n import { ActionHandler, ActionHandlerResult } from './action.interface'\n \n export class HogFunctionHandler implements ActionHandler {\n constructor(\n private hub: Hub,\n private hogFunctionExecutor: HogExecutorService,\n- private hogFunctionTemplateManager: HogFunctionTemplateManagerService\n+ private hogFunctionTemplateManager: HogFunctionTemplateManagerService,\n+ private recipientPreferencesService: RecipientPreferencesService\n ) {}\n \n async execute(\n invocation: CyclotronJobInvocationHogFlow,\n- action: Extract<HogFlowAction, { type: 'function' }>,\n+ action: Extract<\n+ HogFlowAction,\n+ { type: 'function' | 'function_email' | 'function_sms' | 'function_slack' | 'function_webhook' }\n+ >,",
"repo_full_name": "PostHog/posthog",
"discussion_comments": [
{
"comment_id": "2275714281",
"repo_full_name": "PostHog/posthog",
"pr_number": 36271,
"pr_file": "plugin-server/src/cdp/services/hogflows/actions/hog_function.ts",
"discussion_id": "2275714281",
"commented_code": "@@ -12,19 +12,24 @@ import {\n } from '../../../types'\n import { HogExecutorService } from '../../hog-executor.service'\n import { HogFunctionTemplateManagerService } from '../../managers/hog-function-template-manager.service'\n+import { RecipientPreferencesService } from '../../messaging/recipient-preferences.service'\n import { findContinueAction } from '../hogflow-utils'\n import { ActionHandler, ActionHandlerResult } from './action.interface'\n \n export class HogFunctionHandler implements ActionHandler {\n constructor(\n private hub: Hub,\n private hogFunctionExecutor: HogExecutorService,\n- private hogFunctionTemplateManager: HogFunctionTemplateManagerService\n+ private hogFunctionTemplateManager: HogFunctionTemplateManagerService,\n+ private recipientPreferencesService: RecipientPreferencesService\n ) {}\n \n async execute(\n invocation: CyclotronJobInvocationHogFlow,\n- action: Extract<HogFlowAction, { type: 'function' }>,\n+ action: Extract<\n+ HogFlowAction,\n+ { type: 'function' | 'function_email' | 'function_sms' | 'function_slack' | 'function_webhook' }\n+ >,",
"comment_created_at": "2025-08-14T07:23:12+00:00",
"comment_author": "meikelmosby",
"comment_body": "since we are re-using this maybe something like \n\n```\ntype FunctionActionType =\n | 'function'\n | 'function_email'\n | 'function_sms'\n | 'function_slack'\n | 'function_webhook';\n\ntype Action = Extract<HogFlowAction, { type: FunctionActionType }>;\n```\nbit easier to parse and we can re-use it.",
"pr_file_module": null
}
]
},
{
"discussion_id": "2260189959",
"pr_number": 36002,
"pr_file": "frontend/src/scenes/data-warehouse/externalDataSourcesLogic.ts",
"created_at": "2025-08-07T12:36:41+00:00",
"commented_code": "+import { actions, kea, listeners, path, reducers } from 'kea'\n+import { loaders } from 'kea-loaders'\n+import api, { ApiMethodOptions, PaginatedResponse } from 'lib/api'\n+\n+import { ExternalDataSource } from '~/types'\n+\n+import type { externalDataSourcesLogicType } from './externalDataSourcesLogicType'\n+\n+export const externalDataSourcesLogic = kea<externalDataSourcesLogicType>([\n+ path(['scenes', 'data-warehouse', 'externalDataSourcesLogic']),\n+ actions({\n+ abortAnyRunningQuery: true,\n+ }),\n+ loaders(({ cache, values, actions }) => ({\n+ dataWarehouseSources: [\n+ null as PaginatedResponse<ExternalDataSource> | null,\n+ {\n+ loadSources: async (_, breakpoint) => {\n+ await breakpoint(300)\n+ actions.abortAnyRunningQuery()\n+\n+ cache.abortController = new AbortController()\n+ const methodOptions: ApiMethodOptions = {\n+ signal: cache.abortController.signal,\n+ }\n+ const res = await api.externalDataSources.list(methodOptions)\n+ breakpoint()\n+\n+ cache.abortController = null\n+\n+ return res\n+ },\n+ updateSource: async (source: ExternalDataSource) => {\n+ const updatedSource = await api.externalDataSources.update(source.id, source)\n+ return {\n+ ...values.dataWarehouseSources,\n+ results:\n+ values.dataWarehouseSources?.results.map((s) => (s.id === updatedSource.id ? source : s)) ||",
"repo_full_name": "PostHog/posthog",
"discussion_comments": [
{
"comment_id": "2260189959",
"repo_full_name": "PostHog/posthog",
"pr_number": 36002,
"pr_file": "frontend/src/scenes/data-warehouse/externalDataSourcesLogic.ts",
"discussion_id": "2260189959",
"commented_code": "@@ -0,0 +1,63 @@\n+import { actions, kea, listeners, path, reducers } from 'kea'\n+import { loaders } from 'kea-loaders'\n+import api, { ApiMethodOptions, PaginatedResponse } from 'lib/api'\n+\n+import { ExternalDataSource } from '~/types'\n+\n+import type { externalDataSourcesLogicType } from './externalDataSourcesLogicType'\n+\n+export const externalDataSourcesLogic = kea<externalDataSourcesLogicType>([\n+ path(['scenes', 'data-warehouse', 'externalDataSourcesLogic']),\n+ actions({\n+ abortAnyRunningQuery: true,\n+ }),\n+ loaders(({ cache, values, actions }) => ({\n+ dataWarehouseSources: [\n+ null as PaginatedResponse<ExternalDataSource> | null,\n+ {\n+ loadSources: async (_, breakpoint) => {\n+ await breakpoint(300)\n+ actions.abortAnyRunningQuery()\n+\n+ cache.abortController = new AbortController()\n+ const methodOptions: ApiMethodOptions = {\n+ signal: cache.abortController.signal,\n+ }\n+ const res = await api.externalDataSources.list(methodOptions)\n+ breakpoint()\n+\n+ cache.abortController = null\n+\n+ return res\n+ },\n+ updateSource: async (source: ExternalDataSource) => {\n+ const updatedSource = await api.externalDataSources.update(source.id, source)\n+ return {\n+ ...values.dataWarehouseSources,\n+ results:\n+ values.dataWarehouseSources?.results.map((s) => (s.id === updatedSource.id ? source : s)) ||",
"comment_created_at": "2025-08-07T12:36:41+00:00",
"comment_author": "Gilbert09",
"comment_body": "We wanna be returning `updatedSource` here instead of `source` in this ternary ",
"pr_file_module": null
},
{
"comment_id": "2260603508",
"repo_full_name": "PostHog/posthog",
"pr_number": 36002,
"pr_file": "frontend/src/scenes/data-warehouse/externalDataSourcesLogic.ts",
"discussion_id": "2260189959",
"commented_code": "@@ -0,0 +1,63 @@\n+import { actions, kea, listeners, path, reducers } from 'kea'\n+import { loaders } from 'kea-loaders'\n+import api, { ApiMethodOptions, PaginatedResponse } from 'lib/api'\n+\n+import { ExternalDataSource } from '~/types'\n+\n+import type { externalDataSourcesLogicType } from './externalDataSourcesLogicType'\n+\n+export const externalDataSourcesLogic = kea<externalDataSourcesLogicType>([\n+ path(['scenes', 'data-warehouse', 'externalDataSourcesLogic']),\n+ actions({\n+ abortAnyRunningQuery: true,\n+ }),\n+ loaders(({ cache, values, actions }) => ({\n+ dataWarehouseSources: [\n+ null as PaginatedResponse<ExternalDataSource> | null,\n+ {\n+ loadSources: async (_, breakpoint) => {\n+ await breakpoint(300)\n+ actions.abortAnyRunningQuery()\n+\n+ cache.abortController = new AbortController()\n+ const methodOptions: ApiMethodOptions = {\n+ signal: cache.abortController.signal,\n+ }\n+ const res = await api.externalDataSources.list(methodOptions)\n+ breakpoint()\n+\n+ cache.abortController = null\n+\n+ return res\n+ },\n+ updateSource: async (source: ExternalDataSource) => {\n+ const updatedSource = await api.externalDataSources.update(source.id, source)\n+ return {\n+ ...values.dataWarehouseSources,\n+ results:\n+ values.dataWarehouseSources?.results.map((s) => (s.id === updatedSource.id ? source : s)) ||",
"comment_created_at": "2025-08-07T15:01:04+00:00",
"comment_author": "naumaanh",
"comment_body": "This was actually one of the things that I think the greptile bot flagged to me before, but I was a bit unsure about it since the actual code in production actually returned `source` in the ternary instead of `updatedSource`. \r\n\r\nWhen I look at the actual object, the only difference I saw was that the ordering of the `schemas` array was different. Everything else looked the same. Would changing this cause any issues? @Gilbert09 ",
"pr_file_module": null
},
{
"comment_id": "2261479527",
"repo_full_name": "PostHog/posthog",
"pr_number": 36002,
"pr_file": "frontend/src/scenes/data-warehouse/externalDataSourcesLogic.ts",
"discussion_id": "2260189959",
"commented_code": "@@ -0,0 +1,63 @@\n+import { actions, kea, listeners, path, reducers } from 'kea'\n+import { loaders } from 'kea-loaders'\n+import api, { ApiMethodOptions, PaginatedResponse } from 'lib/api'\n+\n+import { ExternalDataSource } from '~/types'\n+\n+import type { externalDataSourcesLogicType } from './externalDataSourcesLogicType'\n+\n+export const externalDataSourcesLogic = kea<externalDataSourcesLogicType>([\n+ path(['scenes', 'data-warehouse', 'externalDataSourcesLogic']),\n+ actions({\n+ abortAnyRunningQuery: true,\n+ }),\n+ loaders(({ cache, values, actions }) => ({\n+ dataWarehouseSources: [\n+ null as PaginatedResponse<ExternalDataSource> | null,\n+ {\n+ loadSources: async (_, breakpoint) => {\n+ await breakpoint(300)\n+ actions.abortAnyRunningQuery()\n+\n+ cache.abortController = new AbortController()\n+ const methodOptions: ApiMethodOptions = {\n+ signal: cache.abortController.signal,\n+ }\n+ const res = await api.externalDataSources.list(methodOptions)\n+ breakpoint()\n+\n+ cache.abortController = null\n+\n+ return res\n+ },\n+ updateSource: async (source: ExternalDataSource) => {\n+ const updatedSource = await api.externalDataSources.update(source.id, source)\n+ return {\n+ ...values.dataWarehouseSources,\n+ results:\n+ values.dataWarehouseSources?.results.map((s) => (s.id === updatedSource.id ? source : s)) ||",
"comment_created_at": "2025-08-07T21:43:53+00:00",
"comment_author": "Gilbert09",
"comment_body": "Shouldn't do - the return object from an update call is the most up to date version of the object ",
"pr_file_module": null
},
{
"comment_id": "2261502838",
"repo_full_name": "PostHog/posthog",
"pr_number": 36002,
"pr_file": "frontend/src/scenes/data-warehouse/externalDataSourcesLogic.ts",
"discussion_id": "2260189959",
"commented_code": "@@ -0,0 +1,63 @@\n+import { actions, kea, listeners, path, reducers } from 'kea'\n+import { loaders } from 'kea-loaders'\n+import api, { ApiMethodOptions, PaginatedResponse } from 'lib/api'\n+\n+import { ExternalDataSource } from '~/types'\n+\n+import type { externalDataSourcesLogicType } from './externalDataSourcesLogicType'\n+\n+export const externalDataSourcesLogic = kea<externalDataSourcesLogicType>([\n+ path(['scenes', 'data-warehouse', 'externalDataSourcesLogic']),\n+ actions({\n+ abortAnyRunningQuery: true,\n+ }),\n+ loaders(({ cache, values, actions }) => ({\n+ dataWarehouseSources: [\n+ null as PaginatedResponse<ExternalDataSource> | null,\n+ {\n+ loadSources: async (_, breakpoint) => {\n+ await breakpoint(300)\n+ actions.abortAnyRunningQuery()\n+\n+ cache.abortController = new AbortController()\n+ const methodOptions: ApiMethodOptions = {\n+ signal: cache.abortController.signal,\n+ }\n+ const res = await api.externalDataSources.list(methodOptions)\n+ breakpoint()\n+\n+ cache.abortController = null\n+\n+ return res\n+ },\n+ updateSource: async (source: ExternalDataSource) => {\n+ const updatedSource = await api.externalDataSources.update(source.id, source)\n+ return {\n+ ...values.dataWarehouseSources,\n+ results:\n+ values.dataWarehouseSources?.results.map((s) => (s.id === updatedSource.id ? source : s)) ||",
"comment_created_at": "2025-08-07T21:51:11+00:00",
"comment_author": "naumaanh",
"comment_body": "Got it, makes sense, I'll adjust this. Thanks! ",
"pr_file_module": null
}
]
}
]