Skip to content

Commit f95a34f

Browse files
authored
Merge branch 'main' into fix/storybook-parallel-build
2 parents 18093be + b3a75dc commit f95a34f

File tree

1,469 files changed

+123037
-66449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,469 files changed

+123037
-66449
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
steps:
2+
- command: .buildkite/scripts/steps/checks/prompt_changes_detector.sh
3+
label: 'Check Prompt Changes'
4+
agents:
5+
machineType: n2-standard-2
6+
preemptible: true
7+
diskSizeGb: 85
8+
timeout_in_minutes: 10
9+
retry:
10+
automatic:
11+
- exit_status: '-1'
12+
limit: 3

.buildkite/scripts/pipelines/pull_request/pipeline.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,18 @@ const getPipeline = (filename: string, removeSteps = true) => {
496496
);
497497
}
498498

499+
// Check for prompt file changes and conditionally add pipeline step
500+
if (
501+
await doAnyChangesMatch([
502+
/^x-pack\/solutions\/security\/plugins\/elastic_assistant\/server\/lib\/prompt\/local_prompt_object\.ts$/,
503+
/^x-pack\/solutions\/security\/plugins\/elastic_assistant\/server\/lib\/prompt\/tool_prompts\.ts$/,
504+
/^x-pack\/solutions\/security\/plugins\/elastic_assistant\/server\/lib\/prompt\/defend_insight_prompts\.ts$/,
505+
/^x-pack\/solutions\/security\/plugins\/elastic_assistant\/server\/lib\/prompt\/prompts\.ts$/,
506+
])
507+
) {
508+
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/prompt_changes.yml'));
509+
}
510+
499511
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/post_build.yml'));
500512

