Repository navigation
ci: run functional tests for nightshift 794 - #832
margaretjgu wants to merge 14 commits into
Conversation
…d chat message command `nightshift ask` is the generated `kb agent-builder post-chat-message` command (POST /api/chat/message) with `agent_id` pinned to `nightshift.investigation`. A new `buildKbPresetCommand` helper re-exposes any generated Kibana command under a new name with some input fields fixed. Fixed fields are removed from the flags and schema, and supplying one via JSON input is a validation error rather than a silent override. Co-authored-by: Cursor <cursoragent@cursor.com>
`elastic nightshift ask "..."` now works alongside `--message`. `positionalArg.inputKey` lets a command fill an input schema field from its positional argument before validation; passing both the argument and the flag is an error. `buildKbPresetCommand` exposes this as a `positional` option. Also fixes cli-schema option hoisting, which dropped a positional parameter whenever a hoisted flag had the same name. Co-authored-by: Cursor <cursoragent@cursor.com>
Running the emitter in a subprocess, like the other cli-schema tests, checks the real nightshift ask entry and keeps cli-schema.ts out of in-process coverage, which pulled branch coverage below the 90% threshold in CI. Co-authored-by: Cursor <cursoragent@cursor.com>
`nightshift` only applies to Serverless Observability projects. The `serverless` and `default` profiles now allow `nightshift.*` (they previously blocked it, since their allow-list only covered `stack.*`), and the `stack` profile blocks it, which also hides it from namespace help and completion. Without a profile nothing changes. Co-authored-by: Cursor <cursoragent@cursor.com>
The factory reads JSON input from stdin when it is not a TTY. On Windows CI that read never ends, so test/factory.test.ts hit the 60s timeout. Mark stdin as a TTY like the file's other input tests. Co-authored-by: Cursor <cursoragent@cursor.com>
…-preset Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # README.md # src/factory.ts # src/kb/register.ts # test/completion/complete.test.ts
… agent - Resolve the Kibana availability target for the preset and restrict it to serverless, so nightshift ask is hidden for stack version hints. - Pin agent_id to nightshift.assistant, the single-question agent, instead of the investigation agent. - Reword docs to Serverless Observability only. - Add regression tests for the --json positional conflict error and fold the nightshift assertion into the stack profile test. Co-authored-by: Cursor <cursoragent@cursor.com>
Bun ignores `process.exitCode = undefined`, so the new --json positional conflict test leaked exit code 1 into later tests under Bun. Co-authored-by: Cursor <cursoragent@cursor.com>
Print a stderr warning before each nightshift ask request, suppressed by --accept-experimental or --json, following the elastic docs commands. Add a matching warning callout to the Nightshift docs page. Co-authored-by: Cursor <cursoragent@cursor.com>
…commands Move the --accept-experimental option and the stderr warning into src/lib/experimental.ts and use it from docs ask, docs search and the Kibana preset. Warning text is unchanged; the three commands now share one --accept-experimental description. Co-authored-by: Cursor <cursoragent@cursor.com>
|
👋 This PR can use the first-failure repair loop on GitHub Actions and Buildkite. Labels
Comments
|
|
PR type mismatch: title uses The diff adds the user-facing This affects the version bump and changelog entry release-please generates on merge. Update the PR title (and squash commit message) to match, or push a follow-up commit that justifies the current prefix. |
🔍 Preview links for changed docs |
Elastic Docs Style Checker (Vale)Summary: 1 suggestion found 💡 Suggestions (1): Optional style improvements. Apply when helpful.
The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts MegaLinter is graciously provided by OX Security |
Startup perf: PR vs merge-base ✅
|
There was a problem hiding this comment.
🟡 Changes recommended
Registration fails when presets pin path parameters, and completion suggests version-incompatible commands because it omits the active context’s version hint.
2 open issues
What changed in this PR
This PR mirrors #794 to run the required Buildkite check unavailable to fork pull requests; #794 remains the intended merge target. Its changes add elastic nightshift ask using the generated Kibana chat-message command.
Changes:
- Add a Serverless-only Nightshift preset with positional input, a fixed assistant agent, and experimental warnings.
- Integrate command profiles, completion, and schema generation.
- Add regression tests and update command documentation.
| File | Description |
|---|---|
test/namespaces.test.ts |
Test Nightshift requests and version visibility. |
test/lib/experimental.test.ts |
Test shared warnings and suppression. |
test/kb/preset.test.ts |
Test preset input, requests, and availability. |
test/factory.test.ts |
Test positional input mapping and profile rules. |
test/completion/complete.test.ts |
Test Nightshift completion and profile filtering. |
test/cli-schema.test.ts |
Test preservation of positional parameters. |
src/namespaces.ts |
Register the Serverless-only Nightshift command. |
src/lib/experimental.ts |
Centralize experimental flags and warnings. |
src/kb/register.ts |
Add generated-command presets and shared target lookup. |
src/factory.ts |
Map positional arguments into validated input. |
src/factory-core.ts |
Extend positional configuration and profile handling. |
src/docs/search.ts |
Reuse the shared experimental warning utility. |
src/docs/ask.ts |
Reuse the shared experimental warning utility. |
src/config/profiles.ts |
Define Nightshift access by profile. |
src/completion/complete.ts |
Add lazy Nightshift completion registration. |
src/cli-schema.ts |
Preserve positionals when hoisting flags. |
docs/cli/schema.json |
Publish Nightshift parameters and updated warning descriptions. |
docs/cli/nightshift/index.md |
Document usage, availability, and experimental status. |
docs/cli/configuration_reference.md |
Update profile descriptions for Nightshift. |
Review effort: Balanced
| // `nightshift` — deep-load on exact match, stub otherwise. | ||
| if (firstWord === 'nightshift') { | ||
| const { NAMESPACES } = await import('../namespaces.ts') | ||
| root.addCommand(await NAMESPACES.find(ns => ns.name === 'nightshift')!.load()) |
| const properties = { ...(def.input?.['properties'] as Record<string, unknown> | undefined) } | ||
| for (const key of Object.keys(opts.fixed)) { | ||
| if (!(key in properties)) throw new Error(`fixed field ${JSON.stringify(key)} is not an input of ${opts.apiId}`) | ||
| delete properties[key] |

Same commit as #794. Fork pull requests do not run Buildkite, and
buildkite/elastic-cli/pris required to merge 794. This pull request only exists so that check runs on that commit. Merge 794, not this one.