: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
fix(engineering_analytics): widen job-logs discovery lookback to 24h (#67703)
Julian Bez78a1a2004ae5
diff --git a/posthog/models/test/__snapshots__/test_async_deletion_model.ambr b/posthog/models/test/__snapshots__/test_async_deletion_model.ambrindex 33fd9d5a01d7..50711c25ee02 100644--- a/posthog/models/test/__snapshots__/test_async_deletion_model.ambr+++ b/posthog/models/test/__snapshots__/test_async_deletion_model.ambr@@ -1,132 +1,4 @@# serializer version: 1-# name: TestAsyncDeletion.test_delete_auxilary_models_via_team- '''-- ALTER TABLE sharded_events ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team.1- '''-- ALTER TABLE person ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team.2- '''-- ALTER TABLE person_distinct_id ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team.3- '''-- ALTER TABLE person_distinct_id2 ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team.4- '''-- ALTER TABLE groups ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team.5- '''-- ALTER TABLE cohortpeople ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team.6- '''-- ALTER TABLE person_static_cohort ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team.7- '''-- ALTER TABLE plugin_log_entries ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team_unrelated- '''-- ALTER TABLE sharded_events ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team_unrelated.1- '''-- ALTER TABLE person ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team_unrelated.2- '''-- ALTER TABLE person_distinct_id ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team_unrelated.3- '''-- ALTER TABLE person_distinct_id2 ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team_unrelated.4- '''-- ALTER TABLE groups ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team_unrelated.5- '''-- ALTER TABLE cohortpeople ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team_unrelated.6- '''-- ALTER TABLE person_static_cohort ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_auxilary_models_via_team_unrelated.7- '''-- ALTER TABLE plugin_log_entries ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ---# name: TestAsyncDeletion.test_delete_cohortpeople'''SELECT count()@@ -139,180 +11,6 @@FROM cohortpeople'''# ----# name: TestAsyncDeletion.test_delete_group- '''-- ALTER TABLE sharded_events ON CLUSTER 'posthog'- DELETE- WHERE (team_id = 2- AND $group_0 = 'foo')- '''-# ----# name: TestAsyncDeletion.test_delete_group_unrelated- '''-- ALTER TABLE sharded_events ON CLUSTER 'posthog'- DELETE- WHERE (team_id = 2- AND $group_0 = 'foo')- '''-# ----# name: TestAsyncDeletion.test_delete_person- '''-- ALTER TABLE sharded_events ON CLUSTER 'posthog'- DELETE- WHERE (team_id = 2- AND person_id = '00000000-0000-0000-0000-000000000000')- AND _timestamp <= '2024-01-01 00:00:00'- '''-# ----# name: TestAsyncDeletion.test_delete_person_unrelated- '''-- ALTER TABLE sharded_events ON CLUSTER 'posthog'- DELETE- WHERE (team_id = 2- AND person_id = '00000000-0000-0000-0000-000000000000')- AND _timestamp <= '2024-01-01 00:00:00'- '''-# ----# name: TestAsyncDeletion.test_delete_teams- '''-- ALTER TABLE sharded_events ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- OR team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams.1- '''-- ALTER TABLE person ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- OR team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams.2- '''-- ALTER TABLE person_distinct_id ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- OR team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams.3- '''-- ALTER TABLE person_distinct_id2 ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- OR team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams.4- '''-- ALTER TABLE groups ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- OR team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams.5- '''-- ALTER TABLE cohortpeople ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- OR team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams.6- '''-- ALTER TABLE person_static_cohort ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- OR team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams.7- '''-- ALTER TABLE plugin_log_entries ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- OR team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams_unrelated- '''-- ALTER TABLE sharded_events ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams_unrelated.1- '''-- ALTER TABLE person ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams_unrelated.2- '''-- ALTER TABLE person_distinct_id ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams_unrelated.3- '''-- ALTER TABLE person_distinct_id2 ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams_unrelated.4- '''-- ALTER TABLE groups ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams_unrelated.5- '''-- ALTER TABLE cohortpeople ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams_unrelated.6- '''-- ALTER TABLE person_static_cohort ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ----# name: TestAsyncDeletion.test_delete_teams_unrelated.7- '''-- ALTER TABLE plugin_log_entries ON CLUSTER 'posthog'- DELETE- WHERE team_id = 2- '''-# ---# name: TestAsyncDeletion.test_mark_deletions_done_groups'''diff --git a/posthog/models/test/__snapshots__/test_remote_config.ambr b/posthog/models/test/__snapshots__/test_remote_config.ambrindex 050bcff4442f..88c6b9e0e5d9 100644--- a/posthog/models/test/__snapshots__/test_remote_config.ambr+++ b/posthog/models/test/__snapshots__/test_remote_config.ambr@@ -65,421 +65,3 @@'token': 'phc_12345',})# ----# name: TestRemoteConfigCaching.test_gets_array_js_via_redis_cache- '''- (function() {- window._POSTHOG_REMOTE_CONFIG = window._POSTHOG_REMOTE_CONFIG || {};- window._POSTHOG_REMOTE_CONFIG['phc_12345'] = {- config: {"analytics": {"endpoint": "/i/v0/e/"}, "autocaptureExceptions": false, "autocapture_opt_out": false, "captureDeadClicks": false, "capturePerformance": {"network_timing": true, "web_vitals": false, "web_vitals_allowed_metrics": null}, "conversations": false, "defaultIdentifiedOnly": true, "elementsChainAsString": true, "errorTracking": {"autocaptureExceptions": false, "suppressionRules": []}, "hasFeatureFlags": false, "heatmaps": false, "logs": {"captureConsoleLogs": false}, "productTours": false, "sessionRecording": {"canvasFps": null, "canvasQuality": null, "consoleLogRecordingEnabled": true, "endpoint": "/s/", "eventTriggers": [], "linkedFlag": null, "masking": null, "minimumDurationMilliseconds": null, "networkPayloadCapture": null, "recordCanvas": false, "recorderVersion": "v2", "sampleRate": null, "scriptConfig": {"script": "posthog-recorder"}, "triggerMatchType": null, "urlBlocklist": [], "urlTriggers": [], "version": 1}, "supportedCompression": ["gzip", "gzip-js"], "surveys": false, "token": "phc_12345"},- siteApps: []- }- })();-- [MOCKED_ARRAY_JS_CONTENT]- '''-# ----# name: TestRemoteConfigCaching.test_gets_array_js_via_redis_cache.1- '''- (function() {- window._POSTHOG_REMOTE_CONFIG = window._POSTHOG_REMOTE_CONFIG || {};- window._POSTHOG_REMOTE_CONFIG['phc_12345'] = {- config: {"analytics": {"endpoint": "/i/v0/e/"}, "autocaptureExceptions": false, "autocapture_opt_out": false, "captureDeadClicks": false, "capturePerformance": {"network_timing": true, "web_vitals": false, "web_vitals_allowed_metrics": null}, "conversations": false, "defaultIdentifiedOnly": true, "elementsChainAsString": true, "errorTracking": {"autocaptureExceptions": false, "suppressionRules": []}, "hasFeatureFlags": false, "heatmaps": false, "logs": {"captureConsoleLogs": false}, "productTours": false, "sessionRecording": {"canvasFps": null, "canvasQuality": null, "consoleLogRecordingEnabled": true, "endpoint": "/s/", "eventTriggers": [], "linkedFlag": null, "masking": null, "minimumDurationMilliseconds": null, "networkPayloadCapture": null, "recordCanvas": false, "recorderVersion": "v2", "sampleRate": null, "scriptConfig": {"script": "posthog-recorder"}, "triggerMatchType": null, "urlBlocklist": [], "urlTriggers": [], "version": 1}, "supportedCompression": ["gzip", "gzip-js"], "surveys": false, "token": "phc_12345"},- siteApps: []- }- })();-- [MOCKED_ARRAY_JS_CONTENT]- '''-# ----# name: TestRemoteConfigCaching.test_gets_js_reuses_config_cache- '''- (function() {- window._POSTHOG_REMOTE_CONFIG = window._POSTHOG_REMOTE_CONFIG || {};- window._POSTHOG_REMOTE_CONFIG['phc_12345'] = {- config: {"analytics": {"endpoint": "/i/v0/e/"}, "autocaptureExceptions": false, "autocapture_opt_out": false, "captureDeadClicks": false, "capturePerformance": {"network_timing": true, "web_vitals": false, "web_vitals_allowed_metrics": null}, "conversations": false, "defaultIdentifiedOnly": true, "elementsChainAsString": true, "errorTracking": {"autocaptureExceptions": false, "suppressionRules": []}, "hasFeatureFlags": false, "heatmaps": false, "logs": {"captureConsoleLogs": false}, "productTours": false, "sessionRecording": {"canvasFps": null, "canvasQuality": null, "consoleLogRecordingEnabled": true, "endpoint": "/s/", "eventTriggers": [], "linkedFlag": null, "masking": null, "minimumDurationMilliseconds": null, "networkPayloadCapture": null, "recordCanvas": false, "recorderVersion": "v2", "sampleRate": null, "scriptConfig": {"script": "posthog-recorder"}, "triggerMatchType": null, "urlBlocklist": [], "urlTriggers": [], "version": 1}, "supportedCompression": ["gzip", "gzip-js"], "surveys": false, "token": "phc_12345"},- siteApps: []- }- })();- '''-# ----# name: TestRemoteConfigCaching.test_gets_js_via_redis_cache- '''- (function() {- window._POSTHOG_REMOTE_CONFIG = window._POSTHOG_REMOTE_CONFIG || {};- window._POSTHOG_REMOTE_CONFIG['phc_12345'] = {- config: {"analytics": {"endpoint": "/i/v0/e/"}, "autocaptureExceptions": false, "autocapture_opt_out": false, "captureDeadClicks": false, "capturePerformance": {"network_timing": true, "web_vitals": false, "web_vitals_allowed_metrics": null}, "conversations": false, "defaultIdentifiedOnly": true, "elementsChainAsString": true, "errorTracking": {"autocaptureExceptions": false, "suppressionRules": []}, "hasFeatureFlags": false, "heatmaps": false, "logs": {"captureConsoleLogs": false}, "productTours": false, "sessionRecording": {"canvasFps": null, "canvasQuality": null, "consoleLogRecordingEnabled": true, "endpoint": "/s/", "eventTriggers": [], "linkedFlag": null, "masking": null, "minimumDurationMilliseconds": null, "networkPayloadCapture": null, "recordCanvas": false, "recorderVersion": "v2", "sampleRate": null, "scriptConfig": {"script": "posthog-recorder"}, "triggerMatchType": null, "urlBlocklist": [], "urlTriggers": [], "version": 1}, "supportedCompression": ["gzip", "gzip-js"], "surveys": false, "token": "phc_12345"},- siteApps: []- }- })();- '''-# ----# name: TestRemoteConfigCaching.test_gets_js_via_redis_cache.1- '''- (function() {- window._POSTHOG_REMOTE_CONFIG = window._POSTHOG_REMOTE_CONFIG || {};- window._POSTHOG_REMOTE_CONFIG['phc_12345'] = {- config: {"analytics": {"endpoint": "/i/v0/e/"}, "autocaptureExceptions": false, "autocapture_opt_out": false, "captureDeadClicks": false, "capturePerformance": {"network_timing": true, "web_vitals": false, "web_vitals_allowed_metrics": null}, "conversations": false, "defaultIdentifiedOnly": true, "elementsChainAsString": true, "errorTracking": {"autocaptureExceptions": false, "suppressionRules": []}, "hasFeatureFlags": false, "heatmaps": false, "logs": {"captureConsoleLogs": false}, "productTours": false, "sessionRecording": {"canvasFps": null, "canvasQuality": null, "consoleLogRecordingEnabled": true, "endpoint": "/s/", "eventTriggers": [], "linkedFlag": null, "masking": null, "minimumDurationMilliseconds": null, "networkPayloadCapture": null, "recordCanvas": false, "recorderVersion": "v2", "sampleRate": null, "scriptConfig": {"script": "posthog-recorder"}, "triggerMatchType": null, "urlBlocklist": [], "urlTriggers": [], "version": 1}, "supportedCompression": ["gzip", "gzip-js"], "surveys": false, "token": "phc_12345"},- siteApps: []- }- })();- '''-# ----# name: TestRemoteConfigCaching.test_gets_via_redis_cache- dict({- 'analytics': dict({- 'endpoint': '/i/v0/e/',- }),- 'autocaptureExceptions': False,- 'autocapture_opt_out': False,- 'captureDeadClicks': False,- 'capturePerformance': dict({- 'network_timing': True,- 'web_vitals': False,- 'web_vitals_allowed_metrics': None,- }),- 'conversations': False,- 'defaultIdentifiedOnly': True,- 'elementsChainAsString': True,- 'errorTracking': dict({- 'autocaptureExceptions': False,- 'suppressionRules': list([- ]),- }),- 'hasFeatureFlags': False,- 'heatmaps': False,- 'logs': dict({- 'captureConsoleLogs': False,- }),- 'productTours': False,- 'sessionRecording': dict({- 'canvasFps': None,- 'canvasQuality': None,- 'consoleLogRecordingEnabled': True,- 'endpoint': '/s/',- 'eventTriggers': list([- ]),- 'linkedFlag': None,- 'masking': None,- 'minimumDurationMilliseconds': None,- 'networkPayloadCapture': None,- 'recordCanvas': False,- 'recorderVersion': 'v2',- 'sampleRate': None,- 'scriptConfig': dict({- 'script': 'posthog-recorder',- }),- 'triggerMatchType': None,- 'urlBlocklist': list([- ]),- 'urlTriggers': list([- ]),- 'version': 1,- }),- 'siteApps': list([- ]),- 'supportedCompression': list([- 'gzip',- 'gzip-js',- ]),- 'surveys': False,- 'token': 'phc_12345',- })-# ----# name: TestRemoteConfigCaching.test_gets_via_redis_cache.1- dict({- 'analytics': dict({- 'endpoint': '/i/v0/e/',- }),- 'autocaptureExceptions': False,- 'autocapture_opt_out': False,- 'captureDeadClicks': False,- 'capturePerformance': dict({- 'network_timing': True,- 'web_vitals': False,- 'web_vitals_allowed_metrics': None,- }),- 'conversations': False,- 'defaultIdentifiedOnly': True,- 'elementsChainAsString': True,- 'errorTracking': dict({- 'autocaptureExceptions': False,- 'suppressionRules': list([- ]),- }),- 'hasFeatureFlags': False,- 'heatmaps': False,- 'logs': dict({- 'captureConsoleLogs': False,- }),- 'productTours': False,- 'sessionRecording': dict({- 'canvasFps': None,- 'canvasQuality': None,- 'consoleLogRecordingEnabled': True,- 'endpoint': '/s/',- 'eventTriggers': list([- ]),- 'linkedFlag': None,- 'masking': None,- 'minimumDurationMilliseconds': None,- 'networkPayloadCapture': None,- 'recordCanvas': False,- 'recorderVersion': 'v2',- 'sampleRate': None,- 'scriptConfig': dict({- 'script': 'posthog-recorder',- }),- 'triggerMatchType': None,- 'urlBlocklist': list([- ]),- 'urlTriggers': list([- ]),- 'version': 1,- }),- 'siteApps': list([- ]),- 'supportedCompression': list([- 'gzip',- 'gzip-js',- ]),- 'surveys': False,- 'token': 'phc_12345',- })-# ----# name: TestRemoteConfigJS.test_renders_js_including_config- '''- (function() {- window._POSTHOG_REMOTE_CONFIG = window._POSTHOG_REMOTE_CONFIG || {};- window._POSTHOG_REMOTE_CONFIG['phc_12345'] = {- config: {"analytics": {"endpoint": "/i/v0/e/"}, "autocaptureExceptions": false, "autocapture_opt_out": false, "captureDeadClicks": false, "capturePerformance": {"network_timing": true, "web_vitals": false, "web_vitals_allowed_metrics": null}, "conversations": false, "defaultIdentifiedOnly": true, "elementsChainAsString": true, "errorTracking": {"autocaptureExceptions": false, "suppressionRules": []}, "hasFeatureFlags": false, "heatmaps": false, "logs": {"captureConsoleLogs": false}, "productTours": false, "sessionRecording": {"canvasFps": null, "canvasQuality": null, "consoleLogRecordingEnabled": true, "endpoint": "/s/", "eventTriggers": [], "linkedFlag": null, "masking": null, "minimumDurationMilliseconds": null, "networkPayloadCapture": null, "recordCanvas": false, "recorderVersion": "v2", "sampleRate": null, "scriptConfig": {"script": "posthog-recorder"}, "triggerMatchType": null, "urlBlocklist": [], "urlTriggers": [], "version": 1}, "supportedCompression": ["gzip", "gzip-js"], "surveys": false, "token": "phc_12345"},- siteApps: []- }- })();- '''-# ----# name: TestRemoteConfigJS.test_renders_js_including_site_apps- '''- (function() {- window._POSTHOG_REMOTE_CONFIG = window._POSTHOG_REMOTE_CONFIG || {};- window._POSTHOG_REMOTE_CONFIG['phc_12345'] = {- config: {"analytics": {"endpoint": "/i/v0/e/"}, "autocaptureExceptions": false, "autocapture_opt_out": false, "captureDeadClicks": false, "capturePerformance": {"network_timing": true, "web_vitals": false, "web_vitals_allowed_metrics": null}, "conversations": false, "defaultIdentifiedOnly": true, "elementsChainAsString": true, "errorTracking": {"autocaptureExceptions": false, "suppressionRules": []}, "hasFeatureFlags": false, "heatmaps": false, "logs": {"captureConsoleLogs": false}, "productTours": false, "sessionRecording": {"canvasFps": null, "canvasQuality": null, "consoleLogRecordingEnabled": true, "endpoint": "/s/", "eventTriggers": [], "linkedFlag": null, "masking": null, "minimumDurationMilliseconds": null, "networkPayloadCapture": null, "recordCanvas": false, "recorderVersion": "v2", "sampleRate": null, "scriptConfig": {"script": "posthog-recorder"}, "triggerMatchType": null, "urlBlocklist": [], "urlTriggers": [], "version": 1}, "supportedCompression": ["gzip", "gzip-js"], "surveys": false, "token": "phc_12345"},- siteApps: []- }- })();- '''-# ----# name: TestRemoteConfigJS.test_renders_js_including_site_functions- '''- (function() {- window._POSTHOG_REMOTE_CONFIG = window._POSTHOG_REMOTE_CONFIG || {};- window._POSTHOG_REMOTE_CONFIG['phc_12345'] = {- config: {"analytics": {"endpoint": "/i/v0/e/"}, "autocaptureExceptions": false, "autocapture_opt_out": false, "captureDeadClicks": false, "capturePerformance": {"network_timing": true, "web_vitals": false, "web_vitals_allowed_metrics": null}, "conversations": false, "defaultIdentifiedOnly": true, "elementsChainAsString": true, "errorTracking": {"autocaptureExceptions": false, "suppressionRules": []}, "hasFeatureFlags": false, "heatmaps": false, "logs": {"captureConsoleLogs": false}, "productTours": false, "sessionRecording": {"canvasFps": null, "canvasQuality": null, "consoleLogRecordingEnabled": true, "endpoint": "/s/", "eventTriggers": [], "linkedFlag": null, "masking": null, "minimumDurationMilliseconds": null, "networkPayloadCapture": null, "recordCanvas": false, "recorderVersion": "v2", "sampleRate": null, "scriptConfig": {"script": "posthog-recorder"}, "triggerMatchType": null, "urlBlocklist": [], "urlTriggers": [], "version": 1}, "supportedCompression": ["gzip", "gzip-js"], "surveys": false, "token": "phc_12345"},- siteApps: [- {- id: 'SITE_DESTINATION_ID',- init: function(config) { return (function() {- function toString (value) { return __STLToString(value) }- function ilike (str, pattern) { return __like(str, pattern, true) }- function __like(str, pattern, caseInsensitive = false) {- if (caseInsensitive) {- str = str.toLowerCase()- pattern = pattern.toLowerCase()- }- pattern = String(pattern)- .replaceAll(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')- .replaceAll('%', '.*')- .replaceAll('_', '.')- return new RegExp(pattern).test(str)- }- function __getProperty(objectOrArray, key, nullish) {- if ((nullish && !objectOrArray) || key === 0) { return null }- if (Array.isArray(objectOrArray)) { return key > 0 ? objectOrArray[key - 1] : objectOrArray[objectOrArray.length + key] }- else { return objectOrArray[key] }- }- function __STLToString(arg) {- if (arg && __isHogDate(arg)) { return `${arg.year}-${arg.month.toString().padStart(2, '0')}-${arg.day.toString().padStart(2, '0')}`; }- else if (arg && __isHogDateTime(arg)) { return __DateTimeToString(arg); }- return __printHogStringOutput(arg); }- function __printHogStringOutput(obj) { if (typeof obj === 'string') { return obj } return __printHogValue(obj) }- function __printHogValue(obj, marked = new Set()) {- if (typeof obj === 'object' && obj !== null && obj !== undefined) {- if (marked.has(obj) && !__isHogDateTime(obj) && !__isHogDate(obj) && !__isHogError(obj)) { return 'null'; }- marked.add(obj);- try {- if (Array.isArray(obj)) {- if (obj.__isHogTuple) { return obj.length < 2 ? `tuple(${obj.map((o) => __printHogValue(o, marked)).join(', ')})` : `(${obj.map((o) => __printHogValue(o, marked)).join(', ')})`; }- return `[${obj.map((o) => __printHogValue(o, marked)).join(', ')}]`;- }- if (__isHogDateTime(obj)) { const millis = String(obj.dt); return `DateTime(${millis}${millis.includes('.') ? '' : '.0'}, ${__escapeString(obj.zone)})`; }- if (__isHogDate(obj)) return `Date(${obj.year}, ${obj.month}, ${obj.day})`;- if (__isHogError(obj)) { return `${String(obj.type)}(${__escapeString(obj.message)}${obj.payload ? `, ${__printHogValue(obj.payload, marked)}` : ''})`; }- if (obj instanceof Map) { return `{${Array.from(obj.entries()).map(([key, value]) => `${__printHogValue(key, marked)}: ${__printHogValue(value, marked)}`).join(', ')}}`; }- return `{${Object.entries(obj).map(([key, value]) => `${__printHogValue(key, marked)}: ${__printHogValue(value, marked)}`).join(', ')}}`;- } finally {- marked.delete(obj);- }- } else if (typeof obj === 'boolean') return obj ? 'true' : 'false';- else if (obj === null || obj === undefined) return 'null';- else if (typeof obj === 'string') return __escapeString(obj);- if (typeof obj === 'function') return `fn<${__escapeIdentifier(obj.name || 'lambda')}(${obj.length})>`;- return obj.toString();- }- function __isHogError(obj) {return obj && obj.__hogError__ === true}- function __escapeString(value) {- const singlequoteEscapeCharsMap = { '\b': '\\b', '\f': '\\f', '\r': '\\r', '\n': '\\n', '\t': '\\t', '\0': '\\0', '\v': '\\v', '\\': '\\\\', "'": "\\'" }- return `'${value.split('').map((c) => singlequoteEscapeCharsMap[c] || c).join('')}'`;- }- function __escapeIdentifier(identifier) {- const backquoteEscapeCharsMap = { '\b': '\\b', '\f': '\\f', '\r': '\\r', '\n': '\\n', '\t': '\\t', '\0': '\\0', '\v': '\\v', '\\': '\\\\', '`': '``' }- if (typeof identifier === 'number') return identifier.toString();- if (/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(identifier)) return identifier;- return `\`${identifier.split('').map((c) => backquoteEscapeCharsMap[c] || c).join('')}\``;- }- function __isHogDateTime(obj) { return obj && obj.__hogDateTime__ === true }- function __isHogDate(obj) { return obj && obj.__hogDate__ === true }- function __DateTimeToString(dt) {- if (__isHogDateTime(dt)) {- const date = new Date(dt.dt * 1000);- const timeZone = dt.zone || 'UTC';- const milliseconds = Math.floor(dt.dt * 1000 % 1000);- const options = { timeZone, year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false };- const formatter = new Intl.DateTimeFormat('en-US', options);- const parts = formatter.formatToParts(date);- let year, month, day, hour, minute, second;- for (const part of parts) {- switch (part.type) {- case 'year': year = part.value; break;- case 'month': month = part.value; break;- case 'day': day = part.value; break;- case 'hour': hour = part.value; break;- case 'minute': minute = part.value; break;- case 'second': second = part.value; break;- default: break;- }- }- const getOffset = (date, timeZone) => {- const tzDate = new Date(date.toLocaleString('en-US', { timeZone }));- const utcDate = new Date(date.toLocaleString('en-US', { timeZone: 'UTC' }));- const offset = (tzDate - utcDate) / 60000; // in minutes- const sign = offset >= 0 ? '+' : '-';- const absOffset = Math.abs(offset);- const hours = Math.floor(absOffset / 60);- const minutes = absOffset % 60;- return `${sign}${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`;- };- let offset = 'Z';- if (timeZone !== 'UTC') {- offset = getOffset(date, timeZone);- }- let isoString = `${year}-${month}-${day}T${hour}:${minute}:${second}`;- isoString += `.${milliseconds.toString().padStart(3, '0')}`;- isoString += offset;- return isoString;- }- }- function buildInputs(globals, initial) {- let inputs = {- };- let __getGlobal = (key) => key === 'inputs' ? inputs : globals[key];- return inputs;}- const source = (function() {-- return {};- })();- let processEvent = undefined;- if ('onEvent' in source) {- processEvent = function processEvent(globals, posthog) {- if (!('onEvent' in source)) { return; };- const inputs = buildInputs(globals);- const filterGlobals = { ...globals.groups, ...globals.event, person: globals.person, inputs, pdi: { distinct_id: globals.event.distinct_id, person: globals.person } };- let __getGlobal = (key) => filterGlobals[key];- const filterMatches = !!(!ilike(toString(__getProperty(__getProperty(__getGlobal("person"), "properties", true), "email", true)), "%@posthog.com%") && (__getGlobal("event") == "$pageview"));- if (!filterMatches) { return; }- ;- }- }-- function init(config) {- const posthog = config.posthog;- const callback = config.callback;- if ('onLoad' in source) {- const globals = {- person: {- properties: posthog.get_property('$stored_person_properties'),- }- }- const r = source.onLoad({ inputs: buildInputs(globals, true), posthog: posthog });- if (r && typeof r.then === 'function' && typeof r.finally === 'function') { r.catch(() => callback(false)).then(() => callback(true)) } else { callback(true) }- } else {- callback(true);- }-- const response = {}-- if (processEvent) {- response.processEvent = (globals) => processEvent(globals, posthog)- }-- return response- }-- return { init: init };- })().init(config) }- },- {- id: 'SITE_APP_ID',- init: function(config) { return (function() {-- function buildInputs(globals, initial) {- let inputs = {- };- let __getGlobal = (key) => key === 'inputs' ? inputs : globals[key];- return inputs;}- const source = (function() {-- return {};- })();- let processEvent = undefined;- if ('onEvent' in source) {- processEvent = function processEvent(globals, posthog) {- if (!('onEvent' in source)) { return; };- const inputs = buildInputs(globals);- const filterGlobals = { ...globals.groups, ...globals.event, person: globals.person, inputs, pdi: { distinct_id: globals.event.distinct_id, person: globals.person } };- let __getGlobal = (key) => filterGlobals[key];- const filterMatches = true;- if (!filterMatches) { return; }- ;- }- }-- function init(config) {- const posthog = config.posthog;- const callback = config.callback;- if ('onLoad' in source) {- const globals = {- person: {- properties: posthog.get_property('$stored_person_properties'),- }- }- const r = source.onLoad({ inputs: buildInputs(globals, true), posthog: posthog });- if (r && typeof r.then === 'function' && typeof r.finally === 'function') { r.catch(() => callback(false)).then(() => callback(true)) } else { callback(true) }- } else {- callback(true);- }-- const response = {}-- if (processEvent) {- response.processEvent = (globals) => processEvent(globals, posthog)- }-- return response- }-- return { init: init };- })().init(config) }- }]- }- })();- '''-# ---diff --git a/products/engineering_analytics/backend/logic/job_logs/coordinator.py b/products/engineering_analytics/backend/logic/job_logs/coordinator.pyindex e303aa194e9a..a4580d245560 100644--- a/products/engineering_analytics/backend/logic/job_logs/coordinator.py+++ b/products/engineering_analytics/backend/logic/job_logs/coordinator.py@@ -40,8 +40,12 @@ from products.warehouse_sources.backend.types import ExternalDataSourceTypelogger = structlog.get_logger(__name__)# How far back to look each tick. With the per-job workflow id (one fetch per job) this bounds-# re-scanning without a separate "already fetched" store.-DEFAULT_LOOKBACK = timedelta(hours=2)+# re-scanning without a separate "already fetched" store. The window must exceed the warehouse's+# worst-case landing delay, not the job's age: discovery filters on completed_at, and rows reach the+# jobs table only as fast as the v3 load consumer drains its queue — during backlogs that's many+# hours, and a 2h window went blind (every row arrived already too old). The proper fix is a+# persisted high-water-mark cursor over landed rows (deferred).+DEFAULT_LOOKBACK = timedelta(hours=24)_PREFIX = re.compile(r"^[A-Za-z0-9_]*$") # warehouse source prefixes; guards the table identifier# Cap total jobs returned per tick — the activity hands them back as one Temporal payload (~2 MiB# limit), so an incident across many sources mustn't return an unbounded list.@@ -55,13 +59,18 @@ def _query_failed_jobs(team: Team, prefix: str, cutoff_iso: str) -> list[dict[st# the cutoff is chronological. The table name is a trusted identifier (validated prefix + fixed# suffix); user values flow through the placeholder, never the f-string.table = f"{prefix}github_workflow_jobs"+ # The LIMIT must exceed any realistic burst of rows becoming visible between two ticks (deploy+ # transitions, warehouse catch-up dumps): already-started jobs keep occupying the newest-first+ # ranks every tick (dedup happens later, at child-workflow start), so a job pushed below the+ # limit can never rise back into view and would be silently dropped. Matches+ # MAX_DISCOVERED_JOBS; the high-water-mark cursor (deferred) removes the cap concern entirely.sql = f"""SELECT id AS job_id, run_id, head_branch AS branch, conclusion,name AS job_name, workflow_name, run_attempt, head_shaFROM {table}WHERE conclusion = 'failure' AND completed_at > {{cutoff}}ORDER BY completed_at DESC- LIMIT 500+ LIMIT {MAX_DISCOVERED_JOBS}"""with tags_context(product=Product.ENGINEERING_ANALYTICS, feature=Feature.QUERY, team_id=team.pk):response = execute_hogql_query(