501513
emitPipeline(pipeline);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
source "$(dirname "${BASH_SOURCE[0]}")/../../common/util.sh"
6+
7+
echo "Running prompt changes comment post..."
8+
ts-node .buildkite/scripts/steps/checks/prompt_changes_detector.ts
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
import { upsertComment } from '#pipeline-utils';
11+
12+
// Mock the pipeline utils for testing
13+
jest.mock('#pipeline-utils', () => ({
14+
upsertComment: jest.fn(),
15+
}));
16+
17+
const mockUpsertComment = upsertComment as jest.MockedFunction<typeof upsertComment>;
18+
19+
describe('Prompt Changes Detector', () => {
20+
beforeEach(() => {
21+
jest.clearAllMocks();
22+
});
23+
24+
it('should post comment when called', async () => {
25+
mockUpsertComment.mockResolvedValue({});
26+
27+
// Import and run the main function
28+
const { main } = await import('./prompt_changes_detector');
29+
await main();
30+
31+
expect(mockUpsertComment).toHaveBeenCalledWith({
32+
commentBody: expect.stringContaining('Prompt Changes Detected'),
33+
commentContext: 'prompt-changes-reminder',
34+
clearPrevious: true,
35+
});
36+
});
37+
38+
it('should handle errors gracefully', async () => {
39+
// Mock an error
40+
mockUpsertComment.mockRejectedValue(new Error('Test error'));
41+
42+
// Import and run the main function
43+
const { main } = await import('./prompt_changes_detector');
44+
45+
// Should not throw, but should exit with code 1
46+
const consoleSpy = jest.spyOn(console, 'error').mockImplementation();
47+
const processSpy = jest.spyOn(process, 'exit').mockImplementation();
48+
49+
await main();
50+
51+
expect(consoleSpy).toHaveBeenCalledWith(
52+
'❌ Error posting prompt changes comment:',
53+
expect.any(Error)
54+
);
55+
expect(processSpy).toHaveBeenCalledWith(1);
56+
57+
consoleSpy.mockRestore();
58+
processSpy.mockRestore();
59+
});
60+
});
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
import { upsertComment } from '#pipeline-utils';
11+
12+
const COMMENT_MESSAGE = `## 🤖 Prompt Changes Detected
13+
14+
Changes have been detected to one or more prompt files in the Elastic Assistant plugin.
15+
16+
**Please remember to update the integrations repository** with your prompt changes to ensure consistency across all deployments.
17+
18+
### Next Steps:
19+
1. Follow the documentation in [x-pack/solutions/security/packages/security-ai-prompts/README.md](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/packages/security-ai-prompts/README.md) to update the corresponding prompt files
20+
2. Make the changes in the [integrations repository](https://github.com/elastic/integrations)
21+
3. Test your changes in the integrations environment
22+
4. Ensure prompt consistency across all deployments
23+
24+
This is an automated reminder to help maintain prompt consistency across repositories.`;
25+
26+
export async function main() {
27+
try {
28+
console.log('Posting prompt changes reminder comment...');
29+
30+
await upsertComment({
31+
commentBody: COMMENT_MESSAGE,
32+
commentContext: 'prompt-changes-reminder',
33+
clearPrevious: true,
34+
});
35+
36+
console.log('✅ Reminder comment posted successfully');
37+
} catch (error) {
38+
console.error('❌ Error posting prompt changes comment:', error);
39+
process.exit(1);
40+
}
41+
}
42+
43+
if (require.main === module) {
44+
main();
45+
}

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ src/platform/packages/private/kbn-handlebars @elastic/kibana-security
350350
src/platform/packages/private/kbn-hapi-mocks @elastic/kibana-core
351351
src/platform/packages/private/kbn-health-gateway-server @elastic/kibana-core
352352
src/platform/packages/private/kbn-import-resolver @elastic/kibana-operations
353+
src/platform/packages/private/kbn-index-editor @elastic/kibana-esql
353354
src/platform/packages/private/kbn-item-buffer @elastic/appex-sharedux
354355
src/platform/packages/private/kbn-jest-serializers @elastic/kibana-operations
355356
src/platform/packages/private/kbn-journeys @elastic/kibana-operations @elastic/appex-qa
@@ -1351,6 +1352,7 @@ src/platform/plugins/shared/discover/public/context_awareness/profile_providers/
13511352
# ES|QL
13521353
/src/platform/test/api_integration/apis/esql/*.ts @elastic/kibana-esql
13531354
/src/platform/test/functional/services/esql.ts @elastic/kibana-esql
1355+
/src/platform/test/functional/page_objects/index_editor.ts @elastic/kibana-esql
13541356
/src/platform/packages/shared/kbn-monaco/src/languages/esql @elastic/kibana-esql
13551357
x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions @elastic/obs-ux-infra_services-team @elastic/obs-ux-logs-team
13561358

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Request review from Copilot for specific team PRs
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- ready_for_review
7+
branches:
8+
- 'main'
9+
10+
jobs:
11+
request_review:
12+
name: Request review from Copilot
13+
runs-on: ubuntu-latest
14+
if: github.event.repository.fork == false
15+
steps:
16+
- name: Check for team labels
17+
id: check_labels
18+
run: |
19+
# Team labels that should get Copilot reviews automatically
20+
TEAMS=(
21+
"Team:Operations"
22+
)
23+
24+
PR_LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}'
25+
SHOULD_REQUEST_REVIEW=false
26+
27+
for team in "${TEAMS[@]}"; do
28+
if echo "$PR_LABELS" | grep -q "\"$team\""; then
29+
echo "Found matching team label: $team"
30+
SHOULD_REQUEST_REVIEW=true
31+
break
32+
fi
33+
done
34+
35+
echo "should_request_review=$SHOULD_REQUEST_REVIEW" >> $GITHUB_OUTPUT
36+
37+
- name: Request Copilot review
38+
if: steps.check_labels.outputs.should_request_review == 'true'
39+
env:
40+
GITHUB_TOKEN: ${{secrets.KIBANAMACHINE_TOKEN}}
41+
PR_NUMBER: ${{ github.event.pull_request.number }}
42+
run: |
43+
echo "Requesting Copilot review for PR #$PR_NUMBER"
44+
45+
# Workaround from https://github.com/cli/cli/issues/10598
46+
gh api --method POST "/repos/elastic/kibana/pulls/${PR_NUMBER}/requested_reviewers" \
47+
-f "reviewers[]=copilot-pull-request-reviewer[bot]"

.github/workflows/evaluate-dependency-health.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
runs-on: ubuntu-latest
1717
if: |
1818
github.repository == 'elastic/kibana' &&
19-
github.actor != 'elastic-renovate-prod[bot]' &&
19+
github.event.pull_request.user.login != 'app/elastic-renovate-prod' &&
20+
github.event.pull_request.user.type != 'Bot' &&
2021
github.event.pull_request.draft == false
2122
steps:
2223
- name: Checkout kibana-operations

api_docs/actions.devdocs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@
19551955
"ConnectorUsageCollector",
19561956
") => Promise<",
19571957
"AxiosResponse",
1958-
"<R, any>>"
1958+
"<R, any, {}>>"
19591959
],
19601960
"path": "x-pack/platform/plugins/shared/actions/server/sub_action_framework/sub_action_connector.ts",
19611961
"deprecated": false,

api_docs/actions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/actions
88
title: "actions"
99
image: https://source.unsplash.com/400x175/?github
1010
description: API docs for the actions plugin
11-
date: 2025-09-12
11+
date: 2025-09-15
1212
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'actions']
1313
---
1414
import actionsObj from './actions.devdocs.json';

0 commit comments

Comments
 (0)