Repository navigation
Commit 24d324c
authored
fix(mcp): default whereLanguage to lucene when creating a saved search (#3404)
## Summary
`clickstack_save_saved_search` stores a new saved search without `whereLanguage` when the caller omits it. The app reads a missing value as Lucene, but alerts read it as SQL (`buildSearchChartConfig` falls back to `'sql'`). So a Lucene filter such as `level:error` looks fine in the search page while the search's alerts evaluate it as SQL and break. Found by @pulpdrew in review of #3396.
- On create, an omitted `whereLanguage` is now stored as `lucene`, which matches the app and the tool's description.
- On update, an omitted `whereLanguage` still keeps the stored value. A schema-level `.default('lucene')` would have overwritten a stored `sql` value on every update that left the field out, so the default lives on the create path only.
Stacked on #3396, which kept its changes to descriptions only.
### How to reproduce
**Starting point:** local `yarn dev`, with an MCP client connected (see `MCP.md`).
**On `main`:**
1. Call `clickstack_save_saved_search` with a `name`, a `sourceId`, and `where: "level:error"`, and no `whereLanguage`.
2. Call `clickstack_get_saved_search` with the returned id. `whereLanguage` is missing.
**On this branch:**
1. Repeat the steps above. `whereLanguage` is `lucene`.
2. Update the same search with `whereLanguage: "sql"`, then update it again without `whereLanguage`. It stays `sql`.
`packages/api/src/mcp/__tests__/savedSearches.int.test.ts` covers both cases.
### References
- Related PRs: #3396 (base)1 parent e494a46 commit 24d324c
3 files changed
Lines changed: 27 additions & 1 deletion
File tree
- .changeset
- packages/api/src/mcp
- __tests__
- tools/savedSearches
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
| |||
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
381 | 400 | | |
382 | 401 | | |
383 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
0 commit comments