Skip to content

Commit

Permalink
ci: Split Temporal backend suite into three (#25880)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Twixes and github-actions[bot] authored Oct 30, 2024
1 parent d915d46 commit 84db60b
Show file tree
Hide file tree
Showing 11 changed files with 1,521 additions and 1,014 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,20 @@ jobs:
person-on-events: false
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19'
python-version: '3.11.9'
concurrency: 1
concurrency: 3
group: 1
- segment: 'Temporal'
person-on-events: false
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19'
python-version: '3.11.9'
concurrency: 3
group: 2
- segment: 'Temporal'
person-on-events: false
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19'
python-version: '3.11.9'
concurrency: 3
group: 3

steps:
# The first step is the only one that should run if `needs.changes.outputs.backend == 'false'`.
Expand Down
1,946 changes: 1,222 additions & 724 deletions .test_durations

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ee/billing/billing_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def update_billing_organization_users(self, organization: Organization) -> None:
"distinct_id",
"organization_membership__level",
)
.order_by("email") # Deterministic order for tests
.annotate(role=F("organization_membership__level"))
.filter(role__gte=OrganizationMembership.Level.ADMIN)
.values(
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/lib/monaco/hogQLAutocompleteProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { codeEditorLogicType } from 'lib/monaco/codeEditorLogicType'
import { languages } from 'monaco-editor'

import { performQuery } from '~/queries/query'
import { AutocompleteCompletionItem, HogLanguage, HogQLAutocomplete, NodeKind } from '~/queries/schema'
import { AutocompleteCompletionItemKind, HogLanguage, HogQLAutocomplete, NodeKind } from '~/queries/schema'

const convertCompletionItemKind = (kind: AutocompleteCompletionItem['kind']): languages.CompletionItemKind => {
const convertCompletionItemKind = (kind: AutocompleteCompletionItemKind): languages.CompletionItemKind => {
switch (kind) {
case 'Method':
return languages.CompletionItemKind.Method
Expand Down Expand Up @@ -68,7 +68,7 @@ const convertCompletionItemKind = (kind: AutocompleteCompletionItem['kind']): la
}
}

const kindToSortText = (kind: AutocompleteCompletionItem['kind'], label: string): string => {
const kindToSortText = (kind: AutocompleteCompletionItemKind, label: string): string => {
if (kind === 'Variable') {
return `1-${label}`
}
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/queries/nodes/WebOverview/WebOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ import { humanFriendlyDuration, humanFriendlyLargeNumber, isNotNil, range } from
import { useState } from 'react'

import { EvenlyDistributedRows } from '~/queries/nodes/WebOverview/EvenlyDistributedRows'
import { AnyResponseType, WebOverviewItem, WebOverviewQuery, WebOverviewQueryResponse } from '~/queries/schema'
import {
AnyResponseType,
WebOverviewItem,
WebOverviewItemKind,
WebOverviewQuery,
WebOverviewQueryResponse,
} from '~/queries/schema'
import { QueryContext } from '~/queries/types'

import { dataNodeLogic } from '../DataNode/dataNodeLogic'
Expand Down Expand Up @@ -146,11 +152,7 @@ const formatUnit = (x: number, options?: { precise?: boolean }): string => {
return humanFriendlyLargeNumber(x)
}

const formatItem = (
value: number | undefined,
kind: WebOverviewItem['kind'],
options?: { precise?: boolean }
): string => {
const formatItem = (value: number | undefined, kind: WebOverviewItemKind, options?: { precise?: boolean }): string => {
if (value == null) {
return '-'
} else if (kind === 'percentage') {
Expand Down
81 changes: 45 additions & 36 deletions frontend/src/queries/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -669,38 +669,8 @@
"type": "string"
},
"kind": {
"description": "The kind of this completion item. Based on the kind an icon is chosen by the editor.",
"enum": [
"Method",
"Function",
"Constructor",
"Field",
"Variable",
"Class",
"Struct",
"Interface",
"Module",
"Property",
"Event",
"Operator",
"Unit",
"Value",
"Constant",
"Enum",
"EnumMember",
"Keyword",
"Text",
"Color",
"File",
"Reference",
"Customcolor",
"Folder",
"TypeParameter",
"User",
"Issue",
"Snippet"
],
"type": "string"
"$ref": "#/definitions/AutocompleteCompletionItemKind",
"description": "The kind of this completion item. Based on the kind an icon is chosen by the editor."
},
"label": {
"description": "The label of this completion item. By default this is also the text that is inserted when selecting this completion.",
Expand All @@ -710,6 +680,39 @@
"required": ["label", "insertText", "kind"],
"type": "object"
},
"AutocompleteCompletionItemKind": {
"enum": [
"Method",
"Function",
"Constructor",
"Field",
"Variable",
"Class",
"Struct",
"Interface",
"Module",
"Property",
"Event",
"Operator",
"Unit",
"Value",
"Constant",
"Enum",
"EnumMember",
"Keyword",
"Text",
"Color",
"File",
"Reference",
"Customcolor",
"Folder",
"TypeParameter",
"User",
"Issue",
"Snippet"
],
"type": "string"
},
"BaseMathType": {
"enum": ["total", "dau", "weekly_active", "monthly_active", "unique_session", "first_time_for_user"],
"type": "string"
Expand Down Expand Up @@ -10686,8 +10689,7 @@
"type": ["string", "number"]
},
"kind": {
"enum": ["ActionsNode", "EventsNode"],
"type": "string"
"$ref": "#/definitions/RetentionEntityKind"
},
"name": {
"type": "string"
Expand All @@ -10704,6 +10706,10 @@
},
"type": "object"
},
"RetentionEntityKind": {
"enum": ["ActionsNode", "EventsNode"],
"type": "string"
},
"RetentionFilter": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -12371,8 +12377,7 @@
"type": "string"
},
"kind": {
"enum": ["unit", "duration_s", "percentage"],
"type": "string"
"$ref": "#/definitions/WebOverviewItemKind"
},
"previous": {
"type": "number"
Expand All @@ -12384,6 +12389,10 @@
"required": ["key", "kind"],
"type": "object"
},
"WebOverviewItemKind": {
"enum": ["unit", "duration_s", "percentage"],
"type": "string"
},
"WebOverviewQuery": {
"additionalProperties": false,
"properties": {
Expand Down
63 changes: 33 additions & 30 deletions frontend/src/queries/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,36 @@ export interface HogQLMetadataResponse {
query_status?: never
}

export type AutocompleteCompletionItemKind =
| 'Method'
| 'Function'
| 'Constructor'
| 'Field'
| 'Variable'
| 'Class'
| 'Struct'
| 'Interface'
| 'Module'
| 'Property'
| 'Event'
| 'Operator'
| 'Unit'
| 'Value'
| 'Constant'
| 'Enum'
| 'EnumMember'
| 'Keyword'
| 'Text'
| 'Color'
| 'File'
| 'Reference'
| 'Customcolor'
| 'Folder'
| 'TypeParameter'
| 'User'
| 'Issue'
| 'Snippet'

export interface AutocompleteCompletionItem {
/**
* The label of this completion item. By default
Expand All @@ -385,35 +415,7 @@ export interface AutocompleteCompletionItem {
* The kind of this completion item. Based on the kind
* an icon is chosen by the editor.
*/
kind:
| 'Method'
| 'Function'
| 'Constructor'
| 'Field'
| 'Variable'
| 'Class'
| 'Struct'
| 'Interface'
| 'Module'
| 'Property'
| 'Event'
| 'Operator'
| 'Unit'
| 'Value'
| 'Constant'
| 'Enum'
| 'EnumMember'
| 'Keyword'
| 'Text'
| 'Color'
| 'File'
| 'Reference'
| 'Customcolor'
| 'Folder'
| 'TypeParameter'
| 'User'
| 'Issue'
| 'Snippet'
kind: AutocompleteCompletionItemKind
}

export interface HogQLAutocompleteResponse {
Expand Down Expand Up @@ -1419,11 +1421,12 @@ export interface WebOverviewQuery extends WebAnalyticsQueryBase<WebOverviewQuery
includeLCPScore?: boolean
}

export type WebOverviewItemKind = 'unit' | 'duration_s' | 'percentage'
export interface WebOverviewItem {
key: string
value?: number
previous?: number
kind: 'unit' | 'duration_s' | 'percentage'
kind: WebOverviewItemKind
changeFromPreviousPct?: number
isIncreaseBad?: boolean
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2354,9 +2354,11 @@ export interface PathsFilterType extends FilterType {
path_dropoff_key?: string // Paths People Dropoff Key
}

export type RetentionEntityKind = NodeKind.ActionsNode | NodeKind.EventsNode

export interface RetentionEntity {
id?: string | number // TODO: Fix weird typing issues
kind?: NodeKind.ActionsNode | NodeKind.EventsNode
kind?: RetentionEntityKind
name?: string
type?: EntityType
/** @asType integer */
Expand Down
20 changes: 10 additions & 10 deletions posthog/hogql/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
HogQLAutocomplete,
HogQLAutocompleteResponse,
AutocompleteCompletionItem,
Kind,
AutocompleteCompletionItemKind,
HogLanguage,
)
from hogvm.python.stl import STL
Expand Down Expand Up @@ -285,15 +285,15 @@ def append_table_field_to_response(table: Table, suggestions: list[AutocompleteC
extend_responses(
available_functions,
suggestions,
Kind.FUNCTION,
AutocompleteCompletionItemKind.FUNCTION,
insert_text=lambda key: f"{key}()",
)


def extend_responses(
keys: list[str],
suggestions: list[AutocompleteCompletionItem],
kind: Kind = Kind.VARIABLE,
kind: AutocompleteCompletionItemKind = AutocompleteCompletionItemKind.VARIABLE,
insert_text: Optional[Callable[[str], str]] = None,
details: Optional[list[str | None]] = None,
) -> None:
Expand Down Expand Up @@ -448,12 +448,12 @@ def get_hogql_autocomplete(
extend_responses(
keys=hog_vars,
suggestions=response.suggestions,
kind=Kind.VARIABLE,
kind=AutocompleteCompletionItemKind.VARIABLE,
)
extend_responses(
ALL_HOG_FUNCTIONS,
response.suggestions,
Kind.FUNCTION,
AutocompleteCompletionItemKind.FUNCTION,
insert_text=lambda key: f"{key}()",
)

Expand Down Expand Up @@ -509,7 +509,7 @@ def get_hogql_autocomplete(
extend_responses(
keys=table_aliases,
suggestions=response.suggestions,
kind=Kind.FOLDER,
kind=AutocompleteCompletionItemKind.FOLDER,
details=["Table"] * len(table_aliases),
)
break
Expand Down Expand Up @@ -608,7 +608,7 @@ def get_hogql_autocomplete(
extend_responses(
keys=table_names,
suggestions=response.suggestions,
kind=Kind.FOLDER,
kind=AutocompleteCompletionItemKind.FOLDER,
details=["Table"] * len(table_names),
)
elif isinstance(node, ast.Field) and isinstance(parent_node, ast.Placeholder):
Expand All @@ -622,7 +622,7 @@ def get_hogql_autocomplete(
extend_responses(
keys=code_names,
suggestions=response.suggestions,
kind=Kind.CONSTANT,
kind=AutocompleteCompletionItemKind.CONSTANT,
details=["Variable"] * len(code_names),
)
elif len(node.chain) > 1 and node.chain[0] == "variables":
Expand All @@ -633,7 +633,7 @@ def get_hogql_autocomplete(
extend_responses(
keys=code_names,
suggestions=response.suggestions,
kind=Kind.CONSTANT,
kind=AutocompleteCompletionItemKind.CONSTANT,
details=["Variable"] * len(code_names),
)
except Exception:
Expand Down Expand Up @@ -692,6 +692,6 @@ def add_globals_to_suggestions(globalVars: dict, response: HogQLAutocompleteResp
extend_responses(
keys=list(globalVars.keys()),
suggestions=response.suggestions,
kind=Kind.VARIABLE,
kind=AutocompleteCompletionItemKind.VARIABLE,
details=values,
)
Loading

0 comments on commit 84db60b

Please sign in to comment.