Skip to content

Commit

Permalink
[8.x] Sustainable Kibana Architecture: Categorise straightforward p…
Browse files Browse the repository at this point in the history
…ackages (#199630) (#201340)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Sustainable Kibana Architecture: Categorise `straightforward`
packages (#199630)](#199630)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-22T09:33:25Z","message":"Sustainable
Kibana Architecture: Categorise `straightforward` packages
(#199630)\n\n## Summary\r\n\r\nThis PR is part of the Kibana Sustainable
Architecture effort.\r\n\r\nThe goal is to start categorising Kibana
packages into _generic\r\nplatform_ (`group: \"platform\"`) vs
_solution-specific_.\r\n\r\n```\r\ngroup?: 'search' | 'security' |
'observability' | 'platform'\r\nvisibility?: 'private' |
'shared'\r\n```\r\nUncategorised modules are considered to be `group:
'common', visibility:\r\n'shared'` by default.\r\n\r\nWe want to prevent
code from solution A to depend on code from solution\r\nB.\r\nThus, the
rules are pretty simple:\r\n\r\n* Modules can only depend on:\r\n *
Modules in the same group\r\n * OR modules with 'shared' visibility\r\n*
Modules in `'observability', 'security', 'search'` groups
are\r\nmandatorily `visibility: \"private\"`.\r\n\r\nLong term, the goal
is to re-organise packages into dedicated
folders,\r\ne.g.:\r\n\r\n```\r\nx-pack/platform/plugins/private\r\nx-pack/observability/packages\r\n```\r\n\r\nFor
this first wave, we have categorised packages that
seem\r\n\"straightforward\":\r\n* Any packages that have:\r\n * at least
one dependant module\r\n * all dependants belong to the same group\r\n*
Categorise all Core packages:\r\n * `@kbn/core-...-internal` =>
_platform/private_\r\n * everything else => _platform/shared_\r\n*
Categorise as _platform/shared_ those packages that:\r\n * Have at least
one dependant in the _platform_ group.\r\n * Don't have any `devOnly:
true` dependants.\r\n\r\n### What we ask from you, as CODEOWNERS of the
_package manifests_, is\r\nthat you confirm that the categorisation is
correct:\r\n\r\n* `group: \"platform\", visibility: \"private\"` if it's
a package that\r\nshould only be used from platform code, not from any
solution code. It\r\nwill be loaded systematically in all serverless
flavors, but solution\r\nplugins and packages won't be able to `import`
from it.\r\n* `group: \"platform\", visibility: \"shared\"` if it's a
package that can\r\nbe consumed by both platform and solutions code. It
will be loaded\r\nsystematically in all serverless flavors, and anybody
can import / use\r\ncode from it.\r\n* `group: \"observability\" |
\"security\" | \"search\", visibility:\r\n\"private\"` if it's a package
that is intented to be used exclusively\r\nfrom a given solution. It
won't be accessible nor loaded from other\r\nsolutions nor platform
code.\r\n\r\nPlease refer
to\r\n[#kibana-sustainable-architecture](https://elastic.slack.com/archives/C07TCKTA22E)\r\nfor
any related questions.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"b24fdf5d3f6b7454a4edcedb8141b82f571e1d74","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"number":199630,"url":"https://github.com/elastic/kibana/pull/199630","mergeCommit":{"message":"Sustainable
Kibana Architecture: Categorise `straightforward` packages
(#199630)\n\n## Summary\r\n\r\nThis PR is part of the Kibana Sustainable
Architecture effort.\r\n\r\nThe goal is to start categorising Kibana
packages into _generic\r\nplatform_ (`group: \"platform\"`) vs
_solution-specific_.\r\n\r\n```\r\ngroup?: 'search' | 'security' |
'observability' | 'platform'\r\nvisibility?: 'private' |
'shared'\r\n```\r\nUncategorised modules are considered to be `group:
'common', visibility:\r\n'shared'` by default.\r\n\r\nWe want to prevent
code from solution A to depend on code from solution\r\nB.\r\nThus, the
rules are pretty simple:\r\n\r\n* Modules can only depend on:\r\n *
Modules in the same group\r\n * OR modules with 'shared' visibility\r\n*
Modules in `'observability', 'security', 'search'` groups
are\r\nmandatorily `visibility: \"private\"`.\r\n\r\nLong term, the goal
is to re-organise packages into dedicated
folders,\r\ne.g.:\r\n\r\n```\r\nx-pack/platform/plugins/private\r\nx-pack/observability/packages\r\n```\r\n\r\nFor
this first wave, we have categorised packages that
seem\r\n\"straightforward\":\r\n* Any packages that have:\r\n * at least
one dependant module\r\n * all dependants belong to the same group\r\n*
Categorise all Core packages:\r\n * `@kbn/core-...-internal` =>
_platform/private_\r\n * everything else => _platform/shared_\r\n*
Categorise as _platform/shared_ those packages that:\r\n * Have at least
one dependant in the _platform_ group.\r\n * Don't have any `devOnly:
true` dependants.\r\n\r\n### What we ask from you, as CODEOWNERS of the
_package manifests_, is\r\nthat you confirm that the categorisation is
correct:\r\n\r\n* `group: \"platform\", visibility: \"private\"` if it's
a package that\r\nshould only be used from platform code, not from any
solution code. It\r\nwill be loaded systematically in all serverless
flavors, but solution\r\nplugins and packages won't be able to `import`
from it.\r\n* `group: \"platform\", visibility: \"shared\"` if it's a
package that can\r\nbe consumed by both platform and solutions code. It
will be loaded\r\nsystematically in all serverless flavors, and anybody
can import / use\r\ncode from it.\r\n* `group: \"observability\" |
\"security\" | \"search\", visibility:\r\n\"private\"` if it's a package
that is intented to be used exclusively\r\nfrom a given solution. It
won't be accessible nor loaded from other\r\nsolutions nor platform
code.\r\n\r\nPlease refer
to\r\n[#kibana-sustainable-architecture](https://elastic.slack.com/archives/C07TCKTA22E)\r\nfor
any related questions.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"b24fdf5d3f6b7454a4edcedb8141b82f571e1d74"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199630","number":199630,"mergeCommit":{"message":"Sustainable
Kibana Architecture: Categorise `straightforward` packages
(#199630)\n\n## Summary\r\n\r\nThis PR is part of the Kibana Sustainable
Architecture effort.\r\n\r\nThe goal is to start categorising Kibana
packages into _generic\r\nplatform_ (`group: \"platform\"`) vs
_solution-specific_.\r\n\r\n```\r\ngroup?: 'search' | 'security' |
'observability' | 'platform'\r\nvisibility?: 'private' |
'shared'\r\n```\r\nUncategorised modules are considered to be `group:
'common', visibility:\r\n'shared'` by default.\r\n\r\nWe want to prevent
code from solution A to depend on code from solution\r\nB.\r\nThus, the
rules are pretty simple:\r\n\r\n* Modules can only depend on:\r\n *
Modules in the same group\r\n * OR modules with 'shared' visibility\r\n*
Modules in `'observability', 'security', 'search'` groups
are\r\nmandatorily `visibility: \"private\"`.\r\n\r\nLong term, the goal
is to re-organise packages into dedicated
folders,\r\ne.g.:\r\n\r\n```\r\nx-pack/platform/plugins/private\r\nx-pack/observability/packages\r\n```\r\n\r\nFor
this first wave, we have categorised packages that
seem\r\n\"straightforward\":\r\n* Any packages that have:\r\n * at least
one dependant module\r\n * all dependants belong to the same group\r\n*
Categorise all Core packages:\r\n * `@kbn/core-...-internal` =>
_platform/private_\r\n * everything else => _platform/shared_\r\n*
Categorise as _platform/shared_ those packages that:\r\n * Have at least
one dependant in the _platform_ group.\r\n * Don't have any `devOnly:
true` dependants.\r\n\r\n### What we ask from you, as CODEOWNERS of the
_package manifests_, is\r\nthat you confirm that the categorisation is
correct:\r\n\r\n* `group: \"platform\", visibility: \"private\"` if it's
a package that\r\nshould only be used from platform code, not from any
solution code. It\r\nwill be loaded systematically in all serverless
flavors, but solution\r\nplugins and packages won't be able to `import`
from it.\r\n* `group: \"platform\", visibility: \"shared\"` if it's a
package that can\r\nbe consumed by both platform and solutions code. It
will be loaded\r\nsystematically in all serverless flavors, and anybody
can import / use\r\ncode from it.\r\n* `group: \"observability\" |
\"security\" | \"search\", visibility:\r\n\"private\"` if it's a package
that is intented to be used exclusively\r\nfrom a given solution. It
won't be accessible nor loaded from other\r\nsolutions nor platform
code.\r\n\r\nPlease refer
to\r\n[#kibana-sustainable-architecture](https://elastic.slack.com/archives/C07TCKTA22E)\r\nfor
any related questions.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"b24fdf5d3f6b7454a4edcedb8141b82f571e1d74"}}]}]
BACKPORT-->
  • Loading branch information
gsoldevila authored Nov 22, 2024
1 parent f8217ef commit 58c8aff
Show file tree
Hide file tree
Showing 673 changed files with 4,025 additions and 1,526 deletions.
6 changes: 3 additions & 3 deletions examples/resizable_layout_examples/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { CoreThemeProvider } from '@kbn/core-theme-browser-internal';
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import type { AppMountParameters } from '@kbn/core/public';
import { I18nProvider } from '@kbn/i18n-react';
import React, { ReactNode, useState } from 'react';
Expand Down Expand Up @@ -101,7 +101,7 @@ const ResizableSection = ({
export const renderApp = ({ element, theme$ }: AppMountParameters) => {
ReactDOM.render(
<I18nProvider>
<CoreThemeProvider theme$={theme$}>
<KibanaThemeProvider theme={{ theme$ }}>
<div
css={css`
height: calc(100vh - var(--euiFixedHeadersOffset, 0));
Expand Down Expand Up @@ -151,7 +151,7 @@ export const renderApp = ({ element, theme$ }: AppMountParameters) => {
}
/>
</div>
</CoreThemeProvider>
</KibanaThemeProvider>
</I18nProvider>,
element
);
Expand Down
2 changes: 1 addition & 1 deletion examples/resizable_layout_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"include": ["common/**/*", "public/**/*", "server/**/*", "../../typings/**/*"],
"kbn_references": [
"@kbn/resizable-layout",
"@kbn/core-theme-browser-internal",
"@kbn/core",
"@kbn/i18n-react",
"@kbn/developer-examples-plugin",
"@kbn/react-kibana-context-theme",
],
"exclude": ["target/**/*"]
}
4 changes: 2 additions & 2 deletions examples/search_examples/public/search_sessions/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { lastValueFrom, of } from 'rxjs';

import { CoreStart } from '@kbn/core/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { mountReactNode } from '@kbn/core-mount-utils-browser-internal';
import type { TimeRange } from '@kbn/es-query';
import { NavigationPublicPluginStart } from '@kbn/navigation-plugin/public';

Expand All @@ -48,6 +47,7 @@ import {
import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import type { DataView, DataViewField } from '@kbn/data-views-plugin/public';
import { createStateContainer, useContainerState } from '@kbn/kibana-utils-plugin/public';
import { toMountPoint } from '@kbn/react-kibana-mount';
import { PLUGIN_ID } from '../../common';
import { getInitialStateFromUrl, SEARCH_SESSIONS_EXAMPLES_APP_LOCATOR } from './app_locator';

Expand Down Expand Up @@ -735,7 +735,7 @@ function doSearch(
);
notifications.toasts.addSuccess({
title: 'Query result',
text: mountReactNode(message),
text: toMountPoint(message, startServices),
});
}
}),
Expand Down
1 change: 0 additions & 1 deletion examples/search_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@kbn/utility-types",
"@kbn/es-query",
"@kbn/i18n",
"@kbn/core-mount-utils-browser-internal",
"@kbn/config-schema",
"@kbn/shared-ux-router",
"@kbn/search-types",
Expand Down
6 changes: 3 additions & 3 deletions examples/unified_field_list_examples/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { I18nProvider } from '@kbn/i18n-react';
import { CoreThemeProvider } from '@kbn/core-theme-browser-internal';
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import type { AppMountParameters, CoreStart } from '@kbn/core/public';
import { AppPluginStartDependencies } from './types';
import { UnifiedFieldListExampleApp } from './example_app';
Expand All @@ -22,14 +22,14 @@ export const renderApp = (
) => {
ReactDOM.render(
<I18nProvider>
<CoreThemeProvider theme$={theme$}>
<KibanaThemeProvider theme={{ theme$ }}>
<UnifiedFieldListExampleApp
services={{
core,
...deps,
}}
/>
</CoreThemeProvider>
</KibanaThemeProvider>
</I18nProvider>,
element
);
Expand Down
2 changes: 1 addition & 1 deletion examples/unified_field_list_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@kbn/field-formats-plugin",
"@kbn/data-view-field-editor-plugin",
"@kbn/unified-field-list",
"@kbn/core-theme-browser-internal",
"@kbn/ui-actions-plugin",
"@kbn/react-kibana-context-theme",
]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
"@kbn/core-http-router-server-internal": "link:packages/core/http/core-http-router-server-internal",
"@kbn/core-http-server": "link:packages/core/http/core-http-server",
"@kbn/core-http-server-internal": "link:packages/core/http/core-http-server-internal",
"@kbn/core-http-server-utils": "link:packages/core/http/core-http-server-utils",
"@kbn/core-i18n-browser": "link:packages/core/i18n/core-i18n-browser",
"@kbn/core-i18n-browser-internal": "link:packages/core/i18n/core-i18n-browser-internal",
"@kbn/core-i18n-server": "link:packages/core/i18n/core-i18n-server",
Expand Down Expand Up @@ -638,7 +639,6 @@
"@kbn/management-settings-types": "link:packages/kbn-management/settings/types",
"@kbn/management-settings-utilities": "link:packages/kbn-management/settings/utilities",
"@kbn/management-test-plugin": "link:test/plugin_functional/plugins/management_test_plugin",
"@kbn/manifest": "link:packages/kbn-manifest",
"@kbn/mapbox-gl": "link:packages/kbn-mapbox-gl",
"@kbn/maps-custom-raster-source-plugin": "link:x-pack/examples/third_party_maps_source_example",
"@kbn/maps-ems-plugin": "link:src/plugins/maps_ems",
Expand Down Expand Up @@ -1458,6 +1458,7 @@
"@kbn/managed-vscode-config": "link:packages/kbn-managed-vscode-config",
"@kbn/managed-vscode-config-cli": "link:packages/kbn-managed-vscode-config-cli",
"@kbn/management-storybook-config": "link:packages/kbn-management/storybook/config",
"@kbn/manifest": "link:packages/kbn-manifest",
"@kbn/mock-idp-plugin": "link:packages/kbn-mock-idp-plugin",
"@kbn/mock-idp-utils": "link:packages/kbn-mock-idp-utils",
"@kbn/observability-onboarding-e2e": "link:x-pack/plugins/observability_solution/observability_onboarding/e2e",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-common",
"id": "@kbn/analytics-collection-utils",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "private"
}
8 changes: 6 additions & 2 deletions packages/cloud/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-common",
"id": "@kbn/cloud",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared"
}
8 changes: 6 additions & 2 deletions packages/content-management/content_editor/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-content-editor",
"owner": "@elastic/appex-sharedux",
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-content-insights-public",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-server",
"id": "@kbn/content-management-content-insights-server",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/content-management-favorites-common",
"owner": "@elastic/appex-sharedux"
"owner": "@elastic/appex-sharedux",
"group": "platform",
"visibility": "private"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-favorites-public",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-server",
"id": "@kbn/content-management-favorites-server",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-tabbed-table-list-view",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "private"
}
8 changes: 6 additions & 2 deletions packages/content-management/table_list_view/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-table-list-view",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-common",
"id": "@kbn/content-management-table-list-view-common",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-table-list-view-table",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
8 changes: 6 additions & 2 deletions packages/content-management/user_profiles/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-user-profiles",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/core-analytics-browser-internal",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "private"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"type": "shared-browser",
"id": "@kbn/core-analytics-browser-mocks",
"devOnly": true,
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared",
"devOnly": true
}
8 changes: 6 additions & 2 deletions packages/core/analytics/core-analytics-browser/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/core-analytics-browser",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-server",
"id": "@kbn/core-analytics-server-internal",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "private"
}
10 changes: 7 additions & 3 deletions packages/core/analytics/core-analytics-server-mocks/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"type": "shared-server",
"id": "@kbn/core-analytics-server-mocks",
"devOnly": true,
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared",
"devOnly": true
}
8 changes: 6 additions & 2 deletions packages/core/analytics/core-analytics-server/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-server",
"id": "@kbn/core-analytics-server",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/core-application-browser-internal",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "private"
}
Loading

0 comments on commit 58c8aff

Please sign in to comment.