Skip to content

[ResponseOps][Connectors] Zod lazy schemas @kbn/connector-schemas#265448

Merged
georgianaonoleata1904 merged 10 commits into
elastic:mainfrom
georgianaonoleata1904:wrap-zod-schemas-connectors
May 6, 2026
Merged

[ResponseOps][Connectors] Zod lazy schemas @kbn/connector-schemas#265448
georgianaonoleata1904 merged 10 commits into
elastic:mainfrom
georgianaonoleata1904:wrap-zod-schemas-connectors

Conversation

@georgianaonoleata1904
Copy link
Copy Markdown
Contributor

@georgianaonoleata1904 georgianaonoleata1904 commented Apr 24, 2026

Closes #264179

Summary

  • Wraps all Zod schema definitions in @kbn/connector-schemas with lazySchema()

@georgianaonoleata1904 georgianaonoleata1904 changed the title Wrap zod schemas connectors [ResponseOps][Connectors] Zod lazy schemas @kbn/connector-schemas Apr 24, 2026
@georgianaonoleata1904 georgianaonoleata1904 self-assigned this Apr 24, 2026
@georgianaonoleata1904 georgianaonoleata1904 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.5.0 labels Apr 24, 2026
@georgianaonoleata1904 georgianaonoleata1904 marked this pull request as ready for review April 27, 2026 05:04
@georgianaonoleata1904 georgianaonoleata1904 requested review from a team as code owners April 27, 2026 05:04
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Copy Markdown
Contributor

@lorenabalan lorenabalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MCP connector changes look good!

Comment thread src/platform/packages/shared/kbn-connector-schemas/sentinelone/schemas/v1.ts Outdated
Copy link
Copy Markdown
Contributor

@szwarckonrad szwarckonrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my concern!
LGTM!

let actionTypeRegistry: ActionTypeRegistry;

beforeAll(async () => {
setLazySchemaDisabled(true);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is there any way to set up the kibanaServer to load with the following config instead of using setLazySchemaDisabled?

feature_flags:
  overrides:
    disableLazyZodSchemas: true

aggregateBy: z.string().optional(),
})
.strict();
export const TelemetryMetadataSchema = lazySchema(() =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe out of scope, but would there be a way to guarantee we always apply lazySchema? In other words, what about new ones? Could we implement something to not having to think about wrapping with lazySchema? Would it be possible to use it somehow at framework level once, instead of having to wrap all schemas?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, it would be nice to have something that automatically wraps schemas with lazySchema, but I'm not sure if this is straightforward, maybe we could add a lint guard to enforce the usage of lazySchema

Copy link
Copy Markdown
Contributor

@arturoliduena arturoliduena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Only Obs AI code review

Copy link
Copy Markdown
Contributor

@yngrdyn yngrdyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@georgianaonoleata1904 georgianaonoleata1904 enabled auto-merge (squash) May 6, 2026 08:06
@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #8 / GraphInvestigation Component grouped-actor scenario - mixed namespaces as actor grouped actor node with mixed namespaces falls back to generic entity.id filter

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
agentBuilder 1.1MB 1.1MB +300.0B
automaticImport 332.1KB 332.2KB +120.0B
observabilityAgentBuilder 30.5KB 31.3KB +780.0B
observabilityAIAssistant 20.4KB 20.3KB -1.0B
securitySolution 12.0MB 12.0MB +288.0B
stackConnectors 1.8MB 1.8MB +2.4KB
streamsApp 2.0MB 2.0MB +1.0KB
workflowsManagement 2.3MB 2.3MB +997.0B
workplaceAIApp 512.2KB 513.0KB +797.0B
total +6.7KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
elasticAssistant 266.2KB 266.3KB +108.0B
observabilityAIAssistant 59.7KB 60.5KB +782.0B
total +890.0B

History

cc @georgianaonoleata1904

@georgianaonoleata1904 georgianaonoleata1904 merged commit 6d212db into elastic:main May 6, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zod lazy schemas @kbn/connector-schemas